Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60d5b78df0 | ||
|
|
f04017e05b | ||
|
|
cb0098ec85 | ||
|
|
d007d5f230 | ||
|
|
07c6fbe747 | ||
|
|
5e3d413b33 | ||
|
|
bcf8586fbf | ||
|
|
6431182ec3 | ||
|
|
cef623f493 | ||
|
|
0c00c1a2e3 | ||
|
|
ab8805f272 | ||
|
|
da180fcc92 | ||
|
|
a9d80bef8f | ||
|
|
010561596e | ||
|
|
9fc67e37f6 | ||
|
|
151ae50a07 | ||
|
|
b0c6165fee | ||
|
|
6a3ed65e06 | ||
|
|
4395ab508f | ||
|
|
a681ceb4f5 | ||
|
|
58cd51d776 | ||
|
|
b450fa5c44 |
@@ -0,0 +1,34 @@
|
||||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: BuildCI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, enc]
|
||||
pull_request:
|
||||
branches: [master, enc]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: my-dist
|
||||
path: |
|
||||
main.js
|
||||
manifest.json
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsdian-save-remote",
|
||||
"name": "Save remote",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.6",
|
||||
"minAppVersion": "0.12.15",
|
||||
"description": "This is yet another plugin allowing users to sync notes between local device and the cloud.",
|
||||
"author": "fyears",
|
||||
|
||||
+26
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "obsidian-save-remote",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.6",
|
||||
"description": "This is yet another sync plugin for Obsidian app.",
|
||||
"scripts": {
|
||||
"dev": "webpack --mode development --watch",
|
||||
@@ -27,12 +27,37 @@
|
||||
"@aws-sdk/client-s3": "^3.37.0",
|
||||
"@aws-sdk/signature-v4-crt": "^3.37.0",
|
||||
"@types/mime-types": "^2.1.1",
|
||||
"acorn": "^8.5.0",
|
||||
"assert": "^2.0.0",
|
||||
"aws-crt": "^1.10.1",
|
||||
"browserify-zlib": "^0.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
"codemirror": "^5.63.1",
|
||||
"console-browserify": "^1.2.0",
|
||||
"constants-browserify": "^1.0.0",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"domain-browser": "^4.22.0",
|
||||
"events": "^3.3.0",
|
||||
"hash-wasm": "^4.9.0",
|
||||
"hi-base32": "^0.5.1",
|
||||
"https-browserify": "^1.0.0",
|
||||
"lovefield-ts": "^0.7.0",
|
||||
"mime-types": "^2.1.33",
|
||||
"obsidian": "^0.12.0",
|
||||
"os-browserify": "^0.3.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"process": "^0.11.10",
|
||||
"punycode": "^2.1.1",
|
||||
"querystring-es3": "^0.2.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"stream-http": "^3.2.0",
|
||||
"string_decoder": "^1.3.0",
|
||||
"timers-browserify": "^2.0.12",
|
||||
"tty-browserify": "0.0.1",
|
||||
"url": "^0.11.0",
|
||||
"util": "^0.12.4",
|
||||
"vm-browserify": "^1.1.2",
|
||||
"webdav": "^4.7.0",
|
||||
"webdav-fs": "^4.0.0"
|
||||
}
|
||||
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
import * as base32 from "hi-base32";
|
||||
import { bufferToArrayBuffer, arrayBufferToBuffer } from "./misc";
|
||||
|
||||
const DEFAULT_ITER = 10000;
|
||||
|
||||
const getKeyIVFromPassword = async (
|
||||
salt: Uint8Array,
|
||||
password: string,
|
||||
rounds: number = DEFAULT_ITER
|
||||
) => {
|
||||
const k1 = await window.crypto.subtle.importKey(
|
||||
"raw",
|
||||
new TextEncoder().encode(password),
|
||||
{ name: "PBKDF2" },
|
||||
false,
|
||||
["deriveKey", "deriveBits"]
|
||||
);
|
||||
|
||||
const k2 = await window.crypto.subtle.deriveBits(
|
||||
{
|
||||
name: "PBKDF2",
|
||||
salt: salt,
|
||||
iterations: rounds,
|
||||
hash: "SHA-256",
|
||||
},
|
||||
k1,
|
||||
256 + 128
|
||||
);
|
||||
|
||||
return k2;
|
||||
};
|
||||
|
||||
export const encryptArrayBuffer = async (
|
||||
arrBuf: ArrayBuffer,
|
||||
password: string,
|
||||
rounds: number = DEFAULT_ITER
|
||||
) => {
|
||||
const salt = window.crypto.getRandomValues(new Uint8Array(8));
|
||||
|
||||
const derivedKey = await getKeyIVFromPassword(salt, password, rounds);
|
||||
const key = derivedKey.slice(0, 32);
|
||||
const iv = derivedKey.slice(32, 32 + 16);
|
||||
|
||||
const keyCrypt = await window.crypto.subtle.importKey(
|
||||
"raw",
|
||||
key,
|
||||
{ name: "AES-CBC" },
|
||||
false,
|
||||
["encrypt", "decrypt"]
|
||||
);
|
||||
|
||||
const enc = (await window.crypto.subtle.encrypt(
|
||||
{ name: "AES-CBC", iv },
|
||||
keyCrypt,
|
||||
arrBuf
|
||||
)) as ArrayBuffer;
|
||||
|
||||
const prefix = new TextEncoder().encode("Salted__");
|
||||
|
||||
const res = new Uint8Array(
|
||||
[
|
||||
...prefix,
|
||||
...salt,
|
||||
...new Uint8Array(enc)
|
||||
]
|
||||
);
|
||||
|
||||
return bufferToArrayBuffer(res);
|
||||
};
|
||||
|
||||
export const decryptArrayBuffer = async (
|
||||
arrBuf: ArrayBuffer,
|
||||
password: string,
|
||||
rounds: number = DEFAULT_ITER
|
||||
) => {
|
||||
const prefix = arrBuf.slice(0, 8);
|
||||
const salt = arrBuf.slice(8, 16);
|
||||
const derivedKey = await getKeyIVFromPassword(
|
||||
new Uint8Array(salt),
|
||||
password,
|
||||
rounds
|
||||
);
|
||||
const key = derivedKey.slice(0, 32);
|
||||
const iv = derivedKey.slice(32, 32 + 16);
|
||||
|
||||
const keyCrypt = await window.crypto.subtle.importKey(
|
||||
"raw",
|
||||
key,
|
||||
{ name: "AES-CBC" },
|
||||
false,
|
||||
["encrypt", "decrypt"]
|
||||
);
|
||||
|
||||
const dec = (await window.crypto.subtle.decrypt(
|
||||
{ name: "AES-CBC", iv },
|
||||
keyCrypt,
|
||||
arrBuf.slice(16)
|
||||
)) as ArrayBuffer;
|
||||
|
||||
return dec;
|
||||
};
|
||||
|
||||
export const encryptStringToBase32 = async (
|
||||
text: string,
|
||||
password: string,
|
||||
rounds: number = DEFAULT_ITER
|
||||
) => {
|
||||
return base32.encode(
|
||||
await encryptArrayBuffer(new TextEncoder().encode(text), password, rounds)
|
||||
);
|
||||
};
|
||||
|
||||
export const decryptBase32ToString = async (
|
||||
text: string,
|
||||
password: string,
|
||||
rounds: number = DEFAULT_ITER
|
||||
) => {
|
||||
return (
|
||||
await decryptArrayBuffer(
|
||||
bufferToArrayBuffer(Uint8Array.from(base32.decode.asBytes(text))),
|
||||
password,
|
||||
rounds
|
||||
)
|
||||
).toString();
|
||||
};
|
||||
+19
-9
@@ -27,10 +27,12 @@ import { DEFAULT_S3_CONFIG, getS3Client, listFromRemote, S3Config } from "./s3";
|
||||
|
||||
interface SaveRemotePluginSettings {
|
||||
s3?: S3Config;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
const DEFAULT_SETTINGS: SaveRemotePluginSettings = {
|
||||
s3: DEFAULT_S3_CONFIG,
|
||||
password: "",
|
||||
};
|
||||
|
||||
export default class SaveRemotePlugin extends Plugin {
|
||||
@@ -60,13 +62,6 @@ export default class SaveRemotePlugin extends Plugin {
|
||||
})
|
||||
);
|
||||
|
||||
// this.addRibbonIcon("dice", "Misc", async () => {
|
||||
// const a = this.app.vault.getAllLoadedFiles();
|
||||
// console.log(a);
|
||||
// const h = await getAllRecords(this.db);
|
||||
// console.log(h);
|
||||
// });
|
||||
|
||||
this.addRibbonIcon("switch", "Save Remote", async () => {
|
||||
if (this.syncStatus !== "idle") {
|
||||
new Notice("Save Remote already running!");
|
||||
@@ -87,7 +82,8 @@ export default class SaveRemotePlugin extends Plugin {
|
||||
remoteRsp.Contents,
|
||||
local,
|
||||
localHistory,
|
||||
this.db
|
||||
this.db,
|
||||
this.settings.password
|
||||
);
|
||||
|
||||
for (const [key, val] of Object.entries(mixedStates)) {
|
||||
@@ -106,7 +102,8 @@ export default class SaveRemotePlugin extends Plugin {
|
||||
this.settings.s3,
|
||||
this.db,
|
||||
this.app.vault,
|
||||
mixedStates
|
||||
mixedStates,
|
||||
this.settings.password
|
||||
);
|
||||
|
||||
new Notice("Save Remote finish!");
|
||||
@@ -230,5 +227,18 @@ class SaveRemoteSettingTab extends PluginSettingTab {
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("password")
|
||||
.setDesc("password")
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("")
|
||||
.setValue(`${this.plugin.settings.password}`)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.password = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-1
@@ -46,6 +46,23 @@ export const mkdirpInVault = async (thePath: string, vault: Vault) => {
|
||||
* @param b Buffer
|
||||
* @returns ArrayBuffer
|
||||
*/
|
||||
export const bufferToArrayBuffer = (b: Buffer) => {
|
||||
export const bufferToArrayBuffer = (b: Buffer | Uint8Array) => {
|
||||
return b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength);
|
||||
};
|
||||
|
||||
/**
|
||||
* Simple func.
|
||||
* @param b
|
||||
* @returns
|
||||
*/
|
||||
export const arrayBufferToBuffer = (b: ArrayBuffer) => {
|
||||
return Buffer.from(b);
|
||||
};
|
||||
|
||||
export const arrayBufferToBase64 = (b: ArrayBuffer) => {
|
||||
return arrayBufferToBuffer(b).toString("base64");
|
||||
};
|
||||
|
||||
export const base64ToArrayBuffer = (b64text: string) => {
|
||||
return bufferToArrayBuffer(Buffer.from(b64text, "base64"));
|
||||
};
|
||||
|
||||
@@ -14,8 +14,13 @@ import {
|
||||
|
||||
import type { _Object } from "@aws-sdk/client-s3";
|
||||
|
||||
import { bufferToArrayBuffer, mkdirpInVault } from "./misc";
|
||||
import {
|
||||
arrayBufferToBuffer,
|
||||
bufferToArrayBuffer,
|
||||
mkdirpInVault,
|
||||
} from "./misc";
|
||||
import * as mime from "mime-types";
|
||||
import { decryptArrayBuffer, encryptArrayBuffer } from "./encrypt";
|
||||
|
||||
export interface S3Config {
|
||||
s3Endpoint: string;
|
||||
@@ -65,8 +70,14 @@ export const uploadToRemote = async (
|
||||
s3Config: S3Config,
|
||||
fileOrFolderPath: string,
|
||||
vault: Vault,
|
||||
isRecursively: boolean = false
|
||||
isRecursively: boolean = false,
|
||||
password: string = "",
|
||||
remoteEncryptedKey: string = ""
|
||||
) => {
|
||||
let uploadFile = fileOrFolderPath;
|
||||
if (password !== "") {
|
||||
uploadFile = remoteEncryptedKey;
|
||||
}
|
||||
const isFolder = fileOrFolderPath.endsWith("/");
|
||||
|
||||
const DEFAULT_CONTENT_TYPE = "application/octet-stream";
|
||||
@@ -79,7 +90,7 @@ export const uploadToRemote = async (
|
||||
await s3Client.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: s3Config.s3BucketName,
|
||||
Key: fileOrFolderPath,
|
||||
Key: uploadFile,
|
||||
Body: "",
|
||||
ContentType: contentType,
|
||||
})
|
||||
@@ -88,20 +99,28 @@ export const uploadToRemote = async (
|
||||
} else {
|
||||
// file
|
||||
// we ignore isRecursively parameter here
|
||||
const contentType =
|
||||
mime.contentType(mime.lookup(fileOrFolderPath) || DEFAULT_CONTENT_TYPE) ||
|
||||
DEFAULT_CONTENT_TYPE;
|
||||
const content = await vault.adapter.readBinary(fileOrFolderPath);
|
||||
const body = Buffer.from(content);
|
||||
let contentType = DEFAULT_CONTENT_TYPE;
|
||||
if (password === "") {
|
||||
contentType =
|
||||
mime.contentType(
|
||||
mime.lookup(fileOrFolderPath) || DEFAULT_CONTENT_TYPE
|
||||
) || DEFAULT_CONTENT_TYPE;
|
||||
}
|
||||
const localContent = await vault.adapter.readBinary(fileOrFolderPath);
|
||||
let remoteContent = localContent;
|
||||
if (password !== "") {
|
||||
remoteContent = await encryptArrayBuffer(localContent, password);
|
||||
}
|
||||
const body = arrayBufferToBuffer(remoteContent);
|
||||
await s3Client.send(
|
||||
new PutObjectCommand({
|
||||
Bucket: s3Config.s3BucketName,
|
||||
Key: fileOrFolderPath,
|
||||
Key: uploadFile,
|
||||
Body: body,
|
||||
ContentType: contentType,
|
||||
})
|
||||
);
|
||||
return await getRemoteMeta(s3Client, s3Config, fileOrFolderPath);
|
||||
return await getRemoteMeta(s3Client, s3Config, uploadFile);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -169,22 +188,35 @@ export const downloadFromRemote = async (
|
||||
s3Config: S3Config,
|
||||
fileOrFolderPath: string,
|
||||
vault: Vault,
|
||||
mtime: number
|
||||
mtime: number,
|
||||
password: string = "",
|
||||
remoteEncryptedKey: string = ""
|
||||
) => {
|
||||
const isFolder = fileOrFolderPath.endsWith("/");
|
||||
|
||||
await mkdirpInVault(fileOrFolderPath, vault);
|
||||
|
||||
// the file is always local file
|
||||
// we need to encrypt it
|
||||
|
||||
if (isFolder) {
|
||||
// mkdirp locally is enough
|
||||
// do nothing here
|
||||
} else {
|
||||
const content = await downloadFromRemoteRaw(
|
||||
let downloadFile = fileOrFolderPath;
|
||||
if (password !== "") {
|
||||
downloadFile = remoteEncryptedKey;
|
||||
}
|
||||
const remoteContent = await downloadFromRemoteRaw(
|
||||
s3Client,
|
||||
s3Config,
|
||||
fileOrFolderPath
|
||||
downloadFile
|
||||
);
|
||||
await vault.adapter.writeBinary(fileOrFolderPath, content, {
|
||||
let localContent = remoteContent;
|
||||
if (password !== "") {
|
||||
localContent = await decryptArrayBuffer(remoteContent, password);
|
||||
}
|
||||
await vault.adapter.writeBinary(fileOrFolderPath, localContent, {
|
||||
mtime: mtime,
|
||||
});
|
||||
}
|
||||
@@ -200,12 +232,25 @@ export const downloadFromRemote = async (
|
||||
export const deleteFromRemote = async (
|
||||
s3Client: S3Client,
|
||||
s3Config: S3Config,
|
||||
fileOrFolderPath: string
|
||||
fileOrFolderPath: string,
|
||||
password: string = "",
|
||||
remoteEncryptedKey: string = ""
|
||||
) => {
|
||||
if (fileOrFolderPath === "/") {
|
||||
return;
|
||||
}
|
||||
if (fileOrFolderPath.endsWith("/")) {
|
||||
let remoteFileName = fileOrFolderPath;
|
||||
if (password !== "") {
|
||||
remoteFileName = remoteEncryptedKey;
|
||||
}
|
||||
await s3Client.send(
|
||||
new DeleteObjectCommand({
|
||||
Bucket: s3Config.s3BucketName,
|
||||
Key: remoteFileName,
|
||||
})
|
||||
);
|
||||
|
||||
if (fileOrFolderPath.endsWith("/") && password === "") {
|
||||
const x = await listFromRemote(s3Client, s3Config, fileOrFolderPath);
|
||||
x.Contents.forEach(async (element) => {
|
||||
await s3Client.send(
|
||||
@@ -215,12 +260,9 @@ export const deleteFromRemote = async (
|
||||
})
|
||||
);
|
||||
});
|
||||
} else if (fileOrFolderPath.endsWith("/") && password !== "") {
|
||||
// TODO
|
||||
} else {
|
||||
await s3Client.send(
|
||||
new DeleteObjectCommand({
|
||||
Bucket: s3Config.s3BucketName,
|
||||
Key: fileOrFolderPath,
|
||||
})
|
||||
);
|
||||
// pass
|
||||
}
|
||||
};
|
||||
|
||||
+41
-9
@@ -17,6 +17,7 @@ import {
|
||||
downloadFromRemote,
|
||||
} from "./s3";
|
||||
import { mkdirpInVault } from "./misc";
|
||||
import { decryptBase32ToString, encryptStringToBase32 } from "./encrypt";
|
||||
|
||||
type DecisionType =
|
||||
| "undecided"
|
||||
@@ -44,26 +45,32 @@ interface FileOrFolderMixedState {
|
||||
decision?: DecisionType;
|
||||
syncDone?: "done";
|
||||
decision_branch?: number;
|
||||
remote_encrypted_key?: string;
|
||||
}
|
||||
|
||||
export const ensembleMixedStates = async (
|
||||
remote: S3ObjectType[],
|
||||
local: TAbstractFile[],
|
||||
deleteHistory: FileFolderHistoryRecord[],
|
||||
db: lf.DatabaseConnection
|
||||
db: lf.DatabaseConnection,
|
||||
password: string = ""
|
||||
) => {
|
||||
const results = {} as Record<string, FileOrFolderMixedState>;
|
||||
|
||||
if (remote !== undefined) {
|
||||
for (const entry of remote) {
|
||||
const remoteEncryptedKey = entry.Key;
|
||||
let key = remoteEncryptedKey;
|
||||
if (password !== "") {
|
||||
key = await decryptBase32ToString(remoteEncryptedKey, password);
|
||||
}
|
||||
const backwardMapping = await getSyncMetaMappingByRemoteKeyS3(
|
||||
db,
|
||||
entry.Key,
|
||||
key,
|
||||
entry.LastModified.valueOf(),
|
||||
entry.ETag
|
||||
);
|
||||
|
||||
let key = entry.Key;
|
||||
let r = {} as FileOrFolderMixedState;
|
||||
if (backwardMapping !== undefined) {
|
||||
key = backwardMapping.local_key;
|
||||
@@ -72,6 +79,7 @@ export const ensembleMixedStates = async (
|
||||
exist_remote: true,
|
||||
mtime_remote: backwardMapping.local_mtime,
|
||||
size_remote: backwardMapping.local_size,
|
||||
remote_encrypted_key: remoteEncryptedKey,
|
||||
};
|
||||
} else {
|
||||
r = {
|
||||
@@ -79,6 +87,7 @@ export const ensembleMixedStates = async (
|
||||
exist_remote: true,
|
||||
mtime_remote: entry.LastModified.valueOf(),
|
||||
size_remote: entry.Size,
|
||||
remote_encrypted_key: remoteEncryptedKey,
|
||||
};
|
||||
}
|
||||
if (results.hasOwnProperty(key)) {
|
||||
@@ -86,6 +95,7 @@ export const ensembleMixedStates = async (
|
||||
results[key].exist_remote = r.exist_remote;
|
||||
results[key].mtime_remote = r.mtime_remote;
|
||||
results[key].size_remote = r.size_remote;
|
||||
results[key].remote_encrypted_key = r.remote_encrypted_key;
|
||||
} else {
|
||||
results[key] = r;
|
||||
}
|
||||
@@ -277,13 +287,21 @@ export const doActualSync = async (
|
||||
s3Config: S3Config,
|
||||
db: lf.DatabaseConnection,
|
||||
vault: Vault,
|
||||
keyStates: Record<string, FileOrFolderMixedState>
|
||||
keyStates: Record<string, FileOrFolderMixedState>,
|
||||
password: string = ""
|
||||
) => {
|
||||
Object.entries(keyStates)
|
||||
.sort((k, v) => -(k as string).length)
|
||||
.map(async ([k, v]) => {
|
||||
const key = k as string;
|
||||
const state = v as FileOrFolderMixedState;
|
||||
let remoteEncryptedKey = key;
|
||||
if (password !== "") {
|
||||
remoteEncryptedKey = state.remote_encrypted_key;
|
||||
if (remoteEncryptedKey === undefined || remoteEncryptedKey === "") {
|
||||
remoteEncryptedKey = await encryptStringToBase32(key, password);
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
state.decision === undefined ||
|
||||
@@ -299,7 +317,9 @@ export const doActualSync = async (
|
||||
s3Config,
|
||||
state.key,
|
||||
vault,
|
||||
state.mtime_remote
|
||||
state.mtime_remote,
|
||||
password,
|
||||
remoteEncryptedKey
|
||||
);
|
||||
await clearDeleteRenameHistoryOfKey(db, state.key);
|
||||
} else if (state.decision === "upload_clearhist") {
|
||||
@@ -308,7 +328,9 @@ export const doActualSync = async (
|
||||
s3Config,
|
||||
state.key,
|
||||
vault,
|
||||
false
|
||||
false,
|
||||
password,
|
||||
remoteEncryptedKey
|
||||
);
|
||||
await upsertSyncMetaMappingDataS3(
|
||||
db,
|
||||
@@ -328,10 +350,18 @@ export const doActualSync = async (
|
||||
s3Config,
|
||||
state.key,
|
||||
vault,
|
||||
state.mtime_remote
|
||||
state.mtime_remote,
|
||||
password,
|
||||
remoteEncryptedKey
|
||||
);
|
||||
} else if (state.decision === "delremote_clearhist") {
|
||||
await deleteFromRemote(s3Client, s3Config, state.key);
|
||||
await deleteFromRemote(
|
||||
s3Client,
|
||||
s3Config,
|
||||
state.key,
|
||||
password,
|
||||
remoteEncryptedKey
|
||||
);
|
||||
await clearDeleteRenameHistoryOfKey(db, state.key);
|
||||
} else if (state.decision === "upload") {
|
||||
const remoteObjMeta = await uploadToRemote(
|
||||
@@ -339,7 +369,9 @@ export const doActualSync = async (
|
||||
s3Config,
|
||||
state.key,
|
||||
vault,
|
||||
false
|
||||
false,
|
||||
password,
|
||||
remoteEncryptedKey
|
||||
);
|
||||
await upsertSyncMetaMappingDataS3(
|
||||
db,
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"0.0.2": "0.12.15"
|
||||
"0.0.6": "0.12.15"
|
||||
}
|
||||
|
||||
+12
-1
@@ -1,4 +1,5 @@
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
|
||||
module.exports = {
|
||||
@@ -9,6 +10,16 @@ module.exports = {
|
||||
path: __dirname,
|
||||
libraryTarget: "commonjs",
|
||||
},
|
||||
plugins: [
|
||||
// Work around for Buffer is undefined:
|
||||
// https://github.com/webpack/changelog-v5/issues/10
|
||||
new webpack.ProvidePlugin({
|
||||
Buffer: ["buffer", "Buffer"],
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: "process/browser",
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@@ -20,7 +31,7 @@ module.exports = {
|
||||
},
|
||||
resolve: {
|
||||
extensions: [".tsx", ".ts", ".js"],
|
||||
mainFields: ["module", "main"],
|
||||
mainFields: ["browser", "module", "main"],
|
||||
fallback: {
|
||||
assert: require.resolve("assert"),
|
||||
buffer: require.resolve("buffer/"),
|
||||
|
||||
Reference in New Issue
Block a user