Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
修复错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Ran-Xing committed May 1, 2024
1 parent f02f3aa commit 6a2335d
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 800 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
repository: "AsahiLinux/macvdmtool"
- name: Build MacVDMTool
run: |
cd macvdmtool
make
cc -o dfuTools_${{ matrix.arch }} main.o -framework CoreFoundation -framework IOKit -lc++
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: dfuTools_${{ matrix.arch }}
path: macvdmtool/dfuTools_${{ matrix.arch }}
path: dfuTools_${{ matrix.arch }}
retention-days: 5
build:
needs: macvdmtool
Expand All @@ -42,41 +43,44 @@ jobs:
uses: actions/download-artifact@v4
with:
name: dfuTools_arm64
path: electron/dfuTools_arm64
path: electron/

- name: Download Artifact (amd64)
uses: actions/download-artifact@v4
with:
name: dfuTools_amd64
path: electron/dfuTools_x64
path: electron/

- name: Chmod dfuTools
run: |
chmod +x electron/dfuTools_*
mkdir -p electron/dfuTools/x64 electron/dfuTools/arm64
mv electron/dfuTools_amd64 electron/dfuTools/x64/dfuTools
mv electron/dfuTools_arm64 electron/dfuTools/arm64/dfuTools
chmod +x electron/dfuTools/x64/dfuTools electron/dfuTools/arm64/dfuTools
- name: Build Release Files
run: npm run pack
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}

-
name: Delete old Releases
uses: dev-drprasad/[email protected]
- name: Delete old Releases
uses: dev-drprasad/[email protected]
with:
repo: ${{ github.repository }}
keep_latest: 3
delete_tag_pattern: ""
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
-
name: 获取版本号

- name: 获取版本号
id: get-version
run: |
version=$(jq -r .version package.json)
echo "version=${version}" >> $GITHUB_OUTPUT
-
name: Make release
uses: softprops/action-gh-release@v1
- name: Make release
uses: softprops/action-gh-release@v2
with:
files: |
release/${{ steps.get-version.outputs.version }}/DFU-Tools_x64.dmg
Expand All @@ -89,4 +93,4 @@ jobs:
tag_name: ${{ steps.get-version.outputs.version }}
draft: false
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/release/
/node_modules
/electron/dfuTools*
/macvdmtool/main.o
/macvdmtool/
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

> [Github Release](https://github.com/XRSec/DFU-Tools/releases)
>
> [镜像加速(Inter 1.1.8)](https://mirror.ghproxy.com/https://github.com/XRSec/DFU-Tools/releases/download/1.1.8/DFU-Tools_x64.dmg)
> [镜像加速(Inter 1.1.9)](https://mirror.ghproxy.com/https://github.com/XRSec/DFU-Tools/releases/download/1.1.9/DFU-Tools_x64.dmg)
>
> [镜像加速(Apple 1.1.8)](https://mirror.ghproxy.com/https://github.com/XRSec/DFU-Tools/releases/download/1.1.8/DFU-Tools_arm64.dmg)
> [镜像加速(Apple 1.1.9)](https://mirror.ghproxy.com/https://github.com/XRSec/DFU-Tools/releases/download/1.1.9/DFU-Tools_arm64.dmg)
### 使用 / Usage

Expand Down
6 changes: 3 additions & 3 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
},
"files": [
"!icon.icns",
"!electron/dfuTools*",
"!electron/dfuTools",
"!macvdmtool",
"!docs",
"!release",
"!electron/已损坏修复"
],
"extraFiles": [
{
"from": "electron/dfuTools_${arch}",
"to": "./Resources/dfuTools"
"from": "electron/dfuTools/${arch}/dfuTools",
"to": "./Resources/"
}
],
"artifactName": "${productName}_${arch}.${ext}",
Expand Down
24 changes: 11 additions & 13 deletions electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ const {chmod, existsSync, lstatSync} = require("fs");
const prompt = require('electron-prompt');

const arch = process.arch === 'arm64' ? 'arm64' : 'x64';
let dfuTools = join(__dirname, `dfuTools_${arch}`),
let dfuTools = join(__dirname, `dfuTools/${arch}/dfuTools`),
admin_pass = '',
configuratorStatus = false,
win;

if (__dirname.includes('/Contents/Resources/')) {
dfuTools = join(__dirname, '../../dfuTools')
}
if (!existsSync(dfuTools) || lstatSync(dfuTools).isDirectory()) {
dfuTools = join(dfuTools, `dfuTools_${arch}`)
dfuTools = join(__dirname, `../../dfuTools`)
}

console.debug(`dfuTools: ${dfuTools}`)
Expand Down Expand Up @@ -110,17 +107,17 @@ ipcMain.on('openReboot', (event) => {
return;
}
exec(`echo '${admin_pass}' | sudo -S ${dfuTools} reboot`, {encoding: 'utf-8'}, function (_error, stdout, _stderr) {
if (stdout.includes('No connection detected')) {
if (stdout?.includes('No connection detected')) {
event.returnValue = "no_connection";
return;
} else if (stdout.includes('IOCreatePlugInInterfaceForService failed')) {
} else if (stdout?.includes('IOCreatePlugInInterfaceForService failed')) {
event.returnValue = "no_admin_permission";
return;
} else if (_error.toString().includes('command not found')) {
} else if (_error?.toString().includes('command not found')) {
event.returnValue = "no_dfu_permission";
return;
}
console.debug(_error, _stderr)
console.debug(`error: ${_error} stderr: ${_stderr}`)
event.returnValue = stdout;
})
})
Expand All @@ -132,17 +129,18 @@ ipcMain.on('openDFU', (event) => {
return;
}
exec(`echo '${admin_pass}' | sudo -S ${dfuTools} dfu`, {encoding: 'utf-8'}, function (_error, stdout, _stderr) {
if (stdout.includes('No connection detected')) {
console.log(_error)
if (stdout?.includes('No connection detected')) {
event.returnValue = "no_connection";
return;
} else if (stdout.includes('IOCreatePlugInInterfaceForService failed')) {
} else if (stdout?.includes('IOCreatePlugInInterfaceForService failed')) {
event.returnValue = "no_admin_permission";
return;
} else if (_error.toString().includes('command not found')) {
} else if (_error?.toString().includes('command not found')) {
event.returnValue = "no_dfu_permission";
return;
}
console.debug(_error, _stderr)
console.debug(`error: ${_error} stderr: ${_stderr}`)
event.returnValue = stdout;
})
})
Expand Down
9 changes: 0 additions & 9 deletions macvdmtool/.clang-format

This file was deleted.

1 change: 0 additions & 1 deletion macvdmtool/.gitignore

This file was deleted.

43 changes: 0 additions & 43 deletions macvdmtool/AppleHPMLib.h

This file was deleted.

Loading

0 comments on commit 6a2335d

Please sign in to comment.