Remove unused functions, improve startup checks

This commit is contained in:
NGnius (Graham) 2023-09-03 17:36:40 -04:00
parent 255958f96b
commit f4a3f06aae
4 changed files with 29 additions and 27 deletions

2
backend-rs/Cargo.lock generated
View file

@ -247,7 +247,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "fantastic-rs"
version = "0.5.0-alpha1"
version = "0.5.0-alpha2"
dependencies = [
"log",
"nrpc",

View file

@ -1,7 +1,14 @@
[package]
name = "fantastic-rs"
version = "0.5.0-alpha1"
version = "0.5.0-alpha2"
edition = "2021"
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
description = "Backend (superuser) functionality for Fantastic"
license = "GPL-3.0-only"
repository = "https://git.ngni.us/NG-SD-Plugins/Fantastic"
keywords = ["utility", "fan-control", "root", "decky"]
readme = "../README.md"
[dependencies]
usdpl-back = { version = "0.11", features = ["blocking"], path = "../../usdpl-rs/usdpl-back"}

View file

@ -1,6 +1,5 @@
import {
definePlugin,
DialogButton,
PanelSection,
PanelSectionRow,
Field,
@ -222,8 +221,12 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({serverAPI}) => {
if (!usdplReady) {
return (
<PanelSection>
</PanelSection>
<PanelSectionRow>
<Field
label="Loading...">
If you can read this, something probably went wrong :(
</Field>
</PanelSectionRow>
);
}
@ -302,28 +305,15 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({serverAPI}) => {
);
};
const DeckyPluginRouterTest: VFC = () => {
return (
<div style={{ marginTop: "50px", color: "white" }}>
Hello World!
<DialogButton onClick={() => {}}>
Go to Store
</DialogButton>
</div>
);
};
export default definePlugin((serverApi: ServerAPI) => {
serverApi.routerHook.addRoute("/decky-plugin-test", DeckyPluginRouterTest, {
exact: true,
});
(async function(){
if (!usdplReady) {
await backend.initBackend();
usdplReady = true;
backend.getEnabled();
name = await backend.getName();
version = await backend.getVersion();
}
})();
let ico = <FaFan />;
@ -338,7 +328,6 @@ export default definePlugin((serverApi: ServerAPI) => {
icon: ico,
onDismount() {
clearInterval(periodicHook!);
serverApi.routerHook.removeRoute("/decky-plugin-test");
},
};
});

View file

@ -2,6 +2,12 @@
name = "fantastic-wasm"
version = "0.5.0"
edition = "2021"
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
description = "Frontend bindings for fan control functionality"
license = "GPL-3.0-only"
repository = "https://git.ngni.us/NG-SD-Plugins/Fantastic"
keywords = ["utility", "fan-control", "root", "decky"]
readme = "../../README.md"
[lib]
crate-type = ["cdylib", "rlib"]
@ -21,7 +27,7 @@ decky = ["usdpl-front/decky"]
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"
debug = true # while indev TODO turn off debug info
debug = false
strip = true
lto = true
codegen-units = 4