Skip to content

Commit

Permalink
v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
g122622 committed Oct 4, 2023
1 parent 4a52687 commit fe4a5f5
Show file tree
Hide file tree
Showing 17 changed files with 289 additions and 106 deletions.
146 changes: 73 additions & 73 deletions package.json
Original file line number Diff line number Diff line change
@@ -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
]
}
}
2 changes: 2 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Suspense>
<BuiltinFilePicker></BuiltinFilePicker>
</Suspense>
<DatePicker></DatePicker>

<div :style="{ opacity: backgroundOpacity }">
<v-app>
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion src/assets/whatsNew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,确保安全性', "界面优化", "应用锁交互逻辑优化", "支持高级文本框(历史记录、智能填充、)"],
}
4 changes: 3 additions & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class ApplicationMain {
break;
case 'reload':
thisRef.mainWindow.reload();

break;
case 'relaunch':
app.relaunch();
Expand All @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/components/AdvancedNotification/NotificationCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
32 changes: 24 additions & 8 deletions src/components/AppLocker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
1.这个密码仅用来防止未授权人员访问隐域的界面、阻止其对这个应用进行操作,并不会参与数据加密。
<br />
2.密码以私有方式加密,外部应用无法解密你的密码,且密码全程不会以明文形式参与解锁判定。
<br />
<span style="color: rgb(242,158,116);">3.忘记密码之后将无法恢复。</span>
</v-card-text>
</v-card>
<v-btn block class="mb-8" color="blue" size="large" variant="tonal" @click="onSetPasswordConfirm">
Expand All @@ -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()
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
}
}
Expand All @@ -144,7 +160,7 @@ onMounted(() => {
encryptionStore.setAppLockerKeyEncrypted('')
}
if (settingsStore.getSetting("window_lock")) {
models.isPasswordDialogOpen = true
lockApp()
}
})
})
Expand Down
11 changes: 7 additions & 4 deletions src/components/BuiltinFilePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
<template #title>
<div style="margin-left: 7px; width: 150px;">
<v-select density="compact" label="选择盘符" clearable :items="allDrive.map(i => i.drive).sort()"
v-model="currentDrive"></v-select>
v-model="item.currentDrive"></v-select>
</div>
<v-spacer></v-spacer>
<v-btn color="primary" style="margin-right: 10px;" @click="item.cancellHandler()">取消</v-btn>
<v-btn color="primary" @click="item.confirmHandler(item.selectedItems, item.adapter)">确定</v-btn>
<v-btn color="primary" @click="item.confirmHandler(item.selectedItems, item.adapter)"
prepend-icon="mdi-check">确定</v-btn>
</template>
<template #mainContent>
<FileMgr :adapter="item.adapter" height="300px" :options="item.fileMgrOptions"
v-model:selectedItems="item.selectedItems" :directory="currentDrive ? newAddr(currentDrive) : null">
v-model:selectedItems="item.selectedItems"
:directory="item.currentDrive ? newAddr(item.currentDrive) : null">
</FileMgr>
</template>
</DialogGenerator>
Expand All @@ -33,14 +35,14 @@ import Addr from '@/api/core/common/Addr';
const filePickers = ref<{
isDialogOpen: boolean,
currentDrive: string
adapter: Adapter,
selectedItems: Set<dirSingleItem>,
fileMgrOptions: FileMgrOptions,
taskId: string,
confirmHandler(selectedItems: Set<dirSingleItem>, adapter: Adapter): void,
cancellHandler(): void
}[]>([])
const currentDrive = ref("")
const allDrive = await getAllDrive()
// vue有一个在template内使用new关键字的bug,see https://github.com/vuejs/core/issues/6483
Expand All @@ -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,
Expand Down
52 changes: 52 additions & 0 deletions src/components/DatePicker.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<DialogGenerator height="690px" width="470px" v-model:isDialogOpen="item.isDialogOpen" :title="'选择日期'"
:isPersistent="true" useCompactContentOuterMargin v-for="item in datePickers" :key="item.taskId">
<template #mainContent>
<!-- 时间选择器 -->
<v-date-picker color="primary" show-adjacent-months show-week v-model="item.selectedDate"
@click:save="item.confirmHandler(item.selectedDate)" @click:cancel="item.cancellHandler()"></v-date-picker>
</template>
</DialogGenerator>
</template>

<script setup lang="ts">
import { ref, onUnmounted } from 'vue';
import emitter from "@/eventBus"
import notification from '@/api/notification';
const datePickers = ref<{
isDialogOpen: boolean,
selectedDate: string[], // 实际上v-model的结果是单个Date对象,但是vuetify的类型声明文件有bug(标注的是any[]),所以只能写成string[]来通过类型检查
confirmHandler(selectedDate: string[]): void,
cancellHandler(): void,
taskId: string
}[]>([])
emitter.on("Action::openDatePicker", async ({ taskId }) => {
datePickers.value.push({
isDialogOpen: true,
selectedDate: null,
taskId,
confirmHandler: (selectedDate) => {
if (!selectedDate || selectedDate?.length === 0) {
notification.error("你还没有选择日期")
return
}
emitter.emit("Action::datePicked" + taskId, selectedDate)
emitter.off("Action::datePicked" + taskId)
datePickers.value.find(item => item.taskId === taskId).isDialogOpen = false
},
cancellHandler: () => {
emitter.emit("Action::datePickerCancelled" + taskId)
emitter.off("Action::datePickerCancelled" + taskId)
datePickers.value.find(item => item.taskId === taskId).isDialogOpen = false
}
})
})
onUnmounted(() => {
emitter.off("Action::openDatePicker")
})
</script>

<style lang="less" scoped></style>
8 changes: 6 additions & 2 deletions src/components/FileMgr/DialogMgr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field label="文件夹名称*" required density="compact" v-model="folderName"></v-text-field>
<AdvancedTextField label="文件夹名称*" prepend-inner-icon="mdi-magnify"
v-model:currentInput="folderName" density="compact" required>
</AdvancedTextField>
</v-col>
<v-col cols="12" sm="6">
<v-autocomplete :items="['读r--', '写-w-', '执行--x']" label="操作权限" multiple
Expand Down Expand Up @@ -41,7 +43,9 @@
<v-container>
<v-row>
<v-col cols="12">
<v-text-field label="文件名称*" required density="compact" v-model="fileName"></v-text-field>
<AdvancedTextField label="文件名称*" prepend-inner-icon="mdi-magnify"
v-model:currentInput="fileName" density="compact" required>
</AdvancedTextField>
</v-col>
<v-col cols="12" sm="6">
<v-autocomplete :items="['读r--', '写-w-', '执行--x']" label="操作权限" multiple
Expand Down
Loading

0 comments on commit fe4a5f5

Please sign in to comment.