Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions lib/plugins/leetcode.cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/leetcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down