mirror of
https://gitlab.com/hagrid-keyserver/hagrid.git
synced 2023-02-13 20:55:02 -05:00
news: add atom feed
This commit is contained in:
parent
695e4af7e9
commit
ff66332ea7
4 changed files with 39 additions and 0 deletions
19
dist/templates/atom.xml.hbs
vendored
Normal file
19
dist/templates/atom.xml.hbs
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>keys.openpgp.org</title>
|
||||
<link href="{{ base_uri }}/atom.xml" rel="self"/>
|
||||
<id>urn:uuid:8e783366-73b1-460e-83d3-42f01046646d</id>
|
||||
<updated>2019-09-12T12:00:00Z</updated>
|
||||
<entry>
|
||||
<title>Launching a new keyserver! 🚀</title>
|
||||
<link href="{{ base_uri }}/about/news#2019-06-12-launch" />
|
||||
<updated>2019-06-12T12:00:00Z</updated>
|
||||
<id>urn:uuid:a071a6dc-f8ea-43de-b853-bd6d8bbe063f</id>
|
||||
</entry>
|
||||
<entry>
|
||||
<title>Three months after launch ✨</title>
|
||||
<link href="{{ base_uri }}/about/news#2019-09-12-three-months-later" />
|
||||
<updated>2019-09-12T12:00:00Z</updated>
|
||||
<id>urn:uuid:1bd5412a-f480-4c3f-a72d-c9b7a849f544</id>
|
||||
</entry>
|
||||
</feed>
|
1
dist/templates/layout.html.hbs
vendored
1
dist/templates/layout.html.hbs
vendored
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="/assets/site.css?v=18" type="text/css"/>
|
||||
<link rel="alternate" href="atom.xml" type="application/atom+xml" title="keys.openpgp.org newsfeed" />
|
||||
<title>keys.openpgp.org</title>
|
||||
</head>
|
||||
<body lang="{{lang}}">
|
||||
|
|
|
@ -195,6 +195,12 @@ location = / {
|
|||
proxy_pass http://127.0.0.1:8080;
|
||||
}
|
||||
|
||||
# cache "about" pages
|
||||
location = /atom.xml {
|
||||
proxy_cache static_cache;
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
}
|
||||
|
||||
# cache "about" pages
|
||||
location /about {
|
||||
proxy_cache static_cache;
|
||||
|
|
|
@ -68,6 +68,8 @@ pub enum MyResponse {
|
|||
Success(HagridTemplate),
|
||||
#[response(status = 200, content_type = "plain")]
|
||||
Plain(String),
|
||||
#[response(status = 200, content_type = "xml")]
|
||||
Xml(HagridTemplate),
|
||||
#[response(status = 200, content_type = "application/pgp-keys")]
|
||||
Key(String, ContentDisposition),
|
||||
#[response(status = 200, content_type = "application/pgp-keys")]
|
||||
|
@ -101,6 +103,11 @@ impl MyResponse {
|
|||
MyResponse::Success(HagridTemplate(tmpl, context_json))
|
||||
}
|
||||
|
||||
pub fn xml(tmpl: &'static str) -> Self {
|
||||
let context_json = serde_json::to_value(templates::Bare { dummy: () }).unwrap();
|
||||
MyResponse::Xml(HagridTemplate(tmpl, context_json))
|
||||
}
|
||||
|
||||
pub fn plain(s: String) -> Self {
|
||||
MyResponse::Plain(s)
|
||||
}
|
||||
|
@ -311,6 +318,11 @@ fn news() -> MyResponse {
|
|||
MyResponse::ok_bare("about/news")
|
||||
}
|
||||
|
||||
#[get("/atom.xml")]
|
||||
fn news_atom() -> MyResponse {
|
||||
MyResponse::xml("atom")
|
||||
}
|
||||
|
||||
#[get("/about/faq")]
|
||||
fn faq() -> MyResponse {
|
||||
MyResponse::ok_bare("about/faq")
|
||||
|
@ -367,6 +379,7 @@ fn rocket_factory(mut rocket: rocket::Rocket) -> Result<rocket::Rocket> {
|
|||
root,
|
||||
about,
|
||||
news,
|
||||
news_atom,
|
||||
privacy,
|
||||
apidoc,
|
||||
faq,
|
||||
|
|
Loading…
Reference in a new issue