summaryrefslogtreecommitdiff
path: root/public/index.php
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-06-24 22:35:29 +0500
committerilotterytea <iltsu@alright.party>2025-06-24 22:35:29 +0500
commitc734db91064944637e361f90ed90b30d48a7d910 (patch)
tree641e8a7246039d98b13fa43b0d370460168a17e2 /public/index.php
parent2bdd40b6320d1504bb15f48242068534482c9b54 (diff)
feat: flash (.swf) support
Diffstat (limited to 'public/index.php')
-rw-r--r--public/index.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/public/index.php b/public/index.php
index 556349f..a9ddec3 100644
--- a/public/index.php
+++ b/public/index.php
@@ -248,6 +248,12 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt');
</audio>
<?php elseif (str_starts_with($file['mime'], 'text/')): ?>
<pre><?= file_get_contents(FILE_UPLOAD_DIRECTORY . "/{$file['id']}.{$file['extension']}") ?></pre>
+ <?php elseif ($file['mime'] == 'application/x-shockwave-flash' && !empty(RUFFLE_DRIVER_PATH)): ?>
+ <noscript>JavaScript is required to play Flash</noscript>
+ <object>
+ <embed src="<?= $file['full_url'] ?>" width="<?= $file['width'] - 4 ?>"
+ height="<?= $file['height'] ?>">
+ </object>
<?php else: ?>
<p><i>This file cannot be displayed.</i></p>
<?php endif; ?>
@@ -452,6 +458,10 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt');
</main>
</body>
+<?php if ($file && $file['mime'] == 'application/x-shockwave-flash' && !empty(RUFFLE_DRIVER_PATH)): ?>
+ <script src="<?= RUFFLE_DRIVER_PATH ?>"></script>
+<?php endif; ?>
+
<?php if ($file): ?>
<script>
const fileTabButtons = document.getElementById('file-tab-buttons');
@@ -649,7 +659,7 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt');
thumbnailPath = '/static/img/icons/file_audio.png';
} else if (file.mime.startsWith('text/')) {
thumbnailPath = '/static/img/icons/file_text.png';
- } else if (!file.mime.startsWith('image/') && !file.mime.startsWith('video/')) {
+ } else if (!file.mime.startsWith('image/') && !file.mime.startsWith('video/') && file.mime != 'application/x-shockwave-flash') {
thumbnailPath = '/static/img/icons/file.png';
} else {
thumbnailSize = 'max-width:100%; max-height: 100%;';