Skip to content

feat: electron playground - #38

Merged
aiko-chan-ai merged 4 commits into
masterfrom
dev-electron
May 19, 2026
Merged

feat: electron playground#38
aiko-chan-ai merged 4 commits into
masterfrom
dev-electron

Conversation

@aiko-chan-ai

Copy link
Copy Markdown
Contributor

Enhance the plugin development experience.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an Electron-based “playground” to improve LNReader plugin development/debugging by providing a desktop environment with IPC-backed fetch/cookies/storage, plus a built-in WebView-like browser tab for solving challenges (e.g., Cloudflare) and reusing the same cookie jar.

Changes:

  • Add a new electron/ subproject (Vite + Electron) with preload + main process IPC handlers for fetch/cookies/storage/settings.
  • Update the React UI to detect Electron and route settings persistence through window.electronAPI, and switch chapter preview rendering to an isolated iframe-based preview.
  • Update tooling/config/docs: exclude/ignore Electron from root TS/ESLint, add .gitignore entries, and document the new Electron workflow (VI docs).

Reviewed changes

Copilot reviewed 22 out of 27 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tsconfig.json Excludes electron/ from the root TS project.
eslint.config.js Ignores the electron/ folder in root linting.
src/types/electron.d.ts Adds global typings for window.electronAPI in the web UI codebase.
src/main.tsx Skips the localhost fetch-rewrite when running under Electron.
src/components/settings.tsx Uses Electron IPC for loading/saving settings when available.
src/components/parse-chapter.tsx Reworks chapter preview to render in an iframe and loads plugin custom assets inside it.
electron/vite.config.ts Adds an Electron-specific Vite config that merges the root config and overrides library aliases for IPC.
electron/tsconfig.json Adds a dedicated TS config for the Electron subproject.
electron/preload/preload.ts Implements a contextBridge preload exposing a whitelisted IPC invoke API.
electron/preload/preload.cjs Provides a CommonJS preload variant for direct loading.
electron/package.json Defines Electron subproject scripts and dev dependencies.
electron/package-lock.json Locks Electron subproject dependencies.
electron/main/main.ts Creates the main BrowserWindow, shared persistent session, menu, and a “Spawn New Tab” BrowserWindow.
electron/main/ipc/index.ts Registers IPC handlers via side-effect imports.
electron/main/ipc/fetch-handler.ts Adds IPC-based fetch via net.request, including cookie merge + Set-Cookie persistence.
electron/main/ipc/cookie-handler.ts Adds IPC endpoints for cookie CRUD/flush/clear.
electron/main/ipc/storage-handler.ts Adds a simple JSON-file backed plugin storage service over IPC.
electron/main/ipc/settings-handler.ts Adds in-memory settings + effective User-Agent lookup for IPC fetch.
electron/lib/fetch.ts Renderer-side fetch wrapper that calls IPC and rebuilds a Response.
electron/lib/cookie.ts Renderer-side cookie helpers backed by IPC.
electron/lib/storage.ts Renderer-side storage implementation backed by IPC.
electron/lib/utils.ts Electron renderer override for shared utils (UA caching + Node crypto/Buffer exports).
electron/lib/env.d.ts Electron-side global typing for window.electronAPI.
electron/eslint.config.js Adds a minimal ESLint config for the Electron subproject.
electron/browser/index.html Adds a simple Browser tab UI around a <webview> to interactively solve challenges.
docs/docs_vi.md Documents the new Electron Playground workflow.
.gitignore Ignores Electron build output and .agent/ artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/parse-chapter.tsx
Comment thread electron/tsconfig.json
"include": [
"main/**/*.ts",
"preload/**/*.ts",
"lib/**/*.ts"
Comment thread electron/main/ipc/index.ts
Comment thread electron/main/main.ts
Comment on lines +21 to +26
sandbox: true,
session: customSession,
preload: process.env.VITE_DEV_SERVER_URL
? path.resolve(__dirname, '../../preload/preload.cjs')
: path.join(__dirname, '../preload/preload.cjs'),
},
Comment on lines +173 to +181
const parts = raw.split(';').map(s => s.trim());
const [nameVal, ...attrs] = parts;
const eqIdx = nameVal.indexOf('=');

const details: Electron.CookiesSetDetails = {
url: requestUrl,
name: nameVal.substring(0, eqIdx),
value: nameVal.substring(eqIdx + 1),
};
@aiko-chan-ai
aiko-chan-ai merged commit 782f80a into master May 19, 2026
5 of 6 checks passed
@aiko-chan-ai
aiko-chan-ai deleted the dev-electron branch May 19, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants