Skip to content

Remember images and identity per site, and switch between two sites in one press - #76

Merged
PatrickSt1991 merged 1 commit into
mainfrom
feat/site-settings
Sep 6, 2026
Merged

PatrickSt1991 merged 1 commit into
mainfrom
feat/site-settings

Conversation

@PatrickSt1991

Copy link
Copy Markdown
Contributor

Issues 74 and 75, from the same reporter, turn out to be the same question: what counts as one site.

He wants images off on Instagram and on for Spotify (which will not play without them), Instagram identified as a desktop and other sites as mobile, and a way between those two sites that is neither the address bar nor the start screen. One switch each meant flipping both by hand on every crossing.

What a site is

src/common/SiteRules.cs — so all six packages have it.

A site is its host, lower-cased, without port, credentials or a leading www., and a rule saved there covers that host and anything under it, matched on whole labels: notinstagram.com and instagram.com.evil.test get nothing. Where two rules cover a host the more specific wins.

Deliberately not the registrable domain — there is no public suffix list on a 2018 television, and "the last two labels" turns www.bbc.co.uk into a country. So open.spotify.com and accounts.spotify.com are two sites; every message names the site it just saved for, so this is never ambiguous on screen.

KeyFor returns null for an address that is on no site — this app's own start screen in both shapes (the marker and the data: URL, the pair issue 53 was about), about:, file:. Null means leave whatever is applied alone, so a trip through the start screen does not reset the page on either side of it.

Per-site settings (74)

  • Each switch is a third state per site: unset follows the browser-wide setting rather than meaning "off". A site remembered only for its identity still follows the images switch when that is flipped later.
  • Where you press decides what you move: on a page it writes the site's rule, on the start screen (on no site) it moves the browser-wide setting. The flash says which — "Images off for instagram.com" against "Images off — faster". No new key for it.
  • A menu row, Forget this site's settings, takes a site back to the defaults.
  • Rules go on the view before the request on our own navigations, so anything the browser opens itself is asked with the right identity the first time. A link followed into another site costs one reload — the reload the user was doing by hand, once per crossing.
  • Rule-driven reloads are counted and capped at three without a load settling: two sites whose rules disagree and which redirect to each other would otherwise reload one another for ever, and a television that will not stop reloading is a different order of bad than a page with the wrong identity. The reload is also deferred a tick, so the engine is never asked to start a load from inside its own load-started notification.

Switching sites (75)

SiteRules.OtherSite walks the history — most-recent-first — for the first entry that is not on this site. From B that is the page on A you came from, and from A it is the page on B you left, so one action alternates between the two sites somebody is actually using. Because it goes through Navigate, both sites arrive with their own settings on the first request and no reload at all.

It is the second row of the menu, so every remote can reach it, plus the red / A button as an accelerator — every digit and Info were already spoken for. Which name that button sends is undocumented and differs by remote generation, and the slim remotes have no colour buttons at all, so RemoteKeys.SwitchKeys answers to every plausible spelling exactly as MenuKeys does. If we guessed wrong, the remote card prints the name the TV actually sent, which is how we find out.

Report

site rules: names the rule in force on the page in hand; the full report at :8081 lists every remembered site. A setting that follows you around invisibly is the kind that gets reported as "the browser changed on its own".

Checks

  • tools/siterules/run.sh — new. 43 checks over the shipping file: the names, what a rule covers and what it must not, the unset field, a disk round trip, forgetting that reports whether it did anything, a hand-edited or future-build file that cannot stop the browser starting, and the alternation. Documented in CLAUDE.md beside the other harnesses.
  • tools/startpage/run.sh — still green.
  • ./build.sh all — all five browser packages, 0 warnings; OverscanProbe builds too.

docs/INTERNALS.md gains Settings that belong to a site, not to the browser, and What is left on the 2025 sets records that 37 is closed and confirmed and that 74/75 are now the open threads, with what the next report from that set decides.

…n one press

Issues 74 and 75, from the same reporter, are the same question: what counts as
one site. He wants images off on Instagram and on for Spotify, which will not
play without them, Instagram identified as a desktop and other sites as mobile,
and a way between those two sites that is not the address bar or the start
screen. One switch each meant flipping both by hand on every crossing.

SiteRules (src/common, so all six packages) is the answer to both. A site is its
host without a leading www., and a rule saved there covers that host and
anything under it, matched on whole labels so notinstagram.com gets nothing. It
is not the registrable domain: there is no public suffix list on a 2018 TV, and
"the last two labels" turns www.bbc.co.uk into a country. An address that is on
no site — this app's own start screen in both of its shapes, about:, file: —
returns null, which means leave whatever is applied alone, so a trip through the
start screen does not reset the page on either side of it.

Each switch is a third state per site: unset follows the browser-wide setting
rather than meaning off. Which one a key press moves is decided by where it was
pressed — on a page it writes the site's rule, on the start screen it moves the
browser-wide setting — and the flash says which. A menu row forgets a site.

Rules go on the view before the request on our own navigations, so anything this
browser opens itself is asked with the right identity the first time; a link
followed into another site costs one reload, which is the reload the user was
doing by hand. Rule-driven reloads are counted and capped at three without a
load settling, because two sites whose rules disagree and which redirect to each
other would otherwise reload one another for ever. The reload is deferred a tick
so the engine is never asked to start a load from inside its own load-started
notification.

Switching sites walks the history for the first entry that is not on this site,
which alternates between the two sites somebody is going back and forth between.
It is the second row of the menu, so every remote can reach it, plus the red / A
button as an accelerator — every digit and Info were already spoken for. Which
name that button sends is undocumented, so RemoteKeys.SwitchKeys answers to all
the plausible spellings the way MenuKeys does; if we guessed wrong the remote
card prints the name the TV actually sent.

tools/siterules/run.sh compiles the shipping file and holds it to the names,
what a rule covers and what it must not, the unset field, a disk round trip, a
hand-edited file that cannot stop the browser starting, and the alternation.
@PatrickSt1991
PatrickSt1991 merged commit d526114 into main Sep 6, 2026
7 checks passed
@PatrickSt1991
PatrickSt1991 deleted the feat/site-settings branch September 6, 2026 06:43
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