move https from code to the webring

This commit is contained in:
jacekpoz 2024-09-16 14:12:01 +02:00
parent e162dc988c
commit ad2d56f585
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
3 changed files with 12 additions and 15 deletions

View file

@ -19,10 +19,9 @@ async fn next(
if let Some((i, _)) = members.iter().enumerate().find(|(_, member)| member.name == *name) { if let Some((i, _)) = members.iter().enumerate().find(|(_, member)| member.name == *name) {
let next_index = (i + 1) % members.len(); let next_index = (i + 1) % members.len();
let next_site = &members[next_index].site; let next_site = &members[next_index].site;
let next_url = format!("https://{next_site}/");
return Response::PermanentRedirect() return Response::PermanentRedirect()
.header(header::LOCATION, next_url) .header(header::LOCATION, next_site)
.header(header::CACHE_CONTROL, "no-store") .header(header::CACHE_CONTROL, "no-store")
.take(); .take();
} }
@ -41,10 +40,9 @@ async fn prev(
if let Some((i, _)) = members.iter().enumerate().find(|(_, member)| member.name == *name) { if let Some((i, _)) = members.iter().enumerate().find(|(_, member)| member.name == *name) {
let prev_index = if i == 0 { members.len() - 1 } else { i - 1 }; let prev_index = if i == 0 { members.len() - 1 } else { i - 1 };
let prev_site = &members[prev_index].site; let prev_site = &members[prev_index].site;
let prev_url = format!("https://{prev_site}/");
return Response::PermanentRedirect() return Response::PermanentRedirect()
.header(header::LOCATION, prev_url) .header(header::LOCATION, prev_site)
.header(header::CACHE_CONTROL, "no-store") .header(header::CACHE_CONTROL, "no-store")
.take(); .take();
} }
@ -61,10 +59,9 @@ async fn rand(
) -> impl web::Responder { ) -> impl web::Responder {
let rand_index = thread_rng().gen_range(0..members.len()); let rand_index = thread_rng().gen_range(0..members.len());
let rand_site = &members[rand_index].site; let rand_site = &members[rand_index].site;
let rand_url = format!("https://{rand_site}/");
Response::PermanentRedirect() Response::PermanentRedirect()
.header(header::LOCATION, rand_url) .header(header::LOCATION, rand_site)
.header(header::CACHE_CONTROL, "no-store") .header(header::CACHE_CONTROL, "no-store")
.take() .take()
} }

View file

@ -41,9 +41,9 @@ in {
in /*html*/'' in /*html*/''
<li> <li>
<div class="webring-member"> <div class="webring-member">
<a href="https://${member.site}">${member.name}</a> <a href="${member.site}">${member.name}</a>
${optionalString hasConfig /*html*/'' ${optionalString hasConfig /*html*/''
<a href="https://${member.config}"><img class="config-image" src="/nix.svg" alt="their nixos config"></a> <a href="${member.config}"><img class="config-image" src="/nix.svg" alt="their nixos config"></a>
''} ''}
</div> </div>
</li> </li>

View file

@ -1,9 +1,9 @@
[ [
{ name = "poz"; site = "jacekpoz.pl"; config = "flake.jacekpoz.pl"; } { name = "poz"; site = "https://jacekpoz.pl"; config = "https://flake.jacekpoz.pl"; }
{ name = "krizej"; site = "krizej.codeberg.page"; config = "git.jacekpoz.pl/krizej/nix"; } { name = "krizej"; site = "https://krizej.codeberg.page"; config = "https://git.jacekpoz.pl/krizej/nix"; }
{ name = "partywumpus"; site = "partywump.us"; config = "nix.partywump.us"; } { name = "partywumpus"; site = "https://partywump.us"; config = "https://nix.partywump.us"; }
{ name = "notashelf"; site = "notashelf.dev"; config = "github.com/NotAShelf/nyx"; } { name = "notashelf"; site = "https://notashelf.dev"; config = "https://github.com/NotAShelf/nyx"; }
{ name = "twig"; site = "imnottwig.github.io"; config = "git.disroot.org/twigthecat/nixos"; } { name = "twig"; site = "https://imnottwig.github.io"; config = "https://git.disroot.org/twigthecat/nixos"; }
{ name = "fufexan"; site = "fufexan.net"; config = "dots.fufexan.net"; } { name = "fufexan"; site = "https://fufexan.net"; config = "https://dots.fufexan.net"; }
{ name = "orangc"; site = "orangc.xyz"; config = "github.com/orxngc/dots"; } { name = "orangc"; site = "https://orangc.xyz"; config = "https://github.com/orxngc/dots"; }
] ]