mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix builder
This commit is contained in:
3 files changed
+10
-12
No files matched your search
@@ -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,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>
|
||||
|
||||
Reference in new issue
Block a user