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]] [[package]]
name = "fantastic-rs" name = "fantastic-rs"
version = "0.5.0-alpha1" version = "0.5.0-alpha2"
dependencies = [ dependencies = [
"log", "log",
"nrpc", "nrpc",

View file

@ -1,7 +1,14 @@
[package] [package]
name = "fantastic-rs" name = "fantastic-rs"
version = "0.5.0-alpha1" version = "0.5.0-alpha2"
edition = "2021" 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] [dependencies]
usdpl-back = { version = "0.11", features = ["blocking"], path = "../../usdpl-rs/usdpl-back"} usdpl-back = { version = "0.11", features = ["blocking"], path = "../../usdpl-rs/usdpl-back"}

View file

@ -1,6 +1,5 @@
import { import {
definePlugin, definePlugin,
DialogButton,
PanelSection, PanelSection,
PanelSectionRow, PanelSectionRow,
Field, Field,
@ -222,8 +221,12 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({serverAPI}) => {
if (!usdplReady) { if (!usdplReady) {
return ( return (
<PanelSection> <PanelSectionRow>
</PanelSection> <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) => { export default definePlugin((serverApi: ServerAPI) => {
serverApi.routerHook.addRoute("/decky-plugin-test", DeckyPluginRouterTest, {
exact: true,
});
(async function(){ (async function(){
await backend.initBackend(); if (!usdplReady) {
usdplReady = true; await backend.initBackend();
backend.getEnabled(); usdplReady = true;
name = await backend.getName(); backend.getEnabled();
version = await backend.getVersion(); name = await backend.getName();
version = await backend.getVersion();
}
})(); })();
let ico = <FaFan />; let ico = <FaFan />;
@ -338,7 +328,6 @@ export default definePlugin((serverApi: ServerAPI) => {
icon: ico, icon: ico,
onDismount() { onDismount() {
clearInterval(periodicHook!); clearInterval(periodicHook!);
serverApi.routerHook.removeRoute("/decky-plugin-test");
}, },
}; };
}); });

View file

@ -2,6 +2,12 @@
name = "fantastic-wasm" name = "fantastic-wasm"
version = "0.5.0" version = "0.5.0"
edition = "2021" 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] [lib]
crate-type = ["cdylib", "rlib"] crate-type = ["cdylib", "rlib"]
@ -21,7 +27,7 @@ decky = ["usdpl-front/decky"]
[profile.release] [profile.release]
# Tell `rustc` to optimize for small code size. # Tell `rustc` to optimize for small code size.
opt-level = "s" opt-level = "s"
debug = true # while indev TODO turn off debug info debug = false
strip = true strip = true
lto = true lto = true
codegen-units = 4 codegen-units = 4