From 7da1b12afd864ac89949345f0b5714fe7b9edc29 Mon Sep 17 00:00:00 2001 From: Miloas Date: Mon, 9 May 2022 16:44:05 +0800 Subject: [PATCH] fix: update cn domain --- lib/plugins/leetcode.cn.js | 36 ++++++++++++++++++------------------ lib/plugins/leetcode.js | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/plugins/leetcode.cn.js b/lib/plugins/leetcode.cn.js index 77639c7..14b16e1 100644 --- a/lib/plugins/leetcode.cn.js +++ b/lib/plugins/leetcode.cn.js @@ -17,24 +17,24 @@ var plugin = new Plugin(15, 'leetcode.cn', '2018.11.25', plugin.init = function() { config.app = 'leetcode.cn'; - config.sys.urls.base = 'https://leetcode-cn.com'; - config.sys.urls.login = 'https://leetcode-cn.com/accounts/login/'; - config.sys.urls.problems = 'https://leetcode-cn.com/api/problems/$category/'; - config.sys.urls.problem = 'https://leetcode-cn.com/problems/$slug/description/'; - config.sys.urls.graphql = 'https://leetcode-cn.com/graphql'; - config.sys.urls.problem_detail = 'https://leetcode-cn.com/graphql'; - config.sys.urls.test = 'https://leetcode-cn.com/problems/$slug/interpret_solution/'; - config.sys.urls.session = 'https://leetcode-cn.com/session/'; - config.sys.urls.submit = 'https://leetcode-cn.com/problems/$slug/submit/'; - config.sys.urls.submissions = 'https://leetcode-cn.com/api/submissions/$slug'; - config.sys.urls.submission = 'https://leetcode-cn.com/submissions/detail/$id/'; - config.sys.urls.verify = 'https://leetcode-cn.com/submissions/detail/$id/check/'; - config.sys.urls.favorites = 'https://leetcode-cn.com/list/api/questions'; - config.sys.urls.favorite_delete = 'https://leetcode-cn.com/list/api/questions/$hash/$id'; + config.sys.urls.base = 'https://leetcode.cn'; + config.sys.urls.login = 'https://leetcode.cn/accounts/login/'; + config.sys.urls.problems = 'https://leetcode.cn/api/problems/$category/'; + config.sys.urls.problem = 'https://leetcode.cn/problems/$slug/description/'; + config.sys.urls.graphql = 'https://leetcode.cn/graphql'; + config.sys.urls.problem_detail = 'https://leetcode.cn/graphql'; + config.sys.urls.test = 'https://leetcode.cn/problems/$slug/interpret_solution/'; + config.sys.urls.session = 'https://leetcode.cn/session/'; + config.sys.urls.submit = 'https://leetcode.cn/problems/$slug/submit/'; + config.sys.urls.submissions = 'https://leetcode.cn/api/submissions/$slug'; + config.sys.urls.submission = 'https://leetcode.cn/submissions/detail/$id/'; + config.sys.urls.verify = 'https://leetcode.cn/submissions/detail/$id/check/'; + config.sys.urls.favorites = 'https://leetcode.cn/list/api/questions'; + config.sys.urls.favorite_delete = 'https://leetcode.cn/list/api/questions/$hash/$id'; // third parties - config.sys.urls.github_login = 'https://leetcode-cn.com/accounts/github/login/?next=%2F'; - config.sys.urls.linkedin_login = 'https://leetcode-cn.com/accounts/linkedin_oauth2/login/?next=%2F'; - config.sys.urls.leetcode_redirect = 'https://leetcode-cn.com/'; + config.sys.urls.github_login = 'https://leetcode.cn/accounts/github/login/?next=%2F'; + config.sys.urls.linkedin_login = 'https://leetcode.cn/accounts/linkedin_oauth2/login/?next=%2F'; + config.sys.urls.leetcode_redirect = 'https://leetcode.cn/'; }; // FIXME: refactor those @@ -101,7 +101,7 @@ plugin.getProblemsTitle = function(cb) { const opts = makeOpts(config.sys.urls.graphql); opts.headers.Origin = config.sys.urls.base; - opts.headers.Referer = 'https://leetcode-cn.com/api/problems/algorithms/'; + opts.headers.Referer = 'https://leetcode.cn/api/problems/algorithms/'; opts.json = true; opts.body = { diff --git a/lib/plugins/leetcode.js b/lib/plugins/leetcode.js index 9e81014..93d6605 100644 --- a/lib/plugins/leetcode.js +++ b/lib/plugins/leetcode.js @@ -467,7 +467,7 @@ plugin.deleteSession = function(session, cb) { plugin.signin = function(user, cb) { const isCN = config.app === 'leetcode.cn'; - const spin = isCN ? h.spin('Signing in leetcode-cn.com') : h.spin('Signing in leetcode.com'); + const spin = isCN ? h.spin('Signing in leetcode.cn') : h.spin('Signing in leetcode.com'); request(config.sys.urls.login, function(e, resp, body) { spin.stop(); e = plugin.checkError(e, resp, 200);