Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
68fd2da
Fully written except turnstile
PythonSmall-Q Mar 19, 2026
48fe784
好的现在终于有turnstile了
PythonSmall-Q Mar 19, 2026
92c76e0
fix problem of new page not rendering script
PythonSmall-Q Mar 19, 2026
5c6b890
capture keyboard keys
PythonSmall-Q Mar 19, 2026
9032941
Use npm install in code-check workflow
PythonSmall-Q Mar 19, 2026
1cc66df
Potential fix for pull request finding
PythonSmall-Q Mar 19, 2026
0aaefbe
Potential fix for pull request finding
PythonSmall-Q Mar 19, 2026
00ca8d7
Potential fix for pull request finding
PythonSmall-Q Mar 19, 2026
4aa6446
Potential fix for pull request finding
PythonSmall-Q Mar 19, 2026
cde6c54
Preload: fix setter return, regex, and GM API
PythonSmall-Q Mar 19, 2026
67a56a0
Add app icons and set window icons
PythonSmall-Q Mar 19, 2026
e7f3992
Potential fix for pull request finding
PythonSmall-Q Mar 20, 2026
f5fcb6f
Potential fix for pull request finding
PythonSmall-Q Mar 20, 2026
8680f22
Potential fix for pull request finding
PythonSmall-Q Mar 20, 2026
136ac09
Potential fix for pull request finding
PythonSmall-Q Mar 20, 2026
6640899
Potential fix for pull request finding
PythonSmall-Q Mar 20, 2026
ec3d072
Potential fix for pull request finding
PythonSmall-Q Mar 20, 2026
85c58c8
Validate IPC senders; run userscripts in preload
PythonSmall-Q Mar 20, 2026
8b6e6e9
Add App update checks and script debug sync
PythonSmall-Q Mar 20, 2026
6cd6607
Switch app update source to GitHub Releases
PythonSmall-Q Mar 20, 2026
e651036
Remove unused update helper functions
PythonSmall-Q Mar 20, 2026
90a563a
Use XMOJ-Script as submodule
boomzero Mar 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Code Check

on:
push:
branches:
- "**"
pull_request:

permissions:
contents: read

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install dependencies
run: npm install

- name: Run lint and syntax check
run: npm run check
77 changes: 77 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release Build

on:
workflow_dispatch:
push:
tags:
- "v*"

permissions:
contents: write

jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: windows-latest
script: npm run pack:win
- name: macOS
os: macos-latest
script: npm run pack:mac
- name: Linux
os: ubuntu-latest
script: npm run pack:linux

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libarchive-tools rpm

- name: Install dependencies
run: npm install

- name: Run code check
run: npm run check

- name: Build package
run: ${{ matrix.script }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ELXMOJ-${{ matrix.name }}
path: dist/**
if-no-files-found: error

publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest

steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true

- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release-assets/**
generate_release_notes: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "XMOJ-Script"]
path = XMOJ-Script
url = https://github.com/XMOJ-Script-dev/XMOJ-Script
76 changes: 74 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,74 @@
# Electro-XMOJ
XMOJ exported to electron!
# ELXMOJ (Electron)

在 Electron 中访问 `https://www.xmoj.tech`,自动加载 `XMOJ-Script/XMOJ.user.js`,并提供启动自检、脚本更新与设置持久化。

## 功能

- 启动后打开 `www.xmoj.tech`
- 自动注入子模块 `XMOJ-Script/XMOJ.user.js`(首次运行复制到用户数据目录)
- 每次启动可检查脚本更新
- 正式版更新源:`https://xmoj-bbs.me/XMOJ.user.js`
- 预览版更新源:`https://dev.xmoj-bbs.me/XMOJ.user.js`
- App 下载更新源:GitHub Releases `https://github.com/XMOJ-Script-dev/ELXMOJ/releases/download/v{version}/ELXMOJ-{version}.{ext}`
- ext 按平台自动适配:Windows `.exe` / macOS `.dmg` / Linux `.AppImage`
- 发现新版本时弹窗提示用户是否更新
- 设置持久化(通道、启动检查、自动注入)
- 提供启动自检和手动自检

## 运行

```bash
git submodule update --init --recursive
npm install
npm start
```

## 自检模式

```bash
npm run self-check
```

## 代码检查

```bash
npm run check
```

包含:

- `eslint` 静态检查(`src`)
- Node 语法检查(`node --check`)

## 全平台打包

```bash
npm run pack:win
npm run pack:mac
npm run pack:linux
```

打包产物默认输出到 `dist/`。

## GitHub Actions

- 代码检查工作流:`.github/workflows/code-check.yml`
- 在 `push` / `pull_request` 触发
- 执行 `npm ci` + `npm run check`
- 发布构建工作流:`.github/workflows/release-build.yml`
- 在手动触发或 `v*` tag 触发
- Windows/macOS/Linux 矩阵并行打包
- `v*` tag 时自动创建 GitHub Release 并上传产物

应用菜单 `ELXMOJ` 中也可以执行:

- 设置
- 执行自检
- 检查脚本更新

## 持久化位置

应用会把运行数据写到 Electron 的 `userData` 目录,包括:

- `settings.json`
- `XMOJ.user.js`(复制后的托管脚本文件,来源于 `XMOJ-Script/XMOJ.user.js`)
1 change: 1 addition & 0 deletions XMOJ-Script
Submodule XMOJ-Script added at e14e33
Binary file added build/icons/app.ico
Binary file not shown.
Binary file added build/icons/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const js = require("@eslint/js");
const globals = require("globals");

module.exports = [
{
ignores: ["node_modules/**", "dist/**"]
},
js.configs.recommended,
{
files: ["src/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "script",
globals: {
...globals.browser,
...globals.node
}
},
rules: {
"no-console": "off"
}
}
];
Binary file added favicon.ico
Binary file not shown.
68 changes: 68 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "electro-xmoj",
"version": "1.0.0",
"description": "ELXMOJ Electron launcher with userscript updater",
"main": "src/main.js",
"homepage": "https://app.xmoj-bbs.me",
"repository": {
"type": "git",
"url": "https://github.com/XMOJ-Script-dev/ELXMOJ.git"
},
"license": "GPL-3.0-or-later",
"scripts": {
"start": "electron .",
"self-check": "electron . --self-check",
"lint": "eslint src --ext .js",
"check:syntax": "node --check src/main.js && node --check src/preload.js && node --check src/settings.js && node --check src/storage.js && node --check src/updater.js",
"check": "npm run lint && npm run check:syntax",
"pack:win": "electron-builder --win nsis portable --publish never",
"pack:mac": "electron-builder --mac zip --publish never",
"pack:linux": "electron-builder --linux AppImage tar.gz --publish never"
},
"devDependencies": {
"@eslint/js": "^9.23.0",
"electron": "^37.2.0",
"electron-builder": "^26.0.12",
"eslint": "^9.23.0",
"globals": "^16.0.0"
},
"build": {
"appId": "me.xmoj.elxmoj",
"productName": "ELXMOJ",
"directories": {
"output": "dist"
},
"files": [
"src/**/*",
"build/icons/**/*",
"XMOJ-Script/XMOJ.user.js",
"package.json",
"README.md",
"LICENSE"
],
"asar": true,
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
"win": {
"icon": "build/icons/app.ico",
"target": [
"nsis",
"portable"
]
},
"mac": {
"icon": "build/icons/app.png",
"target": [
"zip"
],
"category": "public.app-category.developer-tools"
},
"linux": {
"icon": "build/icons/app.png",
"target": [
"AppImage",
"tar.gz"
],
"category": "Development"
}
}
}
Loading
Loading