Skip to content

fix(api): use browser cookies for library, as is done for search - #146

Open
Dragonjinx wants to merge 11 commits into
ccgauche:masterfrom
Dragonjinx:feature/browser-cookies-for-library
Open

Dragonjinx wants to merge 11 commits into
ccgauche:masterfrom
Dragonjinx:feature/browser-cookies-for-library

Conversation

@Dragonjinx

Copy link
Copy Markdown
  • Fix: main library/homepage API now reads browser cookies via rookie
  • Refactor: single-sourced the user-agent into ytpapi2::YT_USER_AGENT so all callers (fallback, search, API) share one value.
  • Flake: added a flake.nix with packages.default, devShells.default, and apps.default.

- Main API reads cookies via rookie (--with-auto-cookies) instead of a
  stale headers.txt, mirroring the search popup's behaviour. Fixes
  InvalidHeaders on the library/homepage.
- Add a nix flake with packages.default, devShells.default, apps.default.
Previously the Firefox UA was hardcoded inline in three places with two
differing values (rv:108.0 fallback in ytpapi2, rv:128.0 in search + api).
Single-source it into ytpapi2::YT_USER_AGENT so all callers share one value
and bumping the UA updates everywhere.
When imported into a NixOS config via fixedPoints.fix (greyline pattern), the
flake's `self` is the outputs attrs (apps/devShells/packages), not a source
dir — so src=self passed the whole outputs set to buildRustPackage and failed
to stringify. Use a path relative to the flake's own dir, matching greyline.
NixOS config overrides the flake's nixpkgs input anyway (injects host pkgs
via fixedPoints.fix), so the flake's own pin only affects standalone
nix flake/local builds. Point it at unstable for dev consistency.
Remove the prose src=./. explanation in the flake and the multi-line doc
comment on YT_USER_AGENT; the code is self-explanatory and the short
remaining comments capture the intentional choices.
homepage is metadata only and does not affect where code is fetched or
built (src=./. governs that), so it's safe to attribute the original
source on master.
@Dragonjinx
Dragonjinx marked this pull request as ready for review September 3, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant