Add webapp manifest

This commit is contained in:
Zachary Dunn
2018-09-10 10:08:22 -04:00
parent 64a9d8f1f3
commit 3a81dd7089
3 changed files with 16 additions and 0 deletions
+14
View File
@@ -244,3 +244,17 @@ fn about(user: Option<User>, conn: DbConn) -> Template {
"n_instances": Instance::count(&*conn) - 1
}))
}
#[get("/manifest.json")]
fn web_manifest(conn: DbConn) -> Json<serde_json::Value> {
let instance = Instance::get_local(&*conn);
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")
}))
}