diff --git a/backend/requirements.txt b/backend/requirements.txt index 326a924cf..58493e572 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -1,4 +1,4 @@ -aiohttp==3.8.4 +aiohttp==3.8.5 aiohttp-jinja2==1.5.1 aiohttp_cors==0.7.0 watchdog==2.1.7 diff --git a/backend/src/browser.py b/backend/src/browser.py index da8569bee..966206671 100644 --- a/backend/src/browser.py +++ b/backend/src/browser.py @@ -186,6 +186,18 @@ async def _install(self, artifact: str, name: str, version: str, hash: str): else: logger.fatal(f"Could not fetch from URL. {await res.text()}") + storeUrl = "" + match self.settings.getSetting("store", 0): + case 0: storeUrl = "https://plugins.deckbrew.xyz/plugins" # default + case 1: storeUrl = "https://testing.deckbrew.xyz/plugins" # testing + case 2: storeUrl = self.settings.getSetting("store-url", "https://plugins.deckbrew.xyz/plugins") # custom + case _: storeUrl = "https://plugins.deckbrew.xyz/plugins" + logger.info(f"Incrementing installs for {name} from URL {storeUrl} (version {version})") + async with ClientSession() as client: + res = await client.post(storeUrl+f"/{name}/versions/{version}/increment?isUpdate={isInstalled}", ssl=get_ssl_context()) + if res.status != 200: + logger.error(f"Server did not accept install count increment request. code: {res.status}") + # Check to make sure we got the file if res_zip is None: logger.fatal(f"Could not fetch {artifact}") diff --git a/backend/src/localplatformlinux.py b/backend/src/localplatformlinux.py index bde2caac1..1f857f27d 100644 --- a/backend/src/localplatformlinux.py +++ b/backend/src/localplatformlinux.py @@ -58,8 +58,22 @@ def chown(path : str, user : UserType = UserType.HOST_USER, recursive : bool = def chmod(path : str, permissions : int, recursive : bool = True) -> bool: if _get_effective_user_id() != 0: return True - result = call(["chmod", "-R", str(permissions), path] if recursive else ["chmod", str(permissions), path]) - return result == 0 + + try: + octal_permissions = int(str(permissions), 8) + + if recursive: + for root, dirs, files in os.walk(path): + for d in dirs: + os.chmod(os.path.join(root, d), octal_permissions) + for d in files: + os.chmod(os.path.join(root, d), octal_permissions) + + os.chmod(path, octal_permissions) + except: + return False + + return True def folder_owner(path : str) -> UserType|None: user_owner = _get_user_owner(path) @@ -125,11 +139,19 @@ async def service_restart(service_name : str) -> bool: return res.returncode == 0 async def service_stop(service_name : str) -> bool: + if not await service_active(service_name): + # Service isn't running. pretend we stopped it + return True + cmd = ["systemctl", "stop", service_name] res = run(cmd, stdout=PIPE, stderr=STDOUT) return res.returncode == 0 async def service_start(service_name : str) -> bool: + if await service_active(service_name): + # Service is running. pretend we started it + return True + cmd = ["systemctl", "start", service_name] res = run(cmd, stdout=PIPE, stderr=STDOUT) return res.returncode == 0 diff --git a/frontend/src/components/PluginView.tsx b/frontend/src/components/PluginView.tsx index b53035f78..a31053fe3 100644 --- a/frontend/src/components/PluginView.tsx +++ b/frontend/src/components/PluginView.tsx @@ -1,12 +1,4 @@ -import { - ButtonItem, - Focusable, - PanelSection, - PanelSectionRow, - joinClassNames, - scrollClasses, - staticClasses, -} from 'decky-frontend-lib'; +import { ButtonItem, Focusable, PanelSection, PanelSectionRow } from 'decky-frontend-lib'; import { VFC, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { FaEyeSlash } from 'react-icons/fa'; @@ -36,10 +28,7 @@ const PluginView: VFC = () => { return ( -
+
{(visible || activePlugin.alwaysRender) && activePlugin.content}
@@ -48,7 +37,11 @@ const PluginView: VFC = () => { return ( <> -
+
{pluginList .filter((p) => p.content) diff --git a/frontend/src/components/TitleView.tsx b/frontend/src/components/TitleView.tsx index 111f8c807..357656fab 100644 --- a/frontend/src/components/TitleView.tsx +++ b/frontend/src/components/TitleView.tsx @@ -10,6 +10,8 @@ const titleStyles: CSSProperties = { display: 'flex', paddingTop: '3px', paddingRight: '16px', + position: 'sticky', + top: '0px', }; const TitleView: VFC = () => { diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index fd458bef3..dbd006bff 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -67,7 +67,17 @@ export async function getPluginList(): Promise { headers: { 'X-Decky-Version': version.current, }, - }).then((r) => r.json()); + }).then((r) => { + let res = JSON.parse(JSON.stringify(r.json())); + const lng = navigator.language; + if (res.hasOwnProperty('name-' + lng)) { + res.name = res['name-' + lng]; + } + if (res.hasOwnProperty('description-' + lng)) { + res.description = res['description-' + lng]; + } + return res; + }); } export async function installFromURL(url: string) {