Repository navigation
Release 1.2.0: media presence, Default Activity offer, plainer wording - #33
Merged
Merged
Conversation
Windows already gave a write to Discord 5 seconds before treating the connection as dead. The Unix socket had no timeout, so a Discord that accepted the connection and stopped reading would hold the Discord worker in write_all for good, and nothing would show or clear again until it resumed or died. The socket now has the same 5 second write timeout, and the existing error path drops the connection and retries. The new test fails without the change (the write is still blocked after 15 seconds) and passes with it. A timed out frame can take up to two timeouts, since a partly accepted write returns before the next one waits, so the test runs about 10 seconds. Desktop checks: clippy -D warnings, fmt --check, and 141 tests pass. The Windows code was not touched or built here.
An Activity's page lists its version next to its sites and source. It comes from the Activity's own metadata.json, for Parousia's native Activities and the bundled PreMiD ones alike, through the one draft both adapters fill (versionFrom), so there is a single rule for what counts as a version. Only the manifest carries it: the catalog entry leaves it out, as it does the settings, so the list the dashboard loads doesn't grow. A PreMiD Activity with a version that isn't MAJOR.MINOR.PATCH still builds, without one; a native one still fails the build, as before. Browser checks: typecheck, lint, format:check, and 460 tests pass. A real build against the PreMiD and native sources gave all 1,455 manifests a version and no catalog entry one.
The port-in-use and Windows pipe messages say what happened and what to do in fewer words, and the no-tray notice is one line. The README's headings render again (they had been bold text inside `**`), and its sentences are shorter. The message test checks the new port-in-use wording.
Shorter, more direct sentences in the popup, dashboard, settings, and the README: fewer disclaimers and repeated explanations, one term for each thing (Activity for a site's integration, presence for what's shown on Discord), and "declined" for refused access. Every translation follows its English string. The popup's own strings change in the next commit, so their keys stay as they were here.
… is shared The popup looked for a site's Activity only when nothing was shared, so with the Default Activity shared the site's own Activity was hidden: a site with an Activity that was off, or that couldn't run, got no offer at all. Now the offer stays, under the Default Activity: turned off or unable to run, it's offered with its button; on with nothing to share, it's noted without one. The decision is siteOffer in shared/site-offer.ts, with unit tests. The popup's own strings change with it.
Settings > Privacy > Show media presence (off by default): music or video playing in a tab you shared stays on Discord when you move to a site with no Activity, or to a browser page, until the sound stops, the tab closes, or its Activity is turned off. Only an Activity that presents as listening or watching, or has an end time, counts, and only while the tab makes sound. An Activity on the tab you're looking at comes first. With several players the one shared most recently is shown, and one moving to its next track in the background doesn't take over. Keeping it working: the page scripts of a kept tab keep reading while the tab is hidden, so a song skipped there reaches Discord. The kept tabs are written to storage.session, so the presence survives the MV3 background restarting. The popup shows what's shared and, beside it, the site's own Activity. Disabled Activities: their code doesn't run and nothing is injected for them. The page host waits for the stored switches before it answers, so an Activity turned off doesn't run once at startup. A paused private tab runs no Activity code, and its page scripts aren't injected.
…sence PAROUSIA_CHROMIUM_BINARY runs the link and Activities checks in any Chromium-based browser (Helium here) instead of Playwright's bundled one. It is set explicitly: a run never falls back silently. Desktop names a browser from its user agent, so the link check expects "Chrome" for a browser that doesn't identify itself as Chromium. The Activities check covers media presence with a tab that really makes sound: the song staying on a site without an Activity, a skipped song in a tab nobody is looking at, two players, the background restarting, and the popup beside kept music and beside the Default Activity. Headless Chromium never hides a tab, so the tab switch is played back into the extension's own world; the rest of the browser is real.
…ities guarantee The CHANGELOG's 1.2.0 section lists this release's changes. The threat model has a Disabled Activities section (what stops when an Activity is off, and what doesn't), and the architecture and browser READMEs describe media presence and how to verify it.
The extension, userscript, and package.json move to 1.2.0 (Firefox's manifest takes the plain release number: it's the first submission of 1.2.0). Desktop moves to 1.0.2 for the Discord write timeout and the messages above. The version test pins the new release, and the CHANGELOG says where versions are set. scripts/release-check.mjs v1.2.0 passes.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Pending media lookups can republish presence after sharing is disabled, paused private sources continue being read, and desktop-link verification can fail for a working Chromium connection.
3 open issues
What changed in this PR
Prepares browser extension and userscript 1.2.0 and Desktop 1.0.2, extending browser-to-Discord presence with retained media and stronger Activity privacy controls.
Changes:
- Adds opt-in media presence, background updates, restart recovery, and site Activity offers alongside fallback presence.
- Displays Activity versions and simplifies interface text, translations, and documentation.
- Adds a Unix Discord write timeout, expands tests, and updates release versions, dependencies, and CI auditing.
| File | Description |
|---|---|
| README.md | Simplifies project and installation wording. |
| project/threat-model.md | Documents disabled Activities, media privacy, and limitations. |
| project/architecture.md | Describes media selection and Activity switches. |
| desktop/src/platform/windows/control.rs | Simplifies pipe ownership error text. |
| desktop/src/platform/unix/discord.rs | Adds a write timeout and stalled-connection test. |
| desktop/src/platform/linux/tray/mod.rs | Shortens the missing-tray message. |
| desktop/src/main.rs | Simplifies port errors and updates assertions. |
| desktop/src/adapters/discord/mod.rs | Documents write-timeout recovery. |
| desktop/README.md | Simplifies Desktop documentation and fixes headings. |
| desktop/Cargo.toml | Bumps Desktop to 1.0.2. |
| desktop/Cargo.lock | Updates Desktop version and logging dependency. |
| CHANGELOG.md | Adds 1.2.0 features and privacy notes. |
| browser/src/shared/views.ts | Updates connection wording. |
| browser/src/shared/update-notice.ts | Simplifies update notices. |
| browser/src/shared/site-offer.ts | Defines when to offer the current site's Activity. |
| browser/src/shared/site-offer.test.ts | Tests site offers alongside fallback presence. |
| browser/src/shared/settings-view.ts | Adds the media-presence switch and revises wording. |
| browser/src/shared/presence-view.ts | Simplifies empty-presence text. |
| browser/src/shared/connection-status.ts | Uses consistent presence terminology. |
| browser/src/shared/activity-catalog.ts | Updates a site-access comment. |
| browser/src/premid/page.ts | Allows retained tabs to keep updating while hidden. |
| browser/src/premid/page.test.ts | Tests hidden-tab update controls. |
| browser/src/popup/popup.ts | Keeps site offers visible beside fallback presence. |
| browser/src/popup/popup.html | Updates sharing and connection labels. |
| browser/src/platforms/background.ts | Coordinates retained media, recovery, privacy, and UI state. |
| browser/src/locales/zh.json | Updates Chinese wording and media-setting translations. |
| browser/src/locales/sv.json | Updates Swedish wording and media-setting translations. |
| browser/src/locales/fr.json | Updates French wording and media-setting translations. |
| browser/src/locales/de.json | Updates German wording and media-setting translations. |
| browser/src/fullscreen/fullscreen.html | Simplifies dashboard labels and help text. |
| browser/src/fullscreen/default.ts | Simplifies Default Activity editor text. |
| browser/src/fullscreen/activity.ts | Displays Activity versions and revises access wording. |
| browser/src/fullscreen/activities.ts | Updates source badges and bulk-action wording. |
| browser/src/core/ui-port.ts | Carries and validates retained-media UI state. |
| browser/src/core/ui-port.test.ts | Tests retained-media message parsing. |
| browser/src/core/site-access.ts | Updates the all-sites setting comment. |
| browser/src/core/runtime.ts | Separates detection and adds media fallback priority. |
| browser/src/core/runtime.test.ts | Tests detection guards and media precedence. |
| browser/src/core/preferences.ts | Adds the opt-in media-presence preference. |
| browser/src/core/preferences.test.ts | Tests media-presence defaults and validation. |
| browser/src/core/media-presence.ts | Tracks and selects previously shared media tabs. |
| browser/src/core/media-presence.test.ts | Tests selection, ordering, notifications, and restoration. |
| browser/src/core/default-activity.ts | Simplifies validation messages. |
| browser/src/core/activity.ts | Adds optional Activity version metadata. |
| browser/src/activities/messages.ts | Adds background-reading control messages. |
| browser/src/activities/messages.test.ts | Tests background-reading message validation. |
| browser/src/activities/manifest.ts | Excludes versions from catalog entries. |
| browser/src/activities/manifest.test.ts | Extends catalog-field omission coverage. |
| browser/src/activities/host.ts | Waits for switches and controls retained-tab reading. |
| browser/src/activities/host.test.ts | Tests startup gating, non-injecting reads, and script controls. |
| browser/src/activities/collector.ts | Keeps retained media collectors reading while hidden. |
| browser/src/activities/collector.test.ts | Tests hidden collector updates and stopping. |
| browser/scripts/version.test.ts | Updates release-version assertions. |
| browser/scripts/verify-malsync-real.mjs | Updates a verification log message. |
| browser/scripts/verify-desktop-link.mjs | Supports custom Chromium executables and adjusts name checks. |
| browser/scripts/verify-activities.mjs | Adds audible-media, restart, and popup checks. |
| browser/scripts/verify-activities-firefox.mjs | Updates assertion wording. |
| browser/scripts/i18n.test.ts | Updates the expected connection label. |
| browser/scripts/e2e/lib.mjs | Adds custom Chromium launch options. |
| browser/scripts/activities/premid.ts | Reads PreMiD Activity versions. |
| browser/scripts/activities/native.ts | Validates and preserves native Activity versions. |
| browser/scripts/activities/metadata.ts | Adds shared version parsing and manifest support. |
| browser/scripts/activities/fixtures/premid/websites/V/Versioned/v2/metadata.json | Distinguishes versioned fixture metadata. |
| browser/scripts/activities/fixtures/premid/websites/E/Example/metadata.json | Supplies a version-propagation fixture. |
| browser/scripts/activities/fixtures/parousia/websites/T/Tunes/metadata.json | Supplies a native version fixture. |
| browser/scripts/activities/fixtures/parousia/websites/T/Tunes/activity.ts | Marks the media fixture as listening. |
| browser/scripts/activities/activities.test.ts | Tests version validation and packaging. |
| browser/package.json | Bumps the browser release and development dependencies. |
| browser/manifests/firefox.json | Sets Firefox version to 1.2.0. |
| browser/manifests/chromium.json | Sets Chromium version to 1.2.0. |
| .github/workflows/browser-ci.yml | Limits audit failures to high and critical advisories. |
Review effort: Balanced
Comment on lines
+535
to
+538
| if (!next.showMediaPresence) { | ||
| mediaTabs.clear(); | ||
| watchingMedia = false; | ||
| kept = null; |
| * Playwright's Chromium says "Chromium"; a browser that doesn't identify itself | ||
| * in its brands (Helium, headless) is named "Chrome", which is what it is named. | ||
| */ | ||
| const browserName = process.env.PAROUSIA_CHROMIUM_BINARY ? "Chrome" : "Chromium"; |
| */ | ||
| async function mediaOf(tabId: number): Promise<Activity | null> { | ||
| const tab = await chrome.tabs.get(tabId); | ||
| if (tab.audible !== true || !tab.url) return null; |
…ia presence is off A refresh that started before Show media presence was turned off could finish after it, assign the music it had kept, and publish it. A refresh now counts as stale once a newer refresh or a preference change has started, and publishes nothing. Remembered tabs are restored only while the feature is on, so a restore that was still reading when it was switched off can't bring them back. A regression test turns the feature off while the lookup of the remembered player is still waiting. It fails without this change.
Desktop names a browser from its user agent: Playwright's Chromium is named Chromium, and a browser that doesn't identify itself in its brands (Helium, headless) is named Chrome. The link check expected Chrome whenever PAROUSIA_CHROMIUM_BINARY was set, so a plain Chromium binary timed out even with a working connection. The check now accepts either name, since it verifies that Desktop accepted the connection, not the browser's brand. Includes the browser/bun.lock update from bun update: node-forge 1.4.2 to 1.4.3, a transitive dependency (through @devicefarmer/adbkit, used by web-ext).
…docs say so With private windows set to Pause activity, a remembered private player was still looked at: its Activity ran to read it and was detected before the privacy check dropped the result. The private tab also stayed in the kept set, and scripts that were already running in it kept going after the setting changed. The docs claimed they stopped. Now a private tab is rejected before any lookup or detection, and forgotten as kept media. When the setting turns to Pause activity, private tabs are forgotten and the scripts running in them are stopped (PageHost.stopTabs), and a shared private tab has its scripts stopped too. The threat model and CHANGELOG say so. Regression tests: a remembered private player isn't looked at again once the setting changes, a script already running in a private tab is stopped, and the host stops only the tab it's asked about.
Owner
Author
|
all tests pass on my end |
The background keepalive's default ping called chrome.runtime.getPlatformInfo directly. A test double that omits the API, or a shared Activity's interval that outlives its mock, made it throw inside an unrelated test file. The ping is best-effort now, and the two Chrome mocks that normally receive it provide it. The suite passes on the CI pin (1.4.2) and on 1.4.4.
Deleting the current entry while iterating a Set is safe, so the spread was only a lint warning.
Waiting for Discord to clear as the MV3 worker stops races a kept page script that can wake a new worker before Desktop sees the disconnect. The check now waits for the old worker to reject evaluation, then wakes a new one and looks for the kept song. The Desktop link check still covers clearing on disconnect.
The open dashboard holds a UI port that keeps the worker alive, so stopping it only reconnected at once. The check now leaves the dashboard, stops the worker, and waits for a fresh in-memory mark, which a quick restart cannot race.
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.


Release 1.2.0 of the browser extension and userscript, and Parousia Desktop 1.0.2.
Commits
Each is one change, in order. Ported commits keep their original messages and authors (their content was already on
release/v1.2.0).86038b3fix(desktop): end a Discord write that is never taken on Linux and macOS78b9decfeat: show each Activity's version on its dashboard page2244f57docs: start the 1.2.0 changelogdbb159bbuild(deps): update browser and desktop dependencies to latest0217618ci: fail the browser audit only on high and critical advisories1a1e262docs(desktop): shorter port, pipe, and tray messages; plainer READMEf6399dadocs: plainer wording across the popup, dashboard, settings, and READMEa3ca6c0fix(popup): keep the site's Activity offer while the Default Activity is shared862ef06feat: show media presence, and hold disabled Activities to their switchb279887test(e2e): run the real-browser checks in Helium, and cover media presenceeb9b0b9docs: 1.2.0 release notes, and what media presence and disabled Activities guaranteee726b6fbuild: bump the browser to 1.2.0 and Desktop to 1.0.2Commit 9 contains several changes that share the refresh path in
background.tsandhost.ts: the media presence feature itself, the privacy guarantees for disabled Activities, the background reading and restart recovery of kept media, and the popup's indicator. They weren't split further because the same functions were changed in one pass.Versions
package.json; Firefox takes the plain release number)desktop/Cargo.toml). The release binary reportsParousia-Desktop 1.0.2.scripts/release-check.mjs v1.2.0passes.Validation
web-ext lint(0 errors, 0 warnings) pass. 552 tests pass.-D warnings, fmt, and 141 tests pass.desktop:verifypasses 16 of 16 steps;activities:verifypasses 17 of 17, including media presence with a tab that really makes sound, a skipped song in a tab nobody is looking at, two players, the background restarting, and the popup beside kept media.Limitations
web-ext lintpasses.CHANGELOG.mdstill says "IN DEVELOPMENT" for 1.2.0; change it to the release header when the tag is cut.