ui: pageloader: remove localstorage

This commit is contained in:
undefined committed 2022-07-10 11:40:17 +08:00
1 parent fc6e112536
commit 6333c4f9c7
3 files changed
+4 -9

No files matched your search

+2 -7
View File
@@ -32,13 +32,8 @@ document.addEventListener('DOMContentLoaded', async () => {
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
try { __webpack_public_path__ = UiContext.cdn_prefix; } catch (e) { } try { __webpack_public_path__ = UiContext.cdn_prefix; } catch (e) { }
const local = JSON.parse(localStorage.getItem('hydro-constant') || '{}'); const res = await fetch(`/constant/${UiContext.constantVersion}`, { cache: 'force-cache' });
let { data } = local; const data = await res.json();
if (local.version !== UiContext.constantVersion) {
const res = await fetch(`/constant?version=${UiContext.constantVersion}`);
data = await res.json();
localStorage.setItem('hydro-constant', JSON.stringify({ data, version: UiContext.constantVersion }));
}
eval(data[0]); // eslint-disable-line no-eval eval(data[0]); // eslint-disable-line no-eval
data.shift(); data.shift();
window.Hydro.preload = data; window.Hydro.preload = data;
+1 -1
View File
@@ -200,7 +200,7 @@ global.Hydro.handler.ui = async () => {
Route('wiki_help', '/wiki/help', WikiHelpHandler); Route('wiki_help', '/wiki/help', WikiHelpHandler);
Route('wiki_about', '/wiki/about', WikiAboutHandler); Route('wiki_about', '/wiki/about', WikiAboutHandler);
Route('set_theme', '/set_theme/:theme', SetThemeHandler); Route('set_theme', '/set_theme/:theme', SetThemeHandler);
Route('constant', '/constant', UiConstantsHandler); Route('constant', '/constant/:version', UiConstantsHandler);
Route('markdown', '/markdown', MarkdownHandler); Route('markdown', '/markdown', MarkdownHandler);
Route('lang', '/l/:lang', LanguageHandler); Route('lang', '/l/:lang', LanguageHandler);
Route('media', '/media', RichMediaHandler); Route('media', '/media', RichMediaHandler);
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.38.7", "version": "4.38.8",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",