Repository navigation
A Demo may count its visits with Umami, and nothing else may (Closes #408) - #427
Merged
Merged
Conversation
Two optional settings, KAMOSU_DEMO_UMAMI_SCRIPT and KAMOSU_DEMO_UMAMI_WEBSITE_ID, read only in demo mode. A Demo given both opens script-src and connect-src to the script's one origin, names the script in instance_status, and the interface loads it once. An instance that is no Demo never reads them, and its policy is unchanged byte for byte. The address must be an http(s) name or IPv4 address, so a `*` or a `;` cannot widen the policy. A counting Demo adds one line naming its Umami to the service worker it serves, so a phone that kept the shell under another policy installs the worker again and keeps it under the current one. instance_status is read server-first, so a kept answer cannot load the script after counting stops. Closes #408 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01126KLKw9pGwH2vG3r1i2VL
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.
Summary
A Demo given an Umami counts its visits with it. Any other Kamosu never reads the two settings.
Why the worker line: a phone keeps the shell with the headers it came with, so a policy that changes on the same version stayed stale until the next upgrade. A changed worker makes the browser install it again, and the install fetches
/again under the current policy.server-firststops a keptinstance_statusfrom loading the script after counting stops.Evidence
After:
just checkandjust testpass: 1,079 Rust tests, 1,379 screen tests and 68 tool tests. New tests:the_policy_without_analytics_is_what_it_always_was: the whole policy string as it was before.an_instance_that_is_no_demo_counts_nothing_whatever_is_seta_setting_kamosu_cannot_use_counts_nothing_and_says_why: covers*,*.example.com,a.example;sandboxand[::1].a_demo_lets_its_umami_through_and_nothing_else: run through the real door. It checks the policy on the shell, a screen and the stylesheet,instance_status, and the worker's bytes against an ordinary instance's.script-src-elem) and a request (connect-src).Merge Danger
Door: two-way
Unset, nothing changes. The two settings are new and read only in demo mode.
Blast Radius: small
instance_statusis now read server-first everywhere. Sign-in, Settings and the reconnect probe wait for the server when online, and use the phone's copy offline as before.Closes #408
🤖 Generated with Claude Code
https://claude.ai/code/session_01126KLKw9pGwH2vG3r1i2VL