summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock79
-rw-r--r--Cargo.toml12
-rw-r--r--assets/icons/instagram.svg3
-rw-r--r--assets/icons/wishlist.svg4
-rw-r--r--src/html.rs18
-rw-r--r--src/main.rs14
-rw-r--r--vercel.json13
7 files changed, 88 insertions, 55 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 71cb619..e863741 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -31,9 +31,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "base64"
-version = "0.21.7"
+version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bumpalo"
@@ -58,9 +58,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
-version = "0.4.33"
+version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb"
+checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [
"android-tzdata",
"iana-time-zone",
@@ -205,9 +205,9 @@ checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
[[package]]
name = "log"
-version = "0.4.20"
+version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
[[package]]
name = "maud"
@@ -333,23 +333,32 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.21.10"
+version = "0.22.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
+checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432"
dependencies = [
"log",
"ring",
+ "rustls-pki-types",
"rustls-webpki",
- "sct",
+ "subtle",
+ "zeroize",
]
[[package]]
+name = "rustls-pki-types"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
+
+[[package]]
name = "rustls-webpki"
-version = "0.101.7"
+version = "0.102.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
+checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e"
dependencies = [
"ring",
+ "rustls-pki-types",
"untrusted",
]
@@ -369,29 +378,19 @@ dependencies = [
]
[[package]]
-name = "sct"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
-dependencies = [
- "ring",
- "untrusted",
-]
-
-[[package]]
name = "serde"
-version = "1.0.196"
+version = "1.0.202"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32"
+checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.196"
+version = "1.0.202"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67"
+checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
dependencies = [
"proc-macro2",
"quote",
@@ -411,9 +410,9 @@ dependencies = [
[[package]]
name = "simple_logger"
-version = "4.3.3"
+version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e7e46c8c90251d47d08b28b8a419ffb4aede0f87c2eea95e17d1d5bacbf3ef1"
+checksum = "e8c5dfa5e08767553704aa0ffd9d9794d527103c736aba9854773851fd7497eb"
dependencies = [
"colored",
"log",
@@ -428,6 +427,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
[[package]]
+name = "subtle"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
+
+[[package]]
name = "syn"
version = "2.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -513,15 +518,16 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
-version = "2.9.1"
+version = "2.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97"
+checksum = "d11a831e3c0b56e438a28308e7c810799e3c118417f342d30ecec080105395cd"
dependencies = [
"base64",
"flate2",
"log",
"once_cell",
"rustls",
+ "rustls-pki-types",
"rustls-webpki",
"serde",
"serde_json",
@@ -548,7 +554,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "violette"
-version = "2.0.1"
+version = "2.1.1"
dependencies = [
"chrono",
"copy_dir",
@@ -631,9 +637,12 @@ checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b"
[[package]]
name = "webpki-roots"
-version = "0.25.3"
+version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"
+checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009"
+dependencies = [
+ "rustls-pki-types",
+]
[[package]]
name = "winapi"
@@ -797,3 +806,9 @@ name = "windows_x86_64_msvc"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
+
+[[package]]
+name = "zeroize"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d"
diff --git a/Cargo.toml b/Cargo.toml
index e4b9059..3a3c7e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,13 +1,13 @@
[package]
name = "violette"
-version = "2.0.1"
+version = "2.1.1"
edition = "2021"
[dependencies]
maud = "0.26.0"
copy_dir = "0.1.3"
-log = "0.4.20"
-simple_logger = "4.3.3"
-ureq = { version = "2.9.1", features = ["json"] }
-serde = { version = "1.0.196", features = ["derive"] }
-chrono = "0.4.33" \ No newline at end of file
+log = "0.4.21"
+simple_logger = "5.0.0"
+ureq = { version = "2.9.7", features = ["json"] }
+serde = { version = "1.0.202", features = ["derive"] }
+chrono = "0.4.38"
diff --git a/assets/icons/instagram.svg b/assets/icons/instagram.svg
new file mode 100644
index 0000000..855e653
--- /dev/null
+++ b/assets/icons/instagram.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-instagram" viewBox="0 0 16 16">
+ <path d="M8 0C5.829 0 5.556.01 4.703.048 3.85.088 3.269.222 2.76.42a3.9 3.9 0 0 0-1.417.923A3.9 3.9 0 0 0 .42 2.76C.222 3.268.087 3.85.048 4.7.01 5.555 0 5.827 0 8.001c0 2.172.01 2.444.048 3.297.04.852.174 1.433.372 1.942.205.526.478.972.923 1.417.444.445.89.719 1.416.923.51.198 1.09.333 1.942.372C5.555 15.99 5.827 16 8 16s2.444-.01 3.298-.048c.851-.04 1.434-.174 1.943-.372a3.9 3.9 0 0 0 1.416-.923c.445-.445.718-.891.923-1.417.197-.509.332-1.09.372-1.942C15.99 10.445 16 10.173 16 8s-.01-2.445-.048-3.299c-.04-.851-.175-1.433-.372-1.941a3.9 3.9 0 0 0-.923-1.417A3.9 3.9 0 0 0 13.24.42c-.51-.198-1.092-.333-1.943-.372C10.443.01 10.172 0 7.998 0zm-.717 1.442h.718c2.136 0 2.389.007 3.232.046.78.035 1.204.166 1.486.275.373.145.64.319.92.599s.453.546.598.92c.11.281.24.705.275 1.485.039.843.047 1.096.047 3.231s-.008 2.389-.047 3.232c-.035.78-.166 1.203-.275 1.485a2.5 2.5 0 0 1-.599.919c-.28.28-.546.453-.92.598-.28.11-.704.24-1.485.276-.843.038-1.096.047-3.232.047s-2.39-.009-3.233-.047c-.78-.036-1.203-.166-1.485-.276a2.5 2.5 0 0 1-.92-.598 2.5 2.5 0 0 1-.6-.92c-.109-.281-.24-.705-.275-1.485-.038-.843-.046-1.096-.046-3.233s.008-2.388.046-3.231c.036-.78.166-1.204.276-1.486.145-.373.319-.64.599-.92s.546-.453.92-.598c.282-.11.705-.24 1.485-.276.738-.034 1.024-.044 2.515-.045zm4.988 1.328a.96.96 0 1 0 0 1.92.96.96 0 0 0 0-1.92m-4.27 1.122a4.109 4.109 0 1 0 0 8.217 4.109 4.109 0 0 0 0-8.217m0 1.441a2.667 2.667 0 1 1 0 5.334 2.667 2.667 0 0 1 0-5.334"/>
+</svg> \ No newline at end of file
diff --git a/assets/icons/wishlist.svg b/assets/icons/wishlist.svg
new file mode 100644
index 0000000..3044e68
--- /dev/null
+++ b/assets/icons/wishlist.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-card-checklist" viewBox="0 0 16 16">
+ <path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2z"/>
+ <path d="M7 5.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5m-1.496-.854a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0M7 9.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-5a.5.5 0 0 1-.5-.5m-1.496-.854a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0"/>
+</svg> \ No newline at end of file
diff --git a/src/html.rs b/src/html.rs
index aeb2751..6476ff6 100644
--- a/src/html.rs
+++ b/src/html.rs
@@ -1,9 +1,9 @@
use maud::{html, Markup, PreEscaped};
use maud::DOCTYPE;
-use crate::PonyculeData;
use chrono::{Datelike, Utc};
+use ureq::serde_json;
-pub fn generate_template(data: PonyculeData) -> Markup {
+pub fn generate_template(data: Vec<serde_json::Value>) -> Markup {
html! {
(DOCTYPE)
html lang="en" style="height: 100%;" {
@@ -14,7 +14,7 @@ pub fn generate_template(data: PonyculeData) -> Markup {
meta http-equiv="X-UA-Compatible" content="ie=edge";
title { "Raindrops" };
- meta name="description" content=(format!("Hi there! We are Raindrops. We are a plural system of {} creatures. We use she/her pronouns. Learn more about us.", data.count));
+ meta name="description" content=(format!("Hi there! We are Raindrops. We are a plural system of {} creatures. We use she/her pronouns. Learn more about us.", data.len()));
link rel="icon" href="https://cdn.equestria.dev/pluralkit/gdapd/avatar.png" type="image/png";
link rel="stylesheet" href="/assets/bootstrap.min.css";
@@ -158,7 +158,7 @@ pub fn generate_template(data: PonyculeData) -> Markup {
p {
"We are a plural system of "
- (data.count)
+ (data.len())
" creatures. We use "
b { "she/her" }
" pronouns."
@@ -277,7 +277,7 @@ pub fn generate_template(data: PonyculeData) -> Markup {
span style="vertical-align: middle; margin-left: 5px;" { "@miapone_" }
}
a class="list-group-item list-group-item-action" href="https://instagram.com/raindrops.sys" target="_blank" {
- img src="/assets/icons/instagram.png" style="width: 24px; height: 24px;";
+ img src="/assets/icons/instagram.svg" style="width: 24px; height: 24px;";
span style="vertical-align: middle; margin-left: 5px;" { "@raindrops.sys" }
}
a class="list-group-item list-group-item-action" href="https://reddit.com/user/Minteck" target="_blank" {
@@ -318,7 +318,13 @@ pub fn generate_template(data: PonyculeData) -> Markup {
}
}
- div class="alert alert-secondary" style="margin-bottom: 0;margin-top: 1rem;" {
+ p style="margin-top: 1rem;" {
+ "If you are a friend of mine, you might also have access to my "
+ a href="https://wishlist.p.equestria.dev" target="_blank" { "personal wishlist" }
+ ", which contains properly ordered items with their price and the reason behind their choice."
+ }
+
+ div class="alert alert-secondary" style="margin-bottom: 0;" {
"While we try to give back, we are not always able to. Please do not expect anything back from your gifts and only gift if you are financially able to. It's the thought that matters."
}
}
diff --git a/src/main.rs b/src/main.rs
index 4e85fb9..fe6b60c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -8,15 +8,9 @@ use std::env::args_os;
use std::path::PathBuf;
use log::{error, info, LevelFilter, warn};
use simple_logger::SimpleLogger;
-
-use serde::{Deserialize};
+use ureq::serde_json;
use crate::html::generate_template;
-#[derive(Deserialize)]
-struct PonyculeData {
- count: u32
-}
-
fn main() {
SimpleLogger::new().with_level(LevelFilter::Info).init().unwrap();
let mut args = args_os();
@@ -40,11 +34,11 @@ fn main() {
info!("Output directory: {:?}", output_path);
- info!("Fetching Ponycule for plural system information...");
- let data: PonyculeData = ureq::get("https://ponycule.p.equestria.dev/api/violette")
+ info!("Fetching PluralKit for system information...");
+ let data: Vec<serde_json::Value> = ureq::get("https://api.pluralkit.me/v2/systems/gdapd/members")
.call().unwrap()
.into_json().unwrap();
- info!("Request completed, found {} system members", data.count);
+ info!("Request completed, found {} system members", data.len());
if Path::new(&output_path).exists() {
warn!("Found an older build, proceeding to delete it");
diff --git a/vercel.json b/vercel.json
index 7dbfd5a..65024a4 100644
--- a/vercel.json
+++ b/vercel.json
@@ -8,5 +8,16 @@
"source": "/assets/(.*)",
"destination": "/assets/$1"
}
+ ],
+ "headers": [
+ {
+ "source": "/assets/(.*)",
+ "headers": [
+ {
+ "key": "Cache-Control",
+ "value": "public, s-maxage=3600, maxage=86400, stale-while-revalidate=300, stale-if-error=86400"
+ }
+ ]
+ }
]
-} \ No newline at end of file
+}