Add homepage and auto-redirect for Decky
This commit is contained in:
parent
6d68f76482
commit
068cc9f42a
1 changed files with 33 additions and 3 deletions
|
@ -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##"
|
||||
<!DOCTYTPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Not Decky Store</title>
|
||||
<meta name="title" content="Not Decky Store" />
|
||||
<meta name="description" content="Alternate store implementation for Decky Loader" />
|
||||
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://git.ngni.us/NG-SD-Plugins/not-decky-store" />
|
||||
<meta property="og:title" content="Not Decky Store" />
|
||||
<meta property="og:description" content="Alternate store implementation for Decky Loader" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Not Decky Store</h1>
|
||||
<h2>An alternate store implementation for Decky Loader</h2>
|
||||
<h3>Maybe one day this page will display plugin in a human readable way...</h3>
|
||||
<br/>
|
||||
<a href="/plugins">plugins</a>
|
||||
| <a href="https://git.ngni.us/NG-SD-Plugins/not-decky-store">code</a>
|
||||
| GPL v3.0
|
||||
</body>
|
||||
</html>"##))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue