From 068cc9f42a4e15c70689cae970040cb581b3fb6c Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Fri, 10 May 2024 23:25:49 -0400 Subject: [PATCH] Add homepage and auto-redirect for Decky --- src/not_decky/index.rs | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/not_decky/index.rs b/src/not_decky/index.rs index 521a040..5da060a 100644 --- a/src/not_decky/index.rs +++ b/src/not_decky/index.rs @@ -1,6 +1,36 @@ -use actix_web::{get, HttpResponse, Responder}; +use actix_web::{get, HttpResponse, Responder, HttpRequest, Either}; #[get("/")] -pub async fn decky_index() -> impl Responder { - HttpResponse::Ok().body("TODO") +pub async fn decky_index(req: HttpRequest) -> impl Responder { + if req.headers().contains_key("X-Decky-Version") { + // a real store request + Either::Left(actix_web::web::Redirect::to("/plugins").temporary()) + } else { + Either::Right(HttpResponse::Ok() + .insert_header(("Content-Type", "text/html")) + .body(r##" + + + + Not Decky Store + + + + + + + + + + +

Not Decky Store

+

An alternate store implementation for Decky Loader

+

Maybe one day this page will display plugin in a human readable way...

+
+ plugins + | code + | GPL v3.0 + +"##)) + } }