ui: fix builder

This commit is contained in:
undefined committed 2024-06-27 17:42:47 +08:00
1 parent 738047dc63
commit 210e0fb905
3 files changed
+10 -12

No files matched your search

+3 -3
View File
@@ -104,11 +104,11 @@ export async function buildUI() {
}
const entry = await build([
`window.lazyloadMetadata = ${JSON.stringify(hashes)};`,
`window.LANGS=${JSON.stringify(SettingModel.langs)};`,
...entryPoints.map((i) => `import '${relative(tmp, i).replace(/\\/g, '\\\\')}';`),
].join('\n'));
const pages = entry.outputFiles.map((i) => i.text);
const str = `window.LANGS=${JSON.stringify(SettingModel.langs)};window._hydroLoad=()=>{ ${pages.join('\n')} };`;
addFile('entry.js', str);
const pages = entry.outputFiles.filter((i) => i.path.endsWith('.js')).map((i) => i.text);
addFile('entry.js', `window._hydroLoad=()=>{ ${pages.join('\n')} };`);
UiContextBase.constantVersion = hashes['entry.js'];
for (const key in vfs) {
if (newFiles.includes(key)) continue;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.51.3",
"version": "4.51.4",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "index.ts",
@@ -46,17 +46,15 @@
<script>
var _htmlNode = document.documentElement;
_htmlNode.className = _htmlNode.className.replace(' nojs', ' hasjs');
</script>
{% endif %}
</head>
<body>
{% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %}
<script>
var UiContext = '{{ UiContext|json|jsesc|safe }}';
var UserContext = '{{ UserContext|json|jsesc|safe }}';
</script>
{% set UiContext = Object.create(UiContext) %}
{% set UserContext = Object.create(UserContext) %}
{% endif %}
{% set UiContext = Object.create(UiContext) %}
{% set UserContext = Object.create(UserContext) %}
</head>
<body>
{% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %}
<script type="text/javascript" src="/constant/{{ UiContext.constantVersion }}.js"></script>
<script type="text/javascript" src="{{ UiContext.cdn_prefix }}resource/{{ global.Hydro.version['ui-default'] }}/lang-{{ _('__id') }}.js"></script>
<script type="text/javascript" src="{{ UiContext.cdn_prefix }}hydro-{{ global.Hydro.version['ui-default'] }}.js"></script>