mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-20 10:11:22 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3a927084b0 | |||
| 5e07c8f028 | |||
| 91d1bc8a78 | |||
| ea35af2050 | |||
| 6232e3da58 | |||
| 35e46f9ccb | |||
| 2b9a80c151 | |||
| a90ed38c89 | |||
| 3653cf5640 | |||
| 0db45ca71e | |||
| 16681fabb5 | |||
| c210523a22 | |||
| 5d8601347a | |||
| 1e02fcf394 | |||
| f923306a7f |
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Description**
|
||||
[A clear and concise description of what the bug is.]
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
[A clear and concise description of what you expected to happen.]
|
||||
|
||||
**Screenshots**
|
||||
[If applicable, add screenshots to help explain your problem.]
|
||||
|
||||
**Version information**
|
||||
- SteamOS Version: ``[Run ``uname -a`` and place the output here. Leave the single quotations outside.]``
|
||||
- Selected Update Channel: [Stable, Beta or Preview.]
|
||||
|
||||
**Logs**
|
||||
[Please reboot your deck (if possible) when attempting to recreate the issue, then run
|
||||
``cd ~ && journalctl -b0 -u plugin_loader.service > backendlog.txt``. This will save the log file to ``~`` aka ``/home/deck``. Please upload the file here in place of this textblock.]
|
||||
|
||||
**Additional context**
|
||||
Have you modified the read-only filesystem at any point?
|
||||
[Yes or No.]
|
||||
@@ -31,7 +31,7 @@ permissions:
|
||||
jobs:
|
||||
build:
|
||||
name: Build PluginLoader
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Print input
|
||||
@@ -47,10 +47,10 @@ jobs:
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Set up Python 3.10.2 🐍
|
||||
- name: Set up Python 3.10.9 🐍
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.10.2"
|
||||
python-version: "3.10.9"
|
||||
|
||||
- name: Install Python dependencies ⬇️
|
||||
run: |
|
||||
|
||||
@@ -98,7 +98,7 @@ Please consult [the wiki page regarding development](https://deckbrew.xyz/en/loa
|
||||
1. Use the VS Code tasks or `deck.sh` script to deploy your changes to your Steam Deck to test them.
|
||||
1. You will be testing your changes with the Python script version. You will need to build, deploy, and reload each time.
|
||||
|
||||
⚠️ If you are recieving build errors due to an out of date library, you should run this command inside of your repository.
|
||||
⚠️ If you are receiving build errors due to an out of date library, you should run this command inside of your repository.
|
||||
|
||||
```bash
|
||||
pnpm update decky-frontend-lib --latest
|
||||
|
||||
@@ -60,6 +60,9 @@ class PluginBrowser:
|
||||
if "remote_binary" in packageJson and len(packageJson["remote_binary"]) > 0:
|
||||
# create bin directory if needed.
|
||||
rc=call(["chmod", "-R", "777", pluginBasePath])
|
||||
if rc != 0:
|
||||
logger.error(f"chown of plugin w/ remote binary exited with a non-zero exit code, chmod: {rc})")
|
||||
|
||||
if access(pluginBasePath, W_OK):
|
||||
|
||||
if not path.exists(pluginBinPath):
|
||||
@@ -67,6 +70,8 @@ class PluginBrowser:
|
||||
|
||||
if not access(pluginBinPath, W_OK):
|
||||
rc=call(["chmod", "-R", "777", pluginBinPath])
|
||||
if rc != 0:
|
||||
logger.error(f"chown of plugin w/ remote binary exited with a non-zero exit code, chmod: {rc})")
|
||||
|
||||
rv = True
|
||||
for remoteBinary in packageJson["remote_binary"]:
|
||||
@@ -80,6 +85,8 @@ class PluginBrowser:
|
||||
|
||||
code_chown = call(["chown", "-R", get_user()+":"+get_user_group(), self.plugin_path])
|
||||
rc=call(["chmod", "-R", "555", pluginBasePath])
|
||||
if code_chown or rc != 0:
|
||||
logger.error(f"chown/chmod exited with a non-zero exit code (chown: {code_chown}, chmod: {rc})")
|
||||
else:
|
||||
rv = True
|
||||
logger.debug(f"No Remote Binaries to Download")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import grp
|
||||
import pwd
|
||||
import re
|
||||
import ssl
|
||||
import subprocess
|
||||
@@ -56,6 +58,14 @@ def get_user() -> str:
|
||||
raise ValueError("helpers.get_user method called before user variable was set. Run helpers.set_user first.")
|
||||
return user
|
||||
|
||||
#Get the user owner of the given file path.
|
||||
def get_user_owner(file_path) -> str:
|
||||
return pwd.getpwuid(os.stat(file_path).st_uid)[0]
|
||||
|
||||
#Get the user group of the given file path.
|
||||
def get_user_group(file_path) -> str:
|
||||
return grp.getgrgid(os.stat(file_path).st_gid)[0]
|
||||
|
||||
# Set the global user group. get_user must be called first
|
||||
def set_user_group() -> str:
|
||||
global group
|
||||
|
||||
+14
-2
@@ -7,7 +7,7 @@ if hasattr(sys, '_MEIPASS'):
|
||||
from asyncio import new_event_loop, set_event_loop, sleep
|
||||
from json import dumps, loads
|
||||
from logging import DEBUG, INFO, basicConfig, getLogger
|
||||
from os import getenv, chmod, path
|
||||
from os import getenv, chmod, listdir, path
|
||||
from traceback import format_exc
|
||||
|
||||
import aiohttp_cors
|
||||
@@ -91,6 +91,7 @@ class PluginManager:
|
||||
chown_plugin_dir()
|
||||
self.loop.create_task(self.loader_reinjector())
|
||||
self.loop.create_task(self.load_plugins())
|
||||
self.loop.create_task(self.reload_plugin_backends())
|
||||
|
||||
self.web_app.on_startup.append(startup)
|
||||
|
||||
@@ -116,6 +117,17 @@ class PluginManager:
|
||||
self.plugin_loader.import_plugins()
|
||||
# await inject_to_tab("SP", "window.syncDeckyPlugins();")
|
||||
|
||||
async def reload_plugin_backends(self, name):
|
||||
await self.wait_for_server()
|
||||
if name in self.plugin_loader.plugins:
|
||||
self.plugin_loader.plugins[name].stop()
|
||||
self.plugin_loader.plugins.pop(name, None)
|
||||
else:
|
||||
logger.error("Couldn't find plugin %s to reload.", str(name))
|
||||
directories = [i for i in listdir(self.plugin_loader.plugin_path) if path.isdir(path.join(self.plugin_loader.plugin_path, i)) and path.isfile(path.join(self.plugin_loader.plugin_path, i, "plugin.json"))]
|
||||
if name in directories:
|
||||
Loader.import_plugin(path.join(self.plugin_loader.plugin_path, directories[name], "main.py"), directories[name], False, False)
|
||||
|
||||
async def loader_reinjector(self):
|
||||
while True:
|
||||
tab = None
|
||||
@@ -124,7 +136,7 @@ class PluginManager:
|
||||
while not tab:
|
||||
try:
|
||||
tab = await get_gamepadui_tab()
|
||||
except client_exceptions.ClientConnectorError or client_exceptions.ServerDisconnectedError:
|
||||
except (client_exceptions.ClientConnectorError, client_exceptions.ServerDisconnectedError):
|
||||
if not dc:
|
||||
logger.debug("Couldn't connect to debugger, waiting...")
|
||||
dc = True
|
||||
|
||||
+20
-4
@@ -1,20 +1,36 @@
|
||||
import imp
|
||||
from json import dump, load
|
||||
from os import mkdir, path
|
||||
from os import mkdir, path, listdir, rename
|
||||
from shutil import chown
|
||||
|
||||
from helpers import get_home_path, get_homebrew_path, get_user, set_user
|
||||
from helpers import get_home_path, get_homebrew_path, get_user, set_user, get_user_owner
|
||||
|
||||
|
||||
class SettingsManager:
|
||||
def __init__(self, name, settings_directory = None) -> None:
|
||||
set_user()
|
||||
USER = get_user()
|
||||
wrong_dir = get_homebrew_path(get_home_path(USER))
|
||||
if settings_directory == None:
|
||||
settings_directory = get_homebrew_path(get_home_path(USER))
|
||||
settings_directory = path.join(wrong_dir, "settings")
|
||||
|
||||
self.path = path.join(settings_directory, name + ".json")
|
||||
|
||||
#Create the folder with the correct permission
|
||||
if not path.exists(settings_directory):
|
||||
mkdir(settings_directory)
|
||||
chown(settings_directory, USER, USER)
|
||||
|
||||
#Copy all old settings file in the root directory to the correct folder
|
||||
for file in listdir(wrong_dir):
|
||||
if file.endswith(".json"):
|
||||
rename(path.join(wrong_dir,file),
|
||||
path.join(settings_directory, file))
|
||||
self.path = path.join(settings_directory, name + ".json")
|
||||
|
||||
|
||||
#If the owner of the settings directory is not the user, then set it as the user:
|
||||
if get_user_owner(settings_directory) != USER:
|
||||
chown(settings_directory, USER, USER)
|
||||
|
||||
self.settings = {}
|
||||
|
||||
|
||||
@@ -81,10 +81,11 @@ class Utilities:
|
||||
async def http_request(self, method="", url="", **kwargs):
|
||||
async with ClientSession() as web:
|
||||
res = await web.request(method, url, ssl=helpers.get_ssl_context(), **kwargs)
|
||||
text = await res.text()
|
||||
return {
|
||||
"status": res.status,
|
||||
"headers": dict(res.headers),
|
||||
"body": await res.text()
|
||||
"body": text
|
||||
}
|
||||
|
||||
async def ping(self, **kwargs):
|
||||
|
||||
Vendored
+1
@@ -40,6 +40,7 @@ User=root
|
||||
Restart=always
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
KillSignal=SIGKILL
|
||||
Environment=PLUGIN_PATH=${HOMEBREW_FOLDER}/plugins
|
||||
Environment=LOG_LEVEL=DEBUG
|
||||
[Install]
|
||||
|
||||
Vendored
+1
@@ -40,6 +40,7 @@ User=root
|
||||
Restart=always
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
KillSignal=SIGKILL
|
||||
Environment=PLUGIN_PATH=${HOMEBREW_FOLDER}/plugins
|
||||
Environment=LOG_LEVEL=INFO
|
||||
[Install]
|
||||
|
||||
+2
-1
@@ -8,7 +8,8 @@ User=root
|
||||
Restart=always
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
KillSignal=SIGKILL
|
||||
Environment=PLUGIN_PATH=${HOMEBREW_FOLDER}/plugins
|
||||
Environment=LOG_LEVEL=DEBUG
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
Vendored
+2
-1
@@ -8,7 +8,8 @@ User=root
|
||||
Restart=always
|
||||
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
||||
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
||||
KillSignal=SIGKILL
|
||||
Environment=PLUGIN_PATH=${HOMEBREW_FOLDER}/plugins
|
||||
Environment=LOG_LEVEL=INFO
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -5,7 +5,7 @@ import externalGlobals from "rollup-plugin-external-globals";
|
||||
import del from 'rollup-plugin-delete'
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import { defineConfig, handleWarning } from 'rollup';
|
||||
import { defineConfig } from 'rollup';
|
||||
|
||||
const hiddenWarnings = [
|
||||
"THIS_IS_UNDEFINED",
|
||||
@@ -41,7 +41,7 @@ export default defineConfig({
|
||||
return 'chunk-[hash].js'
|
||||
}
|
||||
},
|
||||
onwarn: function ( message ) {
|
||||
onwarn: function ( message, handleWarning ) {
|
||||
if (hiddenWarnings.some(warning => message.code === warning)) return;
|
||||
handleWarning(message);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export enum Store {
|
||||
export interface StorePluginVersion {
|
||||
name: string;
|
||||
hash: string;
|
||||
artifact: string | undefined | null;
|
||||
}
|
||||
|
||||
export interface StorePlugin {
|
||||
@@ -73,9 +74,11 @@ export async function installFromURL(url: string) {
|
||||
}
|
||||
|
||||
export async function requestPluginInstall(plugin: string, selectedVer: StorePluginVersion) {
|
||||
const artifactUrl =
|
||||
selectedVer.artifact ?? `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`;
|
||||
await window.DeckyPluginLoader.callServerMethod('install_plugin', {
|
||||
name: plugin,
|
||||
artifact: `https://cdn.tzatzikiweeb.moe/file/steam-deck-homebrew/versions/${selectedVer.hash}.zip`,
|
||||
artifact: artifactUrl,
|
||||
version: selectedVer.name,
|
||||
hash: selectedVer.hash,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user