Skip to content

Commit 214ad98

Browse files
authored
Merge pull request #312 from ccagml/main
解决国际站不能使用的问题
2 parents 051c09d + f96302f commit 214ad98

File tree

10 files changed

+740
-140
lines changed

10 files changed

+740
-140
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# version 3.1.21
2+
3+
- 修改国际站修改登录方式 cRUL 方式登录,解决国际站不能提交使用的问题
4+
15
# version 3.1.20
26

37
- 多个用例部分正确部分错误的上色问题

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- 增加获取中文站的题解
3131
- 增加 cpp、js、py3 一些题目的 debug(参考 wangtao0101 项目,有问题提 issues)
3232
- [有些题目原插件无法调试,请尝试配置区域调试参数](#区域调试参数的一些说明)
33+
- [国际站修改登录方式 cRUL 方式登录](#cRUL 登录)
3334

3435
# 关于本项目
3536

@@ -75,6 +76,14 @@
7576

7677
- 查看一个题目时会开始计时,提交一个题目通过后会停止计时
7778

79+
## 国际站 cRUL 登录
80+
81+
- 使用谷歌浏览器或者其他浏览器
82+
- F12 查看登录国际站后的请求
83+
- 选中复制最后一个 graphql 请求
84+
- 右键->复制-> 以 cURL(bash)格式复制
85+
- 插件登录选择 使用 cURL Cookie 方式登录,输入账号,输入复制来的 cURL(bash)格式请求数据
86+
7887
## 区域调试参数的一些说明
7988

8089
### 如果有些题目无法 debug,请尝试配置 diy 参数区
@@ -231,6 +240,7 @@
231240
- 本插件基于[LeetCode-OpenSource](https://github.com/LeetCode-OpenSource)[vscode-leetcode](https://github.com/LeetCode-OpenSource/vscode-leetcode/)
232241
- 题目分数数据基于[zerotrac](https://github.com/zerotrac)[leetcode_problem_rating](https://github.com/zerotrac/leetcode_problem_rating/)每周的更新
233242
- 插件 debug 参考[wangtao0101](https://github.com/wangtao0101/vscode-debug-leetcode)
243+
- 插件 使用谷歌浏览器复制为 cUrl 方式登录 参考[StevenJohnston](https://github.com/StevenJohnston/leetcode-cli)
234244

235245
<!-- ## 编译插件的相关信息
236246

package-lock.json

Lines changed: 281 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-leetcode-problem-rating",
33
"displayName": "LeetCode",
44
"description": "%main.description%",
5-
"version": "3.1.20",
5+
"version": "3.1.21",
66
"author": "ccagml",
77
"publisher": "ccagml",
88
"license": "MIT",
@@ -1200,6 +1200,7 @@
12001200
"dependencies": {
12011201
"ansi-styles": "3.2.1",
12021202
"cheerio": "1.0.0-rc.12",
1203+
"fetch-h2": "^3.0.2",
12031204
"fs-extra": "^10.0.0",
12041205
"he": "1.2.0",
12051206
"highlight.js": "^10.7.2",
@@ -1209,6 +1210,7 @@
12091210
"mkdirp": "^1.0.4",
12101211
"moment": "^2.29.1",
12111212
"nconf": "^0.11.2",
1213+
"parse-curl": "^0.2.6",
12121214
"prompt": "^1.2.0",
12131215
"request": "2.88.0",
12141216
"underscore": "1.12.1",

src/childCall/childCallModule.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ class ExecuteService implements Disposable {
404404
["Cookie", "-c"],
405405
["GitHub", "-g"],
406406
["LinkedIn", "-i"],
407+
["curltype", "-r"],
407408
]);
408409

409410
let commandArg = loginArgsMapping.get(loginMethod);
@@ -500,6 +501,16 @@ class ExecuteService implements Disposable {
500501
}
501502
}
502503
// csrftoken="xxxx"; LEETCODE_SESSION="xxxx";
504+
} else if (arg.loginMethod === "curltype") {
505+
pwd = await window.showInputBox({
506+
prompt: "输入从浏览器复制来的cURL请求.",
507+
password: true,
508+
ignoreFocusOut: true,
509+
validateInput: (s: string): string | undefined => (s ? undefined : "Password must not be empty"),
510+
});
511+
512+
pwd = pwd?.trim();
513+
pwd = pwd?.replace(/\\ /g, ' ')
503514
} else {
504515
pwd = await window.showInputBox({
505516
prompt: "Enter password.",

0 commit comments

Comments
 (0)