Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
g122622 committed Aug 25, 2023
1 parent fd9a3b8 commit c365ebc
Show file tree
Hide file tree
Showing 17 changed files with 216 additions and 229 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ pnpm-debug.log*
*.sw?

#Electron-builder output
/dist_electron
/dist_electron
.VSCodeCounter/2023-08-18_16-41-55/details.md
.VSCodeCounter/2023-08-18_16-41-55/diff-details.md
.VSCodeCounter/2023-08-18_16-41-55/diff.csv
.VSCodeCounter/2023-08-18_16-41-55/diff.md
.VSCodeCounter/2023-08-18_16-41-55/diff.txt
.VSCodeCounter/2023-08-18_16-41-55/results.csv
.VSCodeCounter/2023-08-18_16-41-55/results.json
.VSCodeCounter/2023-08-18_16-41-55/results.md
.VSCodeCounter/2023-08-18_16-41-55/results.txt
143 changes: 73 additions & 70 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,74 @@
{
"name": "gcrypt",
"version": "2.0.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",
"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",
"lodash": "^4.17.21",
"mitt": "^3.0.0",
"pinia": "^2.1.3",
"roboto-fontface": "*",
"vue": "^3.3.4",
"vue-router": "^4.0.3",
"vuetify": "^3.3.11",
"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.0.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.11",
"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
]
}
}
7 changes: 6 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
font-style: normal
}
</style>

<!-- 加载FroalaEditor -->
<link href='./libs/FroalaEditor/css/froala_editor.pkgd.min.css' rel='stylesheet' type='text/css' />
<link href='./libs/FroalaEditor/css/themes/dark.min.css' rel='stylesheet' type='text/css' />
<script type='text/javascript' src='./libs/FroalaEditor/js/froala_editor.pkgd.min.js'></script>
<script type='text/javascript' src='./libs/FroalaEditor/js/froala_editor.pkgd.min.js'></script>

<!-- 加载AceEditor -->
<!-- <script src="./libs/AceEditor/ace.js" type="text/javascript" charset="utf-8"></script> -->
93 changes: 46 additions & 47 deletions src/api/registerBuiltinOpenMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import ImageViewer from "@/components/ImageViewer/ImageViewer.vue"
import File from "@/api/File";
import Electron from 'electron'
import FroalaEditor from "@/components/FroalaEditor/FroalaEditor.vue";
import MonacoEditor from "@/components/MonacoEditor/MonacoEditor.vue";
import getDigest from "@/api/hash/getDigest"
import pickFile from "@/utils/shell/pickFile";
import path from 'path'
import AceEditor from "@/components/AceEditor/AceEditor.vue";

/**
* 注册内置方法
Expand Down Expand Up @@ -46,48 +45,6 @@ export default async function registerBulitinOpenMethods(mgr) {
)
}
})
mgr.registerMethod({
name: "生成md5值",
icon: 'mdi-folder-pound',
fileType: /./,
async onSelected(file: File) {
const dialogStore = (await import("@/store/dialog")).useDialogStore()
const md5 = await getDigest(await file.read(), 'md5')
dialogStore.addDialog({
isPersistent: false,
isDialogOpen: true,
title: 'md5生成结果',
destroyAfterClose: true,
width: '450px',
// height: '250px',
HTMLContent: `文件名: ${file.filename}
<br/>
md5: ${md5}
`
})
}
})
mgr.registerMethod({
name: "生成sha1值",
icon: 'mdi-folder-pound',
fileType: /./,
async onSelected(file: File) {
const dialogStore = (await import("@/store/dialog")).useDialogStore()
const sha1 = await getDigest(await file.read(), 'sha1')
dialogStore.addDialog({
isPersistent: false,
isDialogOpen: true,
title: 'sha1生成结果',
destroyAfterClose: true,
width: '550px',
// height: '250px',
HTMLContent: `文件名: ${file.filename}
<br/>
sha1: ${sha1}
`
})
}
})
mgr.registerMethod({
name: "外部打开(写入本地文件系统缓存,并监听写入以同步)",
icon: 'mdi-open-in-new',
Expand All @@ -114,14 +71,14 @@ export default async function registerBulitinOpenMethods(mgr) {
}
})
mgr.registerMethod({
name: "MonacoEditor",
name: "AceEditor",
icon: 'mdi-microsoft-visual-studio-code',
fileType: ['txt', 'html', 'js', 'json', 'vue', 'ts'],
async onSelected(file: File) {
emitter.emit("Action::addTab",
{
name: 'MonacoEditor-' + file.filename,
component: MonacoEditor,
name: 'AceEditor-' + file.filename,
component: AceEditor,
icon: "mdi-microsoft-visual-studio-code",
onClick: () => null,
props: { file }
Expand All @@ -138,4 +95,46 @@ export default async function registerBulitinOpenMethods(mgr) {
await file.exportToExt(directory)
}
})
mgr.registerMethod({
name: "生成md5值",
icon: 'mdi-folder-pound',
fileType: /./,
async onSelected(file: File) {
const dialogStore = (await import("@/store/dialog")).useDialogStore()
const md5 = await getDigest(await file.read(), 'md5')
dialogStore.addDialog({
isPersistent: false,
isDialogOpen: true,
title: 'md5生成结果',
destroyAfterClose: true,
width: '450px',
// height: '250px',
HTMLContent: `文件名: ${file.filename}
<br/>
md5: ${md5}
`
})
}
})
mgr.registerMethod({
name: "生成sha1值",
icon: 'mdi-folder-pound',
fileType: /./,
async onSelected(file: File) {
const dialogStore = (await import("@/store/dialog")).useDialogStore()
const sha1 = await getDigest(await file.read(), 'sha1')
dialogStore.addDialog({
isPersistent: false,
isDialogOpen: true,
title: 'sha1生成结果',
destroyAfterClose: true,
width: '550px',
// height: '250px',
HTMLContent: `文件名: ${file.filename}
<br/>
sha1: ${sha1}
`
})
}
})
}
2 changes: 1 addition & 1 deletion src/assets/whatsNew.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default {
"1.3.1": ['应用锁bug修复'],
"1.4.0": ['支持从外部拖入文件以导入', "完全重写加密引擎,支持异步加密,且显著优化输出文件大小", "改正一处错别字", "临时文件自动销毁"],
"1.5.0": ['若干bug和细节修复', '任务处理并行化,显著提高运行效率', '支持导出文件', '支持快捷打开store所在的目录'],
"2.0.0": ['若干bug和细节修复', '增加内置文件选择器', '内置浏览器可用'],
"2.0.0": ['若干bug和细节修复', '增加内置文件选择器', '内置浏览器可用', '内置代码编辑器可用'],
}
1 change: 1 addition & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ApplicationMain {
nodeIntegration: true,
contextIsolation: false,
devTools: true,
webSecurity: false
}
})

Expand Down
36 changes: 36 additions & 0 deletions src/components/AceEditor/AceEditor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<template>
<div :id="'AceEditor' + guid" style="position: relative;width: 100%;height: 100%;">
<v-ace-editor v-model:value="content" @init="onEditorInit" :lang="getExtName(file.filename) ?? 'text'"
:theme="settingsStore.getSetting('is_dark') ? 'twilight' : 'chrome'" style="height: 100%" />
</div>
</template>

<script setup lang="ts">
import { ref, onMounted, watch } from "vue"
import sharedUtils from "@/utils/sharedUtils"
import { VAceEditor } from 'vue3-ace-editor';
import File from "@/api/File";
import getExtName from "@/utils/getExtName";
import { useSettingsStore } from "@/store/settings"
const settingsStore = useSettingsStore()
const guid = sharedUtils.getHash(10)
const content = ref("")
const props = defineProps<{
file: File
}>()
onMounted(async () => {
content.value = (await props.file.read()).toString()
watch(content, (newVal) => {
props.file.write(newVal)
})
})
const onEditorInit = () => {
console.log("inited")
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less"></style>
4 changes: 3 additions & 1 deletion src/components/BuiltinFilePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const filePickers = ref<{
emitter.on("Action::openFilePicker", async ({ directory, taskId, onlyAllowFolderSelection, allowMultipleSelection }) => {
const adapter = new Adapter()
await adapter.initAdapter(directory)
await adapter.initAdapter(directory ?? "/")
filePickers.value.push({
isDialogOpen: true,
adapter,
Expand All @@ -63,6 +63,8 @@ emitter.on("Action::openFilePicker", async ({ directory, taskId, onlyAllowFolder
filePickers.value.find(item => item.taskId === taskId).isDialogOpen = false
},
cancellHandler: () => {
emitter.emit("Action::filePickerCancelled" + taskId)
emitter.off("Action::filePickerCancelled" + taskId)
filePickers.value.find(item => item.taskId === taskId).isDialogOpen = false
}
})
Expand Down
Loading

0 comments on commit c365ebc

Please sign in to comment.