Skip to content

Commit

Permalink
fix: make windows bootstrap scripts support spaces in path (#14)
Browse files Browse the repository at this point in the history
* fix: support spaces in path on Windows

* chore: add warning about PL1/PL2

* fix: support node 18

Node 20 would require even more work...

* fix: minor Linux build improvement

* chore: bump version

* fix: bump node versions

* fix: remove invalid main prop

* fix: bump edge.js

* fix: increase Windows timeout
  • Loading branch information
s-h-a-d-o-w committed Mar 30, 2024
1 parent f978526 commit b304ddb
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 40 deletions.
2 changes: 1 addition & 1 deletion LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ As for how to figure out whether the addresses are the same on your machine –

## Prerequisites

### Install Node.js
### Install Node.js 18

Needs to be runnable by root.

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Aorus Laptop Fan Control (alfc)

**Please note that if you plan on using `alfc` with a CPU other than the i7-10875H on something other than Windows 11, you would have to look up and set the PL1 and PL2 values in order not to possibly limit the performance of your CPU** - e.g. [tech powerup database](https://www.techpowerup.com/cpu-specs/core-i7-10875h.c2277). (`alfc` will attempt to set those levels whenever it starts or you change them, using Intel XTU on Windows 10 and `constraint_0_power_limit_uw` and `constraint_1_power_limit_uw` on Linux. Windows 11 forbids using Intel XTU, at least for this. As far as I'm aware, there's no danger to setting those values too high, since CPUs won't consume more than a certain maximum, regardless of these values. Throttling is possible though!)

## Confirmed to work with...

| Model | Fan control | CPU limits tweaking | GPU boost |
Expand Down
16 changes: 10 additions & 6 deletions bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ switch (process.argv[2]) {
case 'install':
console.log('Installing...');
sudo.exec(
`node ${process.argv[1]} install-as-sudo`,
`node ${
isWindows ? `"${process.argv[1]}"` : process.argv[1]
} install-as-sudo`,
sudoOptions,
sudoOutputHandler
);
Expand All @@ -42,7 +44,7 @@ switch (process.argv[2]) {
'alfc',
{
programArgs: ['run'],
dependencies: os.platform() === 'win32' ? ['Winmgmt'] : ['acpi_call'],
dependencies: isWindows ? ['Winmgmt'] : ['acpi_call'],
},
errorHandler(() => {
const serviceStartCommand = isWindows
Expand All @@ -51,8 +53,8 @@ switch (process.argv[2]) {
exec(
serviceStartCommand,
errorHandler(async () => {
if (os.platform() === 'win32') {
await new Promise((resolve) => setTimeout(resolve, 1000 * 15));
if (isWindows) {
await new Promise((resolve) => setTimeout(resolve, 1000 * 25));
}

console.log('Done.');
Expand All @@ -65,7 +67,9 @@ switch (process.argv[2]) {
case 'uninstall':
console.log('Uninstalling...');
sudo.exec(
`node ${process.argv[1]} uninstall-as-sudo`,
`node ${
isWindows ? `"${process.argv[1]}"` : process.argv[1]
} uninstall-as-sudo`,
sudoOptions,
sudoOutputHandler
);
Expand Down Expand Up @@ -94,7 +98,7 @@ switch (process.argv[2]) {

// Need to redirect all output to a log file on Windows.
// On Linux, it'll go to the systemd logs.
if (os.platform() === 'win32') {
if (isWindows) {
const access = fs.createWriteStream(path.join(__dirname, 'service.log'));
process.stdout.write = process.stderr.write = access.write.bind(access);
process.on('uncaughtException', function(err) {
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"sudo-prompt": "9.2.1"
},
"devDependencies": {
"@vercel/ncc": "0.23.0",
"@vercel/ncc": "0.38.1",
"rimraf": "3.0.2"
}
}
8 changes: 4 additions & 4 deletions bootstrap/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==

"@vercel/ncc@0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.23.0.tgz#628f293f8ae2038d004378f864396ad8fc14380c"
integrity sha512-Fcr1qlG9t54X4X9qbo/+jr1+t5Qc6H3TgIRBXmKkF/WDs6YFulAN6ilq2Ehx38RbgIOFxaZnjlAQ50GyexnMpQ==
"@vercel/ncc@0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.38.1.tgz#13f08738111e1d9e8a22fd6141f3590e54d9a60e"
integrity sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==

address@1.1.2, address@^1.0.1:
version "1.1.2"
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ copy package.json dist
cd dist
powershell Compress-Archive * alfc-without-node.zip
move alfc-without-node.zip ..\alfc-without-node.zip
curl --output node.exe https://nodejs.org/dist/latest-v14.x/win-x64/node.exe
curl --output node.exe https://nodejs.org/dist/latest-v18.x/win-x64/node.exe
powershell Compress-Archive * alfc.zip
move ..\alfc-without-node.zip alfc-without-node.zip

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ cp package.json dist
cd dist
mkdir alfc
mv * ./alfc
tar -czf alfc.tar.gz ./alfc
tar -czf alfc.tar.gz alfc

cd ..
6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"scripts": {
"lint": "eslint --ignore-path .gitignore --ext=.ts,.tsx ./src",
"start": "cross-env BROWSER=none react-app-rewired start",
"build": "react-app-rewired build",
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider BROWSER=none react-app-rewired start",
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
},
Expand Down Expand Up @@ -55,6 +55,6 @@
"eslint-plugin-prettier": "3.1.1",
"eslint-plugin-react-hooks": "4.0.8",
"prettier": "1.19.1",
"react-app-rewired": "2.1.6"
"react-app-rewired": "2.2.1"
}
}
4 changes: 2 additions & 2 deletions frontend/src/containers/CPUTuning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export function CPUTuning() {
CPU power limits{' '}
<FontAwesomeIcon icon={faInfoCircle} forwardedRef={tooltipRef} />
<SimpleTooltip target={tooltipRef}>
The ECO profile in the Gigabyte Control Center is 38/107, Boost is
62/107.
The ECO profile for the i7-10875H in the Gigabyte Control Center is
38/107, Boost is 62/107.
<br />
NOTE: Don't use <strong>exactly</strong> those numbers, otherwise they
might not get applied at startup.
Expand Down
8 changes: 4 additions & 4 deletions frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8757,10 +8757,10 @@ react-app-polyfill@^1.0.6:
regenerator-runtime "^0.13.3"
whatwg-fetch "^3.0.0"

react-app-rewired@2.1.6:
version "2.1.6"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.6.tgz#33ee3076a7f34d6a7c94e649cac67e7c8c580de8"
integrity sha512-06flj0kK5tf/RN4naRv/sn6j3sQd7rsURoRLKLpffXDzJeNiAaTNic+0I8Basojy5WDwREkTqrMLewSAjcb13w==
react-app-rewired@2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.2.1.tgz#84901ee1e3f26add0377ebec0b41bcdfce9fc211"
integrity sha512-uFQWTErXeLDrMzOJHKp0h8P1z0LV9HzPGsJ6adOtGlA/B9WfT6Shh4j2tLTTGlXOfiVx6w6iWpp7SOC5pvk+gA==
dependencies:
semver "^5.6.0"

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"name": "alfc",
"version": "1.1.0",
"main": "index.ts",
"version": "1.1.1",
"author": "Andreas Opferkuch <andreas.opferkuch@gmail.com>",
"license": "MIT",
"engines": {
"node": "^18"
},
"private": true,
"scripts": {
"install": "yarn install:bootstrap && yarn install:frontend && yarn install:server",
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"debug:oc": "yarn build:cpuoc && ts-node --transpileOnly native\\windows\\cpuoc.ts"
},
"dependencies": {
"edge-js": "14.3.1",
"edge-js": "18.4.3",
"express": "4.17.1",
"is-elevated": "3.0.0",
"json-stringify-pretty-compact": "2.0.0",
Expand All @@ -24,7 +24,7 @@
"@types/express": "4.17.7",
"@types/node": "14.0.27",
"@types/ws": "7.2.6",
"@vercel/ncc": "0.23.0",
"@vercel/ncc": "0.38.1",
"cross-env": "7.0.2",
"kill-port": "1.6.1",
"nodemon": "2.0.4",
Expand Down
26 changes: 13 additions & 13 deletions server/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@
dependencies:
"@types/node" "*"

"@vercel/ncc@0.23.0":
version "0.23.0"
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.23.0.tgz#628f293f8ae2038d004378f864396ad8fc14380c"
integrity sha512-Fcr1qlG9t54X4X9qbo/+jr1+t5Qc6H3TgIRBXmKkF/WDs6YFulAN6ilq2Ehx38RbgIOFxaZnjlAQ50GyexnMpQ==
"@vercel/ncc@0.38.1":
version "0.38.1"
resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.38.1.tgz#13f08738111e1d9e8a22fd6141f3590e54d9a60e"
integrity sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==

abbrev@1:
version "1.1.1"
Expand Down Expand Up @@ -460,13 +460,13 @@ edge-cs@1.2.1:
resolved "https://registry.yarnpkg.com/edge-cs/-/edge-cs-1.2.1.tgz#bd1a9ecdb94ef0ed40c894582046749e57045e5a"
integrity sha1-vRqezblO8O1AyJRYIEZ0nlcEXlo=

edge-js@14.3.1:
version "14.3.1"
resolved "https://registry.yarnpkg.com/edge-js/-/edge-js-14.3.1.tgz#24f239e95f79168d38957c99673a7d92a96df1bf"
integrity sha512-SXedx+AMiqfjBeBOzl8mm5y60RF/cSRj4lSExO6HPxqbOxAQhiIL7MmVlXg9t6xfk7ovOaujfZXFsgupfcjuAQ==
edge-js@18.4.3:
version "18.4.3"
resolved "https://registry.yarnpkg.com/edge-js/-/edge-js-18.4.3.tgz#9ea5963dc8d87d4e6a04df4a941478cd1aad551f"
integrity sha512-iPbzXicq4Ein5OM5erxLo2K6fV6yBOcD+2H9jjACcvhx/mZNEdkAwhL2X0aHAGgIyOfmT8Ds4Vjs9Gz+uU3tYw==
dependencies:
edge-cs "1.2.1"
nan "^2.14.0"
nan "^2.16.0"

ee-first@1.1.1:
version "1.1.1"
Expand Down Expand Up @@ -985,10 +985,10 @@ ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

nan@^2.14.0:
version "2.14.1"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.1.tgz#d7be34dfa3105b91494c3147089315eff8874b01"
integrity sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
nan@^2.16.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.19.0.tgz#bb58122ad55a6c5bc973303908d5b16cfdd5a8c0"
integrity sha512-nO1xXxfh/RWNxfd/XPfbIfFk5vgLsAxUR9y5O0cHMJu/AW9U95JLXqthYHjEp+8gQ5p96K9jUp8nbVOxCdRbtw==

negotiator@0.6.2:
version "0.6.2"
Expand Down

0 comments on commit b304ddb

Please sign in to comment.