From 1795c29603b59ecfbadd9b7213b0744da5559808 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Thu, 8 Sep 2022 20:04:07 -0400 Subject: [PATCH] Minor repo cleanup/reconfigure --- README.md | 5 ++++ backend/build.sh | 8 +++--- server.py | 71 ------------------------------------------------ 3 files changed, 9 insertions(+), 75 deletions(-) delete mode 100644 server.py diff --git a/README.md b/README.md index 7aae504..514060a 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ You will need that installed for this plugin to work. - Display supplementary battery info - Keep settings between restarts (stored in `~/.config/powertools/.json`) +## Install + +Please Decky's built-in store to install official releases. +If you're an advanced user, and/or would like to use an in-development version, feel free to build PowerTools yourself. + ## Build 0. Requirements: a functioning Rust toolchain for x86_64-unknown-linux-musl, npm, and some tech literacy diff --git a/backend/build.sh b/backend/build.sh index 94cd216..f2fab87 100755 --- a/backend/build.sh +++ b/backend/build.sh @@ -1,10 +1,10 @@ #!/bin/bash -#cargo build --release --target x86_64-unknown-linux-musl -cargo build --target x86_64-unknown-linux-musl +cargo build --release --target x86_64-unknown-linux-musl +#cargo build --target x86_64-unknown-linux-musl #cross build --release mkdir -p ../bin -#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/release/powertools-rs ../bin/backend +#cp ./target/x86_64-unknown-linux-musl/debug/powertools-rs ../bin/backend #cp ./target/release/powertools-rs ../bin/backend diff --git a/server.py b/server.py deleted file mode 100644 index 067ae3c..0000000 --- a/server.py +++ /dev/null @@ -1,71 +0,0 @@ -import logging -import json -import os -import pathlib - -# import asyncio -from aiohttp import web -import aiohttp - -HOME_DIR = "/home/deck" -SETTINGS_DIR = HOME_DIR + "/.config/powertools" - -if not os.path.exists(SETTINGS_DIR): - os.mkdir(SETTINGS_DIR) - -http_runner = None -http_server = None -http_site = None - -class GameInfo: - def __init__(self, gameid: int, game_info: dict): - self.gameid = gameid - self.game_info = game_info - - def appid(self): - return self.game_info["appid"] - - def name(self): - return self.game_info["display_name"] - - def settings_path(self) -> str: - return SETTINGS_DIR + os.path.sep + str(self.appid()) + ".json" - - def load_settings(self) -> dict: - settings_path = self.settings_path() - if os.path.exists(settings_path): - with open(settings_path, mode="r") as f: - return json.load(f) - return None - - def has_settings(self) -> bool: - return os.path.exists(self.settings_path()) - - -class Server: - - def __init__(self, version): - super().__init__() - self.version = version - self.current_game = None - logging.debug("Server init complete") - - def game(self) -> GameInfo: - return self.current_game - - def set_game(self, game_id, data): - self.current_game = GameInfo(game_id, data) - - def unset_game(self, game_id): - if self.current_game is None: - return - if game_id is None or self.current_game.gameid == game_id: - self.current_game = None - -async def start(version): - global http_server - http_server = Server(version) - -async def shutdown(): # never really called - global http_server - http_server = None