mirror of
https://github.com/bitwarden/browser
synced 2025-12-10 21:33:27 +00:00
* WIP: PoC with lots of terrible code with web push * fix service worker building * Work on WebPush Tailored to Browser * Clean Up Web And MV2 * Fix Merge Conflicts * Prettier * Use Unsupported for MV2 * Add Doc Comments * Remove Permission Button * Fix Type Test * Write Time In More Readable Format * Add SignalR Logger * `sheduleReconnect` -> `scheduleReconnect` Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Capture Support Context In Connector * Remove Unneeded CSP Change * Fix Build * Simplify `getOrCreateSubscription` * Add More Docs to Matrix * Update libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts Co-authored-by: Matt Gibson <mgibson@bitwarden.com> * Move API Service Into Notifications Folder * Allow Connection When Account Is Locked * Add Comments to NotificationsService * Only Change Support Status If Public Key Changes * Move Service Choice Out To Method * Use Named Constant For Disabled Notification Url * Add Test & Cleanup * Flatten * Move Tests into `beforeEach` & `afterEach` * Add Tests * Test `distinctUntilChanged`'s Operators More * Make Helper And Cleanup Chain * Add Back Cast * Add extra safety to incoming config check * Put data through response object * Apply TS Strict Rules * Finish PushTechnology comment * Use `instanceof` check * Do Safer Worker Based Registration for MV3 * Remove TODO * Switch to SignalR on any WebPush Error * Fix Manifest Permissions * Add Back `webNavigation` * Sorry, Remove `webNavigation` * Fixed merge conflicts. --------- Co-authored-by: Matt Gibson <mgibson@bitwarden.com> Co-authored-by: Todd Martin <tmartin@bitwarden.com> Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com>
89 lines
2.5 KiB
TypeScript
89 lines
2.5 KiB
TypeScript
// FIXME: Update this file to be type safe and remove this and next line
|
|
// @ts-strict-ignore
|
|
import { AllowedFeatureFlagTypes } from "../../../enums/feature-flag.enum";
|
|
import { BaseResponse } from "../../../models/response/base.response";
|
|
import { Region } from "../../abstractions/environment.service";
|
|
import { ServerSettings } from "../domain/server-settings";
|
|
|
|
export class ServerConfigResponse extends BaseResponse {
|
|
version: string;
|
|
gitHash: string;
|
|
server: ThirdPartyServerConfigResponse;
|
|
environment: EnvironmentServerConfigResponse;
|
|
featureStates: { [key: string]: AllowedFeatureFlagTypes } = {};
|
|
push: PushSettingsConfigResponse;
|
|
settings: ServerSettings;
|
|
|
|
constructor(response: any) {
|
|
super(response);
|
|
|
|
if (response == null) {
|
|
return;
|
|
}
|
|
|
|
this.version = this.getResponseProperty("Version");
|
|
this.gitHash = this.getResponseProperty("GitHash");
|
|
this.server = new ThirdPartyServerConfigResponse(this.getResponseProperty("Server"));
|
|
this.environment = new EnvironmentServerConfigResponse(this.getResponseProperty("Environment"));
|
|
this.featureStates = this.getResponseProperty("FeatureStates");
|
|
this.push = new PushSettingsConfigResponse(this.getResponseProperty("Push"));
|
|
this.settings = new ServerSettings(this.getResponseProperty("Settings"));
|
|
}
|
|
}
|
|
|
|
export class PushSettingsConfigResponse extends BaseResponse {
|
|
pushTechnology: number;
|
|
vapidPublicKey: string;
|
|
|
|
constructor(data: any = null) {
|
|
super(data);
|
|
|
|
if (data == null) {
|
|
return;
|
|
}
|
|
|
|
this.pushTechnology = this.getResponseProperty("PushTechnology");
|
|
this.vapidPublicKey = this.getResponseProperty("VapidPublicKey");
|
|
}
|
|
}
|
|
|
|
export class EnvironmentServerConfigResponse extends BaseResponse {
|
|
cloudRegion: Region;
|
|
vault: string;
|
|
api: string;
|
|
identity: string;
|
|
notifications: string;
|
|
sso: string;
|
|
|
|
constructor(data: any = null) {
|
|
super(data);
|
|
|
|
if (data == null) {
|
|
return;
|
|
}
|
|
|
|
this.cloudRegion = this.getResponseProperty("CloudRegion");
|
|
this.vault = this.getResponseProperty("Vault");
|
|
this.api = this.getResponseProperty("Api");
|
|
this.identity = this.getResponseProperty("Identity");
|
|
this.notifications = this.getResponseProperty("Notifications");
|
|
this.sso = this.getResponseProperty("Sso");
|
|
}
|
|
}
|
|
|
|
export class ThirdPartyServerConfigResponse extends BaseResponse {
|
|
name: string;
|
|
url: string;
|
|
|
|
constructor(data: any = null) {
|
|
super(data);
|
|
|
|
if (data == null) {
|
|
return;
|
|
}
|
|
|
|
this.name = this.getResponseProperty("Name");
|
|
this.url = this.getResponseProperty("Url");
|
|
}
|
|
}
|