Track bundled vendor runtime sources
This commit is contained in:
37
vendor/aigcpanel/electron/mapi/updater/index.ts
vendored
Normal file
37
vendor/aigcpanel/electron/mapi/updater/index.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import { AppConfig } from "../../../src/config";
|
||||
import {
|
||||
platformArch,
|
||||
platformName,
|
||||
platformUUID,
|
||||
platformVersion,
|
||||
} from "../../lib/env";
|
||||
|
||||
const checkForUpdate = async () => {
|
||||
try {
|
||||
const res = await fetch(AppConfig.updaterUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
version: AppConfig.version,
|
||||
uuid: platformUUID(),
|
||||
platform: {
|
||||
name: platformName(),
|
||||
version: platformVersion(),
|
||||
arch: platformArch(),
|
||||
},
|
||||
}),
|
||||
});
|
||||
return await res.json();
|
||||
} catch (e) {
|
||||
return {
|
||||
code: -1,
|
||||
msg: `Failed to check update : ${e.message}`,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
checkForUpdate,
|
||||
};
|
||||
17
vendor/aigcpanel/electron/mapi/updater/main.ts
vendored
Normal file
17
vendor/aigcpanel/electron/mapi/updater/main.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import updaterIndex from "./index";
|
||||
import { ipcMain } from "electron";
|
||||
import ConfigMain from "../config/main";
|
||||
|
||||
ipcMain.handle("updater:getCheckAtLaunch", async (event) => {
|
||||
return ConfigMain.get("updaterCheckAtLaunch", "yes");
|
||||
});
|
||||
|
||||
ipcMain.handle("updater:setCheckAtLaunch", async (event, value) => {
|
||||
return ConfigMain.set("updaterCheckAtLaunch", value);
|
||||
});
|
||||
|
||||
export const UpdaterMain = {
|
||||
...updaterIndex,
|
||||
};
|
||||
|
||||
export default UpdaterMain;
|
||||
16
vendor/aigcpanel/electron/mapi/updater/render.ts
vendored
Normal file
16
vendor/aigcpanel/electron/mapi/updater/render.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import updaterIndex from "./index";
|
||||
import { ipcRenderer } from "electron";
|
||||
|
||||
const getCheckAtLaunch = async (): Promise<"yes" | "no"> => {
|
||||
return ipcRenderer.invoke("updater:getCheckAtLaunch");
|
||||
};
|
||||
|
||||
const setCheckAtLaunch = async (value: "yes" | "no"): Promise<void> => {
|
||||
return ipcRenderer.invoke("updater:setCheckAtLaunch", value);
|
||||
};
|
||||
|
||||
export default {
|
||||
...updaterIndex,
|
||||
getCheckAtLaunch,
|
||||
setCheckAtLaunch,
|
||||
};
|
||||
Reference in New Issue
Block a user