Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea12a14d7f | ||
|
|
3609a78465 | ||
|
|
7ec2db4006 | ||
|
|
5352c7b828 | ||
|
|
2a49bb53b2 |
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsdian-save-remote",
|
||||
"name": "Save remote",
|
||||
"version": "0.0.11",
|
||||
"version": "0.0.12",
|
||||
"minAppVersion": "0.12.15",
|
||||
"description": "This is yet another plugin allowing users to sync notes between local device and the cloud.",
|
||||
"author": "fyears",
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "obsidian-save-remote",
|
||||
"version": "0.0.11",
|
||||
"version": "0.0.12",
|
||||
"description": "This is yet another sync plugin for Obsidian app.",
|
||||
"scripts": {
|
||||
"dev": "webpack --mode development --watch",
|
||||
@@ -15,10 +15,12 @@
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.22",
|
||||
"@types/chai-as-promised": "^7.1.4",
|
||||
"@types/mime-types": "^2.1.1",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "^14.14.37",
|
||||
"chai": "^4.3.4",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"mocha": "^9.1.3",
|
||||
"prettier": "^2.4.1",
|
||||
|
||||
+6
-3
@@ -205,13 +205,16 @@ export class PasswordModal extends Modal {
|
||||
contentEl.createEl("p", { text: "Empty means no password." });
|
||||
|
||||
contentEl.createEl("p", {
|
||||
text: "Attention 1/3: The password setting itself is stored in PLAIN TEXT LOCALLY (because the plugin needs to use the password to encrypt the files) (and the password would not be sent to remote by this plugin).",
|
||||
text: "Attention 1/4: The password setting itself is stored in PLAIN TEXT LOCALLY (because the plugin needs to use the password to encrypt the files) (and the password would not be sent to remote by this plugin).",
|
||||
});
|
||||
contentEl.createEl("p", {
|
||||
text: "Attention 2/3: If you change the password. You should make sure the remote service (s3/webdav/...) IS EMPTY, or REMOTE FILES WERE ENCRYPTED BY THAT NEW PASSWORD. OTHERWISE SOMETHING BAD WOULD HAPPEN!",
|
||||
text: "Attention 2/4: The file contents are encrypted using openssl format. BUT, some metadata such as file sizes and directory structures are not encrypted or can be easily guessed.",
|
||||
});
|
||||
contentEl.createEl("p", {
|
||||
text: "Attention 3/3: The longer the password, the better.",
|
||||
text: "Attention 3/4: If you change the password. You should make sure the remote service (s3/webdav/...) IS EMPTY, or REMOTE FILES WERE ENCRYPTED BY THAT NEW PASSWORD. OTHERWISE SOMETHING BAD WOULD HAPPEN!",
|
||||
});
|
||||
contentEl.createEl("p", {
|
||||
text: "Attention 4/4: The longer the password, the better.",
|
||||
});
|
||||
|
||||
new Setting(contentEl)
|
||||
|
||||
@@ -98,7 +98,7 @@ export const uploadToRemote = async (
|
||||
ContentType: contentType,
|
||||
})
|
||||
);
|
||||
return await getRemoteMeta(s3Client, s3Config, fileOrFolderPath);
|
||||
return await getRemoteMeta(s3Client, s3Config, uploadFile);
|
||||
} else {
|
||||
// file
|
||||
// we ignore isRecursively parameter here
|
||||
@@ -149,6 +149,9 @@ export const listFromRemote = async (
|
||||
if (rsp.$metadata.httpStatusCode !== 200) {
|
||||
throw Error("some thing bad while listing remote!");
|
||||
}
|
||||
if (rsp.Contents === undefined) {
|
||||
break;
|
||||
}
|
||||
contents.push(...rsp.Contents);
|
||||
|
||||
isTruncated = rsp.IsTruncated;
|
||||
|
||||
+13
-1
@@ -1,6 +1,7 @@
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { expect } from "chai";
|
||||
import * as chai from "chai";
|
||||
import chaiAsPromised from "chai-as-promised";
|
||||
import { base64ToBase32, bufferToArrayBuffer } from "../src/misc";
|
||||
import {
|
||||
decryptArrayBuffer,
|
||||
@@ -9,6 +10,9 @@ import {
|
||||
encryptStringToBase32,
|
||||
} from "../src/encrypt";
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("Encryption tests", () => {
|
||||
beforeEach(function () {
|
||||
global.window = {
|
||||
@@ -22,6 +26,14 @@ describe("Encryption tests", () => {
|
||||
expect(await encryptStringToBase32(k, password)).to.not.equal(k);
|
||||
});
|
||||
|
||||
it("should raise error using different password", async () => {
|
||||
const k = "secret text";
|
||||
const password = "hey";
|
||||
const password2 = "hey2";
|
||||
const enc = await encryptStringToBase32(k, password);
|
||||
await expect(decryptBase32ToString(enc, password2)).to.be.rejected;
|
||||
});
|
||||
|
||||
it("should encrypt and decrypt string and get the same result returned", async () => {
|
||||
const k = "jfkkjkjbce7983ycdeknkkjckooAIUHIDIBIE((*BII)njD/d/dd/d/sjxhux";
|
||||
const password = "hfiuibec989###oiu982bj1`";
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"0.0.11": "0.12.15"
|
||||
"0.0.12": "0.12.15"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user