j178 / leetgo

Best LeetCode friend for geek. :snowboarder:
MIT License
539 stars 32 forks source link

[Bug] 同时用chrome和edge的情况下,如何仅识别edge的认证 #136

Closed liuliangcan closed 1 year ago

liuliangcan commented 1 year ago

Verify steps

leetgo config

Leetgo version info  :

0.3.0                                           
commit: 2764426ac5844fef41d9131fe33c3d9d23861fc1
built at: 2023-02-25T09:20:06Z                  
goos: windows                                   
goarch: amd64

Global config dir : C:\Users\Administrator.config\leetgo Global config file : C:\Users\Administrator.config\leetgo\config.yaml Project root : F:\play_with_code\play_with_python\tools\leetgo Working dir : F:\play_with_code\play_with_python\tools\leetgo Project config file : F:\play_with_code\play_with_python\tools\leetgo\leetgo.yaml Project configuration:

leetgo project level config, global config is at C:\Users\Administrator.config\leetgo\config.yaml

for more details, please refer to https://github.com/j178/leetgo

language: zh code: lang: python3 filename_template: '{{ .Id | padWithZero 4 }}.{{ .Difficulty }}.{{ .Title }}{{ if .SlugIsMeaningful }}.{{ .Slug }}.{{ .Difficulty }}{{ end }}'

python3:

blocks:

leetcode: site: https://leetcode.cn

credentials:

from: browser

editor:

use: none

Full configuration   :
```yaml
author: Bob
language: zh
code:
  lang: python3
  filename_template: '{{ .Id | padWithZero 4 }}.{{ .Difficulty }}.{{ .Title }}{{ if .SlugIsMeaningful }}.{{ .Slug }}.{{ .Difficulty }}{{ end }}'
  separate_description_file: false
  blocks:
    - name: beforeMarker
      template: |
        from bisect import *
        from collections import *
        from heapq import *
        from typing import List
        from itertools import *
        from math import inf
        from functools import cache
    - name: beforeCode
      template: |+
        from sortedcontainers import SortedList

  modifiers:
    - name: removeUselessComments
  go:
    out_dir: go
    filename_template: ""
    blocks:
      - name: beforeMarker
  credentials:
    from: browser
    session: ""
    csrftoken: ""
    username: ""
    password: ""
contest:
  out_dir: contest
  filename_template: '{{ .ContestShortSlug }}/{{ .Id }}{{ if .SlugIsMeaningful }}.{{ .Slug }}{{ end }}'
  open_in_browser: true
editor:
  use: none
  command: ""
  args: []

### Debug log

```shell
PS F:\play_with_code\play_with_python\tools\leetgo> leetgo contest
INFO reading cookies from browser domain=leetcode.cn
? Select a contest:   第 340 场周赛 at 2023/04/09 10:30:00
? Register for 第 340 场周赛 as @leetcode.cn? Yes
INFO registered contest="第 340 场周赛" user=@leetcode.cn
⣽ 第 340 场周赛 begins in 32 minutes 12 seconds, waiting...                     
PS F:\play_with_code\play_with_python\tools\leetgo>

Description

j178 commented 1 year ago

leetcode 的 cookie 过期机制好像是在前端做的,也就是:虽然 cookie 过期了,但只要不打开页面,cookie 实际上还能继续用。 这就是 leetgo 获取到的 cookie 也还能继续用的原因。

你可以在 Chrome 里打开开发者模式,在 Application tab 里将 leetcode.cn 的 cookie 都清理掉试下。 image

liuliangcan commented 1 year ago