Compare commits
14 commits
mdf-bounce
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 71de0c15a7 | |||
| 770a20de04 | |||
| 6a5baa5416 | |||
| 08ab6070d4 | |||
| 1efb3f5e69 | |||
| f398e4336d | |||
| 36c3967170 | |||
| 0beaa152b4 | |||
| abbb7b7e2e | |||
| af8b7ba279 | |||
| a237f584dc | |||
| fde9e32fe0 | |||
| 94d12da846 | |||
| 225d0f4b25 |
13 changed files with 93 additions and 127 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,3 +4,4 @@ index.html
|
|||
blog-tmp.html
|
||||
public/index.html
|
||||
public/rss.xml
|
||||
mdf-blog
|
||||
|
|
|
|||
7
README.md
Normal file
7
README.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
- If using a precompiled version of mdf-blog, place the `mdf-blog` executable
|
||||
in this directory (project root).
|
||||
- Use `./new.sh` to create new blogpost in ./blogs. This will open your
|
||||
editor defined by the EDITOR environment variable.
|
||||
- Use `./run.sh` to generate all output files in "./public"
|
||||
- Use `USERNAME="your username" PASSWORD="your password" ./push.sh` to
|
||||
push to server.
|
||||
|
|
@ -3,6 +3,7 @@ author: Rakarake
|
|||
pubDate: Fri, Mar 27 2026
|
||||
---
|
||||
Warframe.
|
||||
Erm, yeah.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
title: A statement
|
||||
title: Infrastructure complete
|
||||
author: Rakarake
|
||||
pubDate: Fri, Mar 27 2026
|
||||
pubDate: Sat, Mar 28 2026
|
||||
---
|
||||
Kyuuuuuuu! 🐳
|
||||
It's been done 🐍🥰💕.
|
||||
|
||||
|
|
|
|||
5
blogs/day8.md
Normal file
5
blogs/day8.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
title: We love slop
|
||||
author: Rakarake
|
||||
pubDate: Sat, Mar 28 2026
|
||||
---
|
||||
🐖🐖
|
||||
9
blogs/day9.md
Normal file
9
blogs/day9.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
title: NEW MDF MEMBER IN AGES
|
||||
author: Rakarake
|
||||
pubDate: Wed, Apr 1 2026
|
||||
---
|
||||
Welcome Loriik!
|
||||
|
||||
Huge moment for the MDF, the interview process was long and tedious.
|
||||
Hundreds of candidates. Many work hours. (real).
|
||||
|
||||
71
flake.lock
generated
71
flake.lock
generated
|
|
@ -1,21 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
|
@ -66,28 +50,11 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1771043024,
|
||||
"narHash": "sha256-O1XDr7EWbRp+kHrNNgLWgIrB0/US5wvw9K6RERWAj6I=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3aadb7ca9eac2891d52a9dec199d9580a6e2bf44",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"zig-overlay": "zig-overlay"
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
|
@ -122,42 +89,6 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"zig-overlay": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1772540502,
|
||||
"narHash": "sha256-HXlx2i9gGH2HKfBSMihKCvU6DQMVlR4iyOulkSOe+Cg=",
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"rev": "03fa375def0685b8ce282f118452532845f16a20",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mitchellh",
|
||||
"repo": "zig-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
38
flake.nix
38
flake.nix
|
|
@ -1,14 +1,13 @@
|
|||
{
|
||||
description = "Rust flake";
|
||||
description = "mdf-blog";
|
||||
inputs =
|
||||
{
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # or whatever vers
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
zig-overlay.url = "github:mitchellh/zig-overlay";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, rust-overlay, zig-overlay, ... }:
|
||||
outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
|
|
@ -17,33 +16,20 @@
|
|||
};
|
||||
in
|
||||
{
|
||||
devShell = pkgs.mkShell rec {
|
||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
|
||||
defaultPackage = pkgs.rustPlatform.buildRustPackage {
|
||||
name = "mdf-blog";
|
||||
pname = "mdf-blog";
|
||||
src = ./.;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
};
|
||||
devShell = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rustc
|
||||
cargo
|
||||
rust-analyzer
|
||||
gcc
|
||||
zig-overlay.packages."x86_64-linux".master
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
libdisplay-info
|
||||
libgbm
|
||||
#mesa
|
||||
libinput
|
||||
pixman
|
||||
seatd
|
||||
udev
|
||||
libxkbcommon
|
||||
wayland
|
||||
wayland.dev
|
||||
wayland-protocols
|
||||
libGL
|
||||
vulkan-headers vulkan-loader
|
||||
vulkan-tools vulkan-tools-lunarg
|
||||
vulkan-extension-layer
|
||||
vulkan-validation-layers # don't need them *strictly* but immensely helpful
|
||||
#libglvnd
|
||||
curl
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
8
new.sh
Executable file
8
new.sh
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
git pull
|
||||
|
||||
printf "name of file (e.g. day67.md): "
|
||||
read filename
|
||||
cargo run -- new > blogs/$filename
|
||||
$EDITOR blogs/$filename
|
||||
|
||||
12
push.sh
Executable file
12
push.sh
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
git add blogs
|
||||
git commit -m "blog update"
|
||||
git push
|
||||
|
||||
for file in $(find public -type f)
|
||||
do
|
||||
echo "uploading: $file"
|
||||
curl -u "$USER:$PASSWORD" https://mdf.farm/api/${file#*/} --upload-file $file
|
||||
done
|
||||
|
||||
8
run.sh
8
run.sh
|
|
@ -1,8 +1,12 @@
|
|||
#/bin/sh
|
||||
cargo run -- html blogs/* > blog-tmp.html
|
||||
cargo build && cp target/debug/mdf-blog . || true
|
||||
|
||||
BLOGS=$(ls $PWD/blogs/*)
|
||||
|
||||
./mdf-blog html $BLOGS > blog-tmp.html
|
||||
sed template.html -e '/INSERT_HERE/{
|
||||
r blog-tmp.html
|
||||
d
|
||||
}' > public/index.html
|
||||
cargo run -- rss blogs/* > public/rss.xml
|
||||
./mdf-blog rss $BLOGS > public/rss.xml
|
||||
|
||||
|
|
|
|||
52
src/main.rs
52
src/main.rs
|
|
@ -1,10 +1,11 @@
|
|||
use std::{collections::HashMap, io, path::Path};
|
||||
use markdown::to_html;
|
||||
use rss::{Channel, GuidBuilder, ItemBuilder};
|
||||
use rss::{Channel, ChannelBuilder, GuidBuilder, Item, ItemBuilder};
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
fn main() -> Result<(), String> {
|
||||
let posts = std::env::args().skip(2).map(|f| {
|
||||
let contents = std::fs::read_to_string(f.clone())?;
|
||||
let contents = std::fs::read_to_string(f.clone()).map_err(|e| format!("when reading file {f} got {e}"))?;
|
||||
|
||||
// parse metadata, then the rest to html
|
||||
let mut metadata: HashMap<String, String> = contents.lines().take_while(|l| {
|
||||
// header ends here
|
||||
|
|
@ -26,35 +27,36 @@ fn main() -> io::Result<()> {
|
|||
}).concat();
|
||||
|
||||
Ok((to_html(&body), metadata))
|
||||
}).collect::<Result<Vec<(String, HashMap<String, String>)>, io::Error>>()?;
|
||||
}).collect::<Result<Vec<(String, HashMap<String, String>)>, String>>()?;
|
||||
|
||||
if let Some(mode) = std::env::args().skip(1).next() {
|
||||
match mode.as_str() {
|
||||
"rss" => {
|
||||
let mut channel = Channel::default();
|
||||
channel.title = "MDF blog huge".to_string();
|
||||
channel.link = "https://mdf.farm".to_string();
|
||||
channel.description = "The MDF blog".to_string();
|
||||
channel.generator = Some("Rakabaka's tooling".to_string());
|
||||
channel.items = posts.iter().map(|(body, metadata)| {
|
||||
let guid = metadata.get("guid").map(|guid|
|
||||
GuidBuilder::default()
|
||||
.value(guid)
|
||||
.permalink(false)
|
||||
.build()
|
||||
);
|
||||
ItemBuilder::default()
|
||||
.title(metadata.get("title").map(|title| title.clone()))
|
||||
.description(Some(body.clone()))
|
||||
.pub_date(metadata.get("pubDate").map(|title| title.clone()))
|
||||
.link(metadata.get("guid").map(|g| format!("https://mdf.farm/#{g}")))
|
||||
.guid(guid)
|
||||
.build()
|
||||
}).collect();
|
||||
let channel = ChannelBuilder::default()
|
||||
.title("MDF blog huge".to_string())
|
||||
.link("https://mdf.farm".to_string())
|
||||
.description("The MDF blog".to_string())
|
||||
.generator(Some("Rakabaka's tooling".to_string()))
|
||||
.items(posts.iter().map(|(body, metadata)| {
|
||||
let guid = metadata.get("guid").map(|guid|
|
||||
GuidBuilder::default()
|
||||
.value(guid)
|
||||
.permalink(false)
|
||||
.build()
|
||||
);
|
||||
ItemBuilder::default()
|
||||
.title(metadata.get("title").map(|title| title.clone()))
|
||||
.description(Some(body.clone()))
|
||||
.pub_date(metadata.get("pubDate").map(|title| title.clone()))
|
||||
.link(metadata.get("guid").map(|g| format!("https://mdf.farm/#{g}")))
|
||||
.guid(guid)
|
||||
.build()
|
||||
}).collect::<Vec<Item>>())
|
||||
.build();
|
||||
print!("{}", channel);
|
||||
},
|
||||
"html" => {
|
||||
print!("{}", posts.iter().enumerate().map(|(i, (body, metadata))| {
|
||||
print!("{}", posts.iter().rev().enumerate().map(|(i, (body, metadata))| {
|
||||
let guid = metadata.get("guid").unwrap_or(&i.to_string()).clone();
|
||||
let title = metadata.get("title").map(|title| format!("<h1>{title}</h1>")).unwrap_or("".to_string());
|
||||
let pub_date = metadata.get("pubDate").map(|pub_date| format!("<i>{pub_date}</i>")).unwrap_or("".to_string());
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
rsync -rvz -e 'ssh -p 8022' --progress public/* rakarake@chat.mdf.farm:/data/website
|
||||
Loading…
Add table
Add a link
Reference in a new issue