Skip to content

Commit

Permalink
feat: add moonlight launch
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwjackson committed Oct 15, 2024
1 parent ad0f48a commit 1542a5c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
48 changes: 48 additions & 0 deletions packages/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,54 @@ def resolve_symlink(path):
return os.path.realpath(path)



@app.route("/api/remote", methods=["POST"])
def remote():
data = request.json
# game = data.get("game")
#
# if not game:
# return (
# jsonify({"status": "error", "message": "Missing game parameter"}),
# 400,
# )


command = [
"am",
"start",
"--user",
"0",
"-n",
"com.limelight.root/com.limelight.ShortcutTrampoline",
"--es", "UUID", "49CED8D7-F40A-9D27-D79D-9D9648B4C5BE",
"--es", "Name", "aka",
"--es", "AppId", "1590712279"
]

try:
result = subprocess.run(command, check=True, capture_output=True, text=True)
logger.info(f"Command executed successfully: {result.stdout}")
return (
jsonify(
{"status": "success", "message": "RetroArch launched successfully"}
),
200,
)
except subprocess.CalledProcessError as e:
logger.error(f"Error executing command: {e.stderr}")
return (
jsonify(
{
"status": "error",
"message": f"Failed to launch RetroArch: {e.stderr}",
}
),
500,
)



@app.route("/api/launch", methods=["POST"])
def launch():
data = request.json
Expand Down
8 changes: 5 additions & 3 deletions packages/app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
<div class="container mx-auto flex justify-between items-center">
<a href="#" class="text-2xl font-bold">Game UI</a>
<ul class="flex space-x-4" navi-group="menu">
<li><a href="#" x-navi class="hover:text-blue-200">Home</a></li>
<li><a href="#" x-navi class="hover:text-blue-200">About</a></li>
<li><a href="#" x-navi class="hover:text-blue-200">Contact</a></li>
<li>
<a hx-post="/api/remote" href="#" x-navi class="hover:text-blue-200"
>aka</a
>
</li>
</ul>
</div>
</nav>
Expand Down

0 comments on commit 1542a5c

Please sign in to comment.