Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
23b917b5da |
18
.npmrc
Normal file
18
.npmrc
Normal file
@ -0,0 +1,18 @@
|
||||
# 设置npm镜像源为淘宝镜像
|
||||
registry=https://registry.npmmirror.com/
|
||||
|
||||
# 设置electron下载镜像
|
||||
ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/
|
||||
# 设置electron-builder下载镜像
|
||||
ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/
|
||||
|
||||
# 设置node-pre-gyp镜像(用于sqlite3、bcrypt等原生模块)
|
||||
NODE_PRE_GYP_GITHUB_TOKEN=token
|
||||
node_pre_gyp=https://npmmirror.com/mirrors/node-pre-gyp/
|
||||
|
||||
# 设置python路径(如果需要)
|
||||
python=python3
|
||||
|
||||
# 设置代理(可选,如果有网络代理)
|
||||
# https-proxy=
|
||||
# proxy=
|
@ -6,7 +6,7 @@ import {
|
||||
getConfigById,
|
||||
deleteConfig,
|
||||
} from "../db/config.js";
|
||||
import argon2 from "argon2";
|
||||
import bcrypt from 'bcrypt';
|
||||
|
||||
// 原有接口保持不变
|
||||
/**
|
||||
@ -135,14 +135,19 @@ export async function increaseQuestionBankVersion() {
|
||||
* @param {string} password - 用户输入的密码
|
||||
* @returns {Promise<{success: boolean, message: string}>}
|
||||
*/
|
||||
export async function verifyAdminPassword(password) {
|
||||
/**
|
||||
* 验证管理员密码
|
||||
* @param {string} password - 待验证的密码
|
||||
* @returns {Promise<{success: boolean, message: string}>}
|
||||
*/
|
||||
async function verifyAdminPassword(password) {
|
||||
try {
|
||||
const config = await getConfig("admin_password");
|
||||
if (!config || !config.value) {
|
||||
return { success: false, message: "管理员密码未设置" };
|
||||
}
|
||||
|
||||
const isMatch = await argon2.verify(config.value, password);
|
||||
const isMatch = await bcrypt.compare(password, config.value);
|
||||
if (isMatch) {
|
||||
return { success: true, message: "登录成功" };
|
||||
} else {
|
||||
|
9400
package-lock.json
generated
9400
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
50
package.json
50
package.json
@ -5,7 +5,7 @@
|
||||
"type": "module",
|
||||
"main": "electron/main.js",
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
"node": "12.16.2"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite --mode electron",
|
||||
@ -20,33 +20,31 @@
|
||||
"electron:build:portable32": "vite build && set WIN_CODE_SIGN_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ && electron-builder --win --ia32"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.1",
|
||||
"@fortawesome/fontawesome-svg-core": "^7.0.0",
|
||||
"@fortawesome/free-brands-svg-icons": "^7.0.0",
|
||||
"@fortawesome/free-regular-svg-icons": "^7.0.0",
|
||||
"@fortawesome/free-solid-svg-icons": "^7.0.0",
|
||||
"@fortawesome/vue-fontawesome": "^3.1.1",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"argon2": "^0.43.1",
|
||||
"bootstrap": "^5.3.7",
|
||||
"element-plus": "^2.10.5",
|
||||
"fs": "^0.0.1-security",
|
||||
"pdfkit": "^0.17.1",
|
||||
"popper.js": "^1.16.1",
|
||||
"sqlite": "^5.1.1",
|
||||
"sqlite3": "^5.1.7",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "^4.5.1",
|
||||
"xlsx": "^0.18.5"
|
||||
"@element-plus/icons-vue": "1.1.4",
|
||||
"@fortawesome/fontawesome-svg-core": "6.4.0",
|
||||
"@fortawesome/free-brands-svg-icons": "6.4.0",
|
||||
"@fortawesome/free-regular-svg-icons": "6.4.0",
|
||||
"@fortawesome/free-solid-svg-icons": "6.4.0",
|
||||
"@fortawesome/vue-fontawesome": "3.0.0-5",
|
||||
"@popperjs/core": "2.11.6",
|
||||
"bcrypt": "5.0.1",
|
||||
"bootstrap": "5.2.3",
|
||||
"element-plus": "2.2.36",
|
||||
"fs": "0.0.1-security",
|
||||
"pdfkit": "0.16.0",
|
||||
"popper.js": "1.16.1",
|
||||
"sqlite3": "5.0.2",
|
||||
"vue": "3.2.37",
|
||||
"vue-router": "4.0.16",
|
||||
"xlsx": "0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron/rebuild": "^4.0.1",
|
||||
"@vitejs/plugin-vue": "^6.0.1",
|
||||
"electron": "^37.2.5",
|
||||
"electron-builder": "^26.0.12",
|
||||
"vite": "^7.0.6",
|
||||
"vite-plugin-electron": "^0.29.0",
|
||||
"vite-plugin-vue-devtools": "^8.0.0"
|
||||
"@electron/rebuild": "3.2.10",
|
||||
"@vitejs/plugin-vue": "2.3.3",
|
||||
"electron": "^12.2.3",
|
||||
"electron-builder": "20.38.2",
|
||||
"vite": "2.9.16",
|
||||
"vite-plugin-electron": "0.9.0"
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.example.electron-exam",
|
||||
|
@ -1,35 +1,28 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueDevTools from 'vite-plugin-vue-devtools'
|
||||
import electron from 'vite-plugin-electron'
|
||||
import { fileURLToPath } from 'url';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import electron from 'vite-plugin-electron';
|
||||
|
||||
// 不使用任何global对象操作,仅使用基本配置
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
electron({
|
||||
entry: 'electron/main.js',
|
||||
onstart(options) {
|
||||
// 确保只启动一个 Electron 实例
|
||||
options.startup(['.', '--no-sandbox']);
|
||||
}
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||
'@': '/Users/chenqiang/workspace/work/exam/electron/win7/src'
|
||||
},
|
||||
},
|
||||
build: {
|
||||
// 确保打包后的文件使用相对路径
|
||||
rollupOptions: {
|
||||
output: {
|
||||
assetFileNames: 'assets/[name]-[hash].[ext]',
|
||||
chunkFileNames: 'chunks/[name]-[hash].js',
|
||||
entryFileNames: 'entry-[name]-[hash].js',
|
||||
assetFileNames: 'assets/[name].[hash].[ext]',
|
||||
chunkFileNames: 'assets/[name].[hash].js',
|
||||
entryFileNames: 'assets/[name].[hash].js'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user