From 318fac7c9514467ac04b4572b49f4a4cfa279f0d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 20 Jan 2026 22:04:20 +0000 Subject: [PATCH 1/2] Fix token parsing and remove wild linker from repo - Fix TokenResponse to handle user_id as either string or number (Threads API returns both formats) - Remove .cargo/config.toml from repo (add to .gitignore for local use) - Update CLAUDE.md to reflect config removal --- .cargo/config.toml | 7 ------- .gitignore | 1 + CLAUDE.md | 2 -- ndl-core/src/oauth.rs | 21 ++++++++++++++++++++- 4 files changed, 21 insertions(+), 10 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 3acd178..0000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,7 +0,0 @@ -[target.x86_64-unknown-linux-gnu] -linker = "clang" -rustflags = ["-C", "link-arg=--ld-path=wild"] - -[target.x86_64-unknown-linux-musl] -linker = "clang" -rustflags = ["-C", "link-arg=--ld-path=wild"] diff --git a/.gitignore b/.gitignore index fedaa2b..2b3b29d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target .env +.cargo/config.toml diff --git a/CLAUDE.md b/CLAUDE.md index 96c6a0d..f7fba5e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,7 +14,6 @@ This file provides context for AI assistants working on this codebase. ``` ndl/ ├── Cargo.toml # Workspace manifest (shared version here) -├── .cargo/config.toml # Linker config (wild on Linux) ├── ndl/ # TUI client │ ├── Cargo.toml │ ├── build.rs # Embeds git version at compile time @@ -51,7 +50,6 @@ ndl/ - **Async Runtime**: tokio - **Serialization**: serde + serde_json for config and API - **Bluesky**: bsky-sdk + atrium-api (AT Protocol) -- **Linker**: wild (Linux) - configured in `.cargo/config.toml` ## Versioning diff --git a/ndl-core/src/oauth.rs b/ndl-core/src/oauth.rs index a6f55f9..8966ee7 100644 --- a/ndl-core/src/oauth.rs +++ b/ndl-core/src/oauth.rs @@ -1,14 +1,33 @@ -use serde::Deserialize; +use serde::{Deserialize, Deserializer, de}; use thiserror::Error; pub const TOKEN_URL: &str = "https://graph.threads.net/oauth/access_token"; pub const OAUTH_SCOPES: &str = "threads_basic,threads_read_replies,threads_manage_replies,threads_content_publish"; +/// Deserialize user_id from either a string or number (Threads API returns both) +fn deserialize_user_id<'de, D>(deserializer: D) -> Result +where + D: Deserializer<'de>, +{ + #[derive(Deserialize)] + #[serde(untagged)] + enum StringOrNumber { + String(String), + Number(u64), + } + + match StringOrNumber::deserialize(deserializer)? { + StringOrNumber::String(s) => s.parse().map_err(de::Error::custom), + StringOrNumber::Number(n) => Ok(n), + } +} + #[derive(Debug, Deserialize)] pub struct TokenResponse { pub access_token: String, #[allow(dead_code)] + #[serde(deserialize_with = "deserialize_user_id")] pub user_id: u64, /// Number of seconds until the token expires (3600 for short-lived, 5184000 for long-lived) #[serde(default)] From e72321c8b34c554f08eabfc2136ffdf61b902cd3 Mon Sep 17 00:00:00 2001 From: pgray Date: Tue, 20 Jan 2026 22:52:50 +0000 Subject: [PATCH 2/2] dckr --- ndld/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ndld/Dockerfile b/ndld/Dockerfile index 3c58c7e..3962c19 100644 --- a/ndld/Dockerfile +++ b/ndld/Dockerfile @@ -7,11 +7,9 @@ RUN apt-get update && apt-get install -y \ musl-tools \ clang \ && rm -rf /var/lib/apt/lists/* \ - && rustup target add x86_64-unknown-linux-musl \ - && cargo install wild-linker + && rustup target add x86_64-unknown-linux-musl # Copy workspace files -COPY .cargo .cargo COPY Cargo.toml Cargo.lock ./ COPY ndl ndl COPY ndld ndld @@ -27,6 +25,7 @@ COPY --from=builder /build/target/x86_64-unknown-linux-musl/release/ndld /ndld ENV NDLD_PORT=8080 EXPOSE 8080 +EXPOSE 443 # Run as non-root (UID 10001) USER 10001:10001