aboutsummaryrefslogtreecommitdiff
path: root/lib/go_vanity
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2021-01-14 22:36:34 -0500
committerGitHub <noreply@github.com>2021-01-14 22:36:34 -0500
commitd2455aa1c1bfc599a07966a7d717c1380d41bbc0 (patch)
treec2b206aa41cd6f0e13d61b5455861f09ab5d1304 /lib/go_vanity
parenta359f54a91f4aeb914c69f59a02afabccd72450e (diff)
downloadxesite-d2455aa1c1bfc599a07966a7d717c1380d41bbc0.tar.xz
xesite-d2455aa1c1bfc599a07966a7d717c1380d41bbc0.zip
Cache better (#296)
* Many improvements around bandwidth use - Use ETags for RSS/Atom feeds - Use cache-control headers - Update to rust nightly (for rust-analyzer and faster builds) - Limit feeds to the last 20 posts: https://twitter.com/theprincessxena/status/1349891678857998339 - Use if-none-match to limit bandwidth further Also does this: - bump go_vanity to 0.3.0 and lets users customize the branch name - fix formatting on jsonfeed - remove last vestige of kubernetes/docker support Signed-off-by: Christine Dodrill <me@christine.website> * expire cache quicker for dynamic pages Signed-off-by: Christine Dodrill <me@christine.website> * add rss ttl Signed-off-by: Christine Dodrill <me@christine.website> * add blogpost Signed-off-by: Christine Dodrill <me@christine.website>
Diffstat (limited to 'lib/go_vanity')
-rw-r--r--lib/go_vanity/Cargo.toml2
-rw-r--r--lib/go_vanity/src/lib.rs10
-rw-r--r--lib/go_vanity/templates/gitea.rs.html4
-rw-r--r--lib/go_vanity/templates/github.rs.html4
4 files changed, 10 insertions, 10 deletions
diff --git a/lib/go_vanity/Cargo.toml b/lib/go_vanity/Cargo.toml
index 90fa4f2..f4e5432 100644
--- a/lib/go_vanity/Cargo.toml
+++ b/lib/go_vanity/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "go_vanity"
-version = "0.1.0"
+version = "0.2.0"
authors = ["Christine Dodrill <me@christine.website>"]
edition = "2018"
build = "src/build.rs"
diff --git a/lib/go_vanity/src/lib.rs b/lib/go_vanity/src/lib.rs
index e4a11e2..756c555 100644
--- a/lib/go_vanity/src/lib.rs
+++ b/lib/go_vanity/src/lib.rs
@@ -1,12 +1,12 @@
+use crate::templates::RenderRucte;
use warp::{http::Response, Rejection, Reply};
-use crate::templates::{RenderRucte};
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
-pub async fn gitea(pkg_name: &str, git_repo: &str) -> Result<impl Reply, Rejection> {
- Response::builder().html(|o| templates::gitea_html(o, pkg_name, git_repo))
+pub async fn gitea(pkg_name: &str, git_repo: &str, branch: &str) -> Result<impl Reply, Rejection> {
+ Response::builder().html(|o| templates::gitea_html(o, pkg_name, git_repo, branch))
}
-pub async fn github(pkg_name: &str, git_repo: &str) -> Result<impl Reply, Rejection> {
- Response::builder().html(|o| templates::github_html(o, pkg_name, git_repo))
+pub async fn github(pkg_name: &str, git_repo: &str, branch: &str) -> Result<impl Reply, Rejection> {
+ Response::builder().html(|o| templates::github_html(o, pkg_name, git_repo, branch))
}
diff --git a/lib/go_vanity/templates/gitea.rs.html b/lib/go_vanity/templates/gitea.rs.html
index b20985b..f062d91 100644
--- a/lib/go_vanity/templates/gitea.rs.html
+++ b/lib/go_vanity/templates/gitea.rs.html
@@ -1,11 +1,11 @@
-@(pkg_name: &str, git_repo: &str)
+@(pkg_name: &str, git_repo: &str, branch: &str)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="@pkg_name git @git_repo">
- <meta name="go-source" content="@pkg_name @git_repo @git_repo/src/master@{/dir@} @git_repo/src/master@{/dir@}/@{file@}#L@{line@}">
+ <meta name="go-source" content="@pkg_name @git_repo @git_repo/src/@branch@{/dir@} @git_repo/src/@branch@{/dir@}/@{file@}#L@{line@}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/@pkg_name">
</head>
<body>
diff --git a/lib/go_vanity/templates/github.rs.html b/lib/go_vanity/templates/github.rs.html
index 61f42e5..9782b1c 100644
--- a/lib/go_vanity/templates/github.rs.html
+++ b/lib/go_vanity/templates/github.rs.html
@@ -1,11 +1,11 @@
-@(pkg_name: &str, git_repo: &str)
+@(pkg_name: &str, git_repo: &str, branch: &str)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="@pkg_name git @git_repo">
- <meta name="go-source" content="@pkg_name @git_repo @git_repo/tree/master@{/dir@} @git_repo/blob/master@{/dir@}/@{file@}#L@{line@}">
+ <meta name="go-source" content="@pkg_name @git_repo @git_repo/tree/@branch@{/dir@} @git_repo/blob/@branch@{/dir@}/@{file@}#L@{line@}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/@pkg_name">
</head>
<body>