mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-03 22:59:49 +08:00
Move the Electron macOS app into the main repository and ship it with every DeepTutor release. - apps/desktop: Electron shell that installs a signed bundled runtime and hosts the web UI; versioned with the bundled core. - White app icon with the black DeepTutor mark, generated by scripts/make-icon.swift; redesigned start screen and title bar. - Shell copy in en/zh/de/fr/pl/uk, starting in English and following the interface language and theme from DeepTutor Settings, including live changes. - Web UI labels itself "Open DeepTutor MacOS v<version>" inside the app (user-agent marker) and "Open DeepTutor Web v<version>" in a browser. - Sealing refuses a missing or mismatched signing key instead of silently generating a new one. - desktop-release.yml builds, smoke-tests and attaches the DMG to each GitHub Release; Developer ID signing and notarization run when secrets exist. - tests.yml runs the shell checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
/** Normalize a version string into a ``vMAJOR.MINOR.PATCH`` tag form.
|
|
*
|
|
* Accepts PEP 440 / semver forms used in ``deeptutor/__version__.py`` and
|
|
* GitHub release tags (``1.4.0``, ``v1.4.0``, ``1.4.0rc1``, ``v1.0.0-beta.4``)
|
|
* while rejecting git-describe output like ``v1.2.3-5-gabc1234``.
|
|
*/
|
|
export function normalizeVersionTag(
|
|
raw: string | null | undefined,
|
|
): string | null {
|
|
const value = raw?.trim();
|
|
if (!value) return null;
|
|
const match = value.match(
|
|
/^v?(\d+\.\d+\.\d+(?:(?:rc|a|b)\d+|\.dev\d+|\.post\d+|-[A-Za-z][0-9A-Za-z.-]*)?)$/,
|
|
);
|
|
return match ? `v${match[1]}` : null;
|
|
}
|
|
|
|
/** The desktop shell appends ``OpenDeepTutor/<version> (macOS)`` to its user agent. */
|
|
const DESKTOP_AGENT = /\bOpenDeepTutor\/\S+ \((macOS)\)/;
|
|
|
|
/** The client this page runs in, as shown beside the version: ``MacOS`` or ``Web``. */
|
|
export function clientPlatform(userAgent?: string | null): string {
|
|
const agent =
|
|
userAgent ?? (typeof navigator === "undefined" ? "" : navigator.userAgent);
|
|
return DESKTOP_AGENT.test(agent) ? "MacOS" : "Web";
|
|
}
|
|
|
|
/** ``Open DeepTutor MacOS v1.7.0`` / ``Open DeepTutor Web v1.7.0``. */
|
|
export function clientEditionLabel(
|
|
version: string | null | undefined,
|
|
userAgent?: string | null,
|
|
): string {
|
|
const tag = normalizeVersionTag(version);
|
|
return ["Open DeepTutor", clientPlatform(userAgent), tag]
|
|
.filter(Boolean)
|
|
.join(" ");
|
|
}
|