mirror of
https://github.com/bitwarden/browser
synced 2026-02-09 13:10:17 +00:00
Added feature support property for sync domains
This commit is contained in:
@@ -221,6 +221,10 @@ export abstract class BrowserPlatformUtilsService implements PlatformUtilsServic
|
||||
return true;
|
||||
}
|
||||
|
||||
supportsSyncDomains(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
abstract showToast(
|
||||
type: "error" | "success" | "warning" | "info",
|
||||
title: string,
|
||||
|
||||
@@ -108,6 +108,10 @@ export class CliPlatformUtilsService implements PlatformUtilsService {
|
||||
return false;
|
||||
}
|
||||
|
||||
supportsSyncDomains(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
showToast(
|
||||
type: "error" | "success" | "warning" | "info",
|
||||
title: string,
|
||||
|
||||
@@ -86,6 +86,10 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||
return true;
|
||||
}
|
||||
|
||||
supportsSyncDomains(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
showToast(
|
||||
type: "error" | "success" | "warning" | "info",
|
||||
title: string,
|
||||
|
||||
@@ -125,6 +125,10 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
||||
return true;
|
||||
}
|
||||
|
||||
supportsSyncDomains(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
showToast(
|
||||
type: "error" | "success" | "warning" | "info",
|
||||
title: string,
|
||||
|
||||
@@ -28,6 +28,7 @@ export abstract class PlatformUtilsService {
|
||||
abstract getApplicationVersionNumber(): Promise<string>;
|
||||
abstract supportsWebAuthn(win: Window): boolean;
|
||||
abstract supportsDuo(): boolean;
|
||||
abstract supportsSyncDomains(): boolean;
|
||||
/**
|
||||
* @deprecated use `@bitwarden/components/ToastService.showToast` instead
|
||||
*
|
||||
|
||||
@@ -94,7 +94,7 @@ import { PaymentResponse } from "../billing/models/response/payment.response";
|
||||
import { PlanResponse } from "../billing/models/response/plan.response";
|
||||
import { SubscriptionResponse } from "../billing/models/response/subscription.response";
|
||||
import { TaxInfoResponse } from "../billing/models/response/tax-info.response";
|
||||
import { DeviceType } from "../enums";
|
||||
import { ClientType, DeviceType } from "../enums";
|
||||
import { KeyConnectorUserKeyRequest } from "../key-management/key-connector/models/key-connector-user-key.request";
|
||||
import { SetKeyConnectorKeyRequest } from "../key-management/key-connector/models/set-key-connector-key.request";
|
||||
import { VaultTimeoutSettingsService } from "../key-management/vault-timeout";
|
||||
@@ -147,8 +147,6 @@ import { OptionalCipherResponse } from "../vault/models/response/optional-cipher
|
||||
export class ApiService implements ApiServiceAbstraction {
|
||||
private device: DeviceType;
|
||||
private deviceType: string;
|
||||
private isWebClient = false;
|
||||
private isDesktopClient = false;
|
||||
private refreshTokenPromise: Promise<string> | undefined;
|
||||
|
||||
/**
|
||||
@@ -170,22 +168,6 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
) {
|
||||
this.device = platformUtilsService.getDevice();
|
||||
this.deviceType = this.device.toString();
|
||||
this.isWebClient =
|
||||
this.device === DeviceType.IEBrowser ||
|
||||
this.device === DeviceType.ChromeBrowser ||
|
||||
this.device === DeviceType.EdgeBrowser ||
|
||||
this.device === DeviceType.FirefoxBrowser ||
|
||||
this.device === DeviceType.OperaBrowser ||
|
||||
this.device === DeviceType.SafariBrowser ||
|
||||
this.device === DeviceType.UnknownBrowser ||
|
||||
this.device === DeviceType.VivaldiBrowser;
|
||||
this.isDesktopClient =
|
||||
this.device === DeviceType.WindowsDesktop ||
|
||||
this.device === DeviceType.MacOsDesktop ||
|
||||
this.device === DeviceType.LinuxDesktop ||
|
||||
this.device === DeviceType.WindowsCLI ||
|
||||
this.device === DeviceType.MacOsCLI ||
|
||||
this.device === DeviceType.LinuxCLI;
|
||||
}
|
||||
|
||||
// Auth APIs
|
||||
@@ -875,7 +857,9 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
// Sync APIs
|
||||
|
||||
async getSync(): Promise<SyncResponse> {
|
||||
const path = this.isDesktopClient || this.isWebClient ? "/sync?excludeDomains=true" : "/sync";
|
||||
const path = !this.platformUtilsService.supportsSyncDomains()
|
||||
? "/sync?excludeDomains=true"
|
||||
: "/sync";
|
||||
const r = await this.send("GET", path, null, true, true);
|
||||
return new SyncResponse(r);
|
||||
}
|
||||
@@ -1919,7 +1903,7 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
|
||||
private async getCredentials(): Promise<RequestCredentials> {
|
||||
const env = await firstValueFrom(this.environmentService.environment$);
|
||||
if (!this.isWebClient || env.hasBaseUrl()) {
|
||||
if (this.platformUtilsService.getClientType() !== ClientType.Web || env.hasBaseUrl()) {
|
||||
return "include";
|
||||
}
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user