ci / api / api (push) Successful in 48s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 1m10s
ci / db / db (push) Successful in 57s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m1s
ci / desktop / rust (desktop proxy) (push) Successful in 5m37s
ci / ts / ts (packages + web) (push) Successful in 4m10s
release / release (версия и заметки) (push) Successful in 11s
release / android (APK в релиз) (push) Successful in 4m22s
Serve desktop and Android builds from the latest Gitea release on /download, and fix the desktop compile and CI flakes that blocked v1.3.0. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
769 B
TypeScript
18 lines
769 B
TypeScript
export type AppClient = 'android' | 'windows' | 'linux' | 'macos';
|
|
|
|
const ORDER: AppClient[] = ['windows', 'macos', 'linux', 'android'];
|
|
|
|
/** Клиент, который стоит предложить первым по User-Agent. На iOS приложения нет. */
|
|
export function detectAppClient(ua = typeof navigator === 'undefined' ? '' : navigator.userAgent): AppClient | null {
|
|
if (/Android/i.test(ua)) return 'android';
|
|
if (/iPhone|iPad|iPod/i.test(ua)) return null;
|
|
if (/Windows/i.test(ua)) return 'windows';
|
|
if (/Mac OS X|Macintosh/i.test(ua)) return 'macos';
|
|
if (/Linux|X11/i.test(ua)) return 'linux';
|
|
return null;
|
|
}
|
|
|
|
export function otherAppClients(primary: AppClient | null): AppClient[] {
|
|
return ORDER.filter((c) => c !== primary);
|
|
}
|