feat: try support LiteLoader

This commit is contained in:
手瓜一十雪 2024-05-23 16:30:29 +08:00
parent bc7b4dcc2a
commit 8101d17482
9 changed files with 52 additions and 3 deletions

View File

@ -1 +1,2 @@
VITE_BUILD_TYPE = Development
VITE_BUILD_TARGE = Normal

2
.env.liteloader Normal file
View File

@ -0,0 +1,2 @@
VITE_BUILD_TYPE = Production
VITE_BUILD_TARGE = Liteloader

View File

@ -1 +1,2 @@
VITE_BUILD_TYPE = Production
VITE_BUILD_TARGE = Normal

@ -1 +1 @@
Subproject commit 48c585b7e0d05f591b9ae45b84e805ca611fe313
Subproject commit 8fe462777a9fa4fca1d67a8973be93b051960753

17
src/liteloader/main.ts Normal file
View File

@ -0,0 +1,17 @@
type BrowserWindow = any;
function onBrowserWindowCreated(window: BrowserWindow) {
}
async function loadNapCat() {
}
try {
loadNapCat();
} catch {
console.log("loadNapCat error");
}
export {
onBrowserWindowCreated
};

View File

@ -0,0 +1 @@
//暂且留空

View File

@ -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
};

10
src/vite-env.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_BUILD_TYPE: string
readonly VITE_BUILD_TARGE: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

View File

@ -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';