Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

fix(update): 增加公开清单与备用检查并细化失败原因

quanru6a3ba65e286f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 913a462..f2d6628 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@
- macOS: expose English, Simplified Chinese and system language selection in General settings with immediate switching and persistent preferences.
+## 1.5.2
+
+- Check a public update manifest first, fall back to the GitHub API, allow longer requests, reject invalid caches and show specific Mac connection, HTTP, timeout and rate-limit errors. Ignore stale responses after cancellation.
+
## 1.5.1
- Simplify the Mac update page to one state-dependent action, show release notes as a text link, and prevent repeated checks while a request is active.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7cd0832..8426c41 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -79,9 +79,9 @@ For marketplace preparation, use `make marketplace-check` with Gitleaks on PATH
and follow [the publishing checklist](packaging/MARKETPLACE.md). Reports and local
review drafts belong in ignored `artifacts/` and `docs/`, not in release payloads.
-The current public version is `1.5.1`. Keep `pyproject.toml`, `manifest.json` and
+The current public version is `1.5.2`. Keep `pyproject.toml`, `manifest.json` and
`src/doubao_input/product.py` aligned; `python packaging/version_check.py` verifies
-them. A pushed tag such as `v1.5.1` runs all checks and secret scanning, builds app
+them. A pushed tag such as `v1.5.2` runs all checks and secret scanning, builds app
and plugin archives for every supported Python version, creates `SHA256SUMS`, and
publishes the GitHub Release. `workflow_dispatch` performs a non-publishing build.
# Bounded desktop tests
diff --git a/README.md b/README.md
index 46ea33e..c88dabc 100644
--- a/README.md
+++ b/README.md
@@ -497,7 +497,7 @@ validate package metadata and scan for secrets. The current whole-package branch
coverage floor is 55%; desktop UI, WebKit and real-device paths remain included
in the denominator.
-The current release version is **1.5.1**. A `v1.5.1` tag must match every embedded
+The current release version is **1.5.2**. A `v1.5.2` tag must match every embedded
version before CI can publish. Tag releases rebuild both offline app and Omarchy
plugin archives for Python 3.11–3.14 and attach SHA-256 checksums. A manually started
release workflow builds artifacts for inspection but does not publish them. Real
diff --git a/README.zh-CN.md b/README.zh-CN.md
index e8021ee..a6814a0 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -365,7 +365,7 @@ timeout --kill-after=5s 50s env PYTHONPATH=src python3 tests/manual/x11.py --run
GTK 测试、代码检查、编译、包元数据校验和密钥扫描。覆盖率按整个源码包的分支覆盖率
计算,当前真实门槛为 55%;GTK 界面、WebKit 和实体设备路径没有从分母中排除。
-当前发布版本为 **1.5.1**。只有 `v1.5.1` 标签与所有内置版本完全一致时,CI 才能发布。
+当前发布版本为 **1.5.2**。只有 `v1.5.2` 标签与所有内置版本完全一致时,CI 才能发布。
标签发布会为 Python 3.11–3.14 分别构建独立应用与 Omarchy 插件离线包,并附带 SHA-256
校验文件。手动启动发布工作流只构建供检查的产物,不会公开发布。真实登录、麦克风、
全局按键及桌面行为仍需按人工验收清单检查。
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 2d1e6a7..83a1955 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,28 +1,33 @@
-# Doubao Say 1.5.1
+# Doubao Say 1.5.2
-## Simpler macOS updates
+## Reliable update checks
-The Mac update page now shows one action for the current state:
+Mac and Linux check a public update manifest before falling back to the GitHub
+API. The manifest contains only the stable version and official package URLs;
+no API key, sign-in, settings or personal text is required. Publication checks
+require the Linux archives, both Mac DMGs and all corresponding checksum entries.
-- **Check for updates** when no compatible update is available.
-- **Update and restart** when a compatible newer version is available.
-- **Cancel download** during update download and preparation.
+Mac checks allow 20 seconds per source instead of eight seconds for a single API
+request. Timeout, offline, HTTP, request-limit and invalid-response failures now
+have distinct messages. Invalid caches trigger a fresh request. Cancellation
+suppresses stale results and permits a new check. Checking the current version
+shows that it is up to date. The simple single-action update page is retained.
-While checking, the action shows **Checking…**, is disabled, and includes a
-progress indicator. Release notes use a text link. Version information and
-update status remain visible. Both English and Simplified Chinese are supported.
+This release addresses failure handling and source availability; it does not
+claim to identify every reported network failure on another computer. If an old
+client cannot check for updates, install this version once using its DMG.
## Download and verification
-Existing 1.4.0 previews and 1.5.0 installations can use Settings → Updates to
-upgrade. Choose the signed, notarized arm64 or x86_64 DMG for manual Mac
-installation. Linux app/plugin archives remain available for Python 3.11–3.14;
-Linux already uses a single update action. Settings and login data are retained.
+Choose the Developer ID signed, Apple-notarized arm64 or x86_64 Mac DMG. Linux
+app/plugin archives remain available for Python 3.11–3.14. Settings and login data
+are retained. SHA256SUMS covers both platforms. update.json provides the public
+metadata used by this version's first update source.
-Native before/after interface checks cover both languages and the current,
-available, checking, downloading and unsupported-package states. Swift behavior,
-loopback protocol/polishing, Linux unit/contract/coverage and release archive
-installation checks also cover this release. Cross-built Intel packages are not
-Intel hardware acceptance; live microphone and physical hotkeys remain separate.
+Tests cover timeout fallback, current-version checks, invalid cache recovery,
+HTTP and rate-limit messages, cancellation and metadata privacy. Swift,
+loopback recognition/polishing, Linux unit/contract/coverage and archive
+installation checks also run. Cross-built Intel artifacts do not establish
+execution on Intel hardware; microphone and physical hotkey checks are separate.
-[Full changes](https://github.com/quanru/doubao-say/compare/v1.5.0...v1.5.1)
+[Full changes](https://github.com/quanru/doubao-say/compare/v1.5.1...v1.5.2)
diff --git a/SECURITY.md b/SECURITY.md
index b94d02e..f58560b 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -19,9 +19,10 @@ submitted after a pause while recording is still active. The endpoint operator's
retention, training and privacy terms apply. Doubao Say does not log the text or
include the polishing API key in diagnostics.
-The application checks the fixed public GitHub Releases endpoint at most once
+The application checks the fixed public GitHub release manifest, with the Releases
+API as a fallback, at most once
every 24 hours. GitHub receives normal HTTPS connection metadata. The local
-owner-only cache contains only the check time and public release tag. The check
+owner-only cache contains only the check time and public release metadata. The check
does not send settings, account data, transcripts or a device identifier, and it
does not download or install an update.
diff --git a/macos/Package.swift b/macos/Package.swift
index f22a643..01f37d0 100644
--- a/macos/Package.swift
+++ b/macos/Package.swift
@@ -1,6 +1,6 @@
// swift-tools-version: 5.9
import PackageDescription
let package = Package(name: "DoubaoSayCore", platforms: [.macOS(.v13)], targets: [
- .target(name: "DoubaoSayCore", path: "Sources", exclude: ["APIASRClient.swift", "ASRParamsStore.swift", "AppState.swift", "AudioCaptureManager.swift", "AudioDevices.swift", "DoubaoASRClient.swift", "DoubaoSayApp.swift", "HotkeyManager.swift", "OverlayPanel.swift", "OverlayView.swift", "ListeningWaveform.swift", "PasteHelper.swift", "SecretStore.swift", "SettingsWindow.swift", "StartupService.swift", "TranscriptionManager.swift", "UpdateChecker.swift", "UpdateInstaller.swift", "VibekeyReceiver.swift", "WebViewManager.swift", "WindowCapture.swift", "PersonalViews.swift"], sources: ["VoiceMotion.swift", "HotkeyGesture.swift", "ASRResponse.swift", "FinalResultGate.swift", "ShortcutGesture.swift", "MacSettings.swift", "Strings.swift", "PolishDefaults.swift", "PolishClient.swift", "PolishCoordinator.swift", "SeedProtocol.swift", "VibekeyProtocol.swift", "UpdateRelease.swift", "PersonalData.swift"]),
+ .target(name: "DoubaoSayCore", path: "Sources", exclude: ["APIASRClient.swift", "ASRParamsStore.swift", "AppState.swift", "AudioCaptureManager.swift", "AudioDevices.swift", "DoubaoASRClient.swift", "DoubaoSayApp.swift", "HotkeyManager.swift", "OverlayPanel.swift", "OverlayView.swift", "ListeningWaveform.swift", "PasteHelper.swift", "SecretStore.swift", "SettingsWindow.swift", "StartupService.swift", "TranscriptionManager.swift", "UpdateInstaller.swift", "VibekeyReceiver.swift", "WebViewManager.swift", "WindowCapture.swift", "PersonalViews.swift"], sources: ["VoiceMotion.swift", "HotkeyGesture.swift", "ASRResponse.swift", "FinalResultGate.swift", "ShortcutGesture.swift", "MacSettings.swift", "Strings.swift", "PolishDefaults.swift", "PolishClient.swift", "PolishCoordinator.swift", "SeedProtocol.swift", "VibekeyProtocol.swift", "UpdateRelease.swift", "UpdateChecker.swift", "PersonalData.swift"]),
.testTarget(name: "DoubaoSayCoreTests", dependencies: ["DoubaoSayCore"], path: "Tests", exclude: ["Transport", "Live", "Network", "Settings"])
])
diff --git a/macos/Sources/UpdateChecker.swift b/macos/Sources/UpdateChecker.swift
index 6e5bd94..c5c0c18 100644
--- a/macos/Sources/UpdateChecker.swift
+++ b/macos/Sources/UpdateChecker.swift
@@ -2,48 +2,101 @@ import Foundation
@MainActor
final class UpdateChecker {
+ nonisolated static let sources = [
+ URL(string: "https://github.com/quanru/doubao-say/releases/latest/download/update.json")!,
+ URL(string: "https://api.github.com/repos/quanru/doubao-say/releases/latest")!
+ ]
private var task: URLSessionDataTask?
+ private var generation = 0
+ private let defaults: UserDefaults
+ private let current: String
+ private let session: URLSession
+ private let sources: [URL]
+ private let timeout: TimeInterval
+ private let architecture: String
var onResult: ((UpdateRelease?) -> Void)?
var onStatus: ((String) -> Void)?
var onChecking: ((Bool) -> Void)?
- #if arch(arm64)
- private let architecture = "arm64"
- #else
- private let architecture = "x86_64"
- #endif
+
+ init(defaults: UserDefaults = .standard, current: String? = nil, session: URLSession = .shared,
+ sources: [URL] = UpdateChecker.sources, timeout: TimeInterval = 20) {
+ self.defaults = defaults
+ self.current = current ?? Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.4.0"
+ self.session = session; self.sources = sources; self.timeout = timeout
+ #if arch(arm64)
+ architecture = "arm64"
+ #else
+ architecture = "x86_64"
+ #endif
+ }
func check(force: Bool = false) {
guard task == nil else { return }
- let defaults = UserDefaults.standard
- let current = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.4.0"
if !force && defaults.string(forKey: "updateCurrent") == current,
let checked = defaults.object(forKey: "updateChecked") as? Date,
(0..<86400).contains(Date().timeIntervalSince(checked)),
- let data = defaults.data(forKey: "updateReleaseData") {
- deliver(data, current: current); return
+ let data = defaults.data(forKey: "updateReleaseData"), Self.valid(data) {
+ deliver(data); return
}
- onStatus?(L("Checking for updates…", "正在检查更新…"))
- onChecking?(true)
- var request = URLRequest(url: URL(string: "https://api.github.com/repos/quanru/doubao-say/releases/latest")!, timeoutInterval: 8)
- request.setValue("application/vnd.github+json", forHTTPHeaderField: "Accept")
+ generation += 1
+ onStatus?(L("Checking for updates…", "正在检查更新…")); onChecking?(true)
+ fetch(0, generation: generation)
+ }
+ private static func valid(_ data: Data) -> Bool {
+ guard data.count <= 1_000_000,
+ let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
+ json["draft"] as? Bool != true, json["prerelease"] as? Bool != true,
+ let tag = json["tag_name"] as? String, UpdateRelease.version(tag) != nil,
+ json["assets"] is [[String: Any]] else { return false }
+ return true
+ }
+ private func fetch(_ index: Int, generation token: Int) {
+ guard index < sources.count else { finish(L("No update source is configured.", "未配置更新源。")); return }
+ var request = URLRequest(url: sources[index], cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: timeout)
+ request.setValue("application/json", forHTTPHeaderField: "Accept")
request.setValue("Doubao-Say/" + current, forHTTPHeaderField: "User-Agent")
- task = URLSession.shared.dataTask(with: request) { [weak self] data, response, _ in Task { @MainActor in
- guard let self = self else { return }; self.task = nil
- self.onChecking?(false)
- guard let http = response as? HTTPURLResponse, http.statusCode == 200, let data = data, data.count <= 1_000_000,
- let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
- let tag = json["tag_name"] as? String, UpdateRelease.version(tag) != nil else {
- self.onStatus?(L("Could not check for updates. Try again later.", "更新检查失败,请稍后重试。")); return
+ task = session.dataTask(with: request) { [weak self] data, response, error in Task { @MainActor in
+ guard let self = self, self.generation == token else { return }
+ let http = response as? HTTPURLResponse
+ if error == nil, http?.statusCode == 200, let data = data, Self.valid(data) {
+ self.defaults.set(Date(), forKey: "updateChecked")
+ self.defaults.set(self.current, forKey: "updateCurrent")
+ self.defaults.set(data, forKey: "updateReleaseData")
+ self.task = nil; self.onChecking?(false); self.deliver(data)
+ return
+ }
+ if index + 1 < self.sources.count {
+ self.fetch(index + 1, generation: token); return
}
- let defaults = UserDefaults.standard
- defaults.set(Date(), forKey: "updateChecked"); defaults.set(current, forKey: "updateCurrent"); defaults.set(data, forKey: "updateReleaseData")
- self.deliver(data, current: current)
+ self.finish(Self.failure(error: error, response: http))
} }
task?.resume()
}
- private func deliver(_ data: Data, current: String) {
+ private func finish(_ message: String) {
+ task = nil; onChecking?(false); onStatus?(message)
+ }
+ static func failure(error: Error?, response: HTTPURLResponse?) -> String {
+ if let error = error as NSError? {
+ if error.domain == NSURLErrorDomain && error.code == NSURLErrorTimedOut {
+ return L("Update check timed out. Please retry.", "检查更新超时,请重试。")
+ }
+ if error.domain == NSURLErrorDomain && error.code == NSURLErrorNotConnectedToInternet {
+ return L("Cannot reach the update source. Check your connection and retry.", "无法连接更新源,请检查网络后重试。")
+ }
+ // Only domain/code are shown; URLs, headers and account data stay private.
+ return L("Update connection failed", "更新连接失败") + " (\(error.domain)/\(error.code))"
+ }
+ if let response = response, response.statusCode != 200 {
+ if response.statusCode == 429 || (response.statusCode == 403 && response.value(forHTTPHeaderField: "X-RateLimit-Remaining") == "0") {
+ return L("GitHub's request limit was reached. Please retry later.", "GitHub 请求次数已达上限,请稍后重试。")
+ }
+ return L("Update source returned an error", "更新源返回错误") + " (HTTP \(response.statusCode))"
+ }
+ return L("The update source returned invalid version data. Please retry later.", "更新源返回的版本信息无效,请稍后重试。")
+ }
+ private func deliver(_ data: Data) {
let info = UpdateRelease.parse(data, current: current, architecture: architecture)
onResult?(info)
onStatus?(info == nil ? L("You are using the latest version.", "当前已是最新版本。") : L("An update is available.", "发现新版本。"))
}
- func cancel() { task?.cancel(); task = nil; onChecking?(false) }
+ func cancel() { generation += 1; task?.cancel(); task = nil; onChecking?(false) }
}
diff --git a/macos/Tests/UpdateCheckerTests.swift b/macos/Tests/UpdateCheckerTests.swift
new file mode 100644
index 0000000..e5b53f0
--- /dev/null
+++ b/macos/Tests/UpdateCheckerTests.swift
@@ -0,0 +1,96 @@
+import XCTest
+import Foundation
+@testable import DoubaoSayCore
+
+private final class UpdateProtocol: URLProtocol {
+ static var handler: ((URLRequest) throws -> (Int, [String: String], Data))!
+ override class func canInit(with request: URLRequest) -> Bool { true }
+ override class func canonicalRequest(for request: URLRequest) -> URLRequest { request }
+ override func startLoading() {
+ do {
+ let (status, headers, data) = try Self.handler(request)
+ let response = HTTPURLResponse(url: request.url!, statusCode: status, httpVersion: "HTTP/1.1", headerFields: headers)!
+ client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .notAllowed)
+ client?.urlProtocol(self, didLoad: data)
+ client?.urlProtocolDidFinishLoading(self)
+ } catch { client?.urlProtocol(self, didFailWithError: error) }
+ }
+ override func stopLoading() {}
+}
+
+final class UpdateCheckerTests: XCTestCase {
+ private let payload = Data(#"{"tag_name":"v1.5.2","draft":false,"prerelease":false,"assets":[]}"#.utf8)
+ @MainActor private func checker(_ defaults: UserDefaults, current: String = "1.5.1") -> UpdateChecker {
+ let config = URLSessionConfiguration.ephemeral; config.protocolClasses = [UpdateProtocol.self]
+ return UpdateChecker(defaults: defaults, current: current, session: URLSession(configuration: config),
+ sources: [URL(string: "https://fixture.test/manifest")!, URL(string: "https://fixture.test/api")!])
+ }
+ @MainActor func testPublicManifestAvoidsAPIAndCurrentVersionIsNotAnError() async {
+ let suite = "update-check-tests." + UUID().uuidString
+ let defaults = UserDefaults(suiteName: suite)!; defer { defaults.removePersistentDomain(forName: suite) }
+ var requests: [URLRequest] = [], activity: [Bool] = []
+ UpdateProtocol.handler = { request in requests.append(request); return (200, [:], self.payload) }
+ let check = checker(defaults, current: "1.5.2"), done = expectation(description: "current")
+ check.onChecking = { activity.append($0) }
+ check.onStatus = { if $0 == L("You are using the latest version.", "当前已是最新版本。") { done.fulfill() } }
+ check.check(force: true)
+ await fulfillment(of: [done], timeout: 2)
+ XCTAssertEqual(requests.count, 1); XCTAssertEqual(requests[0].url?.path, "/manifest")
+ XCTAssertNil(requests[0].value(forHTTPHeaderField: "Authorization"))
+ XCTAssertEqual(activity, [true, false])
+ XCTAssertEqual(defaults.string(forKey: "updateCurrent"), "1.5.2")
+ }
+ @MainActor func testTimeoutFallsBackAndStillFindsUpdate() async {
+ let suite = "update-check-tests." + UUID().uuidString
+ let defaults = UserDefaults(suiteName: suite)!; defer { defaults.removePersistentDomain(forName: suite) }
+ var paths: [String] = [], activity: [Bool] = []
+ UpdateProtocol.handler = { request in
+ paths.append(request.url!.path)
+ if request.url!.path == "/manifest" { throw URLError(.timedOut) }
+ return (200, [:], self.payload)
+ }
+ let check = checker(defaults), done = expectation(description: "update")
+ check.onChecking = { activity.append($0) }
+ check.onResult = { XCTAssertEqual($0?.version, "1.5.2"); done.fulfill() }
+ check.check(force: true); check.check(force: true)
+ await fulfillment(of: [done], timeout: 2)
+ XCTAssertEqual(paths, ["/manifest", "/api"]); XCTAssertEqual(activity, [true, false])
+ }
+ @MainActor func testInvalidCacheIsRefetchedAndHTTPErrorDoesNotEraseKnownRelease() async {
+ let suite = "update-check-tests." + UUID().uuidString
+ let defaults = UserDefaults(suiteName: suite)!; defer { defaults.removePersistentDomain(forName: suite) }
+ defaults.set("1.5.1", forKey: "updateCurrent"); defaults.set(Date(), forKey: "updateChecked")
+ defaults.set(Data("broken".utf8), forKey: "updateReleaseData")
+ var requests = 0
+ UpdateProtocol.handler = { _ in requests += 1; return (503, [:], Data()) }
+ let check = checker(defaults), done = expectation(description: "http error")
+ var resultCalls = 0
+ check.onResult = { _ in resultCalls += 1 }
+ check.onStatus = { if $0.contains("HTTP 503") { done.fulfill() } }
+ check.check()
+ await fulfillment(of: [done], timeout: 2)
+ XCTAssertEqual(requests, 2); XCTAssertEqual(resultCalls, 0)
+ XCTAssertEqual(defaults.data(forKey: "updateReleaseData"), Data("broken".utf8))
+ }
+ @MainActor func testRateLimitAndTimeoutHaveSpecificPrivateSafeMessages() {
+ let response = HTTPURLResponse(url: URL(string: "https://fixture.test/api")!, statusCode: 403,
+ httpVersion: "HTTP/1.1", headerFields: ["X-RateLimit-Remaining": "0"])!
+ XCTAssertEqual(UpdateChecker.failure(error: nil, response: response),
+ L("GitHub's request limit was reached. Please retry later.", "GitHub 请求次数已达上限,请稍后重试。"))
+ XCTAssertEqual(UpdateChecker.failure(error: URLError(.timedOut), response: nil),
+ L("Update check timed out. Please retry.", "检查更新超时,请重试。"))
+ let secret = NSError(domain: NSURLErrorDomain, code: -1005, userInfo: [NSLocalizedDescriptionKey: "private-token", NSURLErrorFailingURLStringErrorKey: "https://fixture.test/private-token"])
+ XCTAssertFalse(UpdateChecker.failure(error: secret, response: nil).contains("private-token"))
+ }
+ @MainActor func testCancellationSuppressesLateResponseAndAllowsAnotherCheck() async {
+ let suite = "update-check-tests." + UUID().uuidString
+ let defaults = UserDefaults(suiteName: suite)!; defer { defaults.removePersistentDomain(forName: suite) }
+ UpdateProtocol.handler = { _ in (200, [:], self.payload) }
+ let check = checker(defaults), done = expectation(description: "new request")
+ var results = 0
+ check.onResult = { _ in results += 1; done.fulfill() }
+ check.check(force: true); check.cancel(); check.check(force: true)
+ await fulfillment(of: [done], timeout: 2)
+ XCTAssertEqual(results, 1)
+ }
+}
diff --git a/manifest.json b/manifest.json
index e0ff30f..2b13b6b 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,7 +2,7 @@
"schemaVersion": 1,
"id": "md.lifeos.doubao-say",
"name": "Doubao Say",
- "version": "1.5.1",
+ "version": "1.5.2",
"author": "quanru and contributors",
"description": "Doubao Say turns speech into polished text with live captions and configurable tap or hold triggers on Wayland.",
"kinds": [
diff --git a/packaging/INSTALL.md b/packaging/INSTALL.md
index 0ed7ab4..7efa968 100644
--- a/packaging/INSTALL.md
+++ b/packaging/INSTALL.md
@@ -1,4 +1,4 @@
-# Doubao Say 1.5.1
+# Doubao Say 1.5.2
[Website](https://doubao-say.lifeos.md/) · [简体中文安装指南](https://doubao-say.lifeos.md/zh/guide/install)
diff --git a/packaging/UPDATES.md b/packaging/UPDATES.md
index b1d3e3e..d69fc74 100644
--- a/packaging/UPDATES.md
+++ b/packaging/UPDATES.md
@@ -1,6 +1,9 @@
# In-app updates
-The client checks the latest public stable release every 24 hours. Manual checks
+The client checks the latest public stable release every 24 hours. Version 1.5.2
+and later read the public `releases/latest/download/update.json` asset first and
+fall back to the GitHub Releases API if it is unavailable or invalid. Neither
+source needs application credentials. Manual checks
bypass that interval. Updates are downloaded and installed only after the user
chooses the update action and dictation, polishing and text delivery are idle.
The installer runs after the old process exits, then restarts the application.
@@ -68,3 +71,11 @@ tag. After the Linux release workflow succeeds, upload both DMGs, merge their
and verify the public latest-release endpoint and every download. This local
signing/upload step uses publisher tools only; no signing key, Feishu credential
or GitHub token belongs in application source or release artifacts.
+
+After uploading both Mac DMGs and the combined SHA256SUMS, publish the minimal
+metadata using `python3 packaging/publish-update-feed.py --tag v<version>`. The
+command requires a public stable release, exactly one Mac DMG per architecture,
+all eight Linux archives, official asset URLs and matching checksum entries. It
+omits release body, uploader/account fields and credentials. Verify the public
+`releases/latest/download/update.json` URL and both update-source paths. Older
+clients that cannot reach the API need one manual DMG upgrade to get this fallback.
diff --git a/packaging/publish-update-feed.py b/packaging/publish-update-feed.py
new file mode 100644
index 0000000..cfc80f8
--- /dev/null
+++ b/packaging/publish-update-feed.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python3
+"""Publish minimal public metadata only after every platform package is present."""
+import argparse
+import json
+from pathlib import Path
+import re
+import subprocess
+import tempfile
+from urllib.request import urlopen
+
+REPOSITORY = "quanru/doubao-say"
+PREFIX = f"https://github.com/{REPOSITORY}/releases/download/"
+
+
+def manifest(release):
+ tag = release.get("tag_name", "")
+ if not re.fullmatch(r"v\d+\.\d+\.\d+", tag) or release.get("draft") or release.get("prerelease"):
+ raise ValueError("A public stable release is required")
+ assets = []
+ names = set()
+ for asset in release.get("assets", []):
+ name = asset["name"]
+ if name == "update.json":
+ continue
+ if not re.fullmatch(r"[A-Za-z0-9_.-]+", name) or name in names:
+ raise ValueError("Invalid or duplicate asset name")
+ url = asset["browser_download_url"]
+ if url != PREFIX + tag + "/" + name:
+ raise ValueError("Asset URL must belong to this exact official release")
+ names.add(name)
+ assets.append({"name": name, "browser_download_url": url})
+ if "SHA256SUMS" not in names:
+ raise ValueError("Missing checksum manifest")
+ for arch in ("arm64", "x86_64"):
+ pattern = rf"Doubao-Say-{re.escape(tag[1:])}-macos-{arch}-[a-f0-9]+\.dmg"
+ if sum(bool(re.fullmatch(pattern, name)) for name in names) != 1:
+ raise ValueError(f"Missing or ambiguous {arch} Mac package")
+ for kind in ("app", "plugin"):
+ for python in ("311", "312", "313", "314"):
+ if f"doubao-say-{tag[1:]}-{kind}-linux-x86_64-cpython-{python}.tar.gz" not in names:
+ raise ValueError("Missing supported Linux package")
+ return {"tag_name": tag, "draft": False, "prerelease": False,
+ "assets": sorted(assets, key=lambda value: value["name"])}
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--tag", required=True)
+ args = parser.parse_args()
+ if not re.fullmatch(r"v\d+\.\d+\.\d+", args.tag):
+ parser.error("Expected v<major>.<minor>.<patch>")
+ release = json.loads(subprocess.check_output(["gh", "api", f"repos/{REPOSITORY}/releases/tags/{args.tag}"]))
+ feed = manifest(release)
+ with urlopen(PREFIX + args.tag + "/SHA256SUMS", timeout=20) as response:
+ content = response.read(100_001)
+ if len(content) > 100_000:
+ raise ValueError("Checksum manifest exceeds the limit")
+ entries = {}
+ for line in content.decode("ascii").splitlines():
+ parts = line.split()
+ if len(parts) != 2 or not re.fullmatch(r"[a-f0-9]{64}", parts[0]):
+ raise ValueError("Invalid checksum entry")
+ name = parts[1].lstrip("*")
+ if name in entries:
+ raise ValueError("Duplicate checksum entry")
+ entries[name] = parts[0]
+ for asset in feed["assets"]:
+ if asset["name"].endswith((".dmg", ".tar.gz")) and asset["name"] not in entries:
+ raise ValueError("A package is missing its checksum")
+ with tempfile.TemporaryDirectory(prefix="doubao-public-feed-") as folder:
+ path = Path(folder) / "update.json"
+ path.write_text(json.dumps(feed, indent=2) + "\n")
+ subprocess.run(["gh", "release", "upload", args.tag, str(path), "--clobber", "--repo", REPOSITORY], check=True)
+ print(f"Published public update.json for {args.tag}; no account or credential fields included")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/pyproject.toml b/pyproject.toml
index b75689c..eb7e6e9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "doubao-say"
-version = "1.5.1"
+version = "1.5.2"
description = "Global push-to-hold voice input for Linux/Wayland, backed by Doubao ASR"
readme = "README.md"
requires-python = ">=3.11"
diff --git a/src/doubao_input/product.py b/src/doubao_input/product.py
index 28545c4..b3922e6 100644
--- a/src/doubao_input/product.py
+++ b/src/doubao_input/product.py
@@ -1,5 +1,6 @@
"""Single runtime source for Doubao Say release identity."""
-VERSION = "1.5.1"
+VERSION = "1.5.2"
REPOSITORY_URL = "https://github.com/quanru/doubao-say"
LATEST_RELEASE_API = "https://api.github.com/repos/quanru/doubao-say/releases/latest"
+LATEST_RELEASE_FEED = REPOSITORY_URL + "/releases/latest/download/update.json"
diff --git a/src/doubao_input/updates.py b/src/doubao_input/updates.py
index 61a6e97..8772f93 100644
--- a/src/doubao_input/updates.py
+++ b/src/doubao_input/updates.py
@@ -8,7 +8,7 @@ from threading import Event, Thread
import time
from urllib import error, parse, request
-from doubao_input.product import LATEST_RELEASE_API, REPOSITORY_URL, VERSION
+from doubao_input.product import LATEST_RELEASE_API, LATEST_RELEASE_FEED, REPOSITORY_URL, VERSION
from doubao_input.settings import config_dir, write_atomic
logger = logging.getLogger(__name__)
@@ -77,18 +77,25 @@ class UpdateChecker:
def _fetch(self):
self._notify_status("checking")
- req = request.Request(LATEST_RELEASE_API, headers={
- "Accept": "application/vnd.github+json",
- "User-Agent": f"Doubao-Say/{VERSION}",
- "X-GitHub-Api-Version": "2022-11-28",
- })
try:
- with request.urlopen(req, timeout=4) as response:
- raw = response.read(65_537)
- if len(raw) > 65_536:
- raise ValueError("Release response is too large")
- payload = json.loads(raw)
- info = release_info(payload)
+ last_error = None
+ for source in (LATEST_RELEASE_FEED, LATEST_RELEASE_API):
+ req = request.Request(source, headers={
+ "Accept": "application/json", "User-Agent": f"Doubao-Say/{VERSION}",
+ "X-GitHub-Api-Version": "2022-11-28",
+ })
+ try:
+ with request.urlopen(req, timeout=10) as response:
+ raw = response.read(65_537)
+ if len(raw) > 65_536:
+ raise ValueError("Release response is too large")
+ payload = json.loads(raw)
+ info = release_info(payload)
+ break
+ except (error.URLError, TimeoutError, OSError, ValueError, KeyError, TypeError) as exc:
+ last_error = exc
+ else:
+ raise last_error
self._save_cache(payload["tag_name"], bool(payload.get("draft")),
bool(payload.get("prerelease")))
except (error.URLError, TimeoutError, OSError, ValueError, KeyError,
diff --git a/tests/contracts/test_release.py b/tests/contracts/test_release.py
index f7b494e..cfdfcce 100644
--- a/tests/contracts/test_release.py
+++ b/tests/contracts/test_release.py
@@ -49,7 +49,7 @@ class ReleaseTest(unittest.TestCase):
notes = (ROOT / "RELEASE_NOTES.md").read_text()
self.assertIn("--notes-file RELEASE_NOTES.md", workflow)
self.assertNotIn("--generate-notes", workflow)
- for expected in ("Doubao Say 1.5.1", "Check for updates", "Update and restart"):
+ for expected in ("Doubao Say 1.5.2", "public update manifest", "GitHub API"):
self.assertIn(expected, notes)
def test_both_archives_exclude_ignored_source_files(self):
diff --git a/tests/contracts/test_update_feed.py b/tests/contracts/test_update_feed.py
new file mode 100644
index 0000000..701828f
--- /dev/null
+++ b/tests/contracts/test_update_feed.py
@@ -0,0 +1,41 @@
+import importlib.util
+from pathlib import Path
+import unittest
+
+ROOT = Path(__file__).resolve().parents[2]
+SPEC = importlib.util.spec_from_file_location("update_feed", ROOT / "packaging/publish-update-feed.py")
+FEED = importlib.util.module_from_spec(SPEC)
+SPEC.loader.exec_module(FEED)
+
+
+class UpdateFeedTests(unittest.TestCase):
+ def release(self):
+ names = ["SHA256SUMS"] + [f"Doubao-Say-1.5.2-macos-{arch}-abcdef0.dmg" for arch in ("arm64", "x86_64")]
+ names += [f"doubao-say-1.5.2-{kind}-linux-x86_64-cpython-{python}.tar.gz"
+ for kind in ("app", "plugin") for python in ("311", "312", "313", "314")]
+ return {"tag_name": "v1.5.2", "draft": False, "prerelease": False, "body": "private fixture", "assets": [
+ {"name": name, "browser_download_url": FEED.PREFIX + "v1.5.2/" + name, "uploader": "private fixture"}
+ for name in names]}
+
+ def test_feed_contains_only_public_version_and_official_asset_fields(self):
+ feed = FEED.manifest(self.release())
+ self.assertEqual(len(feed["assets"]), 11)
+ self.assertNotIn("private fixture", str(feed))
+ self.assertEqual(set(feed), {"tag_name", "draft", "prerelease", "assets"})
+ self.assertTrue(all(set(asset) == {"name", "browser_download_url"} for asset in feed["assets"]))
+
+ def test_incomplete_platform_assets_block_publication(self):
+ release = self.release()
+ release["assets"].pop(1)
+ with self.assertRaisesRegex(ValueError, "arm64"):
+ FEED.manifest(release)
+
+ def test_foreign_urls_and_duplicate_assets_are_rejected(self):
+ release = self.release()
+ release["assets"][0]["browser_download_url"] = "https://fixture.test/SHA256SUMS"
+ with self.assertRaisesRegex(ValueError, "official release"):
+ FEED.manifest(release)
+ release = self.release()
+ release["assets"].append(release["assets"][0])
+ with self.assertRaisesRegex(ValueError, "duplicate"):
+ FEED.manifest(release)
diff --git a/tests/contracts/test_version_check.py b/tests/contracts/test_version_check.py
index 657a9e1..2864f21 100644
--- a/tests/contracts/test_version_check.py
+++ b/tests/contracts/test_version_check.py
@@ -11,13 +11,13 @@ SPEC.loader.exec_module(VERSION_CHECK)
class VersionCheckTests(unittest.TestCase):
def test_sources_are_aligned_at_current_release(self):
- self.assertEqual(VERSION_CHECK.validate(root=ROOT), "1.5.1")
+ self.assertEqual(VERSION_CHECK.validate(root=ROOT), "1.5.2")
def test_exact_release_tag_is_accepted(self):
- self.assertEqual(VERSION_CHECK.validate("v1.5.1", ROOT), "1.5.1")
+ self.assertEqual(VERSION_CHECK.validate("v1.5.2", ROOT), "1.5.2")
def test_wrong_release_tag_is_rejected(self):
- with self.assertRaisesRegex(ValueError, "must be 'v1.5.1'"):
+ with self.assertRaisesRegex(ValueError, "must be 'v1.5.2'"):
VERSION_CHECK.validate("v1.1.0", ROOT)
diff --git a/tests/unit/test_product.py b/tests/unit/test_product.py
index cc022f2..3e7166a 100644
--- a/tests/unit/test_product.py
+++ b/tests/unit/test_product.py
@@ -51,7 +51,7 @@ class ProductTest(TestCase):
self.assertNotIn("private-device-identifier", data)
self.assertNotIn("cookies", data)
self.assertNotIn("transcript", data)
- self.assertEqual(json.loads(data)["product_version"], "1.5.1")
+ self.assertEqual(json.loads(data)["product_version"], "1.5.2")
self.assertEqual(json.loads(data)["recognition_provider"], "volcengine")
self.assertEqual(json.loads(data)["recent_stages"], [
{"stage": "first_result", "after_ms": 125}])
diff --git a/tests/unit/test_updates.py b/tests/unit/test_updates.py
index 06e7781..978a704 100644
--- a/tests/unit/test_updates.py
+++ b/tests/unit/test_updates.py
@@ -21,6 +21,28 @@ class Response:
class UpdateTest(TestCase):
+ def test_public_feed_succeeds_without_using_the_api(self):
+ with tempfile.TemporaryDirectory() as root, patch.dict(os.environ, {"XDG_CONFIG_HOME": root}), patch(
+ "doubao_input.updates.request.urlopen", return_value=Response({"tag_name": "v1.6.0"})) as fetch:
+ found = []
+ UpdateChecker(lambda callback: callback(), found.append)._fetch()
+ self.assertEqual(found[0].version, "1.6.0")
+ self.assertEqual(fetch.call_count, 1)
+ req = fetch.call_args.args[0]
+ self.assertTrue(req.full_url.endswith("/releases/latest/download/update.json"))
+ self.assertIsNone(req.get_header("Authorization"))
+
+ def test_missing_or_invalid_feed_falls_back_to_api(self):
+ for first in (URLError("offline"), Response({"tag_name": "invalid"})):
+ with self.subTest(first=type(first).__name__), tempfile.TemporaryDirectory() as root, patch.dict(
+ os.environ, {"XDG_CONFIG_HOME": root}), patch(
+ "doubao_input.updates.request.urlopen", side_effect=[first, Response({"tag_name": "v1.6.0"})]) as fetch:
+ found = []
+ UpdateChecker(lambda callback: callback(), found.append)._fetch()
+ self.assertEqual(found[0].version, "1.6.0")
+ self.assertEqual(fetch.call_count, 2)
+ self.assertIn("api.github.com", fetch.call_args.args[0].full_url)
+
def test_semantic_version_comparison_does_not_compare_strings(self):
self.assertTrue(newer_release("v1.10.0", "1.3.0"))
self.assertFalse(newer_release("1.3.0", "1.3.0"))