From 1c1b2a3121133de4427ea35a4aa88af4e2498fed Mon Sep 17 00:00:00 2001 From: purocean Date: Tue, 12 Mar 2019 09:47:34 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B0=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E4=BF=9D=E5=AD=98=E5=8A=A0=E5=AF=86=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/file.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/src/file.js b/frontend/src/file.js index d5056baa..41dbd343 100644 --- a/frontend/src/file.js +++ b/frontend/src/file.js @@ -13,6 +13,7 @@ const getCryptKey = () => { const encrypt = content => { let key = getCryptKey() let iv = key + const passwordHash = CryptoJS.MD5(key).toString() key = CryptoJS.enc.Utf8.parse(key) iv = CryptoJS.enc.Utf8.parse(iv) @@ -23,12 +24,13 @@ const encrypt = content => { padding: CryptoJS.pad.Pkcs7 }) - return encrypted.toString() + return {content: encrypted.toString(), passwordHash} } const decrypt = content => { let key = getCryptKey() let iv = key + const passwordHash = CryptoJS.MD5(key).toString() key = CryptoJS.enc.Utf8.parse(key) iv = CryptoJS.enc.Utf8.parse(iv) @@ -44,9 +46,10 @@ const decrypt = content => { throw new Error('解密失败!!!') } - return result + return {content: result, passwordHash} } +const oldPasswordHash = {} export default { read: (repo, path, call, ecall) => { fetch(`/api/file?path=${encodeURIComponent(path)}&repo=${repo}`).then(response => { @@ -55,7 +58,9 @@ export default { try { let content = result.data.content if (path.endsWith('.c.md')) { - content = decrypt(content) + const data = decrypt(content) + content = data.content + oldPasswordHash[`${repo}_${path}`] = data.passwordHash } call(content, result.data.hash) @@ -75,7 +80,16 @@ export default { write: (repo, path, content, oldHash, call, ecall) => { try { if (path.endsWith('.c.md')) { - content = encrypt(content) + const data = encrypt(content) + const oldPasswdHash = oldPasswordHash[`${repo}_${path}`] + if (oldPasswdHash) { + if (oldPasswdHash !== data.passwordHash && !window.confirm('密码和上一次输入的密码不一致,是否用新密码保存?')) { + return + } + + delete oldPasswordHash[`${repo}_${path}`] + } + content = data.content } } catch (e) { if (ecall) { From b62131e514f06b24958e4605b9c2b257a2960884 Mon Sep 17 00:00:00 2001 From: purocean Date: Fri, 15 Mar 2019 11:56:58 +0800 Subject: [PATCH 2/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c58e8caf..58cd98ed 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ + 内置终端 [XTERM.JS](https://xtermjs.org/) [node-pty](https://github.com/Microsoft/node-pty) ## 开发贡献 -+ 后端: `cd backend; node main.js` ++ 前端: `cd backend; node main.js` + 后端: `cd frontend; yarn run dev` ## 捐赠 From 3145d254301f34cbece7ff5e1e0329ff429bf7e5 Mon Sep 17 00:00:00 2001 From: purocean Date: Fri, 15 Mar 2019 14:25:03 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=AE=B5=E6=89=93=E5=8D=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/View.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/View.vue b/frontend/src/components/View.vue index 1fc2af01..da24dbe2 100644 --- a/frontend/src/components/View.vue +++ b/frontend/src/components/View.vue @@ -536,7 +536,7 @@ button:hover { @media print { .view table.hljs-ln td { - white-space: normal; + white-space: pre-wrap; } .view .run-in-xterm { From 7d3ba0f0b7a4a5089b6dd5b6e2ad73ec37033763 Mon Sep 17 00:00:00 2001 From: purocean Date: Thu, 21 Mar 2019 16:44:00 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Home.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Home.vue b/frontend/src/pages/Home.vue index a5c78cf5..6fab3d46 100644 --- a/frontend/src/pages/Home.vue +++ b/frontend/src/pages/Home.vue @@ -8,7 +8,7 @@
-
+
Date: Thu, 21 Mar 2019 16:46:17 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Xterm.vue | 1 - frontend/src/pages/Home.vue | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Xterm.vue b/frontend/src/components/Xterm.vue index a593bf03..507f157c 100644 --- a/frontend/src/components/Xterm.vue +++ b/frontend/src/components/Xterm.vue @@ -126,7 +126,6 @@ export default { box-sizing: border-box; padding: 5px; padding-bottom: 20px; - height: 40vh; background: rgb(29, 31, 33); border: 1px solid rgb(92, 91, 100); flex: 0 0 auto; diff --git a/frontend/src/pages/Home.vue b/frontend/src/pages/Home.vue index 6fab3d46..a5cd6e88 100644 --- a/frontend/src/pages/Home.vue +++ b/frontend/src/pages/Home.vue @@ -29,7 +29,7 @@ @sync-scroll="syncScrollEditor" @switch-todo="switchTodoEditor">
- +
@@ -298,6 +298,10 @@ export default { .content.show-xterm { height: 55vh; } + + .xterm { + height: 40vh; + } } @media (max-width: 767px) { @@ -331,7 +335,7 @@ export default { width: 100%; } - .editor, .header, .tree, .status-bar { + .editor, .header, .tree, .status-bar, .xterm { display: none; } From 1025addce55bd360e16e937005debeef2ffa2516 Mon Sep 17 00:00:00 2001 From: purocean Date: Thu, 21 Mar 2019 16:48:53 +0800 Subject: [PATCH 6/6] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 58cd98ed..681e8c89 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,10 @@ ## 更新日志 [最新发布](https://github.com/purocean/yn/releases) +### [v1.18.2](https://github.com/purocean/yn/releases/tag/v1.18.2) 2019-03-21 +1. 保存加密文件密码不一致时增加提示 +1. 修复样式问题 + ### [v1.18.1](https://github.com/purocean/yn/releases/tag/v1.18.1) 2019-03-01 1. 修复目录样式 1. 修复代码块样式