forked from NG-SD-Plugins/PowerTools
Update USDPL and fix other front-back communication inconsistencies
This commit is contained in:
parent
ea89de01d7
commit
ce5b0ed926
10 changed files with 39 additions and 31 deletions
4
backend/Cargo.lock
generated
4
backend/Cargo.lock
generated
|
@ -1375,9 +1375,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "usdpl-back"
|
name = "usdpl-back"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "32af4c47bfeca1d75de693be983edc2ecfee10e71f138933c959ea5f97ca1a64"
|
checksum = "e2938cb40ba84ebea44658ebb1e4e0045fca54a562873bacab2ae094abab61ff"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-recursion",
|
"async-recursion",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|
|
@ -12,7 +12,7 @@ readme = "../README.md"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
usdpl-back = { version = "0.9.0", features = ["blocking"] }#, path = "../../usdpl-rs/usdpl-back"}
|
usdpl-back = { version = "0.9.1", features = ["blocking"] }#, path = "../../usdpl-rs/usdpl-back"}
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#cargo build --release --target x86_64-unknown-linux-musl
|
cargo build --release --target x86_64-unknown-linux-musl
|
||||||
cargo build --target x86_64-unknown-linux-musl
|
#cargo build --target x86_64-unknown-linux-musl
|
||||||
#cross build --release
|
#cross build --release
|
||||||
|
|
||||||
mkdir -p ../bin
|
mkdir -p ../bin
|
||||||
#cp ./target/x86_64-unknown-linux-musl/release/powertools-rs ../bin/backend
|
cp ./target/x86_64-unknown-linux-musl/release/powertools-rs ../bin/backend
|
||||||
cp ./target/x86_64-unknown-linux-musl/debug/powertools-rs ../bin/backend
|
#cp ./target/x86_64-unknown-linux-musl/debug/powertools-rs ../bin/backend
|
||||||
#cp ./target/release/powertools-rs ../bin/backend
|
#cp ./target/release/powertools-rs ../bin/backend
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
"typescript": "^4.9.4"
|
"typescript": "^4.9.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"decky-frontend-lib": "~3.18.5",
|
"decky-frontend-lib": "~3.18.10",
|
||||||
"react-icons": "^4.7.1",
|
"react-icons": "^4.7.1",
|
||||||
"usdpl-front": "file:src/usdpl_front"
|
"usdpl-front": "file:src/usdpl_front"
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ specifiers:
|
||||||
'@rollup/plugin-typescript': ^8.5.0
|
'@rollup/plugin-typescript': ^8.5.0
|
||||||
'@types/react': 16.14.0
|
'@types/react': 16.14.0
|
||||||
'@types/webpack': ^5.28.0
|
'@types/webpack': ^5.28.0
|
||||||
decky-frontend-lib: ~3.18.5
|
decky-frontend-lib: ~3.18.10
|
||||||
react-icons: ^4.7.1
|
react-icons: ^4.7.1
|
||||||
rollup: ^2.79.1
|
rollup: ^2.79.1
|
||||||
rollup-plugin-import-assets: ^1.1.1
|
rollup-plugin-import-assets: ^1.1.1
|
||||||
|
@ -18,7 +18,7 @@ specifiers:
|
||||||
usdpl-front: file:src/usdpl_front
|
usdpl-front: file:src/usdpl_front
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
decky-frontend-lib: 3.18.5
|
decky-frontend-lib: 3.18.10
|
||||||
react-icons: 4.7.1
|
react-icons: 4.7.1
|
||||||
usdpl-front: file:src/usdpl_front
|
usdpl-front: file:src/usdpl_front
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ packages:
|
||||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
caniuse-lite: 1.0.30001442
|
caniuse-lite: 1.0.30001446
|
||||||
electron-to-chromium: 1.4.284
|
electron-to-chromium: 1.4.284
|
||||||
node-releases: 2.0.8
|
node-releases: 2.0.8
|
||||||
update-browserslist-db: 1.0.10_browserslist@4.21.4
|
update-browserslist-db: 1.0.10_browserslist@4.21.4
|
||||||
|
@ -395,8 +395,8 @@ packages:
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/caniuse-lite/1.0.30001442:
|
/caniuse-lite/1.0.30001446:
|
||||||
resolution: {integrity: sha512-239m03Pqy0hwxYPYR5JwOIxRJfLTWtle9FV8zosfV5pHg+/51uD4nxcUlM8+mWWGfwKtt8lJNHnD3cWw9VZ6ow==}
|
resolution: {integrity: sha512-fEoga4PrImGcwUUGEol/PoFCSBnSkA9drgdkxXkJLsUBOnJ8rs3zDv6ApqYXGQFOyMPsjh79naWhF4DAxbF8rw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/chrome-trace-event/1.0.3:
|
/chrome-trace-event/1.0.3:
|
||||||
|
@ -420,8 +420,8 @@ packages:
|
||||||
resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==}
|
resolution: {integrity: sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/decky-frontend-lib/3.18.5:
|
/decky-frontend-lib/3.18.10:
|
||||||
resolution: {integrity: sha512-CTIJs61La17spws5IzAbLbZ/Bqe+gYgnO6xOrolK1QZh7ZbZeoQ67dtnI0zqRMMC10J8H7jPdqmQnwGN10/bzw==}
|
resolution: {integrity: sha512-2mgbA3sSkuwQR/FnmhXVrcW6LyTS95IuL6muJAmQCruhBvXapDtjk1TcgxqMZxFZwGD1IPnemPYxHZll6IgnZw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/deepmerge/4.2.2:
|
/deepmerge/4.2.2:
|
||||||
|
@ -672,8 +672,8 @@ packages:
|
||||||
engines: {node: '>=8.6'}
|
engines: {node: '>=8.6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/punycode/2.2.0:
|
/punycode/2.3.0:
|
||||||
resolution: {integrity: sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==}
|
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
|
||||||
engines: {node: '>=6'}
|
engines: {node: '>=6'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
@ -742,8 +742,8 @@ packages:
|
||||||
ajv-keywords: 3.5.2_ajv@6.12.6
|
ajv-keywords: 3.5.2_ajv@6.12.6
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/serialize-javascript/6.0.0:
|
/serialize-javascript/6.0.1:
|
||||||
resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==}
|
resolution: {integrity: sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
randombytes: 2.1.0
|
randombytes: 2.1.0
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -820,7 +820,7 @@ packages:
|
||||||
'@jridgewell/trace-mapping': 0.3.17
|
'@jridgewell/trace-mapping': 0.3.17
|
||||||
jest-worker: 27.5.1
|
jest-worker: 27.5.1
|
||||||
schema-utils: 3.1.1
|
schema-utils: 3.1.1
|
||||||
serialize-javascript: 6.0.0
|
serialize-javascript: 6.0.1
|
||||||
terser: 5.16.1
|
terser: 5.16.1
|
||||||
webpack: 5.75.0
|
webpack: 5.75.0
|
||||||
dev: true
|
dev: true
|
||||||
|
@ -860,7 +860,7 @@ packages:
|
||||||
/uri-js/4.4.1:
|
/uri-js/4.4.1:
|
||||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
punycode: 2.2.0
|
punycode: 2.3.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/url-join/4.0.1:
|
/url-join/4.0.1:
|
||||||
|
@ -927,5 +927,5 @@ packages:
|
||||||
file:src/usdpl_front:
|
file:src/usdpl_front:
|
||||||
resolution: {directory: src/usdpl_front, type: directory}
|
resolution: {directory: src/usdpl_front, type: directory}
|
||||||
name: usdpl-front
|
name: usdpl-front
|
||||||
version: 0.9.0
|
version: 0.9.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
|
@ -11,12 +11,20 @@ export function resolve<T>(promise: Promise<T>, setter: (t: T) => void) {
|
||||||
console.debug("Got resolved", data);
|
console.debug("Got resolved", data);
|
||||||
setter(data);
|
setter(data);
|
||||||
} else {
|
} else {
|
||||||
console.warn("Resolve failed:", data);
|
console.warn("Resolve failed:", data, promise);
|
||||||
log(LogLevel.Warn, "");
|
log(LogLevel.Warn, "A resolve failed");
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function resolve_nullable<T>(promise: Promise<T | null>, setter: (t: T | null) => void) {
|
||||||
|
(async function () {
|
||||||
|
let data = await promise;
|
||||||
|
console.debug("Got resolved", data);
|
||||||
|
setter(data);
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
export async function initBackend() {
|
export async function initBackend() {
|
||||||
// init usdpl
|
// init usdpl
|
||||||
await init_embedded();
|
await init_embedded();
|
||||||
|
@ -102,7 +110,7 @@ export async function getBatteryChargeDesign(): Promise<number> {
|
||||||
return (await call_backend("BATTERY_charge_design", []))[0];
|
return (await call_backend("BATTERY_charge_design", []))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getBatteryChargeRate(): Promise<number> {
|
export async function getBatteryChargeRate(): Promise<number | null> {
|
||||||
return (await call_backend("BATTERY_get_charge_rate", []))[0];
|
return (await call_backend("BATTERY_get_charge_rate", []))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +122,7 @@ export async function unsetBatteryChargeRate(): Promise<any[]> {
|
||||||
return await call_backend("BATTERY_unset_charge_rate", []);
|
return await call_backend("BATTERY_unset_charge_rate", []);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getBatteryChargeMode(): Promise<string> {
|
export async function getBatteryChargeMode(): Promise<string | null> {
|
||||||
return (await call_backend("BATTERY_get_charge_mode", []))[0];
|
return (await call_backend("BATTERY_get_charge_mode", []))[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ const reload = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
backend.resolve(backend.getBatteryCurrent(), (rate: number) => { set_value(CURRENT_BATT, rate) });
|
backend.resolve(backend.getBatteryCurrent(), (rate: number) => { set_value(CURRENT_BATT, rate) });
|
||||||
backend.resolve(backend.getBatteryChargeRate(), (rate: number) => { set_value(CHARGE_RATE_BATT, rate) });
|
backend.resolve_nullable(backend.getBatteryChargeRate(), (rate: number | null) => { set_value(CHARGE_RATE_BATT, rate) });
|
||||||
backend.resolve(backend.getBatteryChargeMode(), (mode: string) => { set_value(CHARGE_MODE_BATT, mode) });
|
backend.resolve_nullable(backend.getBatteryChargeMode(), (mode: string | null) => { set_value(CHARGE_MODE_BATT, mode) });
|
||||||
backend.resolve(backend.getBatteryChargeNow(), (rate: number) => { set_value(CHARGE_NOW_BATT, rate) });
|
backend.resolve(backend.getBatteryChargeNow(), (rate: number) => { set_value(CHARGE_NOW_BATT, rate) });
|
||||||
backend.resolve(backend.getBatteryChargeFull(), (rate: number) => { set_value(CHARGE_FULL_BATT, rate) });
|
backend.resolve(backend.getBatteryChargeFull(), (rate: number) => { set_value(CHARGE_FULL_BATT, rate) });
|
||||||
backend.resolve(backend.getBatteryChargeDesign(), (rate: number) => { set_value(CHARGE_DESIGN_BATT, rate) });
|
backend.resolve(backend.getBatteryChargeDesign(), (rate: number) => { set_value(CHARGE_DESIGN_BATT, rate) });
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"NGnius (Graham) <ngniusness@gmail.com>"
|
"NGnius (Graham) <ngniusness@gmail.com>"
|
||||||
],
|
],
|
||||||
"description": "Universal Steam Deck Plugin Library front-end designed for WASM",
|
"description": "Universal Steam Deck Plugin Library front-end designed for WASM",
|
||||||
"version": "0.9.0",
|
"version": "0.9.1",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in a new issue