Skip to content

Commit

Permalink
Merge branch 'master' into feat/browser_api
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Jun 4, 2023
2 parents 7ab932f + 91e2844 commit 103a4b3
Show file tree
Hide file tree
Showing 10 changed files with 463 additions and 539 deletions.
866 changes: 412 additions & 454 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Buttercup",
"version": "2.19.0",
"version": "2.20.3",
"description": "Buttercup Password Manager",
"main": "build/main/index.js",
"scripts": {
Expand Down Expand Up @@ -187,15 +187,15 @@
},
"dependencies": {
"@buttercup/channel-queue": "^1.2.0",
"@buttercup/dropbox-client": "^2.1.0",
"@buttercup/dropbox-client": "^2.1.1",
"@buttercup/exporter": "^1.1.0",
"@buttercup/file-interface": "^3.0.0",
"@buttercup/google-oauth2-client": "^2.1.0",
"@buttercup/googledrive-client": "^2.2.0",
"@buttercup/google-oauth2-client": "^2.1.1",
"@buttercup/googledrive-client": "^2.2.1",
"@buttercup/importer": "^3.1.0",
"@buttercup/secure-file-host": "^0.3.0",
"@electron/remote": "^2.0.8",
"buttercup": "^7.1.1",
"buttercup": "^7.2.3",
"debounce": "^1.2.1",
"debounce-promise": "^3.1.2",
"delayable-setinterval": "^0.1.1",
Expand All @@ -208,7 +208,7 @@
"express-promise-router": "^4.1.1",
"i18next": "^21.9.1",
"keytar": "^7.9.0",
"layerr": "^0.1.2",
"layerr": "^2.0.0",
"log-rotate": "^0.2.8",
"ms": "^2.1.3",
"nested-property": "^4.0.0",
Expand All @@ -226,7 +226,7 @@
"@blueprintjs/core": "^4.13.0",
"@blueprintjs/popover2": "^1.10.2",
"@blueprintjs/select": "^4.8.12",
"@buttercup/ui": "^6.2.1",
"@buttercup/ui": "^6.2.2",
"@hookstate/core": "^3.0.13",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.0",
Expand Down Expand Up @@ -262,14 +262,14 @@
"react-obstate": "^0.1.1",
"react-router-dom": "^5.3.3",
"rimraf": "^3.0.2",
"sass": "^1.57.0",
"sass-loader": "^13.2.0",
"sass": "^1.62.1",
"sass-loader": "^13.2.2",
"spectron": "^15.0.0",
"style-loader": "^3.3.0",
"style-loader": "^3.3.2",
"styled-components": "^5.3.6",
"ts-loader": "^9.4.2",
"typescript": "^4.9.4",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
"webpack": "^5.82.1",
"webpack-cli": "^5.1.1"
}
}
25 changes: 12 additions & 13 deletions source/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ app.on("open-url", (e, url) => {
}
});

{
const protocol = BUTTERCUP_PROTOCOL.replace("://", "");
if (!app.isDefaultProtocolClient(protocol)) {
logInfo(`Registering protocol: ${protocol}`);
const protoReg = app.setAsDefaultProtocolClient(protocol);
if (!protoReg) {
logErr(`Failed registering protocol: ${protocol}`);
}
} else {
logInfo(`Protocol already registered: ${protocol}`);
}
}

// **
// ** Boot
// **
Expand All @@ -71,6 +58,18 @@ app.whenReady()
initialiseElectronRemote();
})
.then(() => initialise())
.then(() => {
const protocol = BUTTERCUP_PROTOCOL.replace("://", "");
if (!app.isDefaultProtocolClient(protocol)) {
logInfo(`Registering protocol: ${protocol}`);
const protoReg = app.setAsDefaultProtocolClient(protocol);
if (!protoReg) {
logErr(`Failed registering protocol: ${protocol}`);
}
} else {
logInfo(`Protocol already registered: ${protocol}`);
}
})
.then(() => {
if (!shouldShowMainWindow()) {
logInfo("Opening initial window disabled");
Expand Down
32 changes: 7 additions & 25 deletions source/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,6 @@ ipcMain.on("remove-source", async (evt, payload) => {
await removeSourceWithID(sourceID);
});

ipcMain.on("save-vault-facade", async (evt, payload) => {
const { sourceID, vaultFacade } = JSON.parse(payload) as {
sourceID: VaultSourceID;
vaultFacade: VaultFacade;
};
try {
await saveVaultFacade(sourceID, vaultFacade);
evt.reply(
"save-vault-facade:reply",
JSON.stringify({
ok: true
})
);
} catch (err) {
logErr("Failed saving vault facade", err);
evt.reply(
"save-vault-facade:reply",
JSON.stringify({
ok: false,
error: err.message
})
);
}
});

ipcMain.on("update-vault-windows", () => {
sendSourcesToWindows();
});
Expand Down Expand Up @@ -322,6 +297,13 @@ ipcMain.handle("save-source", async (_, sourceID: VaultSourceID) => {
await saveSource(sourceID);
});

ipcMain.handle(
"save-vault-facade",
async (_, sourceID: VaultSourceID, vaultFacade: VaultFacade) => {
await saveVaultFacade(sourceID, vaultFacade);
}
);

ipcMain.handle("search-single-vault", async (_, sourceID, term): Promise<Array<SearchResult>> => {
const results = await searchSingleVault(sourceID, term);
return results.map((res) => ({
Expand Down
2 changes: 1 addition & 1 deletion source/main/library/build.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// This file updated automatically: changes made here will be overwritten!

export const VERSION = "2.19.0";
export const VERSION = "2.20.3";
47 changes: 17 additions & 30 deletions source/renderer/actions/saveVault.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ipcRenderer } from "electron";
import { Intent } from "@blueprintjs/core";
import { VaultFacade, VaultSourceID } from "buttercup";
import { Layerr } from "layerr";
import { setSaving } from "../state/app";
import { createProgressNotification } from "../services/notifications";
import { logInfo } from "../library/log";
Expand All @@ -9,36 +10,22 @@ import { ICON_UPLOAD } from "../../shared/symbols";

export async function saveVaultFacade(sourceID: VaultSourceID, vaultFacade: VaultFacade) {
const progNotification = createProgressNotification(ICON_UPLOAD, 100);
const savePromise = new Promise<void>((resolve, reject) => {
ipcRenderer.once("save-vault-facade:reply", (evt, result) => {
setSaving(false);
const { ok, error } = JSON.parse(result) as {
ok: boolean;
error?: string;
};
if (!ok) {
progNotification.clear(
`${t("notification.error.vault-save-failed")}: ${
error || t("notification.error.unknown-error")
}`,
Intent.DANGER,
10000
);
return reject(new Error(`Failed saving vault: ${error}`));
}
progNotification.clear(t("notification.vault-saved"), Intent.SUCCESS);
resolve();
});
});
setSaving(true);
logInfo(`Saving vault facade: ${sourceID}`);
ipcRenderer.send(
"save-vault-facade",
JSON.stringify({
sourceID,
vaultFacade
})
);
await savePromise;
logInfo(`Saved vault facade: ${sourceID}`);
try {
await ipcRenderer.invoke("save-vault-facade", sourceID, vaultFacade);
logInfo(`Saved vault facade: ${sourceID}`);
progNotification.clear(t("notification.vault-saved"), Intent.SUCCESS);
} catch (err) {
progNotification.clear(
`${t("notification.error.vault-save-failed")}: ${
err.message || t("notification.error.unknown-error")
}`,
Intent.DANGER,
10000
);
throw new Layerr(err, "Failed saving vault");
} finally {
setSaving(false);
}
}
2 changes: 1 addition & 1 deletion source/renderer/services/authGoogle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ipcRenderer } from "electron";
import { shell } from "@electron/remote";
import { OAuth2Client } from "@buttercup/google-oauth2-client";
import type { VaultSourceID } from "buttercup";
import { logInfo } from "../library/log";
import {
GOOGLE_AUTH_REDIRECT,
Expand All @@ -9,7 +10,6 @@ import {
GOOGLE_CLIENT_ID,
GOOGLE_CLIENT_SECRET
} from "../../shared/symbols";
import { VaultSourceID } from "buttercup";

let __googleDriveOAuthClient: OAuth2Client | null = null;

Expand Down
1 change: 0 additions & 1 deletion source/shared/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@
"format": {
"a-description": "Format A ist das ursprüngliche Buttercup Tresorformat, das Deltas für die Speicherung der Tresorstruktur nutzt.",
"b-description": "Format B ist das neue Buttercup Tresorformat, das eine JSON Struktur verwendet, um die Struktur und den Verlauf des Tresors zu organisieren.",
"a-upgrade-b": "Du kannst zu Format B upgraden, das sich aktuell in der <strong>Beta Testphase befindet</strong>. Es wird nicht empfohlen, solange Du nicht als Vorsichtma0nahme deine Daten gesichert hast.",
"description": "Verwalte aktuelles Tresorformat und Updates",
"format-type": "Format {{format}}",
"title": "Format",
Expand Down
2 changes: 1 addition & 1 deletion source/shared/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
"format": {
"a-description": "Format A is the original Buttercup vault format that uses deltas to store vault structure.",
"b-description": "Format B is the new Buttercup vault format that uses a JSON structure to manage vault structure and history.",
"a-upgrade-b": "You can upgrade to Format B, which is currently in <strong>beta testing</strong>. It is not recommended unless you are taking appropriate measures to secure your data.",
"a-upgrade-b": "You should upgrade to Format B, which is currently <strong>stable</strong>. It is recommended that you backup your vault before doing this.",
"description": "Manage current vault format and updates.",
"format-type": "Format {{format}}",
"title": "Format",
Expand Down
1 change: 0 additions & 1 deletion source/shared/i18n/translations/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@
"format": {
"a-description": "格式 A 是原始的 Buttercup 保险柜格式,它使用增量来存储保险柜结构。",
"b-description": "格式 B 是新的 Buttercup 保险柜格式,它使用 JSON 结构来管理保险柜结构和历史记录。",
"a-upgrade-b": "您可以升级到目前处于<strong>Beta 测试</strong>中的格式 B。 除非您正在采取适当的措施来保护您的数据,否则不建议这样做。",
"description": "管理当前的保险柜格式和更新。",
"format-type": "格式 {{format}}",
"title": "格式",
Expand Down

0 comments on commit 103a4b3

Please sign in to comment.