ui: limit video tag usage (#199)

This commit is contained in:
undefined committed 2021-09-13 22:57:33 +08:00
1 parent da5a54e76a
commit 32694f5a1d
2 files changed
+21 -4

No files matched your search

@@ -1,6 +1,7 @@
/* eslint-disable max-len */ /* eslint-disable max-len */
/* eslint-disable prefer-destructuring */ /* eslint-disable prefer-destructuring */
const { randomUUID } = require('crypto');
const { escapeHtml } = require('vj/../../node_modules/markdown-it/lib/common/utils'); const { escapeHtml } = require('vj/../../node_modules/markdown-it/lib/common/utils');
/* eslint-disable no-restricted-properties */ /* eslint-disable no-restricted-properties */
@@ -118,9 +119,25 @@ module.exports = function videoPlugin(md) {
+ `render?url=https://osf.io/${videoID}/?action=download%26mode=render");` + `render?url=https://osf.io/${videoID}/?action=download%26mode=render");`
+ ' }); </script>'; + ' }); </script>';
} }
if (service === 'pdf') return `<iframe src="${videoID}?noDisposition=on#view=fit" width="100%" style="min-height: 100vh;border: none;"></iframe>`; if (service === 'pdf') {
if (options[service]) { return `\
return `<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item ${service}-player" type="text/html" width="${options[service].width || 640 <object classid="clsid:${randomUUID().toUpperCase()}">
<param name="SRC" value="${videoID}" >
<embed width="100%" style="min-height: 100vh;border: none;" fullscreen="yes" src="${videoID}">
<noembed></noembed>
</embed>
</object>`;
}
if (['url', 'video'].includes(service)) {
return `\
<video width="100%" controls>
<source src="${videoID}" type="${videoID.endsWith('ogg') ? 'video/ogg' : 'video/mp4'}">
Your browser doesn't support video tag.
</video>`;
}
if (options[service]?.width) {
return `<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item ${service}-player" type="text/html" width="${options[service].width || 640
}" height="${options[service].height || 390 }" height="${options[service].height || 390
}" src="${options.url(service, videoID, tokens[idx].url, options) }" src="${options.url(service, videoID, tokens[idx].url, options)
}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`; }" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>`;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.20.2", "version": "4.20.3",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",