Skip to content

Alpha version of ELXMOJ#2

Merged
PythonSmall-Q merged 22 commits intomasterfrom
ptsq/write-app-from-scratch
Mar 21, 2026
Merged

Alpha version of ELXMOJ#2
PythonSmall-Q merged 22 commits intomasterfrom
ptsq/write-app-from-scratch

Conversation

@PythonSmall-Q
Copy link
Member

@PythonSmall-Q PythonSmall-Q commented Mar 19, 2026

please do not accept copilot suggestions since they often break the fragile code

the app runs on a fragile base which breaks easily due to the fact that I transplant the script through translation

Copilot AI review requested due to automatic review settings March 19, 2026 14:27
Update .github/workflows/code-check.yml: remove the actions/setup-node cache setting and replace `npm ci` with `npm install` for the Install dependencies step. This changes how dependencies are installed in the code-check job, accommodating environments where `npm ci` or the previous cache configuration was problematic.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces an Electron-based launcher (“ELXMOJ”) that loads https://www.xmoj.tech, injects the bundled/managed XMOJ.user.js, and adds update/self-check + settings persistence.

Changes:

  • Adds main/preload process implementation for userscript injection, IPC bridges, update checks, and self-check tooling.
  • Adds settings UI (HTML/JS) and filesystem-backed persistence for app settings + a managed userscript copy.
  • Adds project scaffolding: ESLint config, npm scripts, and GitHub Actions workflows for checks and release builds.

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/main.js Electron app bootstrap, windows/menu, IPC handlers, update/self-check orchestration
src/preload.js Userscript injection pipeline, GM_* shims, @require loader, renderer↔main bridge exposure
src/updater.js Download helper + userscript metadata parsing and version comparison
src/storage.js Persists settings + manages the userscript file under Electron userData
src/settings.html Settings window UI
src/settings.js Settings window logic and IPC calls
package.json App metadata, scripts, dev dependencies, electron-builder config
eslint.config.js ESLint flat config for src JS
README.md Usage/build/check documentation
.github/workflows/code-check.yml CI for lint + syntax checks
.github/workflows/release-build.yml Multi-OS build + release workflow
.gitignore Basic ignore rules

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 19, 2026 14:33
PythonSmall-Q and others added 3 commits March 19, 2026 22:33
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces an Electron-based launcher (“ELXMOJ”) that loads https://www.xmoj.tech, injects the bundled/managed XMOJ.user.js, and adds update/self-check + persistent settings to support an alpha release.

Changes:

  • Added Electron main/preload implementation for userscript injection, GM_* shims, update checking, and self-check.
  • Added settings persistence + settings UI (HTML/JS) for channel selection and startup behaviors.
  • Added project tooling: ESLint config, packaging scripts (electron-builder), and GitHub Actions workflows; updated README.

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/main.js Electron main process: window creation, menus, IPC handlers, updater + self-check orchestration
src/preload.js Preload bridge: injection pipeline, GM polyfills, @require loading, cookie/credential shims, ELXMOJ API exposure
src/updater.js Update channel URLs + script download + metadata/version parsing helpers
src/storage.js Settings + managed userscript persistence under Electron userData
src/settings.html Settings window UI
src/settings.js Settings window logic (load/save/update/self-check actions)
package.json App metadata, scripts, devDependencies, electron-builder config
eslint.config.js ESLint flat config for src/
README.md Usage/docs for running, self-check, CI, packaging, persistence
.gitignore Added ignore rules (currently only node_modules/)
.github/workflows/code-check.yml CI lint/syntax check workflow
.github/workflows/release-build.yml Tag/manual release build workflow with artifact upload + GitHub Release publish

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

Make small cleanups in src/preload.js: remove the returned value from the cookie shim setter so the nativeSet result is not propagated; simplify the double-quote regex literal in the markdown fallback; and drop unused parameters from GM_registerMenuCommand (Electron provides menu commands, so the page-level registration is left as a no-op). These are minor refactors to tidy behavior and avoid unnecessary return/unused-arg usage.
Add application icon assets (app.ico, app.png, favicon.ico) and include build/icons in packaged files. Configure platform-specific icons in package.json for Windows, macOS, and Linux. Update src/main.js to compute APP_ICON_PATH based on platform and set it on created BrowserWindow instances so the app windows use the provided icons.
Copilot AI review requested due to automatic review settings March 19, 2026 15:22
Copy link

Copilot AI left a comment

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 introduces an initial (“alpha”) Electron-based launcher for XMOJ (“ELXMOJ”), including userscript injection, update checking, a settings UI, and CI/build packaging configuration.

Changes:

  • Add Electron main/preload processes to load https://www.xmoj.tech, inject XMOJ.user.js, and provide update/self-check features.
  • Add persistent settings + a dedicated settings window (HTML/JS) to manage update channel and startup behavior.
  • Add project scaffolding: ESLint config, package/build scripts, GitHub Actions workflows, and application icons.

Reviewed changes

Copilot reviewed 11 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/main.js Main process app bootstrap, menu, settings IPC, updater/self-check logic, and GM_* IPC plumbing.
src/preload.js Userscript injection pipeline, GM polyfills, @require loader, and renderer bridge exposure.
src/updater.js Download + metadata parsing + version comparison helpers for userscript updating.
src/storage.js Persist settings and managed userscript under Electron userData.
src/settings.html Settings window UI markup/styles.
src/settings.js Settings window logic via window.ELXMOJ bridge.
package.json Electron/electron-builder scripts and build configuration.
eslint.config.js ESLint flat config for src/**/*.js.
README.md Documentation for running, self-check, CI, packaging, and persistence locations.
.github/workflows/code-check.yml CI lint + syntax checks on push/PR.
.github/workflows/release-build.yml Cross-platform build + artifact upload + tag-based GitHub Release publish.
.gitignore Ignore node_modules/.
build/icons/app.png App icon asset.
build/icons/app.ico App icon asset.
favicon.ico Favicon asset.

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

Copy link
Member

@langningchen langningchen left a comment

Choose a reason for hiding this comment

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

我不会写 Electron……

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 20, 2026 04:18
PythonSmall-Q and others added 5 commits March 20, 2026 12:19
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@PythonSmall-Q
Copy link
Member Author

Emm 测试还行, 但是脚本可以用原来仓库里的吗

你说的是构建发布还是别的

@langningchen
Copy link
Member

为什么按了回车以后默认是 Close PR……

@PythonSmall-Q
Copy link
Member Author

Emm 测试还行, 但是脚本可以用原来仓库里的吗

你说的是构建发布还是别的

现在是从官网下载脚本执行

@boomzero
Copy link
Member

Emm 测试还行, 但是脚本可以用原来仓库里的吗

你说的是构建发布还是别的

现在是从官网下载脚本执行

那应该用submodule 吧

@boomzero
Copy link
Member

我的意思是,是否要考虑加上 CI 的 Auto Build

Yes, but this is easy

@PythonSmall-Q
Copy link
Member Author

Emm 测试还行, 但是脚本可以用原来仓库里的吗

你说的是构建发布还是别的

现在是从官网下载脚本执行

那应该用submodule 吧

你说这个repo加入submodule?

@boomzero
Copy link
Member

Emm 测试还行, 但是脚本可以用原来仓库里的吗

你说的是构建发布还是别的

现在是从官网下载脚本执行

那应该用submodule 吧

你说这个repo加入submodule?

在这个repo加入submodule

@PythonSmall-Q
Copy link
Member Author

ok

Introduce App update support and synchronize user-script debug/channel state between the main window and settings. Adds app update URL template, platform mapping, helpers to detect latest release from latest.json/latest.yml or GitHub releases, and functions to build/download update URLs. Exposes new IPC handlers and preload APIs for app update info, opening update page, and reading/writing script debug mode; settings UI now displays app version/update info and includes a "Download latest App" button. Also syncs channel with the script's debug-mode stored in the web app, adds CmdOrCtrl+, accelerator for Settings, updates startup self-check to sync channel, and adds repository/homepage metadata to package.json. README updated with app download update source.
@PythonSmall-Q
Copy link
Member Author

@boomzero submodule你做吧我下载不下来

@PythonSmall-Q
Copy link
Member Author

Also 我可以帮助OSX notarization

ok

@boomzero
Copy link
Member

@boomzero submodule你做吧我下载不下来

Emm?

@boomzero
Copy link
Member

等2h
image

Change app update flow to use GitHub Releases download URLs and simplify updater logic. README updated to show the new Releases URL format. main.js: replaced custom app update endpoints with a GitHub Releases template, removed HTTPS-based version discovery and related helpers (download/parsing/detection), simplified getAppUpdateUrl to build a direct Releases download link using app.getVersion(), adjusted platform extension mapping (default -> zip), and removed unused https import. IPC handlers now return/open the direct download URL only. preload.js / settings.*: removed exposure and UI elements that displayed remote latest-version details (getAppUpdateInfo, appVersionInfo, appUpdateAdvice) and updated settings.js to only show the computed download URL. This simplifies update behavior but removes automatic latest-version checks and the getAppUpdateInfo API; callers should use getAppUpdateUrl or rely on GitHub Releases tags.
Copilot AI review requested due to automatic review settings March 20, 2026 13:04
Remove getUpdateSystemName and getVersionSuffix from src/main.js. These helpers (platform name mapping and semver prerelease normalization) were unused/duplicative and have been deleted to simplify the update-related code. getPlatformPackageExtension and getAppUpdateUrl remain unchanged, so there should be no behavioral change to update URL construction.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 16 changed files in this pull request and generated 5 comments.


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

@def-WA2025
Copy link
Member

def-WA2025 commented Mar 20, 2026

感觉ts要好写一点

Copilot AI review requested due to automatic review settings March 20, 2026 14:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@def-WA2025
Copy link
Member

bushi我还以为是覆写
跑完了才发现是把userjs拿过来调用(

@PythonSmall-Q
Copy link
Member Author

PythonSmall-Q commented Mar 21, 2026 via email

@PythonSmall-Q PythonSmall-Q merged commit 1ed3e98 into master Mar 21, 2026
3 checks passed
@PythonSmall-Q PythonSmall-Q deleted the ptsq/write-app-from-scratch branch March 21, 2026 00:50
@langningchen
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants