[🔀 Merge] PR #45 into HugoAura:dev

## [ Feat] Add ASAR patch locally (main-project) (#45)

* [CI/CD] Delete the patchment of the ASAR on workflow & Change the ZIP packing dir to the whole「src」

* [🔄 Chore  / 🛠️ Fix]  Rename the workflow name & Fixed the path errors

* [🛠️ Fix]  Fixed the path error of「aura.zip」

* [🔄Chore] Separate aura.zip and core.zip

* [🛠️Fix] Fixed the path of zip files.
This commit is contained in:
ntcho&ConiMite
2025-11-09 22:12:13 +08:00
committed by GitHub
parent 2b9d1c97c5
commit 5a29e909f2

View File

@@ -1,4 +1,4 @@
name: Patch ASAR & Pack source code name: Pack source code & Create CI/CD Release
on: on:
schedule: schedule:
@@ -13,115 +13,24 @@ permissions: write-all
jobs: jobs:
pack: pack:
name: Patch & Pack name: Pack
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Setup Node.JS 20 LTS
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y p7zip-full wget
npm install -g asar
- name: Checkout repository code - name: Checkout repository code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
path: "./HugoAura-Code" path: "./HugoAura-Code"
- name: Download SeewoServiceSetup - name: Create aura.zip
run: |
echo "[DEBUG] Working DIR:"
pwd
wget -nv -O "SeewoService.exe" "https://e.seewo.com/download/file?code=SeewoServiceSetup"
echo "[DEBUG] Listing downloaded file"
ls -la SeewoService*
- name: Extract SeewoServiceSetup as zip
run: |
mkdir -p SeewoServiceSource
7z x "SeewoService.exe" -o"./SeewoServiceSource/" -y
echo "[DEBUG] Listing extracted files"
ls -la SeewoServiceSource/
- name: Extract ASAR file
run: |
cd SeewoServiceSource
SEEWO_DIR=$(find . -name "SeewoService_*" -type d | head -1)
echo "[INFO] Found SeewoService directory: $SEEWO_DIR"
cd "$SEEWO_DIR/SeewoServiceAssistant/resources/"
asar extract ./app.asar ./app-unpacked
- name: Move app-unpacked and clean SSASource
run: |
mkdir -p SSARes
cd SeewoServiceSource
SEEWO_DIR=$(find . -name "SeewoService_*" -type d | head -1)
mv "$SEEWO_DIR/SeewoServiceAssistant/resources/app-unpacked" "../SSARes/"
cd ..
rm -rf SeewoServiceSource
rm -rf *.exe
echo "[DEBUG] Listing Working DIR"
ls -la
- name: Patch main.js
run: |
cd SSARes/app-unpacked
### cp main.js main.js.bak
cat > patch_main.js << 'EOF'
const fs = require('fs');
let content = fs.readFileSync('main.js', 'utf8');
content = 'const hook = require("./hook.js");\n' + content;
content = content.replace(/n\.m=e/, ';const zeron = require("./zeron.js");n = zeron(n);n.m=e');
content = content.replace(/let f=new s\(Object\.assign\(\{\},\{transparent:!0,/, ';hook({ central: n, windowName: this.wname, config: c });let f=new s(Object.assign({},{transparent:!0,');
content = content.replace(/c\.canOpenDevTool/, 'c.canOpenDevTool,preload: __dirname + "\\\\preload.js"');
fs.writeFileSync('main.js', content);
console.log('[SUCCESS] main.js has been modified successfully');
EOF
echo "[DEBUG] Running patch_main.js"
node ./patch_main.js
rm -rf patch_main.js
- name: Copy HugoAura core files
run: |
cp -r HugoAura-Code/src/core/* SSARes/app-unpacked/
echo "[DEBUG] Listing files under <Working DIR>/SSARes/app-unpacked/"
ls -la SSARes/app-unpacked/
- name: Create artifacts DIR and re-pack ASAR
run: | run: |
echo "[DEBUG] Creating artifacts directory" echo "[DEBUG] Creating artifacts directory"
mkdir -p Artifacts mkdir -p Artifacts
cd ./HugoAura-Code/src/aura
asar pack SSARes/app-unpacked Artifacts/app-patched.asar
- name: Create aura.zip
run: |
cd HugoAura-Code/src/aura
zip -r ../../../Artifacts/aura.zip . zip -r ../../../Artifacts/aura.zip .
cd ../core
zip -r ../../../Artifacts/core.zip .
cd ../../.. cd ../../..
echo "[DEBUG] Files in <Working DIR>/Artifacts directory:" echo "[DEBUG] Files in <Working DIR>/Artifacts directory:"
@@ -154,18 +63,18 @@ jobs:
#### 🕘 构建时间: ${{ env.BUILDTIME }} #### 🕘 构建时间: ${{ env.BUILDTIME }}
EOF EOF
- name: Upload patched ASAR
uses: actions/upload-artifact@v4
with:
name: asar-patched
path: Artifacts/app-patched.asar
- name: Upload aura.zip - name: Upload aura.zip
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: aura-code name: aura-code
path: Artifacts/aura.zip path: Artifacts/aura.zip
- name: Upload core.zip
uses: actions/upload-artifact@v4
with:
name: aura-core
path: Artifacts/core.zip
- name: Upload release - name: Upload release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
@@ -176,5 +85,5 @@ jobs:
generate_release_notes: false generate_release_notes: false
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
files: | files: |
Artifacts/app-patched.asar
Artifacts/aura.zip Artifacts/aura.zip
Artifacts/core.zip