From fe4a5f5102b8a488be8b490b85c3f694e491efc1 Mon Sep 17 00:00:00 2001 From: g122622 <51020363+g122622@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:14:30 +0800 Subject: [PATCH] v2.3.0 --- package.json | 146 +++++++++--------- src/App.vue | 2 + src/assets/whatsNew.ts | 4 +- src/background.js | 4 +- .../AdvancedNotification/NotificationCard.vue | 2 +- src/components/AppLocker.vue | 32 +++- src/components/BuiltinFilePicker.vue | 11 +- src/components/DatePicker.vue | 52 +++++++ src/components/FileMgr/DialogMgr.vue | 8 +- src/components/shared/AdvancedList.vue | 10 +- src/components/shared/AdvancedTextField.vue | 73 +++++++++ src/main.ts | 4 + src/styles/globalVuetifyOverrides.less | 7 +- src/utils/shell/pickDate.ts | 15 ++ src/views/NewStoreWizard/NewStoreWizard.vue | 8 +- src/views/Settings/SettingsView.vue | 10 +- src/views/StoreMgr/StoreMgr.vue | 7 +- 17 files changed, 289 insertions(+), 106 deletions(-) create mode 100644 src/components/DatePicker.vue create mode 100644 src/components/shared/AdvancedTextField.vue create mode 100644 src/utils/shell/pickDate.ts diff --git a/package.json b/package.json index d76003d..b72bb99 100644 --- a/package.json +++ b/package.json @@ -1,74 +1,74 @@ { - "name": "gcrypt", - "version": "2.1.1", - "private": false, - "author": "g122622", - "repository": "https://github.com/g122622/gcrypt", - "scripts": { - "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts vue-cli-service serve", - "build": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts vue-cli-service build", - "lint": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts vue-cli-service lint", - "electron:build": "vue-cli-service electron:build", - "electron:serve": "vue-cli-service electron:serve", - "postinstall": "electron-builder install-app-deps", - "postuninstall": "electron-builder install-app-deps" - }, - "main": "background.js", - "dependencies": { - "@mdi/font": "5.9.55", - "ace-builds": "^1.24.1", - "axios": "^1.4.0", - "chart.js": "^4.3.0", - "core-js": "^3.8.3", - "dayjs": "^1.11.7", - "electron-store": "^8.1.0", - "fs-extra": "^11.1.0", - "get-windows-shortcut-properties": "^1.1.0", - "lodash": "^4.17.21", - "mitt": "^3.0.0", - "pinia": "^2.1.3", - "roboto-fontface": "*", - "vue": "^3.3.4", - "vue-router": "^4.0.3", - "vue3-ace-editor": "^2.2.3", - "vuetify": "^3.3.16", - "webfontloader": "^1.0.0" - }, - "devDependencies": { - "@types/electron-devtools-installer": "^2.2.0", - "@types/webfontloader": "^1.0.0", - "@typescript-eslint/eslint-plugin": "^5.4.0", - "@typescript-eslint/parser": "^5.4.0", - "@vue/cli-plugin-babel": "~5.0.0", - "@vue/cli-plugin-eslint": "~5.0.0", - "@vue/cli-plugin-router": "~5.0.0", - "@vue/cli-plugin-typescript": "~5.0.0", - "@vue/cli-service": "~5.0.0", - "@vue/eslint-config-standard": "^6.1.0", - "@vue/eslint-config-typescript": "^9.1.0", - "electron": "21.0.0", - "electron-devtools-installer": "^3.1.0", - "eslint": "^7.32.0", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", - "eslint-plugin-vue": "^8.0.3", - "less": "^4.1.3", - "less-loader": "^11.1.0", - "typescript": "~4.5.5", - "vue-cli-plugin-electron-builder": "^2.1.1", - "vue-cli-plugin-vuetify": "~2.5.8", - "webpack-plugin-vuetify": "^2.0.0-alpha.0" - }, - "binary": { - "module_name": "node_sqlite3", - "module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{libc}-{arch}", - "host": "https://github.com/TryGhost/node-sqlite3/releases/download/", - "remote_path": "v{version}", - "package_name": "napi-v{napi_build_version}-{platform}-{libc}-{arch}.tar.gz", - "napi_versions": [ - 3, - 6 - ] - } -} + "name": "gcrypt", + "version": "2.3.0", + "private": false, + "author": "g122622", + "repository": "https://github.com/g122622/gcrypt", + "scripts": { + "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts vue-cli-service serve", + "build": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts vue-cli-service build", + "lint": "SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts vue-cli-service lint", + "electron:build": "vue-cli-service electron:build", + "electron:serve": "vue-cli-service electron:serve", + "postinstall": "electron-builder install-app-deps", + "postuninstall": "electron-builder install-app-deps" + }, + "main": "background.js", + "dependencies": { + "@mdi/font": "5.9.55", + "ace-builds": "^1.24.1", + "axios": "^1.4.0", + "chart.js": "^4.3.0", + "core-js": "^3.8.3", + "dayjs": "^1.11.7", + "electron-store": "^8.1.0", + "fs-extra": "^11.1.0", + "get-windows-shortcut-properties": "^1.1.0", + "lodash": "^4.17.21", + "mitt": "^3.0.0", + "pinia": "^2.1.3", + "roboto-fontface": "*", + "vue": "^3.3.4", + "vue-router": "^4.0.3", + "vue3-ace-editor": "^2.2.3", + "vuetify": "^3.3.16", + "webfontloader": "^1.0.0" + }, + "devDependencies": { + "@types/electron-devtools-installer": "^2.2.0", + "@types/webfontloader": "^1.0.0", + "@typescript-eslint/eslint-plugin": "^5.4.0", + "@typescript-eslint/parser": "^5.4.0", + "@vue/cli-plugin-babel": "~5.0.0", + "@vue/cli-plugin-eslint": "~5.0.0", + "@vue/cli-plugin-router": "~5.0.0", + "@vue/cli-plugin-typescript": "~5.0.0", + "@vue/cli-service": "~5.0.0", + "@vue/eslint-config-standard": "^6.1.0", + "@vue/eslint-config-typescript": "^9.1.0", + "electron": "21.0.0", + "electron-devtools-installer": "^3.1.0", + "eslint": "^7.32.0", + "eslint-plugin-import": "^2.25.3", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-vue": "^8.0.3", + "less": "^4.1.3", + "less-loader": "^11.1.0", + "typescript": "~4.5.5", + "vue-cli-plugin-electron-builder": "^2.1.1", + "vue-cli-plugin-vuetify": "~2.5.8", + "webpack-plugin-vuetify": "^2.0.0-alpha.0" + }, + "binary": { + "module_name": "node_sqlite3", + "module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{libc}-{arch}", + "host": "https://github.com/TryGhost/node-sqlite3/releases/download/", + "remote_path": "v{version}", + "package_name": "napi-v{napi_build_version}-{platform}-{libc}-{arch}.tar.gz", + "napi_versions": [ + 3, + 6 + ] + } +} \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index d324b00..520278d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,6 +19,7 @@ +
@@ -62,6 +63,7 @@ import PostUpdateInfo from './components/Dialogs/PostUpdateInfo.vue' import DialogGenerator from './components/shared/DialogGenerator.vue' import AppLocker from './components/AppLocker.vue' import BuiltinFilePicker from './components/BuiltinFilePicker.vue' +import DatePicker from './components/DatePicker.vue' const settingsStore = useSettingsStore() const mainStore = useMainStore() diff --git a/src/assets/whatsNew.ts b/src/assets/whatsNew.ts index 3d9cde4..a499985 100644 --- a/src/assets/whatsNew.ts +++ b/src/assets/whatsNew.ts @@ -8,5 +8,7 @@ export default { "1.4.0": ['支持从外部拖入文件以导入', "完全重写加密引擎,支持异步加密,且显著优化输出文件大小", "改正一处错别字", "临时文件自动销毁"], "1.5.0": ['若干bug和细节修复', '任务处理并行化,显著提高运行效率', '支持导出文件', '支持快捷打开store所在的目录'], "2.0.0": ['若干bug和细节修复', '增加内置文件选择器', '内置浏览器可用', '内置代码编辑器可用', "列表性能优化"], - "2.1.0": ['支持单例锁', "bug修复", "侧边栏当前标签展示优化"] + "2.1.0": ['支持单例锁', "bug修复", "侧边栏当前标签展示优化"], + "2.1.1": ["v-switch组件夜间模式下的显示bug修复"], + "2.3.0": ['应用锁定时会自动关闭devtools,确保安全性', "界面优化", "应用锁交互逻辑优化", "支持高级文本框(历史记录、智能填充、)"], } diff --git a/src/background.js b/src/background.js index b3d7693..1690e88 100644 --- a/src/background.js +++ b/src/background.js @@ -115,7 +115,6 @@ class ApplicationMain { break; case 'reload': thisRef.mainWindow.reload(); - break; case 'relaunch': app.relaunch(); @@ -124,6 +123,9 @@ class ApplicationMain { case 'toggleDT': thisRef.mainWindow.webContents.toggleDevTools(); break; + case 'closeDT': + thisRef.mainWindow.webContents.closeDevTools() + break; case "showShade": if (!thisRef.hasShade) { thisRef.shadeWindow = new BrowserWindow({ diff --git a/src/components/AdvancedNotification/NotificationCard.vue b/src/components/AdvancedNotification/NotificationCard.vue index ee3b979..15af515 100644 --- a/src/components/AdvancedNotification/NotificationCard.vue +++ b/src/components/AdvancedNotification/NotificationCard.vue @@ -224,7 +224,7 @@ export default { .notification__item__content { display: grid; grid-template-columns: 1fr; - padding: 12px 16px 0px 16px; + padding: 12px 16px 12px 16px; } .notification__item__content__main__header { diff --git a/src/components/AppLocker.vue b/src/components/AppLocker.vue index 57ce5b9..4aad422 100644 --- a/src/components/AppLocker.vue +++ b/src/components/AppLocker.vue @@ -46,6 +46,8 @@ 1.这个密码仅用来防止未授权人员访问隐域的界面、阻止其对这个应用进行操作,并不会参与数据加密。
2.密码以私有方式加密,外部应用无法解密你的密码,且密码全程不会以明文形式参与解锁判定。 +
+ 3.忘记密码之后将无法恢复。 @@ -71,6 +73,7 @@ import getDigest from "@/api/hash/getDigest"; import ASSERT from "@/utils/ASSERT"; import notification from "@/api/notification"; import emitter from "@/eventBus"; +import { ipcRenderer } from "electron"; const settingsStore = useSettingsStore() const encryptionStore = useEncryptionStore() @@ -90,6 +93,11 @@ let interval = null // throw new Error() // } +const lockApp = () => { + models.isPasswordDialogOpen = true + ipcRenderer.send('mainService', { code: 'closeDT' }) +} + const isPasswordAvailable = () => { return !!encryptionStore.appLockerKeyEncrypted } @@ -119,22 +127,30 @@ const onPasswordConfirm = () => { } const onSetPasswordConfirm = () => { - if (!!models.password1 && !!models.password2 && models.password1 === models.password2) { - setPassword(models.password1) - models.password1 = '' - models.password2 = '' - models.isPasswordDialogOpen = false + if (models.password1 !== models.password2) { + notification.error("上下密码不一致") + return + } + if (!models.password1 || !models.password2) { + notification.error("密码无效") + return } + + setPassword(models.password1) + models.password1 = '' + models.password2 = '' + models.isPasswordDialogOpen = false + notification.success("密码设置成功") } onMounted(() => { watchEffect(() => { if (settingsStore.getSetting("window_lock")) { - models.isPasswordDialogOpen = true + lockApp() clearInterval(interval) if (settingsStore.getSetting("window_lock_scheduled")) { interval = setInterval(() => { - models.isPasswordDialogOpen = true + lockApp() }, settingsStore.getSetting("window_lock_interval") * 1e3 * 60) } } @@ -144,7 +160,7 @@ onMounted(() => { encryptionStore.setAppLockerKeyEncrypted('') } if (settingsStore.getSetting("window_lock")) { - models.isPasswordDialogOpen = true + lockApp() } }) }) diff --git a/src/components/BuiltinFilePicker.vue b/src/components/BuiltinFilePicker.vue index 082447a..7674f73 100644 --- a/src/components/BuiltinFilePicker.vue +++ b/src/components/BuiltinFilePicker.vue @@ -5,15 +5,17 @@ @@ -33,6 +35,7 @@ import Addr from '@/api/core/common/Addr'; const filePickers = ref<{ isDialogOpen: boolean, + currentDrive: string adapter: Adapter, selectedItems: Set, fileMgrOptions: FileMgrOptions, @@ -40,7 +43,6 @@ const filePickers = ref<{ confirmHandler(selectedItems: Set, adapter: Adapter): void, cancellHandler(): void }[]>([]) -const currentDrive = ref("") const allDrive = await getAllDrive() // vue有一个在template内使用new关键字的bug,see https://github.com/vuejs/core/issues/6483 @@ -54,6 +56,7 @@ emitter.on("Action::openFilePicker", async ({ directory, taskId, onlyAllowFolder filePickers.value.push({ isDialogOpen: true, adapter, + currentDrive: null, selectedItems: new Set(), fileMgrOptions: { useCtxMenu: true, diff --git a/src/components/DatePicker.vue b/src/components/DatePicker.vue new file mode 100644 index 0000000..39ea2d0 --- /dev/null +++ b/src/components/DatePicker.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/components/FileMgr/DialogMgr.vue b/src/components/FileMgr/DialogMgr.vue index 667046e..81efca1 100644 --- a/src/components/FileMgr/DialogMgr.vue +++ b/src/components/FileMgr/DialogMgr.vue @@ -9,7 +9,9 @@ - + + - + + @@ -21,6 +23,7 @@ style=" display:flex;justify-content: center;flex-direction: column;align-items: center;margin-bottom: 20px;"> 暂无内容 +
{{ props.emptyTip }}
@@ -29,6 +32,7 @@ import sharedUtils from "@/utils/sharedUtils"; import traverseObj from "@/utils/traverseObj"; import { ref, computed } from "vue" +import AdvancedTextField from "@/components/shared/AdvancedTextField.vue"; interface Props { density?: 'default' | 'comfortable' | 'compact', @@ -38,7 +42,8 @@ interface Props { items: any[], subheader?: string, lines?: false | 'one' | 'two' | 'three', - width?: string + width?: string, + emptyTip?: string } const props = defineProps() const guid = sharedUtils.getHash(16) @@ -71,7 +76,6 @@ const handleBackToTop = () => { .v-input { border-radius: 15px; overflow: hidden; - height: 56px; margin: 5px; } diff --git a/src/components/shared/AdvancedTextField.vue b/src/components/shared/AdvancedTextField.vue new file mode 100644 index 0000000..ffe3276 --- /dev/null +++ b/src/components/shared/AdvancedTextField.vue @@ -0,0 +1,73 @@ + + + + + + diff --git a/src/main.ts b/src/main.ts index b4a1bed..69a500a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,7 +19,9 @@ import ActionToolBarBase from "./components/shared/ActionToolBarBase.vue"; import IconBtn from "./components/shared/IconBtn.vue"; import DialogGenerator from "./components/shared/DialogGenerator.vue"; import AdvancedList from "./components/shared/AdvancedList.vue"; +import AdvancedTextField from "./components/shared/AdvancedTextField.vue"; import ToolBarBase from './components/shared/ToolBarBase.vue'; +import { VDatePicker } from 'vuetify/labs/VDatePicker' let pinia; @@ -140,6 +142,8 @@ class Application { .component("DialogGenerator", DialogGenerator) .component("AdvancedList", AdvancedList) .component("ToolBarBase", ToolBarBase) + .component("VDatePicker", VDatePicker) + .component("AdvancedTextField", AdvancedTextField) // 使用插件 this.AppInstance.use(router) diff --git a/src/styles/globalVuetifyOverrides.less b/src/styles/globalVuetifyOverrides.less index 587e547..e955288 100644 --- a/src/styles/globalVuetifyOverrides.less +++ b/src/styles/globalVuetifyOverrides.less @@ -19,6 +19,7 @@ width: unset; } -.v-input__details { - display: none !important; -} +.v-btn--variant-elevated, +.v-btn--variant-flat { + background: unset !important; +} \ No newline at end of file diff --git a/src/utils/shell/pickDate.ts b/src/utils/shell/pickDate.ts new file mode 100644 index 0000000..5ab3cd9 --- /dev/null +++ b/src/utils/shell/pickDate.ts @@ -0,0 +1,15 @@ +import emitter from "@/eventBus" +import sharedUtils from "../sharedUtils" + +export default function pickDate(): Promise { + return new Promise((resolve, reject) => { + const taskId = sharedUtils.getHash(16) + emitter.emit("Action::openDatePicker", { taskId }) + emitter.on("Action::datePicked" + taskId, (result: Date) => { + resolve(result) + }) + emitter.on("Action::datePickerCancelled" + taskId, () => { + reject(new Error("datePickerCancelled")) + }) + }) +} diff --git a/src/views/NewStoreWizard/NewStoreWizard.vue b/src/views/NewStoreWizard/NewStoreWizard.vue index 9530772..c4a8617 100644 --- a/src/views/NewStoreWizard/NewStoreWizard.vue +++ b/src/views/NewStoreWizard/NewStoreWizard.vue @@ -19,10 +19,10 @@ v-model="currentKVPEngine"> - + - + 确定 @@ -39,7 +39,7 @@ 加密库密码 - + 确定 diff --git a/src/views/Settings/SettingsView.vue b/src/views/Settings/SettingsView.vue index 3ce7f79..a558b16 100644 --- a/src/views/Settings/SettingsView.vue +++ b/src/views/Settings/SettingsView.vue @@ -8,7 +8,7 @@ - +
@@ -136,8 +136,8 @@ const cats = computed(() => { - diff --git a/src/views/StoreMgr/StoreMgr.vue b/src/views/StoreMgr/StoreMgr.vue index 161abfe..2ca2a27 100644 --- a/src/views/StoreMgr/StoreMgr.vue +++ b/src/views/StoreMgr/StoreMgr.vue @@ -34,17 +34,18 @@ + v-slot="{ matchedItems }" emptyTip="请点击右上角的“+”新建一个加密库,或导入一个加密库">