From ce79bfab8b9d4b3b58d30114edb11938e0f2c1b0 Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 19 Aug 2020 21:11:07 +0800 Subject: [PATCH] upgrade dep --- .eslintrc.js | 1 + package.json | 12 ++++++------ packages/hydrojudge/package.json | 6 +++--- packages/hydrooj/package.json | 10 +++++----- packages/hydrooj/src/error.ts | 1 + packages/login-with-google/lib.ts | 1 + packages/login-with-google/package.json | 4 ++-- packages/login-with-osu/lib.ts | 8 +++++--- packages/login-with-osu/locales/zh_CN.yaml | 2 +- packages/login-with-osu/package.json | 4 ++-- packages/migrate-vijos/package.json | 4 ++-- packages/migrate-vijos/script.ts | 7 ++----- 12 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 34cf399a0..7fbb5bd94 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,6 +24,7 @@ module.exports = { 'import/prefer-default-export': 'off', indent: ['warn', 4], 'max-classes-per-file': 'off', + 'max-len': ['warn', 150], 'no-bitwise': 'off', 'no-console': 'off', 'no-extend-native': 'off', diff --git a/package.json b/package.json index 942c8c91b..2d64e5911 100644 --- a/package.json +++ b/package.json @@ -17,14 +17,14 @@ "devDependencies": { "@shelf/jest-mongodb": "^1.2.2", "@types/cross-spawn": "^6.0.2", - "@types/jest": "^26.0.9", - "@types/node": "^14.0.27", - "@typescript-eslint/eslint-plugin": "^3.9.0", - "@typescript-eslint/parser": "^3.9.0", + "@types/jest": "^26.0.10", + "@types/node": "^14.6.0", + "@typescript-eslint/eslint-plugin": "^3.9.1", + "@typescript-eslint/parser": "^3.9.1", "cross-spawn": "^7.0.3", - "eslint": "^7.6.0", + "eslint": "^7.7.0", "eslint-config-airbnb-base": "^14.2.0", - "eslint-import-resolver-typescript": "^2.2.0", + "eslint-import-resolver-typescript": "^2.2.1", "eslint-plugin-import": "^2.22.0", "globby": "^11.0.1", "jest": "^26.4.0", diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index e86633f24..f228ad49c 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/hydrojudge", - "version": "2.0.3", + "version": "2.0.4", "main": "package.json", "author": "masnn", "os": [ @@ -12,8 +12,8 @@ "fs-extra": "^9.0.1", "hydrooj": "^2.12.0", "js-yaml": "^3.14.0", - "lodash": "^4.17.19", - "p-queue": "^6.6.0", + "lodash": "^4.17.20", + "p-queue": "^6.6.1", "shell-quote": "^1.7.2", "systeminformation": "^4.26.10" }, diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index e0cb05bd2..d0565d52a 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.12.16", + "version": "2.12.17", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", @@ -20,9 +20,9 @@ "koa": "^2.13.0", "koa-body": "^4.2.0", "koa-morgan": "^1.0.1", - "koa-router": "^8.0.8", + "koa-router": "^9.4.0", "koa-static-cache": "^5.1.3", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "lru-cache": "^6.0.0", "moment-timezone": "^0.5.31", "mongodb": "^3.5.9", @@ -38,13 +38,13 @@ "@types/adm-zip": "^0.4.33", "@types/fs-extra": "^9.0.1", "@types/js-yaml": "^3.12.5", - "@types/koa": "^2.11.3", + "@types/koa": "^2.11.4", "@types/koa-morgan": "^1.0.4", "@types/koa-router": "^7.4.1", "@types/koa-static-cache": "^5.1.0", "@types/lodash": "^4.14.158", "@types/lru-cache": "^5.1.0", - "@types/mongodb": "^3.5.25", + "@types/mongodb": "^3.5.26", "@types/nodemailer": "^6.4.0", "@types/serialize-javascript": "^4.0.0", "@types/sockjs": "^0.3.32", diff --git a/packages/hydrooj/src/error.ts b/packages/hydrooj/src/error.ts index 01d82c9f7..0b7804702 100644 --- a/packages/hydrooj/src/error.ts +++ b/packages/hydrooj/src/error.ts @@ -1,3 +1,4 @@ +/* eslint-disable max-len */ /* eslint-disable func-names */ import { isClass } from './utils'; diff --git a/packages/login-with-google/lib.ts b/packages/login-with-google/lib.ts index eb7f9d0bb..c3c3a0ddc 100644 --- a/packages/login-with-google/lib.ts +++ b/packages/login-with-google/lib.ts @@ -11,6 +11,7 @@ async function get() { system.get('server.url'), token.add(token.TYPE_OAUTH, 600, { redirect: this.request.referer }), ]); + // eslint-disable-next-line max-len this.response.redirect = `https://accounts.google.com/o/oauth2/v2/auth?client_id=${appid}&response_type=code&redirect_uri=${url}oauth/google/callback&scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile&state=${state}`; } diff --git a/packages/login-with-google/package.json b/packages/login-with-google/package.json index 770ae98f8..6e82d29da 100644 --- a/packages/login-with-google/package.json +++ b/packages/login-with-google/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/login-with-google", - "version": "0.0.3", + "version": "0.0.4", "main": "package.json", "repository": "git@github.com:hydro-dev/Hydro.git", "author": "undefined ", @@ -18,4 +18,4 @@ "superagent": "^6.0.0", "superagent-proxy": "^2.0.0" } -} +} \ No newline at end of file diff --git a/packages/login-with-osu/lib.ts b/packages/login-with-osu/lib.ts index ae92e32d2..ff1bd311a 100644 --- a/packages/login-with-osu/lib.ts +++ b/packages/login-with-osu/lib.ts @@ -4,6 +4,8 @@ import superagentProxy from 'superagent-proxy'; superagentProxy(superagent); +const BASE_URL = 'https://osu.ppy.sh/'; + async function get() { const { system, token } = global.Hydro.model; const [[appid, url], [state]] = await Promise.all([ @@ -13,7 +15,7 @@ async function get() { ]), token.add(token.TYPE_OAUTH, 600, { redirect: this.request.referer }), ]); - this.response.redirect = `https://osu.ppy.sh/oauth/authorize?client_id=${appid}&state=${state}&redirect_uri=${url}oauth/osu/callback&response_type=code`; + this.response.redirect = `${BASE_URL}oauth/authorize?client_id=${appid}&state=${state}&redirect_uri=${url}oauth/osu/callback&response_type=code`; } async function callback({ state, code }) { @@ -28,7 +30,7 @@ async function callback({ state, code }) { ]), token.get(state, token.TYPE_OAUTH), ]); - const res = await superagent.post('https://osu.ppy.sh/oauth/token') + const res = await superagent.post(`${BASE_URL}oauth/token`) .proxy(proxy) .send({ client_id: appid, @@ -44,7 +46,7 @@ async function callback({ state, code }) { ); } const t = res.body.access_token; - const userInfo = await superagent.get('https://osu.ppy.sh/api/v2/me') + const userInfo = await superagent.get(`${BASE_URL}api/v2/me`) .proxy(proxy) .set('User-Agent', 'Hydro-OAuth') .set('Authorization', `Bearer ${t}`); diff --git a/packages/login-with-osu/locales/zh_CN.yaml b/packages/login-with-osu/locales/zh_CN.yaml index c95573fba..b75e84d95 100644 --- a/packages/login-with-osu/locales/zh_CN.yaml +++ b/packages/login-with-osu/locales/zh_CN.yaml @@ -1 +1 @@ -Login With Osu: 使用 Osu 登录 \ No newline at end of file +Login with Osu: 使用 Osu 登录 \ No newline at end of file diff --git a/packages/login-with-osu/package.json b/packages/login-with-osu/package.json index 5b97de83a..93b874015 100644 --- a/packages/login-with-osu/package.json +++ b/packages/login-with-osu/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/login-with-osu", - "version": "0.0.3", + "version": "0.0.4", "main": "package.json", "repository": "git@github.com:hydro-dev/Hydro.git", "author": "undefined ", @@ -18,4 +18,4 @@ "superagent": "^6.0.0", "superagent-proxy": "^2.0.0" } -} +} \ No newline at end of file diff --git a/packages/migrate-vijos/package.json b/packages/migrate-vijos/package.json index a50419837..03f566165 100644 --- a/packages/migrate-vijos/package.json +++ b/packages/migrate-vijos/package.json @@ -11,11 +11,11 @@ }, "devDependencies": { "@types/js-yaml": "^3.12.5", - "@types/mongodb": "^3.5.25" + "@types/mongodb": "^3.5.26" }, "dependencies": { "hydrooj": "^2.12.3", "js-yaml": "^3.14.0", "mongodb": "^3.6.0" } -} \ No newline at end of file +} diff --git a/packages/migrate-vijos/script.ts b/packages/migrate-vijos/script.ts index 55f770501..7ce962f24 100644 --- a/packages/migrate-vijos/script.ts +++ b/packages/migrate-vijos/script.ts @@ -250,6 +250,7 @@ const tasks = { doc_id: 'docId', doc_type: 'docType', owner_uid: 'owner', + owner: 'owner', name: 'name', roles: { field: 'roles', @@ -528,11 +529,7 @@ export async function run({ } await dst.collection('system').updateOne( { _id: 'user' }, - { - $set: { - value: userCounter.value, - }, - }, + { $set: { value: userCounter.value } }, { upsert: true }, ); await report({ progress: 1, message: 'Collection:system done.' });