Skip to content

Commit

Permalink
feat(app): 软件更新,支持超星学习作业考试,支持脚本自动更新
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Mar 26, 2022
1 parent 1c78551 commit f500119
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 2 additions & 3 deletions packages/scripts/src/nodejs/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export async function launchScripts({ userDataDir, launchOptions, scripts, sync
let page = await browser.newPage();

if (init) {
initScript(browser);
await initScript(browser);
}

if (sync) {
Expand Down Expand Up @@ -93,10 +93,9 @@ export function script<T extends keyof ScriptOptions>(name: T, options: ScriptOp
async function initScript(browser: Browser | BrowserContext) {
/** 获取最新资源信息 */
const { data } = await axios.get("https://cdn.jsdelivr.net/npm/ocsjs/public/infos.json?t=" + Date.now());
const info = JSON.parse(data);

const page = await browser.newPage();
await page.goto(info.resource.tampermonkey);
await page.goto(data.resource.tampermonkey);

const [installPage] = await Promise.all([
page.context().waitForEvent("page"),
Expand Down
5 changes: 0 additions & 5 deletions packages/web/src/components/file/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@ function run() {

/** 运行 */
data.process.launch(data.options);
// @ts-ignore
if (data.options.init === undefined) {
// @ts-ignore 关闭初始化,下次将不再初始化脚本
data.options.init = false;
}
} else {
data.process.close();
}
Expand Down

0 comments on commit f500119

Please sign in to comment.