Skip to content

Commit

Permalink
fix(app): 新增软件 zip 打包方式,修复工作区丢失的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Jun 11, 2022
1 parent f945a80 commit 8fe1357
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
3 changes: 3 additions & 0 deletions packages/app/electron.builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"ia32",
"x64"
]
},
{
"target": "zip"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ocsjs/app",
"version": "1.4.0",
"version": "1.4.2",
"description": "app package of ocs",
"main": "./lib/index.js",
"types": "./lib/types.d.ts",
Expand Down
13 changes: 11 additions & 2 deletions packages/app/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,19 @@ export const appStore = {
alwaysOnTop: false,
notify: [] as any[],
/** 脚本启动设置 */
script: {} as any,
script: {
/** 是否使用 --user-data-dir (false 为无痕浏览) */
userDataDir: false,
launchOptions: {
/** 无头浏览 */
headless: false,
/** 浏览器路径 */
executablePath: ''
}
},
/** 脚本默认设置 */
setting: {
answererWrappers: []
answererWrappers: [] as any[]
},
/** 用户脚本列表 */
userScripts: [] as UserScripts[],
Expand Down
12 changes: 11 additions & 1 deletion packages/app/src/tasks/init.store.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
// @ts-check

import Store from 'electron-store';
import { existsSync, mkdirSync } from 'fs';
import { appStore } from '../store';

/**
* 初始化配置
*/
export function initStore() {
const store = new Store();
if (!existsSync(appStore.workspace)) {
mkdirSync(appStore.workspace, { recursive: true });
}
if (!store.get('version')) {
appStore.notify = Array.from(store.get('notify') as any[] || []);
appStore.script = store.get('script') || {};
appStore.script = store.get('script') as any || {
userDataDir: '',
launchOptions: {
headless: false,
executablePath: ''
}
};
store.store = appStore;
}
}
3 changes: 2 additions & 1 deletion packages/web/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export const store = reactive<AppStore & {
/** 是否使用 --user-data-dir (false 为无痕浏览) */
userDataDir: false,
launchOptions: {
headless: false
headless: false,
executablePath: ''
}
},
/** 浏览器脚本默认设置 */
Expand Down

0 comments on commit 8fe1357

Please sign in to comment.