leetcode-cli icon indicating copy to clipboard operation
leetcode-cli copied to clipboard

after chrome update the cookies cannot be seen

Open Virgilio-AI opened this issue 3 years ago • 4 comments

in brave and in chromium I am having the same problem. does anyone knows how to find them now. also update the description

Virgilio-AI avatar Jan 20 '23 00:01 Virgilio-AI

Press F12 and open the network tab, the cookies is not existing? Can you offer your chrome version ?

wendajiang avatar Jan 20 '23 03:01 wendajiang

I have the same issue on MacOS, here's the error output when attempting 'leetcode pick 1':

thread 'main' panicked at 'Error connecting to "/Users/decap/Library/Application Support/Google/Chrome/Default/Cookies"', /Users/decap/.cargo/registry/src/github.com-1ecc6299db9ec823/leetcode-cli-0.3.11/src/cache/mod.rs:17:56 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Did the location of the cookies possibly change? There is no 'Default' directory.

decapo avatar Mar 04 '23 16:03 decapo

Found the issue, if you have multiple chrome profiles it stores the cookies in directories called 'Profile 1', 'Profile 2', etc. and not 'Default'

    let p = match std::env::consts::OS {
        // "macos" => home.join("Library/Application Support/Google/Chrome/Default/Cookies"),
        "macos" => home.join("Library/Application Support/Google/Chrome/Profile 1/Cookies"),
        "linux" => home.join(".config/google-chrome/Default/Cookies"),
        _ => panic!("Opps...only works on OSX or Linux now..."),
    };

Fixed it manually by changing the directory, might make sense to check cookies for Default, then 'Profile 1', 'Profile 2', etc. the first time the CLI is run.

decapo avatar Mar 04 '23 17:03 decapo

Actually, I first read it about Chrome cookies, after refactoring the config, we can think deeply about this question. Or welcome your PR. Thanks.

wendajiang avatar Mar 07 '23 02:03 wendajiang