core: bug fix

This commit is contained in:
undefined committed 2022-11-07 02:24:16 +08:00
1 parent 90528f15d1
commit 52cdd166aa
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -167,6 +167,7 @@ if (!argv.args[0] || argv.args[0] === 'cli') {
} else throw new Error(`Unsupported install source: ${src}`); } else throw new Error(`Unsupported install source: ${src}`);
if (!newAddonPath) throw new Error('Addon download failed'); if (!newAddonPath) throw new Error('Addon download failed');
console.log('Installing depedencies'); console.log('Installing depedencies');
if (!fs.existsSync(path.join(newAddonPath, 'package.json'))) throw new Error('Invalid plugin file');
child.execSync('yarn --production', { stdio: 'inherit', cwd: newAddonPath }); child.execSync('yarn --production', { stdio: 'inherit', cwd: newAddonPath });
child.execSync(`hydrooj addon add '${newAddonPath}'`); child.execSync(`hydrooj addon add '${newAddonPath}'`);
fs.writeFileSync(path.join(newAddonPath, '__metadata__'), JSON.stringify({ fs.writeFileSync(path.join(newAddonPath, '__metadata__'), JSON.stringify({
+1 -1
View File
@@ -65,7 +65,7 @@ global.Hydro.locales = new Proxy(translations, {
get(s, key) { get(s, key) {
if (typeof key === 'string') return app.i18n.get(key, lang); if (typeof key === 'string') return app.i18n.get(key, lang);
const result = {}; const result = {};
for (let i = s.length - 1; i; i--) Object.assign(result, s[i]); for (let i = s.length - 1; i >= 0; i--) Object.assign(result, s[i]);
return result; return result;
}, },
has(s, key: string) { has(s, key: string) {