Skip to content

armgit / Piik

Public Imported from GitHub
0

Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。

fix(app): clarify site entry and update guidance (#458)

AAA390e637d4e90
diff --git a/cmd/piik-app/README.md b/cmd/piik-app/README.md
index bdf547d2..7e487a5a 100644
--- a/cmd/piik-app/README.md
+++ b/cmd/piik-app/README.md
@@ -35,8 +35,10 @@ publication are separate steps in [deployment](../../docs/deployment.md).
covers saved preferences and custom paths.
- The `--site`, `--local`, and `--link` flags select a mode for CI and development.
- The default launcher checks official releases after it opens, using GitHub
- first and Gitee if GitHub is unavailable. It opens the matching platform ZIP
- when available, falling back to the release page. It does not install or replace the App.
+ first and Gitee if GitHub is unavailable. Click the update button to download
+ the matching platform ZIP, or open the release page when no package matches.
+ **Release notes** opens separately; a new major version includes an upgrade
+ warning. The App does not install or replace itself.
Local rooms last for this App run and work on a reachable LAN. **Public invite**
uses the packaged Cloudflare Tunnel helper to expose that same room service at a
diff --git a/cmd/piik-app/README.zh-CN.md b/cmd/piik-app/README.zh-CN.md
index f1cda209..8555b0fa 100644
--- a/cmd/piik-app/README.zh-CN.md
+++ b/cmd/piik-app/README.zh-CN.md
@@ -29,7 +29,8 @@ Apple 芯片或 Intel Mac,以及 macOS 13 或更新版本。构建程序包与
[App 配置](../../docs/standards/configuration.md#piik-app-configuration)。
- `--site`、`--local` 和 `--link` 用于在 CI 或开发时直接选择模式。
- 默认启动页打开后会检查官方发布,优先使用 GitHub,GitHub 不可用时使用 Gitee。
- 有对应平台的 ZIP 时直接打开下载地址,否则打开发布页。App 不会自行安装或替换程序。
+ 点击更新按钮下载对应平台的 ZIP,没有匹配包时打开发布页。
+ **版本说明** 可单独查看;发现新的大版本时会显示升级提示。App 不会自行安装或替换程序。
本地房间仅在本次 App 运行期间有效,适用于设备间可互相访问的局域网。
**公网邀请** 通过程序包中的 Cloudflare Tunnel 辅助程序,为同一个房间服务提供临时 HTTPS 地址。
diff --git a/cmd/piik-server/release.go b/cmd/piik-server/release.go
index e9c818ed..79e03972 100644
--- a/cmd/piik-server/release.go
+++ b/cmd/piik-server/release.go
@@ -126,7 +126,13 @@ func logReleaseNotice(logger *slog.Logger, result releaseResult) {
if result.CurrentVersion != nil {
current = *result.CurrentVersion
}
- logger.Info(message, "event", "release-check", "status", result.Status,
+ level := slog.LevelInfo
+ if result.Status == statusUpdateAvailable && semver.IsValid(current) &&
+ semver.Major(*result.LatestVersion) != semver.Major(current) {
+ level = slog.LevelWarn
+ message = "A new major Piik release is available; review breaking changes in the release notes before upgrading"
+ }
+ logger.Log(context.Background(), level, message, "event", "release-check", "status", result.Status,
"currentVersion", current, "latestVersion", *result.LatestVersion, "releaseUrl", *result.ReleaseURL)
}
diff --git a/cmd/piik-server/release_test.go b/cmd/piik-server/release_test.go
index 0a0feb99..fb5e0392 100644
--- a/cmd/piik-server/release_test.go
+++ b/cmd/piik-server/release_test.go
@@ -51,6 +51,28 @@ func TestReleaseNoticeUsesOperatorLogsOnlyForAvailableChoices(t *testing.T) {
}
}
+func TestReleaseNoticeWarnsAboutANewerMajorWithoutChangingCheckerStatus(t *testing.T) {
+ for _, current := range []string{"v1.9.1", "v2.0.0-rc.1", "development"} {
+ t.Run(current, func(t *testing.T) {
+ var output bytes.Buffer
+ version, page := "v2.0.0", releaseURLPrefix+"v2.0.0"
+ logReleaseNotice(slog.New(slog.NewJSONHandler(&output, nil)), releaseResult{
+ Status: statusUpdateAvailable, CurrentVersion: &current, LatestVersion: &version, ReleaseURL: &page,
+ })
+ var entry map[string]any
+ if err := json.Unmarshal(output.Bytes(), &entry); err != nil {
+ t.Fatal(err)
+ }
+ warning := current == "v1.9.1"
+ if (entry["level"] == "WARN") != warning ||
+ strings.Contains(entry["msg"].(string), "breaking changes") != warning ||
+ entry["status"] != statusUpdateAvailable || entry["releaseUrl"] != page {
+ t.Fatalf("incorrect major release notice: %v", entry)
+ }
+ })
+ }
+}
+
func TestParseReleaseMetadataAcceptsOnlyTheStrictReleaseIdentity(t *testing.T) {
tagged := func(version, page string) string {
return `{"tag_name":"` + version + `","html_url":"` + page + `"}`
diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md
index 889c079f..7b03b958 100644
--- a/docs/guide/getting-started.md
+++ b/docs/guide/getting-started.md
@@ -76,6 +76,10 @@ restrictive networks may load the page but block video.
**Screens** as available. Pick the actual source and sound option.
5. Copy and send the room invitation. Keep both the App and sharing tab open.
+When the launcher offers an update, **Release notes** opens its details on GitHub
+or Gitee. A new major version includes a compatibility warning; read the upgrade
+instructions before replacing your App.
+
| Filename contains | Platform |
| --- | --- |
| `windows-amd64` | Windows x64 |
@@ -101,9 +105,9 @@ See the [App guide](../../cmd/piik-app/README.md) for package and runtime detail
For Local room and Public invite, expand **Site passphrase** to set an optional
access passphrase.
-For **Connect to Site**, enter the full site address, such as
-`https://demo.piik.tv`, then choose **Open Piik**. Enter the site's passphrase
-on the page that opens if asked.
+For **Connect to Site**, enter a domain such as `demo.piik.tv` or paste the full
+site address, then choose **Open Piik**. HTTPS is added when omitted; for an HTTP
+site, include `http://`. Enter the site's passphrase on the page that opens if asked.
After opening the site through the App once, the same browser remembers that
entry. Keep the App running with that site configured and you can visit the
address directly. **Start sharing** opens the selector; choose **Apps / Windows**
diff --git a/docs/guide/getting-started.zh-CN.md b/docs/guide/getting-started.zh-CN.md
index 07b8d0b1..04d6bc1a 100644
--- a/docs/guide/getting-started.zh-CN.md
+++ b/docs/guide/getting-started.zh-CN.md
@@ -69,6 +69,9 @@ App 的本地房间和临时公网邀请会随本次 App 退出而结束。
然后选定要分享的画面与声音。
5. 复制房间邀请发给朋友。分享期间保持 App 和分享标签页打开。
+启动页提示更新时,可点击 **版本说明** 查看 GitHub 或 Gitee 上的详情。
+跨大版本更新会显示兼容性提醒;替换 App 前,请先阅读升级说明。
+
| 文件名包含 | 适用平台 |
| --- | --- |
| `windows-amd64` | Windows x64 |
@@ -92,7 +95,8 @@ Linux 原生采集还需要[系统组件](../../native/capture/linux/README.md)
本地房间和公网邀请可展开 **站点口令** 设置可选的访问口令。
-使用 **连接站点** 时,填写完整地址,例如 `https://demo.piik.tv`,然后点击 **进入 Piik**。
+使用 **连接站点** 时,输入域名(例如 `demo.piik.tv`)或粘贴完整网址,然后点击 **进入 Piik**。
+省略前缀时自动使用 HTTPS;HTTP 站点请填写 `http://`。
如果站点要求访问口令,在打开的站点页面输入。通过 App 打开过一次后,同一浏览器会记住这个入口。
保持 App 运行并使用该站点配置,之后就能直接访问网址。点击 **开始分享**,
在选择器里选 **程序 / 窗口** 或 **屏幕**,即可使用 App 采集。
diff --git a/docs/research/cross-platform-client-runtime.md b/docs/research/cross-platform-client-runtime.md
index 7902cc75..aee09a9f 100644
--- a/docs/research/cross-platform-client-runtime.md
+++ b/docs/research/cross-platform-client-runtime.md
@@ -202,6 +202,42 @@ for recoverable edge disconnects. Piik's four-start acquisition limit is not a
four-reconnect limit after readiness. Restarting the Quick Tunnel process would
allocate a new public address rather than repair the old invitation.
+## Major-Upgrade Delivery Assessment
+
+Reviewed 2026-10-06 against released update checkers and simulated v2.0.0
+metadata. The v1.0.0 checker opens a provider's release page; v1.1.0 and v1.9.1
+choose a matching ZIP on both GitHub and the Gitee fallback. Detection does not
+download or install anything: the user must click. These clients have no
+major-upgrade warning. The bounded replay used the released source, not the
+current candidate's checker.
+
+The legacy checkers accept exact provider release/asset URLs; release metadata
+cannot redirect them to `piik.tv`. A valid GitHub API response wins without
+checking whether its page or attachment is reachable. Gitee fallback selects
+the highest stable version itself, so keeping GitHub's Latest on a transition
+release does not constrain both discovery paths. Publishing a transition
+release first cannot guarantee that every installed client receives it.
+
+[Sparkle](https://sparkle-project.org/documentation/publishing/#major-upgrades)
+separates major-upgrade presentation from installation and supports
+[website downloads](https://sparkle-project.org/documentation/publishing/#downloading-from-a-web-site).
+Its [feature-upgrade guidance](https://sparkle-project.org/documentation/publishing/#upgrading-to-newer-features)
+also requires capable readers or a separate feed; metadata alone cannot teach
+older readers a new rule.
+
+[CC Switch's About panel](https://github.com/farion1231/cc-switch/blob/243cd9a93b67f56efac173f32505b4085fb40cae/src/components/settings/AboutSection.tsx)
+separates its update action from opening the target version's release notes.
+The installed edition downloads, installs and restarts. Reading release notes
+is optional. This supports Piik's action hierarchy, not adoption of CC Switch's
+installer or update infrastructure; no implementation code was copied.
+
+The evidence supports direct manual downloads with an optional release-note
+link and inline major-upgrade guidance. The accepted behavior belongs to
+[versioning](../standards/versioning.md#major-upgrade-guidance). Historical
+clients still follow their released behavior; a notice cannot substitute for
+actual App/Site compatibility checks. The scope of a future 2.0 break remains
+undecided.
+
## Remaining Gates
- Run the exact clean-revision package on macOS; Linux amd64 is proved.
diff --git a/docs/research/nat-traversal.md b/docs/research/nat-traversal.md
index f629b0a9..cee29a1a 100644
--- a/docs/research/nat-traversal.md
+++ b/docs/research/nat-traversal.md
@@ -317,6 +317,50 @@ still needs room-authorized key/endpoint exchange, MTU/resource limits and mixed
Browser/Native behavior. The nested probe module and full evidence stay on that
isolated branch; production dependencies and routing remain unchanged.
+### Integration Cost And Recovery Controls
+
+The 2026-10-06 assessment retains the probes on `spike/magicsock-assessment`
+at `fea0587f`, based on current main. These nested Go modules are outside Piik's
+build and dependency graph. Repeated local Tailcat bootstrap, peer denial,
+revocation and synthetic SRTP media checks passed; the raw magicsock direct-path
+matrix again found the same reachable classes as fresh Pion ICE. Retired shared
+mapping-cache reproductions remain causal controls, not the current baseline.
+
+[Tailcat](https://github.com/tailscale/tailcat/blob/b4dc28e8aa8936f0a90a41ad8293a64e3d6b645f/README.md)
+provides a supported Go reuse lead: magicsock plus WireGuard, with DERP bootstrap
+and relay fallback. Its Browser path at that pin is relay-only. In the isolated
+Linux kernel NAT comparison on 2026-10-05, both stacks connected directly through
+ordinary/ordinary and open/hard gateways in either direction. Neither delivered
+fresh direct payloads through ordinary/hard, hard/ordinary, hard/hard or blocked
+UDP pairs within the observation window. Tailcat delivered those cases while
+the fixture relay remained available. This demonstrates relay coverage, not
+an additional P2P reachability class or a field success rate.
+
+Replacing one gateway mapping without notifying endpoints separated recovery
+from initial reachability. Neither established direct path delivered within
+20 seconds with the relay closed. Fresh Pion discovery/exchange recovered in
+about 0.6 seconds after it was started. Tailcat recovered delivery in about
+6.5 seconds through its retained relay; closing it immediately lost delivery
+again. Keeping traffic and discovery alive for 45 seconds allowed subsequent
+direct delivery after relay closure. Both gateway directions were checked.
+These timings have different detection/setup boundaries and are not a Piik
+startup or playback benchmark.
+
+The raw Bind adapter also has a composition cost: it consumes unwrapped STUN
+payloads, and its discovery retry can outlive Pion's initial check budget.
+Dropping the first discovery packet in each direction reproduced that failure;
+increasing only the fixture's ICE budget recovered media. The ordinary Pion
+loss control recovered without that override. Do not adopt packet prefixes,
+diagnostic Ping polling or wider product deadlines as integration shortcuts.
+
+Current recommendation: keep the transport isolated. Go reuse is feasible, but
+new key authorization/revocation, underlay readiness, packet-size limits and
+relay operation have no demonstrated direct-coverage benefit sufficient for
+product integration. A future trial needs matched networks with a repeatable
+benefit, separate direct/relayed/first-media results, and current room/route
+ownership. IPv6, gateway mapping, Piik prediction, physical routers, decoded
+playback and mixed Browser/Native fanout remain outside this comparison.
+
## Native Mapping Cache And Retry Lifetimes
Pion ICE `v4.4.0` caches a shared socket's STUN mapping by destination for 25
diff --git a/docs/standards/configuration.md b/docs/standards/configuration.md
index 12f9529b..040ea29b 100644
--- a/docs/standards/configuration.md
+++ b/docs/standards/configuration.md
@@ -111,6 +111,11 @@ schema field. The user settings are:
| `site` | Saved Piik Site origin. The launcher or `--site` updates it. |
| `localAccessPassword` | Empty by default. Optional password for the App's Local room authority, with the same exact-match behavior as `SITE_ACCESS_PASSWORD`. It is separate from a hosted site's password. |
+Site input in the launcher and `--site` defaults to HTTPS when the scheme is
+omitted; explicit HTTP or HTTPS is preserved. The App saves the normalized origin
+and still rejects credentials, room paths, queries and fragments. It does not
+probe protocols or downgrade a failed HTTPS connection to HTTP.
+
The launcher remembers the last mode confirmed with the launch button. This
optional preference lives beside the configuration as `client.json.mode` (or
`<custom-config-path>.mode`); removing it restores the initial selection without
diff --git a/docs/standards/versioning.md b/docs/standards/versioning.md
index 2d0a747f..d218dd5c 100644
--- a/docs/standards/versioning.md
+++ b/docs/standards/versioning.md
@@ -122,6 +122,29 @@ notice. Unknown SHA is not inferred from a branch name in GitHub metadata.
The publisher records a full SHA in `target_commitish` and verifies actual tag
identity separately. Stable update notices ignore prereleases.
+### Major-Upgrade Guidance
+
+The App update notice keeps a separate link to the selected provider's exact
+release page. A newer major adds a short, visible breaking-change notice; the
+Server logs the same distinction while preserving its checker JSON and exit
+codes. This is release guidance, not a replacement for actual wire checks.
+Updates remain a manual action. Release prose stays on GitHub/Gitee; the App
+does not fetch or render remote Markdown or add a second changelog store.
+Direct download remains the primary action; reading notes is optional. Keep the
+major warning inline, without a confirmation dialog or mandatory website detour.
+
+Older installed Apps cannot acquire new warning UI from release metadata.
+Their historical download behavior is accepted; do not split release feeds or
+force a stepping-stone release solely to make advisory presentation identical.
+Before a major release, put bilingual upgrade guidance near the top of its
+release notes and on the website download entry. Name the actual incompatible
+App/Site combinations, required upgrade order, interruptions and any persistent
+data implications. Do not assume everyone installed the preceding minor/patch.
+Verify the oldest relevant public App/page and the last preceding-major release
+against the candidate: actual mismatches must fail clearly at their owning
+contract. Keep historical packages available through GitHub releases. A major
+preparation change does not itself authorize a wire bump, migration or release.
+
## Automatic Publication
Before a product-changing merge or manual run that can publish, present the
diff --git a/docs/todo.md b/docs/todo.md
index 3911685f..ed06b4af 100644
--- a/docs/todo.md
+++ b/docs/todo.md
@@ -7,11 +7,8 @@ history. A parked idea is not implementation authority.
## Now
-- [ ] **Assess Native Magicsock transport.** Compare the isolated Go transport
- with the repaired Pion baseline under the [NAT evidence boundary](#next-p2p-connection-and-feedback-evidence).
- Establish a measured benefit, supported paths, resource/authority bounds and
- compatibility cost before accepting product integration. Experiments do not
- establish a connectivity gain or authorize publication.
+No active implementation work. Deferred proposals and evidence-dependent reports
+remain below; release delivery is tracked by the pipeline and deployment records.
## Held By Owner
@@ -41,6 +38,11 @@ history. A parked idea is not implementation authority.
These proposals remain deferred beyond the accepted interaction phase.
+- [ ] **Native Magicsock integration.** The [isolated comparison](./research/nat-traversal.md#integration-cost-and-recovery-controls)
+ establishes Go feasibility and relay-assisted recovery, but no additional
+ direct-reachability class in its tested matrix. Keep product transport unchanged.
+ Reopen integration only for a repeatable benefit on matched networks that
+ justifies the extra identity, readiness, packet-size and relay responsibilities.
- [ ] **Managed Demo hosting.** Evaluate cost and public UDP support before any
migration. The assessment remains outside the current product release; keep
the existing P2P-only Demo deployment until a provider and operating boundary
@@ -61,6 +63,10 @@ These proposals remain deferred beyond the accepted interaction phase.
These reports remain unmatched. A local repair or successful test is not proof
of a reporter's cause; research owns the completed experiments and their limits.
+- [ ] **Intermittent native capture self-test failure.** The worker check now
+ records its phase, original exception and per-output progress. A local pass
+ does not explain the earlier CI failure; use the next failed run's diagnostics
+ before changing deadlines or worker behavior.
- [ ] **macOS and Linux physical capture.** Complete the remaining capture/audio
checks in [verification status](./verification-status.md#device-evidence-boundary),
including an Intel Mac with a usable hardware H.264 encoder, an ARM64 Linux
diff --git a/internal/app/config/config.go b/internal/app/config/config.go
index 48aa18a7..62583a33 100644
--- a/internal/app/config/config.go
+++ b/internal/app/config/config.go
@@ -103,6 +103,9 @@ func NormalizeSite(value string) (string, error) {
if value == "" {
return "", nil
}
+ if !strings.Contains(value, "://") {
+ value = "https://" + value
+ }
parsed, err := url.Parse(value)
if err != nil || (parsed.Scheme != "http" && parsed.Scheme != "https") ||
parsed.Host == "" || parsed.User != nil ||
diff --git a/internal/app/config/config_test.go b/internal/app/config/config_test.go
index ffa13195..61190f58 100644
--- a/internal/app/config/config_test.go
+++ b/internal/app/config/config_test.go
@@ -143,6 +143,14 @@ func TestSaveDoesNotModifyPreviousFileInPlace(t *testing.T) {
func TestNormalizeSiteAcceptsOnlyAPlainWebOrigin(t *testing.T) {
for value, want := range map[string]string{
+ "": "",
+ " \t ": "",
+ "share.example": "https://share.example",
+ " Share.Example:443/ ": "https://share.example",
+ "share.example:8443": "https://share.example:8443",
+ "[::1]:8443": "https://[::1]:8443",
+ "bücher.example": "https://xn--bcher-kva.example",
+ " HTTPS://Share.Example/ ": "https://share.example",
"https://share.example": "https://share.example",
"https://Share.Example:443/": "https://share.example",
"http://Share.Example:80": "http://share.example",
@@ -158,6 +166,14 @@ func TestNormalizeSiteAcceptsOnlyAPlainWebOrigin(t *testing.T) {
}
}
for _, value := range []string{
+ "https://https://share.example",
+ "share.example/r/9527",
+ "share.example?mode=host",
+ "share.example#credential",
+ "share.example:65536",
+ "ftp://share.example",
+ "javascript:alert(1)",
"file:///tmp/app",
"https://user:[email protected]",
"https://share.example/room",
diff --git a/internal/app/launcher/server_test.go b/internal/app/launcher/server_test.go
index 819c51d6..5ceeb5c7 100644
--- a/internal/app/launcher/server_test.go
+++ b/internal/app/launcher/server_test.go
@@ -251,12 +251,33 @@ func TestLauncherRequiresTheEmbeddedBrowserBuild(t *testing.T) {
}
}
+func TestLauncherNormalizesSiteSelection(t *testing.T) {
+ for input, want := range map[string]string{
+ " Share.Example:443/ ": "https://share.example",
+ "https://Share.Example/": "https://share.example",
+ "http://192.168.1.4:8787/": "http://192.168.1.4:8787",
+ } {
+ t.Run(input, func(t *testing.T) {
+ payload, err := json.Marshal(Selection{Mode: ModeSite, Language: "en", Site: input})
+ if err != nil {
+ t.Fatal(err)
+ }
+ selection, err := decodeSelection(bytes.NewReader(payload))
+ if err != nil || selection.Site != want {
+ t.Fatalf("site selection = %+v, %v; want %q", selection, err, want)
+ }
+ })
+ }
+}
+
func TestLauncherRejectsInvalidSelections(t *testing.T) {
for name, payload := range map[string]string{
"unknown": `{"mode":"other","language":"en"}`,
"local-site": `{"mode":"local","language":"en","site":"https://share.example"}`,
"missing-site": `{"mode":"site","language":"en"}`,
"site-path": `{"mode":"site","language":"en","site":"https://share.example/path"}`,
+ "bare-site-path": `{"mode":"site","language":"en","site":"share.example/path"}`,
+ "site-credentials": `{"mode":"site","language":"en","site":"user:[email protected]"}`,
"site-password": `{"mode":"site","language":"en","site":"https://share.example","localAccessPassword":"valid-pass"}`,
"unknown-field": `{"mode":"local","language":"en","extra":true}`,
"password-type": `{"mode":"local","language":"en","localAccessPassword":123}`,
diff --git a/native/capture/windows/capture_control.test.cpp b/native/capture/windows/capture_control.test.cpp
index 915d3d3b..b94cb994 100644
--- a/native/capture/windows/capture_control.test.cpp
+++ b/native/capture/windows/capture_control.test.cpp
@@ -8,6 +8,8 @@
#include <array>
#include <cassert>
#include <chrono>
+#include <cstdio>
+#include <exception>
#include <future>
#include <thread>
#include <vector>
@@ -62,6 +64,7 @@ void CheckWorkers() {
std::mutex mutex;
std::condition_variable changed;
std::exception_ptr failure;
+ size_t failed_layer = 0;
std::promise<void> entered, release;
auto entered_future = entered.get_future();
auto released = release.get_future().share();
@@ -99,7 +102,10 @@ void CheckWorkers() {
}
} catch (...) {
std::lock_guard<std::mutex> lock(mutex);
- failure = std::current_exception();
+ if (!failure) {
+ failure = std::current_exception();
+ failed_layer = layer;
+ }
changed.notify_one();
}
});
@@ -108,28 +114,45 @@ void CheckWorkers() {
auto input = std::make_shared<Input>(Input{index});
for (auto& mailbox : mailboxes) mailbox.Submit(input);
};
- auto wait = [&](auto predicate) {
+ auto wait = [&](const char* phase, auto predicate) {
std::unique_lock<std::mutex> lock(mutex);
const bool ready = changed.wait_for(lock, std::chrono::seconds(2), [&]() { return failure || predicate(); });
+ if (!ready || failure) {
+ std::fprintf(stderr, "capture_control: phase=%s result=%s\n", phase,
+ failure ? "worker-exception" : "timeout");
+ if (failure) {
+ try { std::rethrow_exception(failure); }
+ catch (const std::exception& error) {
+ std::fprintf(stderr, " layer=%zu error=%s\n", failed_layer, error.what());
+ } catch (...) {
+ std::fprintf(stderr, " layer=%zu error=non-standard-exception\n", failed_layer);
+ }
+ }
+ for (size_t layer = 0; layer < workers.size(); ++layer) {
+ std::fprintf(stderr, " layer=%zu last=%u count=%u retired=%u\n",
+ layer, last[layer], count[layer], retired[layer]);
+ }
+ std::fflush(stderr);
+ }
assert(ready && !failure);
};
submit(1);
assert(entered_future.wait_for(std::chrono::seconds(2)) == std::future_status::ready);
for (uint32_t index = 2; index <= 4; ++index) submit(index);
- wait([&]() { return last[1] == 4 && last[2] == 4; });
+ wait("independent-outputs", [&]() { return last[1] == 4 && last[2] == 4; });
mailboxes[0].RequestKeyFrame();
release.set_value();
- wait([&]() { return last[0] == 4; });
+ wait("pending-recovery", [&]() { return last[0] == 4; });
assert(count[0] == 2 && recovery[0]); // New request survived the older keyframe; pending 2/3 were replaced.
mailboxes[1].SetActive(false);
mailboxes[2].SetActive(false);
submit(5);
- wait([&]() { return last[0] == 5 && retired[1] == 1 && retired[2] == 1; });
+ wait("output-retirement", [&]() { return last[0] == 5 && retired[1] == 1 && retired[2] == 1; });
assert(last[1] == 4 && last[2] == 4);
mailboxes[0].SetBitrate(30'000);
for (auto& mailbox : mailboxes) { mailbox.SetActive(true); mailbox.RequestKeyFrame(); }
submit(6);
- wait([&]() { return last[0] == 6 && last[1] == 6 && last[2] == 6; });
+ wait("output-reactivation", [&]() { return last[0] == 6 && last[1] == 6 && last[2] == 6; });
assert(recovery[0] && recovery[1] && recovery[2]);
const auto stopped = std::chrono::steady_clock::now();
for (auto& mailbox : mailboxes) mailbox.Stop();
diff --git a/package-lock.json b/package-lock.json
index 702b9d4c..07715038 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1589,9 +1589,9 @@
"license": "ISC"
},
"node_modules/source-map-js": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
- "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
diff --git a/site/assets/brand.css b/site/assets/brand.css
index b0f65c8d..15cc6677 100644
--- a/site/assets/brand.css
+++ b/site/assets/brand.css
@@ -1,5 +1,8 @@
.identity { display:flex; gap:11px; align-items:center; text-decoration:none; font-size:32px; font-weight:800; letter-spacing:-.065em; line-height:1; color:inherit; }
.identity .mascot { width:37px; height:37px; overflow:visible; }
+/* Align the feet with the wordmark baseline, allowing for the SVG's bottom inset. */
+.identity[data-brand],.footer-identity { align-items:baseline; }
+.identity[data-brand] .mascot,.footer-identity > svg { translate:0 .1em; }
.identity-dot { color:#e4572e; }
.identity .mascot-face,.identity .mascot-eye-open,.identity .mascot-sparkles { transform-box:fill-box; transform-origin:center; }
@media (prefers-reduced-motion:no-preference) {
diff --git a/site/docs/package-lock.json b/site/docs/package-lock.json
index 5387e9c4..9f507bb0 100644
--- a/site/docs/package-lock.json
+++ b/site/docs/package-lock.json
@@ -2329,9 +2329,9 @@
}
},
"node_modules/source-map-js": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
- "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
diff --git a/site/styles.css b/site/styles.css
index 25663a12..a895abaf 100644
--- a/site/styles.css
+++ b/site/styles.css
@@ -203,7 +203,7 @@ details p { max-width: 610px; padding: 0 24px 23px 0; color: var(--muted); font-
.docs-links p { margin: 0; font-size: 13px; }
.project-note .docs-note { margin-bottom: 0; font-size: 12px; }
.site-footer { display: flex; align-items: center; flex-wrap: wrap; column-gap: 20px; padding-block: 48px 29px; }
-.footer-identity { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 750; letter-spacing: -.035em; }
+.footer-identity { display: flex; gap: 8px; font-size: 21px; font-weight: 750; letter-spacing: -.035em; }
.footer-identity svg { width: 28px; height: 28px; }
.footer-identity p { color: var(--muted); margin-left: 12px; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 24px; margin-left: auto; font-size: 12px; }
diff --git a/src/client/components/living/AppReleaseNotice.tsx b/src/client/components/living/AppReleaseNotice.tsx
new file mode 100644
index 00000000..5acba430
--- /dev/null
+++ b/src/client/components/living/AppReleaseNotice.tsx
@@ -0,0 +1,37 @@
+import { useId } from "react";
+import type { ReleaseUpdateNotice } from "../../lib/release-update";
+import { useCopy, type CopyKey } from "../../ui/copy";
+import { Glyph } from "../../ui/icons";
+import { Tooltip } from "./Tooltip";
+
+const labels: Record<ReleaseUpdateNotice["kind"], CopyKey> = {
+ "update-available": "client.update.available",
+ "major-update": "client.update.major",
+ "different-build": "client.update.differentBuild",
+ "official-release": "client.update.official",
+};
+
+export function AppReleaseNotice({ update }: { update: ReleaseUpdateNotice }) {
+ const { vis, t } = useCopy();
+ const warningId = useId();
+ const major = update.kind === "major-update";
+ const label = `${t(labels[update.kind])} · ${update.version}`;
+ return <div className="lr-client-release">
+ <div className="lr-client-project-links">
+ <Tooltip kind="update-available" text={major ? t("client.update.majorHint") : vis ? update.version : label}>
+ <a className="lr-btn lr-client-update" href={update.url} target="_blank" rel="noopener noreferrer"
+ aria-label={label} aria-describedby={major ? warningId : undefined}>
+ <Glyph name={major ? "alert" : "arrowUp"} size={17} />
+ <span className={vis ? "visually-hidden" : undefined}>{label}</span>
+ {vis && <span aria-hidden="true">{update.version}</span>}
+ </a>
+ </Tooltip>
+ <a href={update.releaseURL} target="_blank" rel="noopener noreferrer" aria-label={t("client.update.notes")}>
+ {vis ? <Glyph name="window" size={17} /> : t("client.update.notes")}<span aria-hidden="true"> ↗</span>
+ </a>
+ </div>
+ {major && <p id={warningId} className={vis ? "visually-hidden" : "lr-client-release-warning"}>
+ {t("client.update.majorHint")}
+ </p>}
+ </div>;
+}
diff --git a/src/client/components/living/LauncherForm.tsx b/src/client/components/living/LauncherForm.tsx
index 064c2032..3df0388e 100644
--- a/src/client/components/living/LauncherForm.tsx
+++ b/src/client/components/living/LauncherForm.tsx
@@ -166,12 +166,15 @@ export function LauncherForm({
{mode === "site" ? (
<label className="lr-input lr-client-site">
<Glyph name="link" size={18} />
+ {/* The App normalizes bare domains; type="url" would block submission first. */}
<input
- type="url"
+ type="text"
value={site}
+ autoCapitalize="none"
+ autoCorrect="off"
spellCheck={false}
inputMode="url"
- placeholder="https://piik.example.com"
+ placeholder="piik.example.com"
aria-label={t("client.launch.siteAddress")}
onChange={(event) => {
onSiteChange(event.target.value);
@@ -209,11 +212,13 @@ export function LauncherForm({
(mode === "local" && lan !== undefined && !lan.selected)}
/>
<div className="lr-client-about">
- {version && <p className="lr-client-version" aria-label={t("client.launch.version", { version })}>
- {vis ? version : t("client.launch.version", { version })}
+ {version && <p className="lr-client-version">
+ <span className={vis ? "visually-hidden" : undefined}>{t("client.launch.version", { version })}</span>
+ {vis && <span aria-hidden="true">{version}</span>}
</p>}
- <p aria-label={vis ? t("client.launch.credit") : undefined}>
- {vis ? "MIT · TNTcraft" : t("client.launch.credit")}
+ <p>
+ <span className={vis ? "visually-hidden" : undefined}>{t("client.launch.credit")}</span>
+ {vis && <span aria-hidden="true">MIT · TNTcraft</span>}
</p>
<div className="lr-client-project-links">
<a href="https://piik.tv/" target="_blank" rel="noopener noreferrer" aria-label={t("client.launch.website")}>
diff --git a/src/client/lib/release-update.ts b/src/client/lib/release-update.ts
index 0fe11831..39be72c5 100644
--- a/src/client/lib/release-update.ts
+++ b/src/client/lib/release-update.ts
@@ -1,4 +1,4 @@
-import { compare, valid } from "semver";
+import { compare, major, valid } from "semver";
export const DEFAULT_RELEASE_API_URL =
"https://api.github.com/repos/TNTcraftHIM/Piik/releases/latest";
@@ -14,10 +14,11 @@ interface PublishedRelease {
version: string;
revision: string | null;
url: string;
+ releaseURL: string;
publishedAt?: string;
}
export interface ReleaseUpdateNotice extends PublishedRelease {
- kind: "update-available" | "different-build" | "official-release";
+ kind: "update-available" | "major-update" | "different-build" | "official-release";
}
export function normalizeReleaseRevision(value: unknown): string | null {
@@ -61,6 +62,7 @@ export function parseReleaseMetadata(value: unknown, packageTarget?: string): Pu
// GitHub permits a branch here; only our publisher's full SHA is provenance.
revision: normalizeReleaseRevision(release.target_commitish),
url: RELEASE_PAGE + version,
+ releaseURL: RELEASE_PAGE + version,
...(Number.isFinite(publishedTime) ? { publishedAt: new Date(publishedTime).toISOString() } : {}),
};
return { ...normalized, url: packageDownloadURL(normalized, release.assets, packageTarget) };
@@ -78,7 +80,8 @@ export function parseMirrorReleaseMetadata(value: unknown, packageTarget?: strin
target_commitish: sources[0][1],
});
if (!normalized) return null;
- const mirror = { ...normalized, url: MIRROR_RELEASE_PAGE + normalized.version };
+ const mirror = { ...normalized, url: MIRROR_RELEASE_PAGE + normalized.version,
+ releaseURL: MIRROR_RELEASE_PAGE + normalized.version };
return { ...mirror, url: packageDownloadURL(mirror, release.assets, packageTarget) };
}
@@ -90,7 +93,8 @@ export function releaseUpdateNotice(
const revision = normalizeReleaseRevision(current.revision);
if (version) {
const order = compare(latest.version, version);
- if (order > 0) return { ...latest, kind: "update-available" };
+ if (order > 0) return { ...latest,
+ kind: major(latest.version) > major(version) ? "major-update" : "update-available" };
if (order === 0 && revision && latest.revision && revision !== latest.revision) {
return { ...latest, kind: "different-build" };
}
diff --git a/src/client/locales/en.ts b/src/client/locales/en.ts
index 1e31df0f..47d33467 100644
--- a/src/client/locales/en.ts
+++ b/src/client/locales/en.ts
@@ -79,6 +79,9 @@ export const en: Record<CopyKey, string> = {
"client.launch.debugHint": "Record App and browser diagnostics for this launch. Press D in the terminal to export App logs.",
"client.launch.loadFailed": "Could not read launcher settings; reload to retry",
"client.update.available": "A newer Piik release is available",
+ "client.update.major": "New major Piik release",
+ "client.update.majorHint": "This update includes breaking changes. Read the release notes before upgrading.",
+ "client.update.notes": "Release notes",
"client.update.differentBuild": "This build differs from the official release",
"client.update.official": "An official Piik release is available",
diff --git a/src/client/locales/zh.ts b/src/client/locales/zh.ts
index 766795a0..2032e86f 100644
--- a/src/client/locales/zh.ts
+++ b/src/client/locales/zh.ts
@@ -79,6 +79,9 @@ export const zh = {
"client.launch.debugHint": "本次启动记录 App 和网页诊断。App 日志可在终端按 D 导出。",
"client.launch.loadFailed": "无法读取启动设置,请刷新页面重试",
"client.update.available": "发现新的 Piik 版本",
+ "client.update.major": "发现新的 Piik 大版本",
+ "client.update.majorHint": "此更新含不兼容改动。升级前请查看版本说明。",
+ "client.update.notes": "版本说明",
"client.update.differentBuild": "当前构建与官方发行版不同",
"client.update.official": "可获取 Piik 正式发行版",
diff --git a/src/client/pages/AppLauncherPage.tsx b/src/client/pages/AppLauncherPage.tsx
index f3e3f128..e47ebb4a 100644
--- a/src/client/pages/AppLauncherPage.tsx
+++ b/src/client/pages/AppLauncherPage.tsx
@@ -3,12 +3,11 @@ import { z } from "zod";
import { BrandMark } from "../components/living/BrandMark";
import { LoadingStatus } from "../components/living/WaitingStatus";
-import { Tooltip } from "../components/living/Tooltip";
+import { AppReleaseNotice } from "../components/living/AppReleaseNotice";
import { AppHeader } from "../components/living/Header";
import { LauncherForm, type AppMode } from "../components/living/LauncherForm";
import { Btn, Pill } from "../components/living/primitives";
-import { Glyph } from "../ui/icons";
-import { hasCopyPreference, useCopy, type CopyKey } from "../ui/copy";
+import { hasCopyPreference, useCopy } from "../ui/copy";
import { consoleLanguage } from "../locales";
import { currentThemePreference } from "../ui/theme";
import { clientLaunchURL, type ClientLaunchPresentation } from "../lib/session";
@@ -124,27 +123,6 @@ export function AppLauncherPage() {
}
}
- const updateKey: CopyKey =
- update?.kind === "different-build"
- ? "client.update.differentBuild"
- : update?.kind === "official-release"
- ? "client.update.official"
- : "client.update.available";
- const updateText = update ? `${t(updateKey)} · ${update.version}` : "";
- const updateLink = update ? (
- <a
- className="lr-btn lr-client-update"
- href={update.url}
- target="_blank"
- rel="noopener noreferrer"
- aria-label={updateText}
- >
- <Glyph name="arrowUp" size={17} />
- <span className={vis ? "visually-hidden" : undefined}>{updateText}</span>
- {vis && <span aria-hidden="true">{update.version}</span>}
- </a>
- ) : null;
-
return (
<div className="lr-app">
<AppHeader homeHref="/client" diagnosticControl={appDebug === undefined ? null : (
@@ -189,7 +167,7 @@ export function AppLauncherPage() {
lan={lan && { ...lan, onChange: (selected) => setLan({ ...lan, selected }) }}
onSubmit={launch}
>
- {update && updateLink && <Tooltip kind="update-available" text={vis ? update.version : updateText}>{updateLink}</Tooltip>}
+ {update && <AppReleaseNotice update={update} />}
</LauncherForm>
)}
</main>
diff --git a/src/client/pages/ControlsPreview.tsx b/src/client/pages/ControlsPreview.tsx
index 8ca03b7e..a2c66c5b 100644
--- a/src/client/pages/ControlsPreview.tsx
+++ b/src/client/pages/ControlsPreview.tsx
@@ -16,6 +16,7 @@ import { REACTION_IDS, type ReactionId } from "../../shared/room-interactions";
import { PlaybackControls } from "../components/living/PlaybackControls";
import { SharingSettings } from "../components/living/SharingSettings";
import { LauncherForm, type AppMode } from "../components/living/LauncherForm";
+import { AppReleaseNotice } from "../components/living/AppReleaseNotice";
import { useTheaterMode } from "../components/living/use-theater-mode";
import { QualityPresets } from "../components/living/QualityPresets";
@@ -57,6 +58,9 @@ export function ControlsPreview() {
const [microphoneDevice, setMicrophoneDevice] = useState("");
const [sharingSettings, setSharingSettings] = useState(false);
const [launchMode, setLaunchMode] = useState<AppMode>("link");
+ const [majorUpdate, setMajorUpdate] = useState(true);
+ const releaseVersion = majorUpdate ? "v2.0.0" : "v1.1.0";
+ const releaseURL = `https://github.com/TNTcraftHIM/Piik/releases/tag/${releaseVersion}`;
const [launchSite, setLaunchSite] = useState("");
const [launchPassword, setLaunchPassword] = useState("");
const [launchLan, setLaunchLan] = useState("192.0.2.10");
@@ -233,15 +237,25 @@ export function ControlsPreview() {
</section>
<section id="launcher-preview" className="cp-section">
<header className="cp-section-head"><span className="cp-number">08</span><h2>{t("client.launch.title")}</h2></header>
+ <div className="cp-tools">
+ <button className="lr-btn" type="button" aria-pressed={majorUpdate} onClick={() => setMajorUpdate(value => !value)}>
+ {en ? "Preview major update" : "预览跨大版本更新"}
+ </button>
+ </div>
<div className="lr-client-launch">
- <LauncherForm version="development" mode={launchMode} onModeChange={setLaunchMode}
+ <LauncherForm version="v1.0.0" mode={launchMode} onModeChange={setLaunchMode}
site={launchSite} onSiteChange={setLaunchSite}
lan={{ selected: launchLan, onChange: setLaunchLan, addresses: [
{ address: "192.0.2.10", name: "Wi-Fi" },
{ address: "192.0.2.20", name: "vEthernet (Example Virtual Network Adapter with a Long Name)" },
] }}
localAccessPassword={launchPassword} onLocalAccessPasswordChange={setLaunchPassword}
- onSubmit={event => event.preventDefault()} />
+ onSubmit={event => event.preventDefault()}>
+ <AppReleaseNotice update={{ kind: majorUpdate ? "major-update" : "update-available",
+ version: releaseVersion, revision: null,
+ url: `https://github.com/TNTcraftHIM/Piik/releases/download/${releaseVersion}/piik-app-windows-amd64.zip`,
+ releaseURL }} />
+ </LauncherForm>
</div>
</section>
<section id="interaction-preview" className="cp-section">
diff --git a/src/client/styles.css b/src/client/styles.css
index 0de3389d..d167f569 100644
--- a/src/client/styles.css
+++ b/src/client/styles.css
@@ -1506,6 +1506,9 @@ html[data-theme="dark"] .lr-door-glyph { color: #7d92a8; }
.lr-client-project-links a:is(:hover, :focus-visible) { color: var(--ink); }
.lr-client-launch-status { color: var(--ink); font-size: 14px; font-weight: 650; }
.lr-client-launch-detail { max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; font: 13px/1.6 var(--mono); }
+.lr-client-release { display: grid; justify-items: center; gap: 6px; max-width: 100%; }
+.lr-client-release .lr-client-project-links { flex-direction: column; align-items: center; gap: 4px; font-size: 12.5px; }
+.lr-client-release-warning { max-width: 42ch; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }
.lr-client-update {
gap: 7px;
min-width: 0;
diff --git a/tests/release-update.test.ts b/tests/release-update.test.ts
index cb21be86..af8d1db4 100644
--- a/tests/release-update.test.ts
+++ b/tests/release-update.test.ts
@@ -34,6 +34,7 @@ describe("App release update notice", () => {
const fetchImpl = vi.fn<typeof fetch>(async () => Response.json({ ...release, assets }));
await expect(checkReleaseUpdate({ version: "v1.1.0", revision: currentRevision }, { fetchImpl, packageTarget }))
.resolves.toMatchObject({ kind: "update-available", version: release.tag_name,
+ releaseURL: release.html_url,
url: assets.find(asset => asset.name === `piik-app-${packageTarget}.zip`)!.browser_download_url });
expect(fetchImpl).toHaveBeenCalledTimes(1);
expect(String(fetchImpl.mock.calls[0][0])).toBe(DEFAULT_RELEASE_API_URL);
@@ -73,7 +74,8 @@ describe("App release update notice", () => {
const fetchImpl = vi.fn<typeof fetch>(async (input) => String(input) === DEFAULT_RELEASE_API_URL
? new Response(null, { status: 503 }) : Response.json([mirrored]));
await expect(checkReleaseUpdate({ version: "v1.1.0", revision: currentRevision },
- { fetchImpl, packageTarget })).resolves.toMatchObject({ url: mirrorAsset.browser_download_url });
+ { fetchImpl, packageTarget })).resolves.toMatchObject({ url: mirrorAsset.browser_download_url,
+ releaseURL: `https://gitee.com/TNTcraftHIM/Piik/releases/tag/${release.tag_name}` });
expect(fetchImpl).toHaveBeenCalledTimes(2);
for (const assets of [[], [mirrorAsset, mirrorAsset],
[{ ...mirrorAsset, browser_download_url: mirrorAsset.browser_download_url.replace("gitee.com", "evil.example") }],
@@ -92,7 +94,7 @@ describe("App release update notice", () => {
});
await expect(checkReleaseUpdate({ version: "v1.1.0", revision: currentRevision }, { fetchImpl }))
.resolves.toEqual({ version: "v1.2.0", revision: latestRevision,
- url: release.html_url, kind: "update-available" });
+ url: release.html_url, releaseURL: release.html_url, kind: "update-available" });
expect(fetchImpl).toHaveBeenCalledTimes(1);
});
@@ -109,10 +111,23 @@ describe("App release update notice", () => {
["development", currentRevision, null, null],
])("compares %s by release precedence, using SHA only to identify builds", (version, revision, remoteRevision, expected) => {
expect(releaseUpdateNotice({ version, revision }, {
- version: "v1.2.0", revision: remoteRevision, url: release.html_url,
+ version: "v1.2.0", revision: remoteRevision, url: release.html_url, releaseURL: release.html_url,
})?.kind ?? null).toBe(expected);
});
+ it.each([
+ ["v1.9.1", "major-update"],
+ ["v0.9.0", "major-update"],
+ ["v2.0.0-rc.1", "update-available"],
+ ["v2.0.0", "different-build"],
+ ["v3.0.0", null],
+ ["development", "official-release"],
+ ])("warns for a newer major without inferring compatibility from an unknown build: %s", (version, kind) => {
+ const latest = parseReleaseMetadata({ ...release, tag_name: "v2.0.0",
+ html_url: "https://github.com/TNTcraftHIM/Piik/releases/tag/v2.0.0" })!;
+ expect(releaseUpdateNotice({ version, revision: currentRevision }, latest)?.kind ?? null).toBe(kind);
+ });
+
it("does not turn branch names, prereleases or malformed metadata into release identity", async () => {
expect(parseReleaseMetadata({ ...release, target_commitish: "main" })?.revision).toBeNull();
for (const changed of [
@@ -142,6 +157,7 @@ describe("App release update notice", () => {
await expect(checkReleaseUpdate(current, { fetchImpl })).resolves.toEqual({
kind: "update-available", version: "v1.10.0", revision: latestRevision,
url: "https://gitee.com/TNTcraftHIM/Piik/releases/tag/v1.10.0",
+ releaseURL: "https://gitee.com/TNTcraftHIM/Piik/releases/tag/v1.10.0",
});
await expect(checkReleaseUpdate({ ...current, version: "v2.0.0" }, { fetchImpl })).resolves.toBeNull();
});