Compare commits

...

5 Commits
v0.2.0 ... main

Author SHA1 Message Date
Emi Simpson 3d9200b10b
Mark as passively maintained 2022-07-15 14:36:12 -04:00
Emi Simpson 303389de14
Remove the requirement on ordering for domains 2022-07-15 14:29:23 -04:00
Sashanoraa 55bfdb19e3 Fix release page link
Relative links doesn't seem to work except for files in the repo.

Signed-off-by: Sashanoraa <sasha@noraa.gay>
2022-02-08 20:18:34 -05:00
Emi Simpson d10a1c2d52
Add crates.io badge 2022-02-08 19:31:33 -05:00
Emi Simpson fdceae0e75
Clean up stray escapes in the README 2022-02-08 18:00:50 -05:00
3 changed files with 18 additions and 6 deletions

View File

@ -26,3 +26,6 @@ ascii = "1.0.0"
lto = "fat"
codegen-units = 1
panic = "abort"
[badges]
maintenance = { status = "passively-maintained" }

View File

@ -1,3 +1,5 @@
[![Published on crates.io](https://img.shields.io/crates/v/faery-ring?style=flat-square)](https://crates.io/crates/faery-ring)
# Faery Ring
*An ultra-lightweight js-free server-side webring implementation*
@ -47,8 +49,6 @@ queerings.gay
getonflop.xyz
```
One restriction: If one site is a substring of another, the shorter site must go first. For example, if you have `unix.pub` and `unix.pub/~user`, `unix.pub` MUST be higher in the list than `unix.pub/~user`
Now, run the Faery Ring binary (or docker image) with the `.txt` file you just created as the first argument, like this:
```bash
@ -68,11 +68,11 @@ your.web.site {
}
```
Now your webring members can add links on their page to `https://your.web.site/next/\<their\_domain>` `https://your.web.site/prev/\<their\_domain>` in order to build the ring. For example, whoever runs the page at www.dragoness.space would add a link to `https://your.web.site/next/www.dragoness.space` and `https://your.web.site/prev/www.dragoness.space`. garlic.garden/onionring cen either use `/next/garlic.garden` or `/next/garlic.garden/onionring`. If more than one site were hosted on `garlic.garden`, then the second form would be required.
Now your webring members can add links on their page to `https://your.web.site/next/<their_domain>` `https://your.web.site/prev/<their_domain>` in order to build the ring. For example, whoever runs the page at www.dragoness.space would add a link to `https://your.web.site/next/www.dragoness.space` and `https://your.web.site/prev/www.dragoness.space`. garlic.garden/onionring cen either use `/next/garlic.garden` or `/next/garlic.garden/onionring`. If more than one site were hosted on `garlic.garden`, then the second form would be required.
## Downloads
- Linux binaries are available from the [releases page](./releases)
- Linux binaries are available from the [releases page](https://fem.mint.lgbt/Emi/faery-ring/releases)
- A docker image is available on Docker Hub under `alch0emi/faery-ring:latest`
- If you have cargo installed on your system, faery ring can be installed with `cargo install faery-ring`
@ -82,3 +82,7 @@ Now your webring members can add links on their page to `https://your.web.site/n
- that's it for now!
Do you run a webring that uses faery ring? I'd love to know, and add you to the list if you'd like! 💜
## Maintence
Due to the relatively small scope and size of faery-ring, it doesn't require much maintence, and I'm not interested in adding very many features. I'll respond to the any issues and feature requests that are opened, and stay on top of any bugs, but for the most part faery-ring is [passively maintained](https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section).

View File

@ -67,9 +67,14 @@ impl<'a> Route<'a> {
match self {
Self::PrevOrNext(this_domain, offset) => {
// The name of the domain at the index of the index of shortest matching
// domain from the list for which the requested domain is a substring,
// offset by the offset.
let destination = domains.iter()
.position(|d| d.as_str().starts_with(this_domain))
.map(|i| (i as isize + offset).rem_euclid(domains.len() as isize))
.enumerate()
.filter(|(_, d)| d.as_str().starts_with(this_domain))
.min_by_key(|(_, d)| d.len())
.map(|(i, _)| (i as isize + offset).rem_euclid(domains.len() as isize))
.map(|i| domains[i as usize]); // safe to unwrap: we just did a rem_euclid
if let Some(url) = destination {