refactor(launcher): open mod documentation on wto-project.net

Replace the local offline HTML mod docs viewer in the launcher Mods page with a direct link to https://wto-project.net/mod-docs, remove the unused mods:openDocs IPC path and resource entry, and drop build-mod-docs-html.ts from Windows packaging while keeping bundled mod templates intact. Root typecheck, launcher typecheck, and electron-vite build passed.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 06:26:52 +08:00
1 parent 742094ea1e
commit 02fe867cf1
7 files changed
+4 -439

No files matched your search

-2
View File
@@ -24,7 +24,6 @@ import {
exportModPreset,
getModsState,
importModPreset,
openModDocs,
openModsFolder,
saveModPreset,
setModEnabled,
@@ -224,7 +223,6 @@ export function registerIpcHandlers(): void {
return importModPreset(copyId, BrowserWindow.fromWebContents(sender));
});
handle('mods:openFolder', () => openModsFolder());
handle('mods:openDocs', (input) => openModDocs(input?.language));
handle('mods:setFolder', async ({ copyId, path }) => {
requireModsWritable();
const state = await setModsFolder(copyId, path);
@@ -118,20 +118,6 @@ export async function openModsFolder(): Promise<void> {
if (failure) console.warn('[mods] opening the mods folder failed:', modsDir, failure);
}
export async function openModDocs(language?: string): Promise<void> {
const docsRoot = resourcePaths().modDocs;
const preferred = language && language.toLowerCase().startsWith('zh') ? 'zh-CN.html' : 'en.html';
const fallback = preferred === 'zh-CN.html' ? 'en.html' : 'zh-CN.html';
const target = (await pathExists(join(docsRoot, preferred)))
? join(docsRoot, preferred)
: join(docsRoot, fallback);
if (!(await pathExists(target))) {
throw new AppError('folder_unreadable', { path: docsRoot });
}
const failure = await shell.openPath(target);
if (failure) console.warn('[mods] opening the mod docs failed:', target, failure);
}
export async function getModsState(copyId: string): Promise<ModsStateView> {
const copy = await requireCopy(copyId);
return buildModsStateView(copy);
@@ -19,8 +19,6 @@ export interface ResourcePaths {
readonly appIcon: string;
/** Bundled example mod templates seeded into an empty mods folder on first use. */
readonly modTemplates: string;
/** Offline HTML mod development handbook (zh-CN.html and en.html). */
readonly modDocs: string;
}
export function resourcePaths(): ResourcePaths {
@@ -37,7 +35,6 @@ export function bundledResourcePaths(): ResourcePaths {
networkHookLibrary: join(process.resourcesPath, 'native', 'wto_ws.dll'),
appIcon: join(process.resourcesPath, 'icon.ico'),
modTemplates: join(process.resourcesPath, 'mod-templates'),
modDocs: join(process.resourcesPath, 'mod-dev-docs'),
};
}
// The app path is apps/launcher; the repository is two levels up.
@@ -47,7 +44,6 @@ export function bundledResourcePaths(): ResourcePaths {
networkHookLibrary: join(repository, 'build', 'native', 'wto_ws.dll'),
appIcon: join(repository, 'apps', 'launcher', 'resources', 'icon.ico'),
modTemplates: join(repository, 'mod-dev-docs', 'templates'),
modDocs: join(repository, 'build', 'mod-dev-docs'),
};
}