diff --git a/src/main.rs b/src/main.rs index 7878ff30..e121fdc0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,6 +76,7 @@ fn main() { routes::instance::shared_inbox, routes::instance::nodeinfo, routes::instance::about, + routes::instance::web_manifest, routes::likes::create, routes::likes::create_auth, diff --git a/src/routes/instance.rs b/src/routes/instance.rs index a8d7965d..1bec0f3c 100644 --- a/src/routes/instance.rs +++ b/src/routes/instance.rs @@ -244,3 +244,17 @@ fn about(user: Option, conn: DbConn) -> Template { "n_instances": Instance::count(&*conn) - 1 })) } + +#[get("/manifest.json")] +fn web_manifest(conn: DbConn) -> Json { + let instance = Instance::get_local(&*conn).unwrap(); + Json(json!({ + "name": &instance.name, + "description": &instance.short_description, + "start_url": String::from("/"), + "scope": String::from("/"), + "display": String::from("standalone"), + "background_color": String::from("#f4f4f4"), + "theme_color": String::from("#7765e3") + })) +} diff --git a/templates/base.html.tera b/templates/base.html.tera index 0fd1047f..f68031e6 100644 --- a/templates/base.html.tera +++ b/templates/base.html.tera @@ -8,6 +8,7 @@ +