mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-17 16:57:50 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dce3a8cbe | |||
| 9503d5cee0 | |||
| 435dfa7884 | |||
| 2500b748ce | |||
| fd4ed811be | |||
| 3e4c255c5b | |||
| 62e3128d64 | |||
| 7f2caa3ea9 | |||
| 6b4a56c7dc | |||
| 647f3fe8ed | |||
| 3146ebf85f | |||
| 9295e4b038 | |||
| f9a07da3cc | |||
| 12a99b8b06 | |||
| e3d72b6082 | |||
| 39f4f2870b | |||
| 3489fd7d69 |
@@ -18,7 +18,7 @@ jobs:
|
||||
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35.6.3
|
||||
uses: tj-actions/changed-files@v41.0.0
|
||||
with:
|
||||
separator: ","
|
||||
files: |
|
||||
|
||||
Vendored
+2
-2
@@ -38,7 +38,7 @@
|
||||
"type": "shell",
|
||||
"group": "none",
|
||||
"detail": "Check for local runs, create a plugins folder",
|
||||
"command": "rsync -azp --rsh='ssh -p ${config:deckport} ${config:deckkey}' requirements.txt deck@${config:deckip}:${config:deckdir}/homebrew/dev/pluginloader/requirements.txt && ssh deck@${config:deckip} -p ${config:deckport} ${config:deckkey} 'python -m ensurepip && python -m pip install --upgrade pip && python -m pip install --upgrade setuptools && python -m pip install -r ${config:deckdir}/homebrew/dev/pluginloader/requirements.txt'",
|
||||
"command": "rsync -azp --rsh='ssh -p ${config:deckport} ${config:deckkey}' backend/requirements.txt deck@${config:deckip}:${config:deckdir}/homebrew/dev/pluginloader/backend/requirements.txt && ssh deck@${config:deckip} -p ${config:deckport} ${config:deckkey} 'python -m ensurepip && python -m pip install --upgrade --break-system-packages pip && python -m pip install --break-system-packages --upgrade setuptools && python -m pip install --break-system-packages -r ${config:deckdir}/homebrew/dev/pluginloader/backend/requirements.txt'",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
@@ -105,7 +105,7 @@
|
||||
"detail": "Deploy dev PluginLoader to deck",
|
||||
"type": "shell",
|
||||
"group": "none",
|
||||
"command": "rsync -azp --delete --rsh='ssh -p ${config:deckport} ${config:deckkey}' --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='frontend/' --exclude='dist/' --exclude='contrib/' --exclude='*.log' --exclude='requirements.txt' --exclude='backend/__pycache__/' --exclude='.gitignore' . deck@${config:deckip}:${config:deckdir}/homebrew/dev/pluginloader",
|
||||
"command": "rsync -azp --delete --rsh='ssh -p ${config:deckport} ${config:deckkey}' --exclude='.git/' --exclude='.github/' --exclude='.vscode/' --exclude='frontend/' --exclude='dist/' --exclude='contrib/' --exclude='*.log' --exclude='requirements.txt' --exclude='**/__pycache__/' --exclude='.gitignore' . deck@${config:deckip}:${config:deckdir}/homebrew/dev/pluginloader",
|
||||
"problemMatcher": []
|
||||
},
|
||||
// RUN
|
||||
|
||||
+2
-2
@@ -26,10 +26,10 @@ cd ..
|
||||
|
||||
if [[ "$type" == "release" ]]; then
|
||||
printf "release!\n"
|
||||
act workflow_dispatch -e act/release.json --artifact-server-path act/artifacts --container-architecture linux/amd64
|
||||
act workflow_dispatch -e act/release.json --artifact-server-path act/artifacts --container-architecture linux/amd64 --platform ubuntu-22.04=catthehacker/ubuntu:act-22.04
|
||||
elif [[ "$type" == "prerelease" ]]; then
|
||||
printf "prerelease!\n"
|
||||
act workflow_dispatch -e act/prerelease.json --artifact-server-path act/artifacts --container-architecture linux/amd64
|
||||
act workflow_dispatch -e act/prerelease.json --artifact-server-path act/artifacts --container-architecture linux/amd64 --platform ubuntu-22.04=catthehacker/ubuntu:act-22.04
|
||||
else
|
||||
printf "Release type unspecified/badly specified.\n"
|
||||
printf "Options: 'release' or 'prerelease'\n"
|
||||
|
||||
@@ -192,7 +192,8 @@
|
||||
"SettingsIndex": {
|
||||
"developer_title": "Developer",
|
||||
"general_title": "General",
|
||||
"plugins_title": "Plugins"
|
||||
"plugins_title": "Plugins",
|
||||
"testing_title": "Testing"
|
||||
},
|
||||
"Store": {
|
||||
"store_contrib": {
|
||||
@@ -218,6 +219,10 @@
|
||||
"about": "About",
|
||||
"alph_asce": "Alphabetical (Z to A)",
|
||||
"alph_desc": "Alphabetical (A to Z)",
|
||||
"date_asce": "Oldest First",
|
||||
"date_desc": "Newest First",
|
||||
"downloads_asce": "Least Downloaded First",
|
||||
"downloads_desc": "Most Downloaded First",
|
||||
"title": "Browse"
|
||||
},
|
||||
"store_testing_cta": "Please consider testing new plugins to help the Decky Loader team!",
|
||||
@@ -256,5 +261,8 @@
|
||||
"reloading": "Reloading",
|
||||
"updating": "Updating"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Testing": {
|
||||
"download": "Download"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
{
|
||||
"BranchSelect": {
|
||||
"update_channel": {
|
||||
"stable": "安定",
|
||||
"testing": "テスト",
|
||||
"label": "アップデートチャンネル",
|
||||
"prerelease": "プレリリース"
|
||||
}
|
||||
},
|
||||
"DropdownMultiselect": {
|
||||
"button": {
|
||||
"back": "戻る"
|
||||
}
|
||||
},
|
||||
"FilePickerIndex": {
|
||||
"file": {
|
||||
"select": "ファイルを選択"
|
||||
},
|
||||
"files": {
|
||||
"all_files": "すべてのファイル",
|
||||
"file_type": "ファイルタイプ",
|
||||
"show_hidden": "非表示ファイルを表示する"
|
||||
},
|
||||
"filter": {
|
||||
"name_asce": "Z-A",
|
||||
"name_desc": "A-Z",
|
||||
"size_asce": "サイズ(小さい順)",
|
||||
"size_desc": "サイズ(大きい順)",
|
||||
"created_asce": "作成日(古い順)",
|
||||
"created_desc": "作成日(新しい順)",
|
||||
"modified_asce": "更新日(古い順)",
|
||||
"modified_desc": "更新日(新しい順)"
|
||||
},
|
||||
"folder": {
|
||||
"label": "フォルダ",
|
||||
"select": "このフォルダを使用",
|
||||
"show_more": "その他のファイルを表示"
|
||||
}
|
||||
},
|
||||
"MultiplePluginsInstallModal": {
|
||||
"description": {
|
||||
"install": "インストール {{name}} {{version}}",
|
||||
"reinstall": "再インストール {{name}} {{version}}",
|
||||
"update": "アップデート {{name}} {{version}}"
|
||||
},
|
||||
"ok_button": {
|
||||
"idle": "確認",
|
||||
"loading": "作業中"
|
||||
},
|
||||
"title": {
|
||||
"install_other": "{{count}} 個のプラグインをインストール",
|
||||
"mixed_other": "{{count}} 個のプラグインを修正",
|
||||
"update_other": "{{count}} 個のプラグインをアップデート",
|
||||
"reinstall_other": "{{count}} 個のプラグインを再インストール"
|
||||
},
|
||||
"confirm": "以下の変更を加えてもよろしいですか?"
|
||||
},
|
||||
"Developer": {
|
||||
"enabling": "React DevToolsを有効",
|
||||
"disabling": "React DevToolsを無効",
|
||||
"5secreload": "5秒以内に再読み込みされます"
|
||||
},
|
||||
"PluginInstallModal": {
|
||||
"install": {
|
||||
"button_idle": "インストール",
|
||||
"title": "{{artifact}} をインストール",
|
||||
"button_processing": "インストール中",
|
||||
"desc": "{{artifact}} {{version}} をインストールしてもよろしいですか?"
|
||||
},
|
||||
"no_hash": "このプラグインにはハッシュがありません。ご自身の責任でインストールしてください。",
|
||||
"reinstall": {
|
||||
"button_idle": "再インストール",
|
||||
"button_processing": "再インストール中",
|
||||
"desc": "{{artifact}} {{version}} を再インストールしてもよろしいですか?",
|
||||
"title": "{{artifact}} を再インストール"
|
||||
},
|
||||
"update": {
|
||||
"button_idle": "アップデート",
|
||||
"title": "{{artifact}} をアップデート",
|
||||
"desc": "{{artifact}} {{version}} をアップデートしてもよろしいですか?",
|
||||
"button_processing": "アップデート中"
|
||||
}
|
||||
},
|
||||
"PluginListIndex": {
|
||||
"hide": "クイックアクセス: 非表示",
|
||||
"no_plugin": "プラグインがインストールされていません!",
|
||||
"reinstall": "再インストール",
|
||||
"reload": "再読み込み",
|
||||
"uninstall": "アンインストール",
|
||||
"plugin_actions": "プラグインアクション",
|
||||
"update_all_other": "{{count}} 個のプラグインをアップデート",
|
||||
"show": "クイックアクセス: 表示",
|
||||
"update_to": "{{name}} を更新"
|
||||
},
|
||||
"PluginListLabel": {
|
||||
"hidden": "クイックアクセスメニューから非表示にします"
|
||||
},
|
||||
"PluginLoader": {
|
||||
"error": "エラー",
|
||||
"plugin_load_error": {
|
||||
"message": "プラグイン {{name}} の読み込みエラー",
|
||||
"toast": "{{name}} の読み込みエラー"
|
||||
},
|
||||
"plugin_uninstall": {
|
||||
"button": "アンインストール",
|
||||
"desc": "{{name}} をアンインストールしてもよろしいですか?",
|
||||
"title": "{{name}} をアンインストール"
|
||||
},
|
||||
"decky_title": "Decky",
|
||||
"decky_update_available": "{{tag_name}} のアップデートが利用可能です!",
|
||||
"plugin_update_other": "{{count}} 個のプラグインのアップデートが利用可能です!",
|
||||
"plugin_error_uninstall": "{{name}} プラグインを読み込む際に上記のような例外が発生しました。 これは通常、SteamUIの最新バージョンに合ったプラグインのアップデートが必要な場合に発生します。Decky設定のプラグインセクションでアップデートがあるかどうかを確認するか、アンインストールをお試しください。"
|
||||
},
|
||||
"SettingsDeveloperIndex": {
|
||||
"cef_console": {
|
||||
"button": "コンソールを開く",
|
||||
"label": "CEFコンソール",
|
||||
"desc": "CEFコンソールを開きます。デバッグ目的でのみ使用してください。これらの項目は危険な可能性があるので、プラグイン開発者であるか、開発者のガイドに従う場合のみ使用する必要があります。"
|
||||
},
|
||||
"react_devtools": {
|
||||
"ip_label": "IP",
|
||||
"label": "React DevTools を有効化",
|
||||
"desc": "React DevToolsを実行しているコンピューターへの接続を有効にします。この設定を変更すると、Steam が再ロードされます。有効にする前にIPアドレスを設定してください。"
|
||||
},
|
||||
"third_party_plugins": {
|
||||
"button_install": "インストール",
|
||||
"button_zip": "ブラウズ",
|
||||
"header": "サードパーティプラグイン",
|
||||
"label_desc": "URL",
|
||||
"label_url": "URLからプラグインをインストール",
|
||||
"label_zip": "ZIPファイルからプラグインをインストール"
|
||||
},
|
||||
"valve_internal": {
|
||||
"desc1": "Valveの内部開発者メニューを有効にします。",
|
||||
"desc2": "このメニューの機能が分からない場合、このメニューには触れないでください。",
|
||||
"label": "Valve Internalを有効"
|
||||
},
|
||||
"header": "その他"
|
||||
},
|
||||
"PluginView": {
|
||||
"hidden_other": "{{count}} 個のプラグインがこのリストから非表示になります"
|
||||
},
|
||||
"SettingsGeneralIndex": {
|
||||
"about": {
|
||||
"decky_version": "Deckyバージョン",
|
||||
"header": "情報"
|
||||
},
|
||||
"developer_mode": {
|
||||
"label": "開発者モード"
|
||||
},
|
||||
"notifications": {
|
||||
"header": "通知",
|
||||
"plugin_updates_label": "プラグインのアップデートが利用可能な場合に通知",
|
||||
"decky_updates_label": "Deckyのアップデートが利用可能な場合に通知"
|
||||
},
|
||||
"beta": {
|
||||
"header": "ベータ版への参加"
|
||||
},
|
||||
"other": {
|
||||
"header": "その他"
|
||||
},
|
||||
"updates": {
|
||||
"header": "アップデート"
|
||||
}
|
||||
},
|
||||
"SettingsIndex": {
|
||||
"developer_title": "開発者",
|
||||
"plugins_title": "プラグイン",
|
||||
"general_title": "一般"
|
||||
},
|
||||
"Store": {
|
||||
"store_filter": {
|
||||
"label": "フィルター",
|
||||
"label_def": "すべて"
|
||||
},
|
||||
"store_search": {
|
||||
"label": "検索"
|
||||
},
|
||||
"store_sort": {
|
||||
"label": "並べ替え",
|
||||
"label_def": "直近のアップデート(新しい順)"
|
||||
},
|
||||
"store_source": {
|
||||
"desc": "すべてのプラグインのソース コードは、GitHubのSteamDeckHomebrew/decky-plugin-databaseリポジトリで入手できます。",
|
||||
"label": "ソースコード"
|
||||
},
|
||||
"store_tabs": {
|
||||
"alph_asce": "アルファベット(Z to A)",
|
||||
"alph_desc": "アルファベット(A to Z)",
|
||||
"title": "閲覧",
|
||||
"about": "概要"
|
||||
},
|
||||
"store_testing_warning": {
|
||||
"label": "テストストア チャンネルへようこそ",
|
||||
"desc": "このストアチャンネルを使用して、最先端のプラグイン バージョンをテストできます。 すべてのユーザーがプラグインを更新できるように、必ずGitHubにフィードバックを残してください。"
|
||||
},
|
||||
"store_contrib": {
|
||||
"desc": "Decky Plugin Storeに貢献したい場合は、GitHubのSteamDeckHomebrew/decky-plugin-templateリポジトリを確認してください。 開発と配布に関する情報は README で入手できます。",
|
||||
"label": "貢献"
|
||||
},
|
||||
"store_testing_cta": "Decky Loaderチームを支援するために、新しいプラグインのテストを検討してください!"
|
||||
},
|
||||
"StoreSelect": {
|
||||
"custom_store": {
|
||||
"label": "カスタムストア",
|
||||
"url_label": "URL"
|
||||
},
|
||||
"store_channel": {
|
||||
"custom": "カスタム",
|
||||
"default": "デフォルト",
|
||||
"label": "ストアチャンネル",
|
||||
"testing": "テスト"
|
||||
}
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Deckyストアを開く",
|
||||
"settings_desc": "Decky設定を開く"
|
||||
},
|
||||
"Updater": {
|
||||
"decky_updates": "Deckyアップデート",
|
||||
"no_patch_notes_desc": "このバージョンのパッチノートはありません",
|
||||
"patch_notes_desc": "パッチノート",
|
||||
"updates": {
|
||||
"check_button": "アップデートを確認",
|
||||
"checking": "確認中",
|
||||
"cur_version": "現在のバージョン: {{ver}}",
|
||||
"install_button": "アップデートをインストール",
|
||||
"label": "アップデート",
|
||||
"lat_version": "アップデート: {{ver}} を実行中",
|
||||
"reloading": "再読み込み中",
|
||||
"updating": "アップデート中"
|
||||
}
|
||||
},
|
||||
"FilePickerError": {
|
||||
"errors": {
|
||||
"file_not_found": "指定されたパスは無効です。 内容をご確認の上、正しく入力し直してください。",
|
||||
"unknown": "不明なエラーが発生しました。 エラー内容は次のとおりです: {{raw_error}}",
|
||||
"perm_denied": "選択したパスへのアクセス権がありません。選択したフォルダ/ファイルのアクセス権がユーザー(Steam Deckのdeckユーザー)に合わせて正しく設定されていることを確認してください。"
|
||||
}
|
||||
},
|
||||
"PluginCard": {
|
||||
"plugin_version_label": "プラグインバージョン",
|
||||
"plugin_no_desc": "説明はありません。",
|
||||
"plugin_full_access": "このプラグインはSteam Deckの全てのアクセス権を持ちます。",
|
||||
"plugin_install": "インストール"
|
||||
},
|
||||
"RemoteDebugging": {
|
||||
"remote_cef": {
|
||||
"label": "リモート CEF デバッグを許可する",
|
||||
"desc": "ネットワーク上のすべてのユーザーにCEFデバッガへの非認証アクセスを許可します"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,11 @@
|
||||
"title": "Navegar",
|
||||
"alph_asce": "Alfabética (Z - A)"
|
||||
},
|
||||
"store_testing_cta": "Por favor, considere testar os novos plugins para ajudar o time do Decky Loader!"
|
||||
"store_testing_cta": "Por favor, considere testar os novos plugins para ajudar o time do Decky Loader!",
|
||||
"store_testing_warning": {
|
||||
"desc": "Você pode usar este canal da loja para testar versões avançadas do plugin. Certifique-se de deixar feedback no GitHub para que o plugin possa ser atualizado para todos os usuários.",
|
||||
"label": "Bem-vindo ao Canal de Testes da Loja"
|
||||
}
|
||||
},
|
||||
"StoreSelect": {
|
||||
"custom_store": {
|
||||
@@ -255,5 +259,9 @@
|
||||
"unknown": "Ocorreu um erro desconhecido. O erro completo é: {{raw_error}}",
|
||||
"perm_denied": "Você não tem acesso à este diretório. Por favor, verifiquei se seu usuário (deck no Steam Deck) tem as permissões necessárias para acessar este arquivo/pasta."
|
||||
}
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Abrir Loja Decky",
|
||||
"settings_desc": "Abrir Definições Decky"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,27 @@
|
||||
{
|
||||
"FilePickerIndex": {
|
||||
"folder": {
|
||||
"select": "Usar esta pasta"
|
||||
"select": "Usar esta pasta",
|
||||
"label": "Pasta",
|
||||
"show_more": "Mostrar mais ficheiros"
|
||||
},
|
||||
"file": {
|
||||
"select": "Selecionar este ficheiro"
|
||||
},
|
||||
"filter": {
|
||||
"size_desc": "Tamanho (maior)",
|
||||
"created_asce": "Criado (mais antigo)",
|
||||
"created_desc": "Criado (mais recente)",
|
||||
"modified_asce": "Modificado (mais antigo)",
|
||||
"modified_desc": "Modificado (mais recente)",
|
||||
"name_asce": "Z-A",
|
||||
"name_desc": "A-Z",
|
||||
"size_asce": "Tamanho (mais pequeno)"
|
||||
},
|
||||
"files": {
|
||||
"file_type": "Tipo de ficheiro",
|
||||
"show_hidden": "Mostrar ficheiros ocultos",
|
||||
"all_files": "Todos os ficheiros"
|
||||
}
|
||||
},
|
||||
"PluginView": {
|
||||
@@ -157,6 +177,11 @@
|
||||
},
|
||||
"updates": {
|
||||
"header": "Actualizações"
|
||||
},
|
||||
"notifications": {
|
||||
"decky_updates_label": "Atualização Decky disponível",
|
||||
"header": "Notificações",
|
||||
"plugin_updates_label": "Atualizações de plugins disponíveis"
|
||||
}
|
||||
},
|
||||
"SettingsIndex": {
|
||||
@@ -190,7 +215,11 @@
|
||||
"alph_desc": "Alfabeticamente (A-Z)",
|
||||
"title": "Navegar"
|
||||
},
|
||||
"store_testing_cta": "Testa novos plugins e ajuda a equipa do Decky Loader!"
|
||||
"store_testing_cta": "Testa novos plugins e ajuda a equipa do Decky Loader!",
|
||||
"store_testing_warning": {
|
||||
"desc": "Pode usar esta versão da loja para testar versões experimentais de plugins. Certifique-se de deixar feedback no GitHub para que o plugin possa ser atualizado para todos os utilizadores.",
|
||||
"label": "Bem-vindo ao Canal de Testes da Loja"
|
||||
}
|
||||
},
|
||||
"StoreSelect": {
|
||||
"custom_store": {
|
||||
@@ -218,5 +247,21 @@
|
||||
"reloading": "Recarregar",
|
||||
"install_button": "Instalar actualização"
|
||||
}
|
||||
},
|
||||
"FilePickerError": {
|
||||
"errors": {
|
||||
"perm_denied": "Não tem acesso ao diretório especificado. Por favor, verifique se o seu utilizador (deck na Steam Deck) possui as permissões correspondentes para aceder à pasta/ficheiro especificado.",
|
||||
"unknown": "Ocorreu um erro desconhecido. O erro é: {{raw_error}}",
|
||||
"file_not_found": "O caminho especificado não é válido. Por favor, verifique e insira-o corretamente."
|
||||
}
|
||||
},
|
||||
"TitleView": {
|
||||
"decky_store_desc": "Abrir a Loja Decky",
|
||||
"settings_desc": "Abrir as Definições Decky"
|
||||
},
|
||||
"DropdownMultiselect": {
|
||||
"button": {
|
||||
"back": "Voltar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
aiohttp==3.8.5
|
||||
aiohttp==3.9.0
|
||||
aiohttp-jinja2==1.5.1
|
||||
aiohttp_cors==0.7.0
|
||||
watchdog==2.1.7
|
||||
|
||||
+23
-6
@@ -10,6 +10,7 @@ from hashlib import sha256
|
||||
from io import BytesIO
|
||||
from logging import getLogger
|
||||
from os import R_OK, W_OK, path, listdir, access, mkdir
|
||||
from re import sub
|
||||
from shutil import rmtree
|
||||
from time import time
|
||||
from zipfile import ZipFile
|
||||
@@ -162,12 +163,6 @@ class PluginBrowser:
|
||||
current_plugin_order = self.settings.getSetting("pluginOrder")[:]
|
||||
if self.loader.watcher:
|
||||
self.loader.watcher.disabled = True
|
||||
try:
|
||||
pluginFolderPath = self.find_plugin_folder(name)
|
||||
if pluginFolderPath:
|
||||
isInstalled = True
|
||||
except:
|
||||
logger.error(f"Failed to determine if {name} is already installed, continuing anyway.")
|
||||
|
||||
# Check if the file is a local file or a URL
|
||||
if artifact.startswith("file://"):
|
||||
@@ -198,6 +193,28 @@ class PluginBrowser:
|
||||
if res.status != 200:
|
||||
logger.error(f"Server did not accept install count increment request. code: {res.status}")
|
||||
|
||||
if res_zip and version == "dev":
|
||||
with ZipFile(res_zip) as plugin_zip:
|
||||
plugin_json_list = [file for file in plugin_zip.namelist() if file.endswith("/plugin.json") and file.count("/") == 1]
|
||||
|
||||
if len(plugin_json_list) == 0:
|
||||
logger.fatal("No plugin.json found in plugin ZIP")
|
||||
return
|
||||
|
||||
elif len(plugin_json_list) > 1:
|
||||
logger.fatal("Multiple plugin.json found in plugin ZIP")
|
||||
return
|
||||
|
||||
else:
|
||||
name = sub(r"/.+$", "", plugin_json_list[0])
|
||||
|
||||
try:
|
||||
pluginFolderPath = self.find_plugin_folder(name)
|
||||
if pluginFolderPath:
|
||||
isInstalled = True
|
||||
except:
|
||||
logger.error(f"Failed to determine if {name} is already installed, continuing anyway.")
|
||||
|
||||
# Check to make sure we got the file
|
||||
if res_zip is None:
|
||||
logger.fatal(f"Could not fetch {artifact}")
|
||||
|
||||
@@ -412,7 +412,7 @@ async def get_tab_lambda(test: Callable[[Tab], bool]) -> Tab:
|
||||
|
||||
SHARED_CTX_NAMES = ["SharedJSContext", "Steam Shared Context presented by Valve™", "Steam", "SP"]
|
||||
CLOSEABLE_URLS = ["about:blank", "data:text/html,%3Cbody%3E%3C%2Fbody%3E"] # Closing anything other than these *really* likes to crash Steam
|
||||
DO_NOT_CLOSE_URL = "Valve Steam Gamepad/default" # Steam Big Picture Mode tab
|
||||
DO_NOT_CLOSE_URLS = ["Valve Steam Gamepad/default", "Valve%20Steam%20Gamepad/default"] # Steam Big Picture Mode tab
|
||||
|
||||
def tab_is_gamepadui(t: Tab) -> bool:
|
||||
return "https://steamloopback.host/routes/" in t.url and t.title in SHARED_CTX_NAMES
|
||||
@@ -432,7 +432,7 @@ async def inject_to_tab(tab_name: str, js: str, run_async: bool = False):
|
||||
async def close_old_tabs():
|
||||
tabs = await get_tabs()
|
||||
for t in tabs:
|
||||
if not t.title or (t.title not in SHARED_CTX_NAMES and any(url in t.url for url in CLOSEABLE_URLS) and DO_NOT_CLOSE_URL not in t.url):
|
||||
if not t.title or (t.title not in SHARED_CTX_NAMES and any(url in t.url for url in CLOSEABLE_URLS) and not any(url in t.url for url in DO_NOT_CLOSE_URLS)):
|
||||
logger.debug("Closing tab: " + getattr(t, "title", "Untitled"))
|
||||
await t.close()
|
||||
await sleep(0.5)
|
||||
|
||||
+114
-40
@@ -1,20 +1,29 @@
|
||||
from __future__ import annotations
|
||||
import os
|
||||
import shutil
|
||||
from asyncio import sleep
|
||||
from json.decoder import JSONDecodeError
|
||||
from logging import getLogger
|
||||
import os
|
||||
from os import getcwd, path, remove
|
||||
from typing import TYPE_CHECKING, List, TypedDict
|
||||
if TYPE_CHECKING:
|
||||
from .main import PluginManager
|
||||
from .localplatform import chmod, service_restart, ON_LINUX, get_keep_systemd_service, get_selinux
|
||||
import shutil
|
||||
from typing import List, TYPE_CHECKING, TypedDict
|
||||
import zipfile
|
||||
|
||||
from aiohttp import ClientSession, web
|
||||
|
||||
from . import helpers
|
||||
from .injector import get_gamepadui_tab
|
||||
from .localplatform import (
|
||||
ON_LINUX,
|
||||
ON_WINDOWS,
|
||||
chmod,
|
||||
get_keep_systemd_service,
|
||||
get_selinux,
|
||||
service_restart,
|
||||
)
|
||||
from .settings import SettingsManager
|
||||
if TYPE_CHECKING:
|
||||
from .main import PluginManager
|
||||
|
||||
|
||||
logger = getLogger("Updater")
|
||||
|
||||
@@ -25,6 +34,12 @@ class RemoteVer(TypedDict):
|
||||
tag_name: str
|
||||
prerelease: bool
|
||||
assets: List[RemoteVerAsset]
|
||||
class TestingVersion(TypedDict):
|
||||
id: int
|
||||
name: str
|
||||
link: str
|
||||
head_sha: str
|
||||
|
||||
|
||||
class Updater:
|
||||
def __init__(self, context: PluginManager) -> None:
|
||||
@@ -36,7 +51,9 @@ class Updater:
|
||||
"get_version": self.get_version,
|
||||
"do_update": self.do_update,
|
||||
"do_restart": self.do_restart,
|
||||
"check_for_updates": self.check_for_updates
|
||||
"check_for_updates": self.check_for_updates,
|
||||
"get_testing_versions": self.get_testing_versions,
|
||||
"download_testing_version": self.download_testing_version
|
||||
}
|
||||
self.remoteVer: RemoteVer | None = None
|
||||
self.allRemoteVers: List[RemoteVer] = []
|
||||
@@ -150,6 +167,53 @@ class Updater:
|
||||
pass
|
||||
await sleep(60 * 60 * 6) # 6 hours
|
||||
|
||||
async def download_decky_binary(self, download_url: str, version: str, is_zip: bool = False):
|
||||
download_filename = "PluginLoader" if ON_LINUX else "PluginLoader.exe"
|
||||
download_temp_filename = download_filename + ".new"
|
||||
tab = await get_gamepadui_tab()
|
||||
await tab.open_websocket()
|
||||
|
||||
async with ClientSession() as web:
|
||||
logger.debug("Downloading binary")
|
||||
async with web.request("GET", download_url, ssl=helpers.get_ssl_context(), allow_redirects=True) as res:
|
||||
total = int(res.headers.get('content-length', 0))
|
||||
with open(path.join(getcwd(), download_temp_filename), "wb") as out:
|
||||
progress = 0
|
||||
raw = 0
|
||||
async for c in res.content.iter_chunked(512):
|
||||
out.write(c)
|
||||
if total != 0:
|
||||
raw += len(c)
|
||||
new_progress = round((raw / total) * 100)
|
||||
if progress != new_progress:
|
||||
self.context.loop.create_task(tab.evaluate_js(f"window.DeckyUpdater.updateProgress({new_progress})", False, False, False))
|
||||
progress = new_progress
|
||||
|
||||
with open(path.join(getcwd(), ".loader.version"), "w", encoding="utf-8") as out:
|
||||
out.write(version)
|
||||
|
||||
if ON_LINUX:
|
||||
remove(path.join(getcwd(), download_filename))
|
||||
if (is_zip):
|
||||
with zipfile.ZipFile(path.join(getcwd(), download_temp_filename), 'r') as file:
|
||||
file.getinfo(download_filename).filename = download_filename + ".unzipped"
|
||||
file.extract(download_filename)
|
||||
remove(path.join(getcwd(), download_temp_filename))
|
||||
shutil.move(path.join(getcwd(), download_filename + ".unzipped"), path.join(getcwd(), download_filename))
|
||||
else:
|
||||
shutil.move(path.join(getcwd(), download_temp_filename), path.join(getcwd(), download_filename))
|
||||
|
||||
chmod(path.join(getcwd(), download_filename), 777, False)
|
||||
if get_selinux():
|
||||
from asyncio.subprocess import create_subprocess_exec
|
||||
process = await create_subprocess_exec("chcon", "-t", "bin_t", path.join(getcwd(), download_filename))
|
||||
logger.info(f"Setting the executable flag with chcon returned {await process.wait()}")
|
||||
|
||||
logger.info("Updated loader installation.")
|
||||
await tab.evaluate_js("window.DeckyUpdater.finish()", False, False)
|
||||
await self.do_restart()
|
||||
await tab.close_websocket()
|
||||
|
||||
async def do_update(self):
|
||||
logger.debug("Starting update.")
|
||||
try:
|
||||
@@ -161,7 +225,6 @@ class Updater:
|
||||
version = self.remoteVer["tag_name"]
|
||||
download_url = None
|
||||
download_filename = "PluginLoader" if ON_LINUX else "PluginLoader.exe"
|
||||
download_temp_filename = download_filename + ".new"
|
||||
|
||||
for x in self.remoteVer["assets"]:
|
||||
if x["name"] == download_filename:
|
||||
@@ -174,8 +237,6 @@ class Updater:
|
||||
service_url = self.get_service_url()
|
||||
logger.debug("Retrieved service URL")
|
||||
|
||||
tab = await get_gamepadui_tab()
|
||||
await tab.open_websocket()
|
||||
async with ClientSession() as web:
|
||||
if ON_LINUX and not get_keep_systemd_service():
|
||||
logger.debug("Downloading systemd service")
|
||||
@@ -203,36 +264,49 @@ class Updater:
|
||||
os.mkdir(path.join(getcwd(), ".systemd"))
|
||||
shutil.move(service_file_path, path.join(getcwd(), ".systemd")+"/plugin_loader.service")
|
||||
|
||||
logger.debug("Downloading binary")
|
||||
async with web.request("GET", download_url, ssl=helpers.get_ssl_context(), allow_redirects=True) as res:
|
||||
total = int(res.headers.get('content-length', 0))
|
||||
with open(path.join(getcwd(), download_temp_filename), "wb") as out:
|
||||
progress = 0
|
||||
raw = 0
|
||||
async for c in res.content.iter_chunked(512):
|
||||
out.write(c)
|
||||
raw += len(c)
|
||||
new_progress = round((raw / total) * 100)
|
||||
if progress != new_progress:
|
||||
self.context.loop.create_task(tab.evaluate_js(f"window.DeckyUpdater.updateProgress({new_progress})", False, False, False))
|
||||
progress = new_progress
|
||||
|
||||
with open(path.join(getcwd(), ".loader.version"), "w", encoding="utf-8") as out:
|
||||
out.write(version)
|
||||
|
||||
if ON_LINUX:
|
||||
remove(path.join(getcwd(), download_filename))
|
||||
shutil.move(path.join(getcwd(), download_temp_filename), path.join(getcwd(), download_filename))
|
||||
chmod(path.join(getcwd(), download_filename), 777, False)
|
||||
if get_selinux():
|
||||
from asyncio.subprocess import create_subprocess_exec
|
||||
process = await create_subprocess_exec("chcon", "-t", "bin_t", path.join(getcwd(), download_filename))
|
||||
logger.info(f"Setting the executable flag with chcon returned {await process.wait()}")
|
||||
|
||||
logger.info("Updated loader installation.")
|
||||
await tab.evaluate_js("window.DeckyUpdater.finish()", False, False)
|
||||
await self.do_restart()
|
||||
await tab.close_websocket()
|
||||
await self.download_decky_binary(download_url, version)
|
||||
|
||||
async def do_restart(self):
|
||||
await service_restart("plugin_loader")
|
||||
|
||||
async def get_testing_versions(self) -> List[TestingVersion]:
|
||||
result: List[TestingVersion] = []
|
||||
async with ClientSession() as web:
|
||||
async with web.request("GET", "https://api.github.com/repos/SteamDeckHomebrew/decky-loader/pulls",
|
||||
headers={'X-GitHub-Api-Version': '2022-11-28'}, params={'state':'open'}, ssl=helpers.get_ssl_context()) as res:
|
||||
open_prs = await res.json()
|
||||
for pr in open_prs:
|
||||
result.append({
|
||||
"id": int(pr['number']),
|
||||
"name": pr['title'],
|
||||
"link": pr['html_url'],
|
||||
"head_sha": pr['head']['sha'],
|
||||
})
|
||||
return result
|
||||
|
||||
async def download_testing_version(self, pr_id: int, sha_id: str):
|
||||
down_id = ''
|
||||
#Get all the associated workflow run for the given sha_id code hash
|
||||
async with ClientSession() as web:
|
||||
async with web.request("GET", "https://api.github.com/repos/SteamDeckHomebrew/decky-loader/actions/runs",
|
||||
headers={'X-GitHub-Api-Version': '2022-11-28'}, params={'event':'pull_request', 'head_sha': sha_id}, ssl=helpers.get_ssl_context()) as res:
|
||||
works = await res.json()
|
||||
#Iterate over the workflow_run to get the two builds if they exists
|
||||
for work in works['workflow_runs']:
|
||||
if ON_WINDOWS and work['name'] == 'Builder Win':
|
||||
down_id=work['id']
|
||||
break
|
||||
elif ON_LINUX and work['name'] == 'Builder':
|
||||
down_id=work['id']
|
||||
break
|
||||
if down_id != '':
|
||||
async with ClientSession() as web:
|
||||
async with web.request("GET", f"https://api.github.com/repos/SteamDeckHomebrew/decky-loader/actions/runs/{down_id}/artifacts",
|
||||
headers={'X-GitHub-Api-Version': '2022-11-28'}, ssl=helpers.get_ssl_context()) as res:
|
||||
jresp = await res.json()
|
||||
#If the request found at least one artifact to download...
|
||||
if int(jresp['total_count']) != 0:
|
||||
# this assumes that the artifact we want is the first one!
|
||||
down_link = f"https://nightly.link/SteamDeckHomebrew/decky-loader/actions/artifacts/{jresp['artifacts'][0]['id']}.zip"
|
||||
#Then fetch it and restart itself
|
||||
await self.download_decky_binary(down_link, f'PR-{pr_id}' , True)
|
||||
|
||||
@@ -238,7 +238,7 @@ class Utilities:
|
||||
elif include_files:
|
||||
# Handle requested extensions if present
|
||||
if len(include_ext) == 0 or 'all_files' in include_ext \
|
||||
or splitext(file.name)[1].lstrip('.') in include_ext:
|
||||
or splitext(file.name)[1].lstrip('.').upper() in (ext.upper() for ext in include_ext):
|
||||
if (is_hidden and include_hidden) or not is_hidden:
|
||||
files.append({"file": file, "filest": filest, "is_dir": False})
|
||||
# Filter logic
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"i18next-parser": "^8.0.0",
|
||||
"import-sort-style-module": "^6.0.0",
|
||||
"inquirer": "^8.2.5",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier-plugin-import-sort": "^0.0.7",
|
||||
"react": "16.14.0",
|
||||
"react-dom": "16.14.0",
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"decky-frontend-lib": "3.24.1",
|
||||
"decky-frontend-lib": "3.24.5",
|
||||
"filesize": "^10.0.7",
|
||||
"i18next": "^23.2.1",
|
||||
"i18next-http-backend": "^2.2.1",
|
||||
|
||||
Generated
+14
-12
@@ -6,8 +6,8 @@ settings:
|
||||
|
||||
dependencies:
|
||||
decky-frontend-lib:
|
||||
specifier: 3.24.1
|
||||
version: 3.24.1
|
||||
specifier: 3.24.5
|
||||
version: 3.24.5
|
||||
filesize:
|
||||
specifier: ^10.0.7
|
||||
version: 10.0.7
|
||||
@@ -77,11 +77,11 @@ devDependencies:
|
||||
specifier: ^8.2.5
|
||||
version: 8.2.5
|
||||
prettier:
|
||||
specifier: ^2.8.8
|
||||
version: 2.8.8
|
||||
specifier: ^3.2.5
|
||||
version: 3.2.5
|
||||
prettier-plugin-import-sort:
|
||||
specifier: ^0.0.7
|
||||
version: 0.0.7(prettier@2.8.8)
|
||||
version: 0.0.7(prettier@3.2.5)
|
||||
react:
|
||||
specifier: 16.14.0
|
||||
version: 16.14.0
|
||||
@@ -1482,8 +1482,8 @@ packages:
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
|
||||
/decky-frontend-lib@3.24.1:
|
||||
resolution: {integrity: sha512-VGxLTPetxx/pQVC+t8odTHrwQAh7uy4bO2Od2gGWSTfmUUoxtAcEtiXGyE9mKsoD6t7QNHrGvgXn78sf2i/IeQ==}
|
||||
/decky-frontend-lib@3.24.5:
|
||||
resolution: {integrity: sha512-eYlbKDOOcIBPI0b76Rqvlryq2ym/QNiry4xf2pFrXmBa1f95dflqbQAb2gTq9uHEa5gFmeV4lUcMPGJ3M14Xqw==}
|
||||
dev: false
|
||||
|
||||
/decode-named-character-reference@1.0.2:
|
||||
@@ -3108,7 +3108,7 @@ packages:
|
||||
engines: {node: '>=8.6'}
|
||||
dev: true
|
||||
|
||||
/prettier-plugin-import-sort@0.0.7(prettier@2.8.8):
|
||||
/prettier-plugin-import-sort@0.0.7(prettier@3.2.5):
|
||||
resolution: {integrity: sha512-O0KlUSq+lwvh+UiN3wZDT6wWkf7TNxTVv2/XXE5KqpRNbFJq3nRg2ftzBYFFO8QGpdWIrOB0uCTCtFjIxmVKQw==}
|
||||
peerDependencies:
|
||||
prettier: '>= 2.0'
|
||||
@@ -3117,14 +3117,14 @@ packages:
|
||||
import-sort-config: 6.0.0
|
||||
import-sort-parser-babylon: 6.0.0
|
||||
import-sort-parser-typescript: 6.0.0
|
||||
prettier: 2.8.8
|
||||
prettier: 3.2.5
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/prettier@2.8.8:
|
||||
resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
/prettier@3.2.5:
|
||||
resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
@@ -3200,6 +3200,7 @@ packages:
|
||||
prop-types: 15.8.1
|
||||
react: 16.14.0
|
||||
scheduler: 0.19.1
|
||||
bundledDependencies: false
|
||||
|
||||
/react-file-icon@1.3.0(react-dom@16.14.0)(react@16.14.0):
|
||||
resolution: {integrity: sha512-wxl/WwSX5twQKVXloPHbS71iZQUKO84KgZ44Kh7vYZGu1qH2kagx+RSTNfk/+IHtXfjPWPNIHPGi2Y8S94N1CQ==}
|
||||
@@ -3283,6 +3284,7 @@ packages:
|
||||
loose-envify: 1.4.0
|
||||
object-assign: 4.1.1
|
||||
prop-types: 15.8.1
|
||||
bundledDependencies: false
|
||||
|
||||
/readable-stream@2.3.8:
|
||||
resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
|
||||
|
||||
@@ -30,11 +30,14 @@ const DeckyToaster: FC<DeckyToasterProps> = () => {
|
||||
// not actually node but TS is shit
|
||||
let interval: NodeJS.Timer | null;
|
||||
if (renderedToast) {
|
||||
interval = setTimeout(() => {
|
||||
interval = null;
|
||||
console.log('clear toast', renderedToast.data);
|
||||
removeToast(renderedToast.data);
|
||||
}, (renderedToast.data.duration || 5e3) + 1000);
|
||||
interval = setTimeout(
|
||||
() => {
|
||||
interval = null;
|
||||
console.log('clear toast', renderedToast.data);
|
||||
removeToast(renderedToast.data);
|
||||
},
|
||||
(renderedToast.data.duration || 5e3) + 1000,
|
||||
);
|
||||
console.log('set int', interval);
|
||||
}
|
||||
return () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SidebarNavigation } from 'decky-frontend-lib';
|
||||
import { lazy } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FaCode, FaPlug } from 'react-icons/fa';
|
||||
import { FaCode, FaFlask, FaPlug } from 'react-icons/fa';
|
||||
|
||||
import { useSetting } from '../../utils/hooks/useSetting';
|
||||
import DeckyIcon from '../DeckyIcon';
|
||||
@@ -10,6 +10,7 @@ import GeneralSettings from './pages/general';
|
||||
import PluginList from './pages/plugin_list';
|
||||
|
||||
const DeveloperSettings = lazy(() => import('./pages/developer'));
|
||||
const TestingMenu = lazy(() => import('./pages/testing'));
|
||||
|
||||
export default function SettingsPage() {
|
||||
const [isDeveloper, setIsDeveloper] = useSetting<boolean>('developer.enabled', false);
|
||||
@@ -39,6 +40,17 @@ export default function SettingsPage() {
|
||||
icon: <FaCode />,
|
||||
visible: isDeveloper,
|
||||
},
|
||||
{
|
||||
title: t('SettingsIndex.testing_title'),
|
||||
content: (
|
||||
<WithSuspense>
|
||||
<TestingMenu />
|
||||
</WithSuspense>
|
||||
),
|
||||
route: '/decky/settings/testing',
|
||||
icon: <FaFlask />,
|
||||
visible: isDeveloper,
|
||||
},
|
||||
];
|
||||
|
||||
return <SidebarNavigation pages={pages} />;
|
||||
|
||||
@@ -8,10 +8,15 @@ import { useSetting } from '../../../../utils/hooks/useSetting';
|
||||
|
||||
const logger = new Logger('BranchSelect');
|
||||
|
||||
enum UpdateBranch {
|
||||
export enum UpdateBranch {
|
||||
Stable,
|
||||
Prerelease,
|
||||
Testing,
|
||||
}
|
||||
|
||||
enum LessUpdateBranch {
|
||||
Stable,
|
||||
Prerelease,
|
||||
// Testing,
|
||||
}
|
||||
|
||||
const BranchSelect: FunctionComponent<{}> = () => {
|
||||
@@ -24,11 +29,11 @@ const BranchSelect: FunctionComponent<{}> = () => {
|
||||
const [selectedBranch, setSelectedBranch] = useSetting<UpdateBranch>('branch', UpdateBranch.Stable);
|
||||
|
||||
return (
|
||||
// Returns numerical values from 0 to 2 (with current branch setup as of 8/28/22)
|
||||
// 0 being stable, 1 being pre-release and 2 being nightly
|
||||
// Returns numerical values from 0 to 2 (with current branch setup as of 6/16/23)
|
||||
// 0 being stable, 1 being pre-release and 2 being testing (not a branch!)
|
||||
<Field label={t('BranchSelect.update_channel.label')} childrenContainerWidth={'fixed'}>
|
||||
<Dropdown
|
||||
rgOptions={Object.values(UpdateBranch)
|
||||
rgOptions={Object.values(selectedBranch == UpdateBranch.Testing ? UpdateBranch : LessUpdateBranch)
|
||||
.filter((branch) => typeof branch == 'number')
|
||||
.map((branch) => ({
|
||||
label: tBranches[branch as number],
|
||||
|
||||
@@ -135,8 +135,8 @@ export default function UpdaterSettings() {
|
||||
{checkingForUpdates
|
||||
? t('Updater.updates.checking')
|
||||
: !versionInfo?.remote || versionInfo?.remote?.tag_name == versionInfo?.current
|
||||
? t('Updater.updates.check_button')
|
||||
: t('Updater.updates.install_button')}
|
||||
? t('Updater.updates.check_button')
|
||||
: t('Updater.updates.install_button')}
|
||||
</DialogButton>
|
||||
) : (
|
||||
<ProgressBarWithInfo
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
import { DialogBody, DialogButton, DialogControlsSection, Focusable, Navigation } from 'decky-frontend-lib';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FaDownload, FaInfo } from 'react-icons/fa';
|
||||
|
||||
import { callUpdaterMethod } from '../../../../updater';
|
||||
import { setSetting } from '../../../../utils/settings';
|
||||
import { UpdateBranch } from '../general/BranchSelect';
|
||||
|
||||
interface TestingVersion {
|
||||
id: number;
|
||||
name: string;
|
||||
link: string;
|
||||
head_sha: string;
|
||||
}
|
||||
|
||||
export default function TestingVersionList() {
|
||||
const { t } = useTranslation();
|
||||
const [testingVersions, setTestingVersions] = useState<TestingVersion[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
setTestingVersions((await callUpdaterMethod('get_testing_versions')).result);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
if (testingVersions.length === 0) {
|
||||
return (
|
||||
<div>
|
||||
<p>No open PRs found</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DialogBody>
|
||||
<DialogControlsSection>
|
||||
<ul style={{ listStyleType: 'none', padding: '0' }}>
|
||||
{testingVersions.map((version) => {
|
||||
return (
|
||||
<li style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', paddingBottom: '10px' }}>
|
||||
<span>
|
||||
{version.name} <span style={{ opacity: '50%' }}>{'#' + version.id}</span>
|
||||
</span>
|
||||
<Focusable style={{ height: '40px', marginLeft: 'auto', display: 'flex' }}>
|
||||
<DialogButton
|
||||
style={{ height: '40px', minWidth: '60px', marginRight: '10px' }}
|
||||
onClick={() => {
|
||||
callUpdaterMethod('download_testing_version', { pr_id: version.id, sha_id: version.head_sha });
|
||||
setSetting('branch', UpdateBranch.Testing);
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
minWidth: '150px',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
{t('Testing.download')}
|
||||
<FaDownload style={{ paddingLeft: '1rem' }} />
|
||||
</div>
|
||||
</DialogButton>
|
||||
<DialogButton
|
||||
style={{
|
||||
height: '40px',
|
||||
width: '40px',
|
||||
padding: '10px 12px',
|
||||
minWidth: '40px',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
}}
|
||||
onClick={() => Navigation.NavigateToExternalWeb(version.link)}
|
||||
>
|
||||
<FaInfo />
|
||||
</DialogButton>
|
||||
</Focusable>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</DialogControlsSection>
|
||||
</DialogBody>
|
||||
);
|
||||
}
|
||||
@@ -8,20 +8,19 @@ import {
|
||||
TextField,
|
||||
findModule,
|
||||
} from 'decky-frontend-lib';
|
||||
import { FC, useEffect, useMemo, useState } from 'react';
|
||||
import { Dispatch, FC, SetStateAction, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import logo from '../../../assets/plugin_store.png';
|
||||
import Logger from '../../logger';
|
||||
import { Store, StorePlugin, getPluginList, getStore } from '../../store';
|
||||
import { SortDirections, SortOptions, Store, StorePlugin, getPluginList, getStore } from '../../store';
|
||||
import PluginCard from './PluginCard';
|
||||
|
||||
const logger = new Logger('Store');
|
||||
|
||||
const StorePage: FC<{}> = () => {
|
||||
const [currentTabRoute, setCurrentTabRoute] = useState<string>('browse');
|
||||
const [data, setData] = useState<StorePlugin[] | null>(null);
|
||||
const [isTesting, setIsTesting] = useState<boolean>(false);
|
||||
const [pluginCount, setPluginCount] = useState<number | null>(null);
|
||||
const { TabCount } = findModule((m) => {
|
||||
if (m?.TabCount && m?.TabTitle) return true;
|
||||
return false;
|
||||
@@ -29,17 +28,6 @@ const StorePage: FC<{}> = () => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const res = await getPluginList();
|
||||
logger.log('got data!', res);
|
||||
setData(res);
|
||||
const storeRes = await getStore();
|
||||
logger.log(`store is ${storeRes}, isTesting is ${storeRes === Store.Testing}`);
|
||||
setIsTesting(storeRes === Store.Testing);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
@@ -49,52 +37,71 @@ const StorePage: FC<{}> = () => {
|
||||
background: '#0005',
|
||||
}}
|
||||
>
|
||||
{!data ? (
|
||||
<div style={{ height: '100%' }}>
|
||||
<SteamSpinner />
|
||||
</div>
|
||||
) : (
|
||||
<Tabs
|
||||
activeTab={currentTabRoute}
|
||||
onShowTab={(tabId: string) => {
|
||||
setCurrentTabRoute(tabId);
|
||||
}}
|
||||
tabs={[
|
||||
{
|
||||
title: t('Store.store_tabs.title'),
|
||||
content: <BrowseTab children={{ data: data, isTesting: isTesting }} />,
|
||||
id: 'browse',
|
||||
renderTabAddon: () => <span className={TabCount}>{data.length}</span>,
|
||||
},
|
||||
{
|
||||
title: t('Store.store_tabs.about'),
|
||||
content: <AboutTab />,
|
||||
id: 'about',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<Tabs
|
||||
activeTab={currentTabRoute}
|
||||
onShowTab={(tabId: string) => {
|
||||
setCurrentTabRoute(tabId);
|
||||
}}
|
||||
tabs={[
|
||||
{
|
||||
title: t('Store.store_tabs.title'),
|
||||
content: <BrowseTab setPluginCount={setPluginCount} />,
|
||||
id: 'browse',
|
||||
renderTabAddon: () => <span className={TabCount}>{pluginCount}</span>,
|
||||
},
|
||||
{
|
||||
title: t('Store.store_tabs.about'),
|
||||
content: <AboutTab />,
|
||||
id: 'about',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const BrowseTab: FC<{ children: { data: StorePlugin[]; isTesting: boolean } }> = (data) => {
|
||||
const BrowseTab: FC<{ setPluginCount: Dispatch<SetStateAction<number | null>> }> = ({ setPluginCount }) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const sortOptions = useMemo(
|
||||
const dropdownSortOptions = useMemo(
|
||||
(): DropdownOption[] => [
|
||||
{ data: 1, label: t('Store.store_tabs.alph_desc') },
|
||||
{ data: 2, label: t('Store.store_tabs.alph_asce') },
|
||||
// ascending and descending order are the wrong way around for the alphabetical sort
|
||||
// this is because it was initially done incorrectly for i18n and 'fixing' it would
|
||||
// make all the translations incorrect
|
||||
{ data: [SortOptions.name, SortDirections.ascending], label: t('Store.store_tabs.alph_desc') },
|
||||
{ data: [SortOptions.name, SortDirections.descending], label: t('Store.store_tabs.alph_asce') },
|
||||
{ data: [SortOptions.date, SortDirections.ascending], label: t('Store.store_tabs.date_asce') },
|
||||
{ data: [SortOptions.date, SortDirections.descending], label: t('Store.store_tabs.date_desc') },
|
||||
{ data: [SortOptions.downloads, SortDirections.descending], label: t('Store.store_tabs.downloads_desc') },
|
||||
{ data: [SortOptions.downloads, SortDirections.ascending], label: t('Store.store_tabs.downloads_asce') },
|
||||
],
|
||||
[],
|
||||
);
|
||||
|
||||
// const filterOptions = useMemo((): DropdownOption[] => [{ data: 1, label: 'All' }], []);
|
||||
|
||||
const [selectedSort, setSort] = useState<number>(sortOptions[0].data);
|
||||
const [selectedSort, setSort] = useState<[SortOptions, SortDirections]>(dropdownSortOptions[0].data);
|
||||
// const [selectedFilter, setFilter] = useState<number>(filterOptions[0].data);
|
||||
const [searchFieldValue, setSearchValue] = useState<string>('');
|
||||
const [pluginList, setPluginList] = useState<StorePlugin[] | null>(null);
|
||||
const [isTesting, setIsTesting] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const res = await getPluginList(selectedSort[0], selectedSort[1]);
|
||||
logger.log('got data!', res);
|
||||
setPluginList(res);
|
||||
setPluginCount(res.length);
|
||||
})();
|
||||
}, [selectedSort]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const storeRes = await getStore();
|
||||
logger.log(`store is ${storeRes}, isTesting is ${storeRes === Store.Testing}`);
|
||||
setIsTesting(storeRes === Store.Testing);
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -117,7 +124,7 @@ const BrowseTab: FC<{ children: { data: StorePlugin[]; isTesting: boolean } }> =
|
||||
<span className="DialogLabel">{t("Store.store_sort.label")}</span>
|
||||
<Dropdown
|
||||
menuLabel={t("Store.store_sort.label") as string}
|
||||
rgOptions={sortOptions}
|
||||
rgOptions={dropdownSortOptions}
|
||||
strDefaultLabel={t("Store.store_sort.label_def") as string}
|
||||
selectedOption={selectedSort}
|
||||
onChange={(e) => setSort(e.data)}
|
||||
@@ -163,7 +170,7 @@ const BrowseTab: FC<{ children: { data: StorePlugin[]; isTesting: boolean } }> =
|
||||
<span className="DialogLabel">{t('Store.store_sort.label')}</span>
|
||||
<Dropdown
|
||||
menuLabel={t('Store.store_sort.label') as string}
|
||||
rgOptions={sortOptions}
|
||||
rgOptions={dropdownSortOptions}
|
||||
strDefaultLabel={t('Store.store_sort.label_def') as string}
|
||||
selectedOption={selectedSort}
|
||||
onChange={(e) => setSort(e.data)}
|
||||
@@ -182,7 +189,7 @@ const BrowseTab: FC<{ children: { data: StorePlugin[]; isTesting: boolean } }> =
|
||||
</div>
|
||||
</Focusable>
|
||||
</div>
|
||||
{data.children.isTesting && (
|
||||
{isTesting && (
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
@@ -213,22 +220,22 @@ const BrowseTab: FC<{ children: { data: StorePlugin[]; isTesting: boolean } }> =
|
||||
</div>
|
||||
)}
|
||||
<div>
|
||||
{data.children.data
|
||||
.filter((plugin: StorePlugin) => {
|
||||
return (
|
||||
plugin.name.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
|
||||
plugin.description.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
|
||||
plugin.author.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
|
||||
plugin.tags.some((tag: string) => tag.toLowerCase().includes(searchFieldValue.toLowerCase()))
|
||||
);
|
||||
})
|
||||
.sort((a, b) => {
|
||||
if (selectedSort % 2 === 1) return a.name.localeCompare(b.name);
|
||||
else return b.name.localeCompare(a.name);
|
||||
})
|
||||
.map((plugin: StorePlugin) => (
|
||||
<PluginCard plugin={plugin} />
|
||||
))}
|
||||
{!pluginList ? (
|
||||
<div style={{ height: '100%' }}>
|
||||
<SteamSpinner />
|
||||
</div>
|
||||
) : (
|
||||
pluginList
|
||||
.filter((plugin: StorePlugin) => {
|
||||
return (
|
||||
plugin.name.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
|
||||
plugin.description.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
|
||||
plugin.author.toLowerCase().includes(searchFieldValue.toLowerCase()) ||
|
||||
plugin.tags.some((tag: string) => tag.toLowerCase().includes(searchFieldValue.toLowerCase()))
|
||||
);
|
||||
})
|
||||
.map((plugin: StorePlugin) => <PluginCard plugin={plugin} />)
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -24,19 +24,9 @@ export async function setShowValveInternal(show: boolean) {
|
||||
) as any
|
||||
];
|
||||
|
||||
if (mobx.observe_) {
|
||||
// New style, currently broken
|
||||
logger.log('Valve internal not yet supported on this build.');
|
||||
// removeSettingsObserver = mobx.observe_(mobx, [(e: any) => {
|
||||
// console.log("got e", e)
|
||||
// e.newValue.bIsValveEmail = true;
|
||||
// }]);
|
||||
} else if (mobx.observe) {
|
||||
// Old style
|
||||
removeSettingsObserver = mobx.observe((e: any) => {
|
||||
e.newValue.bIsValveEmail = true;
|
||||
});
|
||||
}
|
||||
removeSettingsObserver = (mobx.observe_ || mobx.observe).call(mobx, (e: any) => {
|
||||
e.newValue.bIsValveEmail = true;
|
||||
});
|
||||
|
||||
window.settingsStore.m_Settings.bIsValveEmail = true;
|
||||
logger.log('Enabled Valve Internal menu');
|
||||
|
||||
+22
-2
@@ -7,6 +7,17 @@ export enum Store {
|
||||
Custom,
|
||||
}
|
||||
|
||||
export enum SortOptions {
|
||||
name = 'name',
|
||||
date = 'date',
|
||||
downloads = 'downloads',
|
||||
}
|
||||
|
||||
export enum SortDirections {
|
||||
ascending = 'asc',
|
||||
descending = 'desc',
|
||||
}
|
||||
|
||||
export interface StorePluginVersion {
|
||||
name: string;
|
||||
hash: string;
|
||||
@@ -36,11 +47,20 @@ export async function getStore(): Promise<Store> {
|
||||
return await getSetting<Store>('store', Store.Default);
|
||||
}
|
||||
|
||||
export async function getPluginList(): Promise<StorePlugin[]> {
|
||||
export async function getPluginList(
|
||||
sort_by: SortOptions | null = null,
|
||||
sort_direction: SortDirections | null = null,
|
||||
): Promise<StorePlugin[]> {
|
||||
let version = await window.DeckyPluginLoader.updateVersion();
|
||||
let store = await getSetting<Store | null>('store', null);
|
||||
|
||||
let customURL = await getSetting<string>('store-url', 'https://plugins.deckbrew.xyz/plugins');
|
||||
|
||||
let query: URLSearchParams | string = new URLSearchParams();
|
||||
sort_by && query.set('sort_by', sort_by);
|
||||
sort_direction && query.set('sort_direction', sort_direction);
|
||||
query = '?' + String(query);
|
||||
|
||||
let storeURL;
|
||||
if (store === null) {
|
||||
console.log('Could not get store, using Default.');
|
||||
@@ -62,7 +82,7 @@ export async function getPluginList(): Promise<StorePlugin[]> {
|
||||
storeURL = 'https://plugins.deckbrew.xyz/plugins';
|
||||
break;
|
||||
}
|
||||
return fetch(storeURL, {
|
||||
return fetch(storeURL + query, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'X-Decky-Version': version.current,
|
||||
|
||||
@@ -56,7 +56,8 @@ class Toaster extends Logger {
|
||||
if (
|
||||
currentNode?.memoizedProps?.className?.startsWith?.('gamepadtoasts_GamepadToastPlaceholder') ||
|
||||
currentNode?.memoizedProps?.className?.startsWith?.('toastmanager_ToastPlaceholder') ||
|
||||
currentNode?.memoizedProps?.className?.startsWith?.('toastmanager_ToastPopup')
|
||||
currentNode?.memoizedProps?.className?.startsWith?.('toastmanager_ToastPopup') ||
|
||||
currentNode?.memoizedProps?.className?.startsWith?.('gamepadtoasts_GamepadToastPopup')
|
||||
) {
|
||||
this.log(`Toaster root was found in ${iters} recursion cycles`);
|
||||
return currentNode;
|
||||
@@ -80,7 +81,10 @@ class Toaster extends Logger {
|
||||
instance = findToasterRoot(tree, 0);
|
||||
}
|
||||
this.node = instance.return;
|
||||
this.rNode = this.node.return;
|
||||
this.rNode = findInReactTree(
|
||||
this.node.return.return,
|
||||
(node) => node?.stateNode && node.type?.InstallErrorReportingStore,
|
||||
);
|
||||
let toast: any;
|
||||
let renderedToast: ReactNode = null;
|
||||
let innerPatched: any;
|
||||
|
||||
Reference in New Issue
Block a user