Skip to content

Commit 8822a48

Browse files
committed
feat:setting and optimize
1 parent daf391b commit 8822a48

27 files changed

Lines changed: 433 additions & 203 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "0.0.2",
55
"main": "dist/main/index.js",
66
"scripts": {
7-
"dev": "vite",
7+
"dev": "vite --force",
88
"dev-main": "tsc -w --p ./src/main",
99
"dev-ele": "nodemon --watch ./dist/main/* --exec electron .",
1010
"build": "tsc && vite build && tsc -p ./src/main && electron-builder --ia32 --dir",

resources/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"api":{"api":"https://api.hotpe.top/","ghapi":"http://ghapi.hotpe.top/","dl":"http://p0.hotpe.top/"},"state":{"install":"noSetup","resUpdate":"without","setupToSys":"without"},"environment":{"HotPEDrive":{"new":{"diskIndex":-1,"letter":"","isMove":false,"version":""},"all":[]},"ware":{"system":{"os":"Windows 11 22H2","buildNumber":"10.0.22621","userName":"yyds_","architecture":"x64","firmware":"UEFI"},"disks":[{"index":0,"name":"KIOXIA-EXCERIA SATA SSD","type":"SATA","size":480102899200,"removable":true,"partitions":[{"index":1,"letter":"E:\\"}]},{"index":1,"name":"TOSHIBA HDWD105","type":"SATA","size":500106780160,"removable":true,"partitions":[{"index":1,"letter":"F:\\"}]},{"index":2,"name":"NVME SSD 1TB","type":"NVMe","size":1000204886016,"removable":true,"partitions":[{"index":3,"letter":"C:\\"},{"index":4,"letter":"D:\\"},{"index":1,"letter":""}]},{"index":3,"name":"SSD 128GB","type":"NVMe","size":128035676160,"removable":true,"partitions":[{"index":1,"letter":"G:\\"}]}]}},"resources":{"pe":{"new":"230430.7z","all":["230430.7z"],"update":{"id":"230430","name":"V2.5 Final Build20230430","description":"- 更新PE内核\r\n- HPM管理适配高DPI\r\n- 更新内置软件\r\n- 更新HPM加载窗口样式\r\n- 安装程序适配高DPI\r\n- 移除资源管理器里的快速访问\r\n- 更换网络管理\r\n- 优化HPM加载器\r\n- 移除失效的“在线Edgeless插件”功能\r\n- 移除PECMD托盘图标\r\n- 美化开始菜单","url":"http://p0.hotpe.top/Package/PE/230430.7z","date":"2023-04-30T07:42:48Z"}},"client":{"new":"","all":[],"update":{"id":"230722","name":"V0.2.230722-alpha.2","description":"- 修复更新失败问题\r\n- 增加错误捕获\r\n","url":"http://p0.hotpe.top/Package/Cilent/230722.7z","date":"2023-07-22T02:19:30Z"}}},"directory":{},"notice":{"show":true,"type":"info","content":"提示:此版为开发预览版,并不代表最终的发布版,遇到Bug或有建议请反馈给开发者。"},"download":{"thread":16},"setting":{"pe":{"bootWaitTime":3}}}

resources/tools/PACMDforUSB/cfg.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Vdr=aomei
77
Spd=pa
88
ProductName=Windows 10 Enterprise x64
99
fdate=20220106
10-
ldate=20230720
10+
ldate=20230722
1111
Lang=cn
1212
Ver=9.13.0

resources/tools/aria2c.exe

252 KB
Binary file not shown.

src/main/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import path from 'path'
55
//是否为开发模式
66
import isDev from 'electron-is-dev'
77

8-
98
app.on('ready', () => {
109
//创建一个窗口
1110
const mainWindow = new BrowserWindow({
@@ -26,6 +25,7 @@ app.on('ready', () => {
2625
}
2726
})
2827

28+
2929
//窗口加载html文件
3030
//mainWindow.loadFile('./src/main.html')
3131
mainWindow.loadURL(isDev ? 'http://localhost:5173' : `file://${path.join(__dirname, '../view/index.html')}`);
@@ -68,6 +68,16 @@ app.on('ready', () => {
6868
})
6969
})
7070

71+
ipcMain.on('file:getOpenPath', (event, message) => {
72+
event.returnValue = dialog.showOpenDialogSync({
73+
title: "请选择壁纸文件",
74+
buttonLabel: "打开",
75+
defaultPath: message.toString(),
76+
filters: [
77+
{ name: 'jpg图片文件', extensions: ['jpg','jpeg'] },
78+
]
79+
})
80+
})
7181

7282

7383
})

src/view/controller/Install/toSystem.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ const bcdeditPath = roConfig.path.tools + 'bcdedit.exe'
1717
const tempPath = roConfig.path.clientTemp + 'install\\peFiles\\'
1818

1919
//更新标记
20-
let isUpdate =false
20+
let isUpdate = false
2121

22-
export async function installToSystem(setCurrentStep: Function, setStepStr: Function,setLockMuen:Function) {
22+
export async function installToSystem(setCurrentStep: Function, setStepStr: Function, setLockMuen: Function) {
2323

24-
if(!checkIsReady()){return};// 检查是否准备就绪
24+
if (!checkIsReady()) { return };// 检查是否准备就绪
2525

2626
setLockMuen(true)
2727

@@ -67,9 +67,7 @@ export async function installToSystem(setCurrentStep: Function, setStepStr: Func
6767
setCurrentStep(2)
6868
setStepStr('正在添加HotPE引导')
6969

70-
7170
let installLetter = roConfig.environment.sysLetter.substring(0, 2)
72-
7371

7472
await runCmdAsync(bcdeditPath + ' /create ' + GUID1 + ' /d HotPE工具箱 /application osloader')
7573
await runCmdAsync(bcdeditPath + ' /create ' + GUID2 + ' /d HotPE工具箱 /device')
@@ -92,7 +90,7 @@ export async function installToSystem(setCurrentStep: Function, setStepStr: Func
9290
await runCmdAsync(bcdeditPath + ' /set ' + GUID1 + ' winpe Yes')
9391
await runCmdAsync(bcdeditPath + ' /displayorder ' + GUID1 + ' /addlast')
9492

95-
await runCmdAsync(bcdeditPath + ' /timeout 3')
93+
await runCmdAsync(bcdeditPath + ' /timeout ' + config.setting.pe.bootWaitTime)
9694

9795
//下面两项跟开机动画实现有关
9896
//await runCmdAsync(bcdeditPath + ' /set {bootmgr} nointegritychecks yes')//禁用数字签名检查
@@ -109,7 +107,7 @@ export async function installToSystem(setCurrentStep: Function, setStepStr: Func
109107
await checkPEDrive()
110108

111109

112-
if(!isUpdate){
110+
if (!isUpdate) {
113111
Notification.success({
114112
title: '安装到系统完成!',
115113
content: '每次重启都有3S的等待时间。',
@@ -128,40 +126,40 @@ export async function installToSystem(setCurrentStep: Function, setStepStr: Func
128126

129127

130128

131-
export async function uninstallToSystem(setIsUninstalling: Function,setLockMuen:Function) {
129+
export async function uninstallToSystem(setIsUninstalling: Function, setLockMuen: Function) {
132130
setIsUninstalling(true)
133131
setLockMuen(true)
134132

135-
await runCmdAsync(bcdeditPath + ' /delete '+GUID2+' /f')
136-
await runCmdAsync(bcdeditPath + ' /delete '+GUID1+' /f')
133+
await runCmdAsync(bcdeditPath + ' /delete ' + GUID2 + ' /f')
134+
await runCmdAsync(bcdeditPath + ' /delete ' + GUID1 + ' /f')
137135

138136
await delDir(roConfig.environment.sysLetter + 'HotPE\\')
139137
await delDir(roConfig.environment.sysLetter + 'HotPEModule\\')
140138

141139
//更新PE安装状态
142140
await checkPEDrive()
143141

144-
if(!isUpdate){
142+
if (!isUpdate) {
145143
Notification.success({
146144
title: 'HotPE卸载完成!',
147145
content: '感谢你的使用!我会改进不足,等待你的回归。',
148146
duration: 5,
149147
})
150148
}
151-
149+
152150
setLockMuen(false)
153151
setIsUninstalling(false)
154152
}
155153

156-
export async function updatePEForSys(setIsUninstalling: Function,setCurrentStep: Function, setStepStr: Function,setLockMuen:Function){
157-
if(!checkIsReady()){return};// 检查是否准备就绪
154+
export async function updatePEForSys(setIsUninstalling: Function, setCurrentStep: Function, setStepStr: Function, setLockMuen: Function) {
155+
if (!checkIsReady()) { return };// 检查是否准备就绪
158156

159157
setLockMuen(true)
160158
isUpdate = true
161159

162-
await uninstallToSystem(setIsUninstalling,setLockMuen)
160+
await uninstallToSystem(setIsUninstalling, setLockMuen)
163161

164-
await installToSystem(setCurrentStep, setStepStr,setLockMuen)
162+
await installToSystem(setCurrentStep, setStepStr, setLockMuen)
165163

166164
//更新PE安装状态
167165
await checkPEDrive()

src/view/controller/condition.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,12 @@ export async function checkPEDrive() {
2727
//刷新一下DiskList
2828
await getEnvironment()
2929

30+
config.state.setupToSys = 'without'
3031

3132
//清空
3233
config.environment.HotPEDrive.all = []
3334
config.environment.HotPEDrive.new = { diskIndex: -1, letter: '', isMove: false, version: '' }
3435

35-
config.state.setupToSys = 'without'
36-
37-
3836
//系统安装的PE
3937
/* let SysLetter = roConfig.environment.sysLetter
4038
if (isHotPEDrive(SysLetter)) {
@@ -59,7 +57,11 @@ export async function checkPEDrive() {
5957
let partition = disk.partitions[iP]
6058
if (partition.letter != '') {
6159
if (isHotPEDrive(partition.letter)) {
62-
config.environment.HotPEDrive.all.push({ diskIndex: disk.index, letter: partition.letter, isMove: disk.type == 'USB', version: readHotPEConfig(partition.letter).information.ReleaseVersion })
60+
let HotPEDriveInfoTemp = { diskIndex: disk.index, letter: partition.letter, isMove: disk.type == 'USB', version: readHotPEConfig(partition.letter).information.ReleaseVersion }
61+
if(!config.environment.HotPEDrive.all.includes(HotPEDriveInfoTemp)){
62+
config.environment.HotPEDrive.all.push(HotPEDriveInfoTemp)
63+
}
64+
6365

6466
//判断是否为系统安装的PE
6567
if (partition.letter == roConfig.environment.sysLetter) {
@@ -76,17 +78,18 @@ export async function checkPEDrive() {
7678
if (config.environment.HotPEDrive.all.length == 1) {
7779
config.environment.HotPEDrive.new = config.environment.HotPEDrive.all[0]
7880
} */
81+
console.log('HotPEDrive:', config.environment.HotPEDrive);
82+
config.environment.HotPEDrive.all = Array.from(new Set(config.environment.HotPEDrive.all))//去重
83+
console.log('HotPEDrive:', config.environment.HotPEDrive);
7984

8085
//选择最后一个PE盘符
8186
if (config.environment.HotPEDrive.all.length > 0) {
8287
config.environment.HotPEDrive.new = config.environment.HotPEDrive.all[config.environment.HotPEDrive.all.length - 1]
8388

8489
//更新HPM列表本地
85-
checkHPMFiles()
90+
await checkHPMFiles()
8691
}
8792

88-
console.log('HotPEDrive:', config.environment.HotPEDrive);
89-
9093
//更新安装状态(首页
9194
await updateState()
9295
}

src/view/controller/dlRes.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ export function dlPERes(setDlPercent: Function, setDlSpeed: Function, callback:
1111

1212
aria2.start(config.resources.pe.update.url, roConfig.path.resources.pe, config.resources.pe.update.id + '.7z', config.download.thread,
1313
async (back: Aria2Attrib) => {
14+
1415
if (back.state != 'error' && back.state != "done") {
1516
setDlPercent(back.percentage)
16-
setDlSpeed(back.speed)
17+
if(back.state=='doing'){
18+
setDlSpeed(`${back.speed}(${back.newSize}\\${back.size},${back.remainder})`)
19+
}else{
20+
setDlSpeed('请求中...')
21+
}
22+
1723
} else if (back.state == "done") {
1824
setDlPercent(-1)
1925
//检查资源
@@ -38,7 +44,11 @@ export function dlClientRes(setDlPercent: Function, setDlSpeed: Function, callba
3844
async (back: Aria2Attrib) => {
3945
if (back.state != 'error' && back.state != "done") {
4046
setDlPercent(back.percentage)
41-
setDlSpeed(back.speed)
47+
if(back.state=='doing'){
48+
setDlSpeed(`${back.speed}(${back.newSize}\\${back.size},${back.remainder})`)
49+
}else{
50+
setDlSpeed('请求中...')
51+
}
4252
} else if (back.state == "done") {
4353
//setDlPercent(-1)
4454
//检查资源

src/view/controller/hpm/checkHpmFiles.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ export async function checkHPMFiles() {
2020
})
2121

2222
//排除没有下载完成的
23-
for(let i in HPMListLocal.on){
24-
if(await isFileExisted(HPMDirPath+HPMListLocal.on[i].fileName+'.aria2')){
23+
for (let i in HPMListLocal.on) {
24+
if (await isFileExisted(HPMDirPath + HPMListLocal.on[i].fileName + '.aria2')) {
2525
//alert(HPMListLocal.on[1].fileName)
26-
HPMListLocal.on.splice(Number(i),1)
26+
HPMListLocal.on.splice(Number(i), 1)
2727
}
2828
}
2929

@@ -32,8 +32,8 @@ export async function checkHPMFiles() {
3232
return getHPMinfoLocal(HPMDirPath, fileName)
3333
})
3434

35-
HPMListLocal.on =onHPMTemp
36-
HPMListLocal.off =offHPMTemp
35+
HPMListLocal.on = onHPMTemp
36+
HPMListLocal.off = offHPMTemp
3737
console.log(HPMListLocal);
3838

3939
isCheckingHPMFiles = false

src/view/controller/hpm/hpm.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ import { takeLeftStr, takeRightStr } from "../../utils/utils"
66
const fs = window.require('fs')
77

88
//通过文件名,和路径获取HPMInfo
9-
export function getHPMinfoLocal(HPMFilePath:string,HPMFileName: string) {
9+
export function getHPMinfoLocal(HPMFilePath: string, HPMFileName: string) {
1010

11-
let hpmFileInfo= fs.statSync(HPMFilePath+HPMFileName)
11+
let hpmFileInfo = fs.statSync(HPMFilePath + HPMFileName)
1212

1313
let hpmInfo = HPMFileName.split('_')
14-
let HPM:HPM = {
14+
let HPM: HPM = {
1515
fileName: HPMFileName,
16-
size:hpmFileInfo.size,
16+
size: hpmFileInfo.size,
1717
name: hpmInfo[0],
1818
maker: hpmInfo[1],
1919
version: hpmInfo[2],
20-
description: takeLeftStr(hpmInfo[3],'.'),
21-
time:hpmFileInfo.ctime
20+
description: takeLeftStr(hpmInfo[3], '.'),
21+
time: hpmFileInfo.ctime
2222
}
2323
return HPM
2424
}
2525

2626
//检查是否有模块文件夹,可进行模块操作
27-
export function isHPMReady(){
28-
if(config.environment.HotPEDrive.new.letter !=''){
27+
export function isHPMReady() {
28+
if (config.environment.HotPEDrive.new.letter != '') {
2929
return true
3030
}
3131
Notification.info({

0 commit comments

Comments
 (0)