mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix contentNodes import
This commit is contained in:
1 parent
91a7ebb23d
commit
eff13ac4f5
2 files changed
+7
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "3.9.6",
|
||||
"version": "3.9.7",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/loader",
|
||||
"module": "src/loader",
|
||||
|
||||
@@ -18,7 +18,12 @@ function findOverrideContent(dir: string) {
|
||||
if (!files.length) return null;
|
||||
for (const file of files) {
|
||||
const lang = file.slice(8, -3);
|
||||
languages[lang] = fs.readFileSync(path.join(dir, file), 'utf8');
|
||||
let content: string | any[] = fs.readFileSync(path.join(dir, file), 'utf8');
|
||||
try {
|
||||
content = JSON.parse(content);
|
||||
if (!(content instanceof Array)) content = JSON.stringify(content);
|
||||
} catch (e) { }
|
||||
languages[lang] = content;
|
||||
}
|
||||
return JSON.stringify(languages);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user