diff --git a/.env.development b/.env.development index 4642c3e8..f7103f58 100644 --- a/.env.development +++ b/.env.development @@ -1 +1,2 @@ -VITE_BUILD_TYPE = Development \ No newline at end of file +VITE_BUILD_TYPE = Development +VITE_BUILD_TARGE = Normal \ No newline at end of file diff --git a/.env.liteloader b/.env.liteloader new file mode 100644 index 00000000..e4915151 --- /dev/null +++ b/.env.liteloader @@ -0,0 +1,2 @@ +VITE_BUILD_TYPE = Production +VITE_BUILD_TARGE = Liteloader \ No newline at end of file diff --git a/.env.production b/.env.production index 2f6aa849..d21d5a1d 100644 --- a/.env.production +++ b/.env.production @@ -1 +1,2 @@ VITE_BUILD_TYPE = Production +VITE_BUILD_TARGE = Normal \ No newline at end of file diff --git a/src/core b/src/core index 48c585b7..8fe46277 160000 --- a/src/core +++ b/src/core @@ -1 +1 @@ -Subproject commit 48c585b7e0d05f591b9ae45b84e805ca611fe313 +Subproject commit 8fe462777a9fa4fca1d67a8973be93b051960753 diff --git a/src/liteloader/main.ts b/src/liteloader/main.ts new file mode 100644 index 00000000..101bfcf4 --- /dev/null +++ b/src/liteloader/main.ts @@ -0,0 +1,17 @@ +type BrowserWindow = any; +function onBrowserWindowCreated(window: BrowserWindow) { + +} +async function loadNapCat() { + +} + +try { + loadNapCat(); +} catch { + console.log("loadNapCat error"); +} +export { + onBrowserWindowCreated +}; + diff --git a/src/liteloader/preload.ts b/src/liteloader/preload.ts new file mode 100644 index 00000000..41c47c11 --- /dev/null +++ b/src/liteloader/preload.ts @@ -0,0 +1 @@ +//暂且留空 \ No newline at end of file diff --git a/src/liteloader/renderer.ts b/src/liteloader/renderer.ts new file mode 100644 index 00000000..c4a90b55 --- /dev/null +++ b/src/liteloader/renderer.ts @@ -0,0 +1,18 @@ +async function onSettingWindowCreated(view: Element) { + const iframe = document.createElement('iframe'); + iframe.src = 'http://127.0.0.1:6099/webui/'; //应该从 preload->main 那里获取 + iframe.style.cssText = 'position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none;'; + view.appendChild(iframe); +} +async function isRendererInit() { + +} + +if (location.hash === '#/blank') { + (window as any).navigation.addEventListener('navigatesuccess', isRendererInit, { once: true }); +} else { + isRendererInit(); +} +export { + onSettingWindowCreated +}; diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 00000000..f10468ac --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,10 @@ +/// + +interface ImportMetaEnv { + readonly VITE_BUILD_TYPE: string + readonly VITE_BUILD_TARGE: string + } + + interface ImportMeta { + readonly env: ImportMetaEnv + } \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index a00d9322..97d24e78 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,3 @@ -// import PreprocessorDirectives from 'unplugin-preprocessor-directives/vite'; import obfuscator from 'rollup-plugin-obfuscator'; import cp from 'vite-plugin-cp'; import { UserConfig, defineConfig } from 'vite';