mirror of
https://github.com/felixrieseberg/windows95.git
synced 2026-05-09 00:24:09 +00:00
The previous build patched libv86.js by exact-string match against
Closure-mangled identifiers (k.load_file, H.exportSymbol, pa, qa),
which broke on every upstream rebuild.
Of the three old patches:
- exportSymbol order: now a one-line HTML shim copying module.exports.V86
to window after libv86 loads
- this.fetch binding: fixed upstream
- load_file XHR vs fs: replaced by patching await import('node:fs/promises')
to require('fs').promises - string literals survive Closure, fails loud
if absent
Also adds tools/update-v86.js to pull new builds from copy.sh, and exposes
the renderer DevTools protocol on localhost:9222 in dev.
80 lines
1.9 KiB
TypeScript
80 lines
1.9 KiB
TypeScript
import { app } from "electron";
|
|
|
|
import { isDevMode } from "../utils/devmode";
|
|
import { setupAboutPanel } from "./about-panel";
|
|
import { shouldQuit } from "./squirrel";
|
|
import { setupUpdates } from "./update";
|
|
import { getOrCreateWindow } from "./windows";
|
|
import { setupMenu } from "./menu";
|
|
import { setupIpcListeners } from "./ipc";
|
|
import { setupSession } from "./session";
|
|
import { setupFileServer } from "./fileserver/fileserver";
|
|
|
|
/**
|
|
* Handle the app's "ready" event. This is essentially
|
|
* the method that takes care of booting the application.
|
|
*/
|
|
export async function onReady() {
|
|
if (!isDevMode()) process.env.NODE_ENV = "production";
|
|
|
|
setupSession();
|
|
setupIpcListeners();
|
|
getOrCreateWindow();
|
|
setupAboutPanel();
|
|
setupMenu();
|
|
setupUpdates();
|
|
setupFileServer();
|
|
}
|
|
|
|
/**
|
|
* Handle the "before-quit" event
|
|
*
|
|
* @export
|
|
*/
|
|
export function onBeforeQuit() {
|
|
(global as any).isQuitting = true;
|
|
}
|
|
|
|
/**
|
|
* All windows have been closed, quit on anything but
|
|
* macOS.
|
|
*/
|
|
export function onWindowsAllClosed() {
|
|
// On OS X it is common for applications and their menu bar
|
|
// to stay active until the user quits explicitly with Cmd + Q
|
|
if (process.platform !== "darwin") {
|
|
app.quit();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* The main method - and the first function to run
|
|
* when Fiddle is launched.
|
|
*
|
|
* Exported for testing purposes.
|
|
*/
|
|
export function main() {
|
|
// Handle creating/removing shortcuts on Windows when
|
|
// installing/uninstalling.
|
|
if (shouldQuit()) {
|
|
app.quit();
|
|
return;
|
|
}
|
|
|
|
if (isDevMode()) {
|
|
// Renderer DevTools Protocol — connect Chrome to chrome://inspect
|
|
// or attach a debugger to localhost:9222
|
|
app.commandLine.appendSwitch("remote-debugging-port", "9222");
|
|
}
|
|
|
|
// Set the app's name
|
|
app.setName("windows95");
|
|
|
|
// Launch
|
|
app.on("ready", onReady);
|
|
app.on("before-quit", onBeforeQuit);
|
|
app.on("window-all-closed", onWindowsAllClosed);
|
|
}
|
|
|
|
main();
|