Skip to content

[pull] master from clearloop:master #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 74 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ path = "src/bin/lc.rs"

[package]
name = "leetcode-cli"
version = "0.4.6"
version = "0.4.7"
authors = ["clearloop <[email protected]>"]
edition = "2021"
description = "Leetcode command-line interface in rust."
Expand All @@ -17,23 +17,23 @@ readme = './README.md'

[dependencies]
async-trait = "0.1.88"
tokio = { version = "1.44.2", features = ["full"] }
clap = { version = "4.5.37", features = ["cargo"] }
tokio = { version = "1.45.1", features = ["full"] }
clap = { version = "4.5.39", features = ["cargo"] }
colored = "3.0.0"
dirs = "6.0.0"
env_logger = "0.11.6"
keyring = "3.6.2"
log = "0.4.27"
openssl = "0.10.72"
pyo3 = { version = "0.24.2", optional = true }
openssl = "0.10.73"
pyo3 = { version = "0.25.0", optional = true }
rand = "0.9.1"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
toml = "0.8.22"
regex = "1.11.1"
scraper = "0.23.1"
anyhow = "1.0.98"
clap_complete = "4.5.48"
clap_complete = "4.5.52"
thiserror = "2.0.12"
unicode-width = "0.2"

Expand All @@ -42,11 +42,11 @@ version = "2.2.10"
features = ["sqlite"]

[dependencies.reqwest]
version = "0.12.15"
version = "0.12.18"
features = ["gzip", "json"]

[features]
pym = ["pyo3"]

[target.'cfg(target_family = "unix")'.dependencies]
nix = { version = "0.30.0", features = [ "signal" ] }
nix = { version = "0.30.1", features = [ "signal" ] }
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,27 @@ csrf = '<your-leetcode-csrf-token>'
session = '<your-leetcode-session-key>'
```

#### Environment variables

The cookies can also be overridden by environment variables, which might be useful to exclude the sensitive information from the configuration file `leetcode.toml`. To do this, you can leave the `csrf` and `session` fields empty in the configuration file and override cookies settings via the environment variables `LEETCODE_CSRF`, `LEETCODE_SESSION`, and `LEETCODE_SITE`:

```toml
[cookies]
csrf = ''
session = ''
site = 'leetcode.com'
```

Then set the environment variables:

```bash
export LEETCODE_CSRF='<your-leetcode-csrf-token>'
export LEETCODE_SESSION='<your-leetcode-session-key>'
export LEETCODE_SITE='leetcode.cn' # or 'leetcode.com'
```

Note that `cookies.site` in still required in the `leetcode.toml` to avoid exception during configuration file parsing, but can be overridden using environment variables.

## Programmable

If you want to filter LeetCode questions using custom Python scripts, add the following to your the configuration file:
Expand Down
Loading