diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5eebbd4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,59 @@ +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +*.swp + +pids +logs +results +tmp + +# Coverage reports +coverage + +# API keys and secrets +.env + +# Dependency directory +node_modules +bower_components +.pnpm-store + +# Editors +.idea +*.iml + +# OS metadata +.DS_Store +Thumbs.db + +# Ignore built ts files +dist/ + +__pycache__/ + +/.yalc +yalc.lock + +.vscode/settings.json + +# Ignore output folder + +backend/out + +# Make sure to ignore any instance of the loader's decky_plugin.py +decky_plugin.py + +# Ignore decky CLI for building plugins +out +out/* +cli/ +cli/* +cli/decky + +.superpowers/ diff --git a/main.py b/main.py new file mode 100644 index 0000000..47f74cf --- /dev/null +++ b/main.py @@ -0,0 +1,14 @@ +import os +import sys + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "py_modules")) + +import decky # noqa: E402 + + +class Plugin: + async def _main(self): + decky.logger.info("Mudfish VPN plugin loaded") + + async def _unload(self): + decky.logger.info("Mudfish VPN plugin unloaded") diff --git a/package.json b/package.json new file mode 100644 index 0000000..51aee70 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "mudfish-decky", + "version": "0.1.0", + "description": "Toggle Mudfish Cloud VPN Full VPN mode from Steam Deck Gaming Mode", + "type": "module", + "scripts": { + "build": "rollup -c", + "watch": "rollup -c -w" + }, + "author": "ysj7705", + "license": "BSD-3-Clause", + "devDependencies": { + "@decky/rollup": "^1.0.2", + "@decky/ui": "^4.11.0", + "@types/react": "19.1.1", + "@types/react-dom": "19.1.1", + "@types/webpack": "^5.28.5", + "rollup": "^4.53.3", + "typescript": "^5.6.2" + }, + "dependencies": { + "@decky/api": "^1.1.3", + "react-icons": "^5.3.0", + "tslib": "^2.7.0" + }, + "pnpm": { + "peerDependencyRules": { + "ignoreMissing": [ + "react", + "react-dom" + ] + } + } +} diff --git a/plugin.json b/plugin.json new file mode 100644 index 0000000..241f14d --- /dev/null +++ b/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "Mudfish VPN", + "author": "ysj7705", + "flags": ["root"], + "api_version": 1, + "publish": { + "tags": ["vpn", "mudfish", "root"], + "description": "Toggle Mudfish Cloud VPN Full VPN mode from Gaming Mode and pick a Japan node.", + "image": "" + } +} diff --git a/py_modules/mudfish_decky/__init__.py b/py_modules/mudfish_decky/__init__.py new file mode 100644 index 0000000..0ce9b09 --- /dev/null +++ b/py_modules/mudfish_decky/__init__.py @@ -0,0 +1 @@ +"""Mudfish Cloud VPN control for the Decky plugin backend.""" diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..17e71a7 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,5 @@ +import deckyPlugin from "@decky/rollup"; + +export default deckyPlugin({ + // Add your extra Rollup options here +}) \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000..07f4166 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Build the frontend and install the plugin on the Steam Deck, then restart Decky. +# Needs passwordless sudo for the deck user (development only). +set -euo pipefail +cd "$(dirname "$0")/.." +DECK="${DECK:-deck@192.168.1.50}" +pnpm build +tar --exclude='__pycache__' -cf - dist main.py plugin.json package.json py_modules | ssh "$DECK" ' + D=/home/deck/homebrew/plugins/mudfish-decky + sudo rm -rf "$D" && sudo mkdir -p "$D" && sudo tar -xf - -C "$D" && + sudo systemctl restart plugin_loader' +echo "deployed to $DECK" diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100644 index 0000000..514355e --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Run the Python unit tests on the Steam Deck (its python3 matches the target runtime closely). +set -euo pipefail +cd "$(dirname "$0")/.." +DECK="${DECK:-deck@192.168.1.50}" +tar -cf - py_modules tests | ssh "$DECK" ' + rm -rf /tmp/mfd-test && mkdir /tmp/mfd-test && tar -xf - -C /tmp/mfd-test && + cd /tmp/mfd-test && PYTHONPATH=py_modules python3 -m unittest discover -s tests -t . -v' diff --git a/src/index.tsx b/src/index.tsx new file mode 100644 index 0000000..b4ab92c --- /dev/null +++ b/src/index.tsx @@ -0,0 +1,10 @@ +import { PanelSection, staticClasses } from "@decky/ui"; +import { definePlugin } from "@decky/api"; +import { FaFish } from "react-icons/fa"; + +export default definePlugin(() => ({ + name: "Mudfish VPN", + titleView: