Repository navigation
feat(locallibrary): add account plugins, manifests that say how to sign in to a service - #289
Merged
Merged
Conversation
apps/locallibrary/GLOSSARY.md starts locallibrary's own vocabulary (built-in plugin, account plugin, publisher, account, account type, DJ account, default account, scope, access, sign in). GLOSSARY-MAP.md lists it beside the website's glossary and notes that the website's grant and locallibrary's access are unrelated. ADR 0001 records that account plugins are manifests, that locallibrary runs every sign-in, and that only built-in account plugins may use Local Network's token exchange.
"Built-in plugin" is the glossary's word for a plugin that ships with locallibrary. PluginSpec::first_party becomes built_in, and so do the build script's table (built_in.rs), Manifest::validate's flag, test names and docs. No behaviour change.
…one place The endpoint, token endpoint, token place and redirect port checks move out of the accounts hook's validate into functions the account types in the next commit share, so each error message is written once. No behaviour change.
…t_types]] An account type says how to sign in to a service: its endpoints and client, where the token goes, where to ask who signed in, and the params for signing in again as one account or adding another. It names its scopes, each with the service scopes it asks for and the requests it covers. A manifest with an account type is an account plugin and holds nothing else, and only built-in ones may name Local Network's token exchange. Scope::covers matches a request against a scope. Patterns are written normalised, so a trailing * can't reach past a host. Example tests and hegel properties cover each check.
…plugins as manifests Account plugins live in plugins/accounts/<id>/ as a locallibrary-plugin.toml with no crate. build.rs reads them and the workspace excludes the folder, so adding one adds a folder and edits no list. The host never starts one, and plugin serve refuses to. plugin list, plugin info and plugins.describe show account types. Each scope's patterns come from the requests the youtube, mixcloud and soundcloud plugins make, and tests check those requests are covered.
An "Account plugins" section in docs/plugins.md and a changelog entry. Plugins keep declaring their own accounts until the next change moves them onto account types.
# Conflicts: # apps/locallibrary/CHANGELOG.md # apps/locallibrary/docs/plugins.md
one_account and another_account were checked against the params the host sets itself, which left request, request_uri, response_mode, nonce and claims open: request_uri alone can replace every other param, redirect_uri included. They now take only login_hint, prompt, hd and access_type.
The mistakes property built a lookalike exchange by replacing localnetwork.computer in a drawn exchange, but a drawn test exchange on this computer has no such host, so the "wrong" one was sometimes a valid test exchange and the property failed. It now spells the lookalike host out.
NEW_PROJECT.md said every plugin is a crate in plugins/<id>/. It now has a section for account plugins, a manifest alone in plugins/accounts/<id>/, and says the build and the workspace leave that folder out.
# Conflicts: # apps/locallibrary/CHANGELOG.md
SizeCompared with main. KiB are 1,024 bytes.
|
bnb
previously approved these changes
Oct 29, 2026
Rust coverageFrom run 540. Both are held to the thresholds in .cargo/config.toml.
|
# Conflicts: # apps/locallibrary/CHANGELOG.md
bnb
approved these changes
Oct 29, 2026
Merged
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
First step toward signing in to a service once and letting every plugin use that sign-in. Today each plugin declares its own
[[contributes.accounts]], so two plugins that use Google sign in twice and keep two sets of tokens. This PR adds the piece the rest builds on: account plugins. Nothing signs in through them yet; the next PR moves plugins onto them.Added:
[[contributes.account_types]]in loclib-plugin (hooks/account_types.rs). It describes how to sign in to a service: endpoints, client, where the token goes, awhoamiendpoint with JSON pointers to who signed in, and authorize params for signing in again as one account or adding another (onlylogin_hint,prompt,hd,access_type). It also names scopes, each with the service scopes it asks for and the requests it covers.Scope::coversmatches a request against a scope; patterns are written normalised so a trailing*can't reach past a host.plugins/accounts/<id>/with no crate.build.rsincludes them, the workspace excludes the folder, the host never starts one, andplugin serverefuses. Only built-in account plugins may name Local Network's token exchange.youtube-upload), mixcloud-account (upload) and soundcloud-account (upload,read). Their request patterns come from the youtube, mixcloud and soundcloud plugins' requests, and those plugins' tests check they're covered.plugin list,plugin infoandplugins.describeshow account types.apps/locallibrary/GLOSSARY.md(built-in plugin, account plugin, publisher, account, account type, DJ account, default account, scope, access, sign in), a rootGLOSSARY-MAP.md, and ADR 0001 on why account plugins are manifests and why only built-in ones use the exchange.docs/plugins.md, a NEW_PROJECT.md section, the changelog.Changed:
PluginSpec::built_in,built_in.rs,validate(built_in), test names).Removed: nothing yet.
[[contributes.accounts]]stays until the next PR.How it was tested
plugin list,plugin infoandplugin serve google-accountrefusing.-D warnings, ast-grep,tools/policy.sh, and nextest on the workspace. Hegel coverage on this branch: 95.78% lines, 94.20% functions, 93.86% regions;account_types.rs100%.main:props_edit::replaying_the_journal_after_a_new_export_redoes_the_edits(a playlist renamed tox//yis accepted by the plan and refused by the model). It gets its own fix PR.New app or plugin
CODEOWNERSif someone else reviews it, a changelog line, and READMEs that say what it doesChecklist
apps/locallibrary/CHANGELOG.mdhas a line under Unreleased, if people using it will noticedocs/and--helpstill say what the code does (apps/locallibrary/docs/rpc/too, for a sidecar change)