Skip to content

Commit 8eb2ea0

Browse files
committed
cookie登录方式的格式
1 parent 70a1081 commit 8eb2ea0

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

src/childCall/childCallModule.ts

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,34 @@ class ExecuteService implements Disposable {
468468
}
469469
child_process.stdin?.write(`${name}\n`);
470470
const isByCookie: boolean = arg.loginMethod === "Cookie";
471-
const pwd: string | undefined = await window.showInputBox({
472-
prompt: isByCookie ? "Enter cookie" : "Enter password.",
473-
password: true,
474-
ignoreFocusOut: true,
475-
validateInput: (s: string): string | undefined =>
476-
s ? undefined : isByCookie ? "Cookie must not be empty" : "Password must not be empty",
477-
});
471+
let pwd: string | undefined = undefined;
472+
if (isByCookie) {
473+
let cf_v = await window.showInputBox({
474+
title: '正确的cookie例子csrftoken="xxx"; LEETCODE_SESSION="yyy";',
475+
prompt: "输入例子中csrftoken的值xxx",
476+
ignoreFocusOut: true,
477+
validateInput: (s: string): string | undefined => (s ? undefined : "csrftoken不为空"),
478+
});
479+
let ls_v = await window.showInputBox({
480+
title: '正确的cookie例子csrftoken="xxx"; LEETCODE_SESSION="yyy";',
481+
prompt: "输入例子中LEETCODE_SESSION的值yyy",
482+
ignoreFocusOut: true,
483+
validateInput: (s: string): string | undefined => (s ? undefined : "LEETCODE_SESSION不为空"),
484+
});
485+
486+
if (cf_v && ls_v) {
487+
pwd = `csrftoken="${cf_v}";LEETCODE_SESSION="${ls_v}";`;
488+
}
489+
// csrftoken="xxxx"; LEETCODE_SESSION="xxxx";
490+
} else {
491+
pwd = await window.showInputBox({
492+
prompt: "Enter password.",
493+
password: true,
494+
ignoreFocusOut: true,
495+
validateInput: (s: string): string | undefined => (s ? undefined : "Password must not be empty"),
496+
});
497+
}
498+
478499
if (!pwd) {
479500
child_process.kill();
480501
return resolve(undefined);

0 commit comments

Comments
 (0)