proxy cgit website assets instead of redir, add diff highlight

This commit is contained in:
Gabriel Fontes
2022-08-21 13:07:18 -03:00
parent fb3fc2c24f
commit 8953c88b71
4 changed files with 31 additions and 6 deletions
Generated
+3 -3
View File
@@ -529,11 +529,11 @@
"utils": "utils_5"
},
"locked": {
"lastModified": 1661058364,
"narHash": "sha256-KRjLoxlrznRkbsJ3ciPg/uQG/+x0JcE60+W/RYXgcHU=",
"lastModified": 1661062745,
"narHash": "sha256-1Sl10D3u9W+Vj4309d3qwEV/GjCj9ej6qz0UOdoanyg=",
"owner": "~misterio",
"repo": "website",
"rev": "bd2aa820d87579851ff0e613921c15c290df9a9b",
"rev": "79cc5e46888fcc05ed6a11d1d3845a1ad21a1285",
"type": "sourcehut"
},
"original": {
+15
View File
@@ -1,3 +1,18 @@
td.linenos {
width: 2em;
}
code span.head {
color: var(--highlight);
}
code span.hunk {
color: var(--text-muted);
}
code span.ctx {
color: var(--text-main);
}
code span.add {
color: var(--positive);
}
code span.del {
color: var(--negative);
}
+13 -2
View File
@@ -1,6 +1,12 @@
{ pkgs, lib, persistence, ... }:
{ inputs, pkgs, lib, persistence, ... }:
let
cgit = "${pkgs.semanticgit}";
toDateTime = timestamp: builtins.readFile (
pkgs.runCommandLocal "datetime" { } ''
dt="$(date -Ru -d @${toString timestamp})"
echo -n ''${dt/+0000/GMT} > $out
''
);
in
{
services = {
@@ -12,8 +18,13 @@ in
"=/cgit.css" = {
alias = "${./cgit.css}";
};
# Get assets from main website
"/assets" = {
return = "301 https://fontes.dev.br$request_uri";
root = "${pkgs.website.main}/public";
extraConfig = ''
add_header Last-Modified "${toDateTime inputs.website.lastModified}";
add_header Cache-Control max-age="${toString (60 * 60 * 24 /* One day */)}";
'';
};
"/" = {
root = "${cgit}/cgit";
-1
View File
@@ -38,7 +38,6 @@ in
extraConfig = ''
add_header Last-Modified "${toDateTime inputs.website.lastModified}";
add_header Cache-Control max-age="${toString (60 * 60 * 24 /* One day */)}";
add_header Access-Control-Allow-Origin https://git.fontes.dev.br;
'';
};
};