Fix manual errors
This commit is contained in:
parent
e3ae1c1519
commit
b08ac70905
|
@ -3,5 +3,6 @@ build
|
|||
jslib
|
||||
webpack.main.js
|
||||
webpack.renderer.js
|
||||
src/scripts/duo.js
|
||||
|
||||
**/node_modules
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires, no-console */
|
||||
require("dotenv").config();
|
||||
const path = require("path");
|
||||
|
||||
|
|
2
sign.js
2
sign.js
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-var-requires, no-console */
|
||||
|
||||
exports.default = async function (configuration) {
|
||||
if (parseInt(process.env.ELECTRON_BUILDER_SIGN) === 1 && configuration.path.slice(-4) == ".exe") {
|
||||
console.log(`[*] Signing file: ${configuration.path}`);
|
||||
|
|
|
@ -205,7 +205,7 @@ export class AppComponent implements OnInit {
|
|||
case "openPremium":
|
||||
await this.openModal<PremiumComponent>(PremiumComponent, this.premiumRef);
|
||||
break;
|
||||
case "showFingerprintPhrase":
|
||||
case "showFingerprintPhrase": {
|
||||
const fingerprint = await this.cryptoService.getFingerprint(
|
||||
await this.stateService.getUserId()
|
||||
);
|
||||
|
@ -219,6 +219,7 @@ export class AppComponent implements OnInit {
|
|||
this.platformUtilsService.launchUri("https://bitwarden.com/help/fingerprint-phrase/");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "openPasswordHistory":
|
||||
await this.openModal<PasswordGeneratorHistoryComponent>(
|
||||
PasswordGeneratorHistoryComponent,
|
||||
|
@ -238,7 +239,7 @@ export class AppComponent implements OnInit {
|
|||
queryParams: { code: message.code, state: message.state },
|
||||
});
|
||||
break;
|
||||
case "premiumRequired":
|
||||
case "premiumRequired": {
|
||||
const premiumConfirmed = await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t("premiumRequiredDesc"),
|
||||
this.i18nService.t("premiumRequired"),
|
||||
|
@ -249,7 +250,8 @@ export class AppComponent implements OnInit {
|
|||
await this.openModal<PremiumComponent>(PremiumComponent, this.premiumRef);
|
||||
}
|
||||
break;
|
||||
case "emailVerificationRequired":
|
||||
}
|
||||
case "emailVerificationRequired": {
|
||||
const emailVerificationConfirmed = await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t("emailVerificationRequiredDesc"),
|
||||
this.i18nService.t("emailVerificationRequired"),
|
||||
|
@ -262,6 +264,7 @@ export class AppComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "syncVault":
|
||||
try {
|
||||
await this.syncService.fullSync(true, true);
|
||||
|
@ -323,7 +326,7 @@ export class AppComponent implements OnInit {
|
|||
case "convertAccountToKeyConnector":
|
||||
this.router.navigate(["/remove-password"]);
|
||||
break;
|
||||
case "switchAccount":
|
||||
case "switchAccount": {
|
||||
if (message.userId != null) {
|
||||
await this.stateService.setActiveUser(message.userId);
|
||||
}
|
||||
|
@ -338,12 +341,16 @@ export class AppComponent implements OnInit {
|
|||
this.router.navigate(["vault"]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "systemSuspended":
|
||||
await this.checkForSystemTimeout(systemTimeoutOptions.onSuspend);
|
||||
break;
|
||||
case "systemLocked":
|
||||
await this.checkForSystemTimeout(systemTimeoutOptions.onLock);
|
||||
break;
|
||||
case "systemIdle":
|
||||
await this.checkForSystemTimeout(systemTimeoutOptions.onIdle);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ export function initFactory(
|
|||
stateService: StateServiceAbstraction,
|
||||
cryptoService: CryptoServiceAbstraction,
|
||||
nativeMessagingService: NativeMessagingService
|
||||
): Function {
|
||||
): () => Promise<void> {
|
||||
return async () => {
|
||||
nativeMessagingService.init();
|
||||
await stateService.init();
|
||||
|
|
|
@ -135,7 +135,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||
case "modalClosed":
|
||||
this.showingModal = false;
|
||||
break;
|
||||
case "copyUsername":
|
||||
case "copyUsername": {
|
||||
const uComponent =
|
||||
this.addEditComponent == null ? this.viewComponent : this.addEditComponent;
|
||||
const uCipher = uComponent != null ? uComponent.cipher : null;
|
||||
|
@ -149,7 +149,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||
this.copyValue(uCipher, uCipher.login.username, "username", "Username");
|
||||
}
|
||||
break;
|
||||
case "copyPassword":
|
||||
}
|
||||
case "copyPassword": {
|
||||
const pComponent =
|
||||
this.addEditComponent == null ? this.viewComponent : this.addEditComponent;
|
||||
const pCipher = pComponent != null ? pComponent.cipher : null;
|
||||
|
@ -164,7 +165,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||
this.copyValue(pCipher, pCipher.login.password, "password", "Password");
|
||||
}
|
||||
break;
|
||||
case "copyTotp":
|
||||
}
|
||||
case "copyTotp": {
|
||||
const tComponent =
|
||||
this.addEditComponent == null ? this.viewComponent : this.addEditComponent;
|
||||
const tCipher = tComponent != null ? tComponent.cipher : null;
|
||||
|
@ -179,6 +181,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||
const value = await this.totpService.getCode(tCipher.login.totp);
|
||||
this.copyValue(tCipher, value, "verificationCodeTotp", "TOTP");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
detectChanges = false;
|
||||
break;
|
||||
|
@ -730,7 +734,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
|
||||
private functionWithChangeDetection(func: Function) {
|
||||
private functionWithChangeDetection(func: () => void) {
|
||||
this.ngZone.run(() => {
|
||||
func();
|
||||
this.changeDetectorRef.detectChanges();
|
||||
|
|
|
@ -10,7 +10,7 @@ if (
|
|||
process.argv.some((arg) => arg.indexOf("chrome-extension://") !== -1 || arg.indexOf("{") !== -1)
|
||||
) {
|
||||
if (process.platform === "darwin") {
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
const app = require("electron").app;
|
||||
|
||||
app.on("ready", () => {
|
||||
|
@ -27,7 +27,7 @@ if (
|
|||
const proxy = new NativeMessagingProxy();
|
||||
proxy.run();
|
||||
} else {
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
const Main = require("./main").Main;
|
||||
|
||||
const main = new Main();
|
||||
|
|
|
@ -62,7 +62,7 @@ export class Main {
|
|||
const watch = args.some((val) => val === "--watch");
|
||||
|
||||
if (watch) {
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
require("electron-reload")(__dirname, {});
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,7 @@ export class Main {
|
|||
});
|
||||
|
||||
if (process.platform === "win32") {
|
||||
// eslint-disable-next-line
|
||||
const BiometricWindowsMain = require("jslib-electron/biometric.windows.main").default;
|
||||
this.biometricMain = new BiometricWindowsMain(
|
||||
this.i18nService,
|
||||
|
@ -122,6 +123,7 @@ export class Main {
|
|||
this.logService
|
||||
);
|
||||
} else if (process.platform === "darwin") {
|
||||
// eslint-disable-next-line
|
||||
const BiometricDarwinMain = require("jslib-electron/biometric.darwin.main").default;
|
||||
this.biometricMain = new BiometricDarwinMain(this.i18nService, this.stateService);
|
||||
}
|
||||
|
@ -191,7 +193,7 @@ export class Main {
|
|||
});
|
||||
},
|
||||
(e: any) => {
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
console.error(e);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -57,6 +57,7 @@ export class MessagingMain {
|
|||
break;
|
||||
case "removeOpenAtLogin":
|
||||
this.removeOpenAtLogin();
|
||||
break;
|
||||
case "setFocus":
|
||||
this.setFocus();
|
||||
break;
|
||||
|
|
|
@ -99,7 +99,7 @@ export class NativeMessagingMain {
|
|||
};
|
||||
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
case "win32": {
|
||||
const destination = path.join(this.userPath, "browsers");
|
||||
this.writeManifest(path.join(destination, "firefox.json"), firefoxJson);
|
||||
this.writeManifest(path.join(destination, "chrome.json"), chromeJson);
|
||||
|
@ -115,7 +115,8 @@ export class NativeMessagingMain {
|
|||
path.join(destination, "chrome.json")
|
||||
);
|
||||
break;
|
||||
case "darwin":
|
||||
}
|
||||
case "darwin": {
|
||||
const nmhs = this.getDarwinNMHS();
|
||||
for (const [key, value] of Object.entries(nmhs)) {
|
||||
if (existsSync(value)) {
|
||||
|
@ -134,6 +135,7 @@ export class NativeMessagingMain {
|
|||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "linux":
|
||||
if (existsSync(`${this.homedir()}/.mozilla/`)) {
|
||||
this.writeManifest(
|
||||
|
@ -173,15 +175,16 @@ export class NativeMessagingMain {
|
|||
"HKCU\\SOFTWARE\\Google\\Chrome\\NativeMessagingHosts\\com.8bit.bitwarden"
|
||||
);
|
||||
break;
|
||||
case "darwin":
|
||||
case "darwin": {
|
||||
const nmhs = this.getDarwinNMHS();
|
||||
for (const [_, value] of Object.entries(nmhs)) {
|
||||
for (const [, value] of Object.entries(nmhs)) {
|
||||
const p = path.join(value, "NativeMessagingHosts", "com.8bit.bitwarden.json");
|
||||
if (existsSync(p)) {
|
||||
fs.unlink(p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "linux":
|
||||
if (
|
||||
existsSync(`${this.homedir()}/.mozilla/native-messaging-hosts/com.8bit.bitwarden.json`)
|
||||
|
@ -215,6 +218,7 @@ export class NativeMessagingMain {
|
|||
}
|
||||
|
||||
private getDarwinNMHS() {
|
||||
/* eslint-disable no-useless-escape */
|
||||
return {
|
||||
Firefox: `${this.homedir()}/Library/Application\ Support/Mozilla/`,
|
||||
Chrome: `${this.homedir()}/Library/Application\ Support/Google/Chrome/`,
|
||||
|
@ -228,6 +232,7 @@ export class NativeMessagingMain {
|
|||
"Microsoft Edge Canary": `${this.homedir()}/Library/Application\ Support/Microsoft\ Edge\ Canary/`,
|
||||
Vivaldi: `${this.homedir()}/Library/Application\ Support/Vivaldi/`,
|
||||
};
|
||||
/* eslint-enable no-useless-escape */
|
||||
}
|
||||
|
||||
private async writeManifest(destination: string, manifest: object) {
|
||||
|
@ -246,6 +251,7 @@ export class NativeMessagingMain {
|
|||
}
|
||||
|
||||
private getRegeditInstance() {
|
||||
// eslint-disable-next-line
|
||||
const regedit = require("regedit");
|
||||
regedit.setExternalVBSLocation(path.join(path.dirname(this.exePath), "resources/regedit/vbs"));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* tslint:disable:no-console */
|
||||
/* eslint-disable no-console */
|
||||
import { homedir } from "os";
|
||||
|
||||
import * as ipc from "node-ipc";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* tslint:disable:no-console */
|
||||
/* eslint-disable no-console */
|
||||
import IPC from "./ipc";
|
||||
|
||||
// Mostly based on the example from MDN,
|
||||
|
|
|
@ -119,7 +119,7 @@ export class NativeMessagingService {
|
|||
}
|
||||
|
||||
switch (message.command) {
|
||||
case "biometricUnlock":
|
||||
case "biometricUnlock": {
|
||||
if (!this.platformUtilService.supportsBiometric()) {
|
||||
return this.send({ command: "biometricUnlock", response: "not supported" }, appId);
|
||||
}
|
||||
|
@ -151,8 +151,10 @@ export class NativeMessagingService {
|
|||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
this.logService.error("NativeMessage, got unknown command.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue