1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-01 09:13:54 +00:00

User agent

This commit is contained in:
Bernd Schoolmann
2025-11-19 10:03:40 +01:00
parent 9733ef0a3e
commit de9d7b0318
6 changed files with 33 additions and 0 deletions

View File

@@ -329,6 +329,10 @@ export abstract class BrowserPlatformUtilsService implements PlatformUtilsServic
return autofillCommand;
}
userAgentPart(): Promise<string> {
return Promise.resolve("");
}
/**
* Triggers the offscreen document API to copy the text to the clipboard.
*/

View File

@@ -152,4 +152,8 @@ export class CliPlatformUtilsService implements PlatformUtilsService {
getAutofillKeyboardShortcut(): Promise<string> {
return null;
}
userAgentPart(): Promise<string> {
return Promise.resolve("");
}
}

View File

@@ -185,6 +185,10 @@ export class WindowMain {
await this.createWindow();
resolve();
const userAgent = this.win.webContents.session.getUserAgent();
this.logService.info(`Loaded URL with user agent: ${userAgent}`);
if (this.argvCallback != null) {
this.argvCallback(process.argv);
}

View File

@@ -151,4 +151,20 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
getAutofillKeyboardShortcut(): Promise<string> {
return null;
}
async userAgentPart(): Promise<string> {
let packageType = "Unsandboxed";
if (ipc.platform.isMacAppStore) {
packageType = "MacAppStore";
} else if (ipc.platform.isWindowsStore) {
packageType = "WindowsStore";
} else if (ipc.platform.isAppImage) {
packageType = "AppImage";
} else if (ipc.platform.isSnapStore) {
packageType = "Snap";
} else if (ipc.platform.isFlatpak) {
packageType = "Flatpak";
}
return `Bitwarden-Desktop/${await this.getApplicationVersion()} (${packageType})`;
}
}

View File

@@ -219,4 +219,8 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
getAutofillKeyboardShortcut(): Promise<string> {
return null;
}
userAgentPart(): Promise<string> {
return Promise.resolve("");
}
}

View File

@@ -55,4 +55,5 @@ export abstract class PlatformUtilsService {
abstract readFromClipboard(): Promise<string>;
abstract supportsSecureStorage(): boolean;
abstract getAutofillKeyboardShortcut(): Promise<string>;
abstract userAgentPart(): Promise<string>;
}