mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-10-20 22:41:22 +02:00
feat: cross-OS profile sync
This commit is contained in:
1 parent
b7a89ac94e
commit
c359049e09
28 files changed
+532
-122
No files matched your search
@@ -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 ?? "",
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user