-
Notifications
You must be signed in to change notification settings - Fork 0
Alpha version of ELXMOJ #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,803
−2
Merged
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 48fe784
好的现在终于有turnstile了
PythonSmall-Q 92c76e0
fix problem of new page not rendering script
PythonSmall-Q 5c6b890
capture keyboard keys
PythonSmall-Q 9032941
Use npm install in code-check workflow
PythonSmall-Q 1cc66df
Potential fix for pull request finding
PythonSmall-Q 0aaefbe
Potential fix for pull request finding
PythonSmall-Q 00ca8d7
Potential fix for pull request finding
PythonSmall-Q 4aa6446
Potential fix for pull request finding
PythonSmall-Q cde6c54
Preload: fix setter return, regex, and GM API
PythonSmall-Q 67a56a0
Add app icons and set window icons
PythonSmall-Q e7f3992
Potential fix for pull request finding
PythonSmall-Q f5fcb6f
Potential fix for pull request finding
PythonSmall-Q 8680f22
Potential fix for pull request finding
PythonSmall-Q 136ac09
Potential fix for pull request finding
PythonSmall-Q 6640899
Potential fix for pull request finding
PythonSmall-Q ec3d072
Potential fix for pull request finding
PythonSmall-Q 85c58c8
Validate IPC senders; run userscripts in preload
PythonSmall-Q 8b6e6e9
Add App update checks and script debug sync
PythonSmall-Q 6cd6607
Switch app update source to GitHub Releases
PythonSmall-Q e651036
Remove unused update helper functions
PythonSmall-Q 90a563a
Use XMOJ-Script as submodule
boomzero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| node_modules/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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`) | ||
Submodule XMOJ-Script
added at
e14e33
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.