diff --git a/hydro/loader.ts b/hydro/loader.ts index a3821db78..d40e15f0b 100644 --- a/hydro/loader.ts +++ b/hydro/loader.ts @@ -129,7 +129,7 @@ const tmp = path.resolve(os.tmpdir(), 'hydro', '__'); export function addon(addonPath: string) { let modulePath = path.resolve(addonPath); - if (modulePath.endsWith('.hydro') && !(fs.existsSync(addonPath) && fs.statSync(addonPath).isFile())) { + if (!(fs.existsSync(addonPath) && fs.statSync(addonPath).isFile())) { try { // Is a npm package const packagejson = require.resolve(`${addonPath}/package.json`); @@ -140,7 +140,7 @@ export function addon(addonPath: string) { } catch (e) { throw new Error(`Addon not found: ${addonPath}`); } - } else { + } else if (modulePath.endsWith('.hydro')) { try { // Is *.hydro module const t = modulePath.split(path.sep); @@ -162,7 +162,7 @@ export function addon(addonPath: string) { console.error('Addon load fail: ', e); throw e; } - } + } else throw new Error(`Addon not found: ${addonPath}`); } export async function load() { diff --git a/package.json b/package.json index df48bdf79..fbe938747 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.9.1", + "version": "2.9.2", "main": "entry.js", "bin": "bin/hydrooj.js", "repository": "https://github.com/hydro-dev/Hydro.git", @@ -39,7 +39,7 @@ "sockjs": "^0.3.20", "superagent": "^5.2.2", "superagent-proxy": "^2.0.0", - "systeminformation": "^4.26.5", + "systeminformation": "^4.26.10", "yargs-parser": "^18.1.3" }, "devDependencies": { @@ -65,7 +65,7 @@ "@types/yargs": "^15.0.5", "@typescript-eslint/eslint-plugin": "^3.6.0", "@typescript-eslint/parser": "^3.6.0", - "eslint": "^7.4.0", + "eslint": "^7.5.0", "eslint-config-airbnb-base": "^14.2.0", "eslint-import-resolver-typescript": "^2.0.0", "eslint-plugin-import": "^2.20.2", @@ -74,6 +74,6 @@ "scripts": { "build": "tsc", "build:watch": "tsc --watch", - "lint": "eslint build hydro tool --ext ts,js --fix" + "lint": "eslint bin hydro tool --ext ts,js --fix" } } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 436b86edb..418015abc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -400,7 +400,7 @@ acorn-jsx@^5.2.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== -acorn@^7.2.0: +acorn@^7.3.1: version "7.3.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.3.1.tgz#85010754db53c3fbaf3b9ea3e083aa5c5d147ffd" integrity sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA== @@ -1038,22 +1038,22 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^2.0.0: +eslint-utils@^2.0.0, eslint-utils@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-2.1.0.tgz#d2de5e03424e707dc10c74068ddedae708741b27" integrity sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg== dependencies: eslint-visitor-keys "^1.1.0" -eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.2.0: +eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint@^7.4.0: - version "7.4.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.4.0.tgz#4e35a2697e6c1972f9d6ef2b690ad319f80f206f" - integrity sha512-gU+lxhlPHu45H3JkEGgYhWhkR9wLHHEXC9FbWFnTlEkbKyZKWgWRLgf61E8zWmBuI6g5xKBph9ltg3NtZMVF8g== +eslint@^7.5.0: + version "7.5.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.5.0.tgz#9ecbfad62216d223b82ac9ffea7ef3444671d135" + integrity sha512-vlUP10xse9sWt9SGRtcr1LAC67BENcQMFeV+w5EvLEoFe3xJ8cF1Skd0msziRx/VMC+72B4DxreCE+OR12OA6Q== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -1063,9 +1063,9 @@ eslint@^7.4.0: doctrine "^3.0.0" enquirer "^2.3.5" eslint-scope "^5.1.0" - eslint-utils "^2.0.0" - eslint-visitor-keys "^1.2.0" - espree "^7.1.0" + eslint-utils "^2.1.0" + eslint-visitor-keys "^1.3.0" + espree "^7.2.0" esquery "^1.2.0" esutils "^2.0.2" file-entry-cache "^5.0.1" @@ -1079,7 +1079,7 @@ eslint@^7.4.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.14" + lodash "^4.17.19" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -1092,14 +1092,14 @@ eslint@^7.4.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" -espree@^7.1.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-7.1.0.tgz#a9c7f18a752056735bf1ba14cb1b70adc3a5ce1c" - integrity sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw== +espree@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.2.0.tgz#1c263d5b513dbad0ac30c4991b93ac354e948d69" + integrity sha512-H+cQ3+3JYRMEIOl87e7QdHX70ocly5iW4+dttuR8iYSPr/hXKFb+7dBsZ7+u1adC4VrnPlTkv0+OwuPnDop19g== dependencies: - acorn "^7.2.0" + acorn "^7.3.1" acorn-jsx "^5.2.0" - eslint-visitor-keys "^1.2.0" + eslint-visitor-keys "^1.3.0" esprima@3.x.x: version "3.1.3" @@ -2574,10 +2574,10 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -systeminformation@^4.26.5: - version "4.26.9" - resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-4.26.9.tgz#ecc725a162c0c7d8d48226f97637a5f590042ffd" - integrity sha512-69MTIX9j//wnteJzQWuGL6FiMxlfS3wTWyhROI6pNUaQALYqJb3W9VtLVcEcKFOjO1vrGRgilJVFzJeRRi//Pg== +systeminformation@^4.26.10: + version "4.26.10" + resolved "https://registry.yarnpkg.com/systeminformation/-/systeminformation-4.26.10.tgz#2244e7529ca9e7b8ecd6941e19fe7df7e3da9146" + integrity sha512-bO4FIzrjESAfh4KHwkUJym3jvKtJ4oJ2PG0BBQGBmKa0pF2oanpkB7CF4ZsSX7vfp3+GKaLzioVwpV/3Tyk+lQ== table@^5.2.3: version "5.4.6"