Remember images and identity per site, and switch between two sites in one press - #76
Merged
Merged
Conversation
…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.
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.
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.comandinstagram.com.evil.testget 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.ukinto a country. Soopen.spotify.comandaccounts.spotify.comare two sites; every message names the site it just saved for, so this is never ambiguous on screen.KeyForreturns null for an address that is on no site — this app's own start screen in both shapes (the marker and thedata: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)
Switching sites (75)
SiteRules.OtherSitewalks 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 throughNavigate, 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
Infowere 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, soRemoteKeys.SwitchKeysanswers to every plausible spelling exactly asMenuKeysdoes. 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:8081lists 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 inCLAUDE.mdbeside the other harnesses.tools/startpage/run.sh— still green../build.sh all— all five browser packages, 0 warnings;OverscanProbebuilds too.docs/INTERNALS.mdgains 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.