Skip to content

Commit

Permalink
Merge pull request #312 from ccagml/main
Browse files Browse the repository at this point in the history
解决国际站不能使用的问题
  • Loading branch information
ccagml authored Mar 27, 2024
2 parents 051c09d + f96302f commit 214ad98
Show file tree
Hide file tree
Showing 10 changed files with 740 additions and 140 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# version 3.1.21

- 修改国际站修改登录方式 cRUL 方式登录,解决国际站不能提交使用的问题

# version 3.1.20

- 多个用例部分正确部分错误的上色问题
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- 增加获取中文站的题解
- 增加 cpp、js、py3 一些题目的 debug(参考 wangtao0101 项目,有问题提 issues)
- [有些题目原插件无法调试,请尝试配置区域调试参数](#区域调试参数的一些说明)
- [国际站修改登录方式 cRUL 方式登录](#cRUL 登录)

# 关于本项目

Expand Down Expand Up @@ -75,6 +76,14 @@

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

## 国际站 cRUL 登录

- 使用谷歌浏览器或者其他浏览器
- F12 查看登录国际站后的请求
- 选中复制最后一个 graphql 请求
- 右键->复制-> 以 cURL(bash)格式复制
- 插件登录选择 使用 cURL Cookie 方式登录,输入账号,输入复制来的 cURL(bash)格式请求数据

## 区域调试参数的一些说明

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

<!-- ## 编译插件的相关信息
Expand Down
293 changes: 281 additions & 12 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-leetcode-problem-rating",
"displayName": "LeetCode",
"description": "%main.description%",
"version": "3.1.20",
"version": "3.1.21",
"author": "ccagml",
"publisher": "ccagml",
"license": "MIT",
Expand Down Expand Up @@ -1200,6 +1200,7 @@
"dependencies": {
"ansi-styles": "3.2.1",
"cheerio": "1.0.0-rc.12",
"fetch-h2": "^3.0.2",
"fs-extra": "^10.0.0",
"he": "1.2.0",
"highlight.js": "^10.7.2",
Expand All @@ -1209,6 +1210,7 @@
"mkdirp": "^1.0.4",
"moment": "^2.29.1",
"nconf": "^0.11.2",
"parse-curl": "^0.2.6",
"prompt": "^1.2.0",
"request": "2.88.0",
"underscore": "1.12.1",
Expand Down
11 changes: 11 additions & 0 deletions src/childCall/childCallModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ class ExecuteService implements Disposable {
["Cookie", "-c"],
["GitHub", "-g"],
["LinkedIn", "-i"],
["curltype", "-r"],
]);

let commandArg = loginArgsMapping.get(loginMethod);
Expand Down Expand Up @@ -500,6 +501,16 @@ class ExecuteService implements Disposable {
}
}
// csrftoken="xxxx"; LEETCODE_SESSION="xxxx";
} else if (arg.loginMethod === "curltype") {
pwd = await window.showInputBox({
prompt: "输入从浏览器复制来的cURL请求.",
password: true,
ignoreFocusOut: true,
validateInput: (s: string): string | undefined => (s ? undefined : "Password must not be empty"),
});

pwd = pwd?.trim();
pwd = pwd?.replace(/\\ /g, ' ')
} else {
pwd = await window.showInputBox({
prompt: "Enter password.",
Expand Down
Loading

0 comments on commit 214ad98

Please sign in to comment.