feat: cross-OS profile sync

This commit is contained in:
zhom committed 2026-10-11 17:09:42 +04:00
1 parent b7a89ac94e
commit c359049e09
28 files changed
+532 -122

No files matched your search

+3
View File
@@ -155,6 +155,7 @@ export type BackendErrorCode =
| "REMOTE_HOURS_EXHAUSTED"
| "PROFILE_RUNNING_REMOTELY"
| "PROFILE_REMOTE_SYNC_PENDING"
| "PROFILE_DATA_NOT_DOWNLOADED"
| "PROFILE_LOCKED_BY_MEMBER"
| "PROFILE_LOCKED_ELSEWHERE"
| "PROFILE_LOCK_UNAVAILABLE"
@@ -670,6 +671,8 @@ export function translateBackendError(t: TFunction, err: unknown): string {
return t("backendErrors.profileRunningRemotely");
case "PROFILE_REMOTE_SYNC_PENDING":
return t("backendErrors.profileRemoteSyncPending");
case "PROFILE_DATA_NOT_DOWNLOADED":
return t("backendErrors.profileDataNotDownloaded");
case "PROFILE_LOCKED_BY_MEMBER":
return t("backendErrors.profileLockedByMember", {
email: parsed.params?.email ?? "",
+19
View File
@@ -90,10 +90,29 @@ export function getProfileIcon(profile: {
return getBrowserIcon(profile.browser);
}
/**
* The OS a fingerprint without an explicit `os` was generated for: the machine
* that created the profile. Mirrors `BrowserProfile::native_os`, without its
* fallback to this computer, so callers can tell "unknown" apart.
*/
export function getProfileNativeOs(profile: {
host_os?: string;
}): "macos" | "windows" | "linux" | undefined {
const os = profile.host_os;
return os === "macos" || os === "windows" || os === "linux" ? os : undefined;
}
/**
* Whether a profile cannot run on this computer because a browser bound to
* its OS created it elsewhere. Mirrors `BrowserProfile::is_cross_os`: a
* Wayfern profile runs on every OS, so it is never cross-OS.
*/
export function isCrossOsProfile(profile: {
browser: string;
host_os?: string;
wayfern_config?: { os?: string };
}): boolean {
if (profile.browser === "wayfern") return false;
const profileOs = profile.host_os || profile.wayfern_config?.os;
if (!profileOs) return false;
return profileOs !== getCurrentOS();