#generate #post #webring #feed #webrings #frenring #frens

frenring-core

library for generating webrings with posts from frens

8 releases

0.2.0-rc2 May 3, 2024
0.2.0-rc1 Apr 6, 2024
0.1.5 Apr 1, 2024
0.1.4 Feb 7, 2024
0.1.1 Jul 18, 2023

#5 in #webring


Used in frenring

LGPL-3.0-only

23KB
291 lines

frenring

it's a webring with posts from frens!

use std::error::Error;

use frenring_core::{generate_frenring, FrenringOptionsBuilder};

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let options = FrenringOptionsBuilder::new().build();

    let frenring = generate_frenring(
        vec![
            "https://sdomi.pl/weblog/atom/",
            "https://maia.crimew.gay/feed.xml",
            "./examples/basic/jsonfeed.json",
        ],
        options,
    )
    .await?;

    println!("{:#?}", frenring);

    Ok(())
}
[
    Article {
        title: "Making MDR-V6 wireless, the hard way",
        link: "http://sakamoto.pl/weblog/16-making-mdrv6-wireless/",
        summary: Some(
            "Join me as I hack a pair of cool wired headphones to have a detachable cord alongside a wireless module, featuring A2DP and WiFi streaming!",
        ),
        date: 2022-11-21T09:53:00Z,
        source_link: "https://sdomi.pl/weblog/",
        source_title: "sdomi's weblog",
    },
    Article {
        title: "#FuckStalkerware pt. 1 - the LetMeSpy hack",
        link: "https://maia.crimew.gay/posts/fuckstalkerware-1/",
        summary: Some(
            "the intro to this series can be found here a few days ago, while i was starting work on this very series, polish stalkerware company LetMeSpy (LMS) got completely pwned and had their databases dumped. the link to the file (jaki_kraj_taki_finfisher.tar) was…",
        ),
        date: 2023-06-26T00:00:00Z,
        source_link: "https://maia.crimew.gay/",
        source_title: "maia blog",
    },
    Article {
        title: "Hello, world?",
        link: "https://example.org/initial-post",
        summary: Some(
            "Hack the\u{a0}planet",
        ),
        date: 2023-07-06T20:30:00Z,
        source_link: "https://example.org/",
        source_title: "My Example Blog",
    },
]

inspired by Drew DeVault's openring. I mean this is basically a "rewrite it in rust" moment, because I didn't want to touch golang templates, or worse, golang. the main difference is that it outputs a JSON array rather than fill the data into a supplied golang template.

in Zola, you can use the resulting JSON in a template with the load_data built-in function.

this is the rust library. there is also a cli - see one directory higher or in frenring crate (lib.rs).

security considerations: make sure the output you serve (such as html) is sanitized. xml parser is in use. strings with paths to local filesystem are accepted as a source of a feed. remote http/https servers receive your ip address. http communication can be intercepted and altered by a third party.

copyright (c) 2023 lauren n. liberda, usage allowed under LGPL-3.0-only, see LICENSE file.

Dependencies

~16–34MB
~639K SLoC