Skip to content

Meta: Prepare support for multiple tokens - #10121

Merged
fregante merged 7 commits into
mainfrom
multiple-tokens
Sep 26, 2026
Merged

fregante merged 7 commits into
mainfrom
multiple-tokens

Conversation

@fregante

@fregante fregante commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

@github-actions github-actions Bot added the meta Related to Refined GitHub itself label Sep 24, 2026
Comment thread source/options-storage.ts
export async function getToken(): Promise<string | undefined> {
const {personalToken} = await cachedSettings;
return personalToken;
return personalToken[0];

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User-picking logic to be implemented separately

Comment thread source/options.svelte Outdated
Comment on lines +70 to +74
<TokenInput {host} />
<TokenInput {host} />
<TokenInput {host} />
<TokenInput {host} />
<TokenInput {host} />

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid a chicken and egg problem in webext-options-sync's syncForm method, I just create a pre-set maximum number of fields and just hide them visually as required.

Comment thread source/options.tsx
for (const tokenField of $$('input[name="personalToken"]')) {
informComponentOfExternalUpdate(tokenField);
for (const tokenField of $$('input[name="personalToken[]"]')) {
informComponentOfExternalUpdate(tokenField as HTMLInputElement);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread source/welcome.svelte

// @ts-expect-error TS and its index signatures...
optionsStorage.set({personalToken: tokenInput});
optionsStorage.set({personalToken: [tokenInput]});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to decide what to do when the user clicks "Open welcome page" in the options and enters a token here. Currently this discards everything else.

Lowest-effort: check for multiple tokens, open alert() on load

@fregante

Copy link
Copy Markdown
Member Author

The PR now works using pre-release versions. The gif shows the values being stored and then loaded into the form after a page refresh

try

@fregante
fregante marked this pull request as ready for review September 26, 2026 09:34
@fregante fregante changed the title Meta: Preliminary support for multiple tokens Meta: Prepare support for multiple tokens Sep 26, 2026
@fregante
fregante enabled auto-merge (squash) September 26, 2026 10:00
@fregante
fregante disabled auto-merge September 26, 2026 10:00
@fregante
fregante enabled auto-merge (squash) September 26, 2026 10:01
@fregante
fregante merged commit 6f96ebf into main Sep 26, 2026
20 checks passed
@fregante
fregante deleted the multiple-tokens branch September 26, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta Related to Refined GitHub itself

Development

Successfully merging this pull request may close these issues.

1 participant