aboutsummaryrefslogtreecommitdiff
path: root/lib/xesite_types/src
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2023-09-30 10:36:37 -0400
committerGitHub <noreply@github.com>2023-09-30 10:36:37 -0400
commitac6a3df0d18cc73524c0096d954a57d24cad5669 (patch)
tree81474177d730440657f490ae29892d62392251ea /lib/xesite_types/src
parentcbdea8ba3fca9a663778af71f8df5965aeb6c090 (diff)
downloadxesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.tar.xz
xesite-ac6a3df0d18cc73524c0096d954a57d24cad5669.zip
Xesite V4 (#723)
* scripts/ditherify: fix quoting Signed-off-by: Xe Iaso <me@xeiaso.net> * clean up some old files Signed-off-by: Xe Iaso <me@xeiaso.net> * import site into lume Signed-off-by: Xe Iaso <me@xeiaso.net> * initial go code Signed-off-by: Xe Iaso <me@xeiaso.net> * move vods index to top level Signed-off-by: Xe Iaso <me@xeiaso.net> * remove the ads Signed-off-by: Xe Iaso <me@xeiaso.net> * internal/lume: metrics Signed-off-by: Xe Iaso <me@xeiaso.net> * delete old code Signed-off-by: Xe Iaso <me@xeiaso.net> * load config into memory Signed-off-by: Xe Iaso <me@xeiaso.net> * autogenerate data from dhall config Signed-off-by: Xe Iaso <me@xeiaso.net> * various cleanups, import clackset logic Signed-off-by: Xe Iaso <me@xeiaso.net> * Update signalboost.dhall (#722) Added myself, and also fixed someone’s typo * Add Connor Edwards to signal boost (#721) * add cache headers Signed-off-by: Xe Iaso <me@xeiaso.net> * move command to xesite folder Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: listen for GitHub webhook push events Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: 5 minute timeout for rebuilding the site Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: add rebuild metrics Signed-off-by: Xe Iaso <me@xeiaso.net> * xesite: update default variables Signed-off-by: Xe Iaso <me@xeiaso.net> * don't commit binaries oops lol Signed-off-by: Xe Iaso <me@xeiaso.net> * lume: make search have a light background Signed-off-by: Xe Iaso <me@xeiaso.net> * add a notfound page Signed-off-by: Xe Iaso <me@xeiaso.net> * fetch info from patreon API Signed-off-by: Xe Iaso <me@xeiaso.net> * create contact page Signed-off-by: Xe Iaso <me@xeiaso.net> * Toot embedding Signed-off-by: Xe Iaso <me@xeiaso.net> * attempt a docker image Signed-off-by: Xe Iaso <me@xeiaso.net> * lume: fix deno lock Signed-off-by: Xe Iaso <me@xeiaso.net> * add gokrazy post Signed-off-by: Xe Iaso <me@xeiaso.net> * cmd/xesite: go up before trying to connect to the saas proxy Signed-off-by: Xe Iaso <me@xeiaso.net> * blog: add Sine post/demo Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Co-authored-by: bri <284789+b-@users.noreply.github.com> Co-authored-by: Connor Edwards <38229097+cedws@users.noreply.github.com>
Diffstat (limited to 'lib/xesite_types/src')
-rw-r--r--lib/xesite_types/src/lib.rs41
-rw-r--r--lib/xesite_types/src/mastodon.rs223
-rw-r--r--lib/xesite_types/src/testdata/post_attachment.json62
-rw-r--r--lib/xesite_types/src/testdata/post_hashtags.json59
-rw-r--r--lib/xesite_types/src/testdata/post_mention.json54
-rw-r--r--lib/xesite_types/src/testdata/robocadey.json97
6 files changed, 0 insertions, 536 deletions
diff --git a/lib/xesite_types/src/lib.rs b/lib/xesite_types/src/lib.rs
deleted file mode 100644
index 890ef39..0000000
--- a/lib/xesite_types/src/lib.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use serde::{Deserialize, Serialize};
-
-pub mod mastodon;
-
-#[derive(Eq, PartialEq, Deserialize, Default, Debug, Serialize, Clone)]
-pub struct Frontmatter {
- #[serde(default = "frontmatter_about")]
- pub about: String,
- #[serde(skip_serializing)]
- pub title: String,
- #[serde(skip_serializing)]
- pub date: String,
- #[serde(skip_serializing)]
- pub author: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub series: Option<String>,
- #[serde(skip_serializing)]
- pub tags: Option<Vec<String>>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub slides_link: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub image: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub thumb: Option<String>,
- #[serde(skip_serializing)]
- pub redirect_to: Option<String>,
- #[serde(skip_serializing_if = "Option::is_none")]
- pub vod: Option<Vod>,
- #[serde(default)]
- pub skip_ads: bool,
-}
-
-fn frontmatter_about() -> String {
- "https://xeiaso.net/blog/api-jsonfeed-extensions#_xesite_frontmatter".to_string()
-}
-
-#[derive(Eq, PartialEq, Deserialize, Default, Debug, Serialize, Clone)]
-pub struct Vod {
- pub twitch: String,
- pub youtube: String,
-}
diff --git a/lib/xesite_types/src/mastodon.rs b/lib/xesite_types/src/mastodon.rs
deleted file mode 100644
index ac34574..0000000
--- a/lib/xesite_types/src/mastodon.rs
+++ /dev/null
@@ -1,223 +0,0 @@
-use chrono::prelude::*;
-use serde::{Deserialize, Serialize};
-
-#[derive(Serialize, Deserialize)]
-pub struct User {
- #[serde(rename = "id")]
- pub id: String,
-
- #[serde(rename = "type")]
- pub user_type: String,
-
- #[serde(rename = "following")]
- pub following: String,
-
- #[serde(rename = "followers")]
- pub followers: String,
-
- #[serde(rename = "inbox")]
- pub inbox: String,
-
- #[serde(rename = "outbox")]
- pub outbox: String,
-
- #[serde(rename = "featured")]
- pub featured: String,
-
- #[serde(rename = "featuredTags")]
- pub featured_tags: Option<String>,
-
- #[serde(rename = "preferredUsername")]
- pub preferred_username: String,
-
- #[serde(rename = "name")]
- pub name: String,
-
- #[serde(rename = "summary")]
- pub summary: String,
-
- #[serde(rename = "url")]
- pub url: String,
-
- #[serde(rename = "manuallyApprovesFollowers")]
- pub manually_approves_followers: bool,
-
- #[serde(rename = "discoverable")]
- pub discoverable: bool,
-
- #[serde(rename = "published")]
- pub published: Option<String>,
-
- #[serde(rename = "devices")]
- pub devices: Option<String>,
-
- #[serde(rename = "icon")]
- pub icon: Icon,
-
- #[serde(rename = "image")]
- pub image: Option<Icon>,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Icon {
- #[serde(rename = "type")]
- pub icon_type: String,
-
- #[serde(rename = "mediaType")]
- pub media_type: Option<String>,
-
- #[serde(rename = "url")]
- pub url: String,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Toot {
- #[serde(rename = "id")]
- pub id: String,
-
- #[serde(rename = "type")]
- pub toot_type: String,
-
- #[serde(rename = "inReplyTo")]
- pub in_reply_to: Option<String>,
-
- #[serde(rename = "published")]
- pub published: DateTime<Utc>,
-
- #[serde(rename = "url")]
- pub url: Option<String>,
-
- #[serde(rename = "attributedTo")]
- pub attributed_to: String,
-
- #[serde(rename = "to")]
- pub to: Vec<String>,
-
- #[serde(rename = "cc")]
- pub cc: Vec<String>,
-
- #[serde(rename = "sensitive")]
- pub sensitive: Option<bool>,
-
- #[serde(rename = "conversation")]
- pub conversation: String,
-
- #[serde(rename = "summary")]
- pub summary: Option<String>,
-
- #[serde(rename = "content")]
- pub content: String,
-
- #[serde(rename = "contentMap")]
- pub content_map: Option<ContentMap>,
-
- #[serde(rename = "attachment")]
- pub attachment: Vec<Attachment>,
-
- #[serde(rename = "tag")]
- pub tag: Vec<Tag>,
-
- #[serde(rename = "replies")]
- pub replies: Option<Replies>,
-}
-
-impl Toot {
- pub fn content_text(&self) -> String {
- html2text::from_read(std::io::Cursor::new(&self.content), 80)
- }
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Source {
- #[serde(rename = "content")]
- pub content: String,
- #[serde(rename = "mediaType")]
- pub content_type: String,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Tag {
- #[serde(rename = "type")]
- pub tag_type: String,
-
- #[serde(rename = "href")]
- pub href: String,
-
- #[serde(rename = "name")]
- pub name: String,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Attachment {
- #[serde(rename = "type")]
- pub attachment_type: String,
-
- #[serde(rename = "mediaType")]
- pub media_type: String,
-
- #[serde(rename = "url")]
- pub url: String,
-
- #[serde(rename = "name")]
- pub name: Option<String>,
-
- #[serde(rename = "blurhash")]
- pub blurhash: String,
-
- #[serde(rename = "width")]
- pub width: i64,
-
- #[serde(rename = "height")]
- pub height: i64,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct ContentMap {
- #[serde(rename = "en")]
- pub en: String,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Replies {
- #[serde(rename = "id")]
- pub id: String,
-
- #[serde(rename = "type")]
- pub replies_type: String,
-
- #[serde(rename = "first")]
- pub first: Page,
-}
-
-#[derive(Serialize, Deserialize)]
-pub struct Page {
- #[serde(rename = "type")]
- pub first_type: String,
-
- #[serde(rename = "next")]
- pub next: String,
-
- #[serde(rename = "partOf")]
- pub part_of: String,
-
- #[serde(rename = "items")]
- pub items: Vec<String>,
-}
-
-#[cfg(test)]
-pub mod test {
- use super::*;
- use serde_json::from_str;
-
- #[test]
- fn user() {
- let _: User = from_str(include_str!("./testdata/robocadey.json")).unwrap();
- }
-
- #[test]
- fn toot() {
- let _attachment: Toot = from_str(include_str!("./testdata/post_attachment.json")).unwrap();
- let _hashtags: Toot = from_str(include_str!("./testdata/post_hashtags.json")).unwrap();
- let _mention: Toot = from_str(include_str!("./testdata/post_mention.json")).unwrap();
- }
-}
diff --git a/lib/xesite_types/src/testdata/post_attachment.json b/lib/xesite_types/src/testdata/post_attachment.json
deleted file mode 100644
index 4c4ba7c..0000000
--- a/lib/xesite_types/src/testdata/post_attachment.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- {
- "ostatus": "http://ostatus.org#",
- "atomUri": "ostatus:atomUri",
- "inReplyToAtomUri": "ostatus:inReplyToAtomUri",
- "conversation": "ostatus:conversation",
- "sensitive": "as:sensitive",
- "toot": "http://joinmastodon.org/ns#",
- "votersCount": "toot:votersCount",
- "blurhash": "toot:blurhash",
- "focalPoint": {
- "@container": "@list",
- "@id": "toot:focalPoint"
- }
- }
- ],
- "id": "https://pony.social/users/cadey/statuses/109122208862903363",
- "type": "Note",
- "summary": null,
- "inReplyTo": null,
- "published": "2022-10-06T16:12:47Z",
- "url": "https://pony.social/@cadey/109122208862903363",
- "attributedTo": "https://pony.social/users/cadey",
- "to": [
- "https://www.w3.org/ns/activitystreams#Public"
- ],
- "cc": [
- "https://pony.social/users/cadey/followers"
- ],
- "sensitive": false,
- "atomUri": "https://pony.social/users/cadey/statuses/109122208862903363",
- "inReplyToAtomUri": null,
- "conversation": "tag:pony.social,2022-10-06:objectId=5615742:objectType=Conversation",
- "content": "<p>Normal human hands</p>",
- "contentMap": {
- "en": "<p>Normal human hands</p>"
- },
- "attachment": [
- {
- "type": "Document",
- "mediaType": "image/png",
- "url": "https://cdn.pony.social/file/tscs37-pony-social/media_attachments/files/109/122/208/408/843/969/original/0bb50ba4b067e8dd.png",
- "name": null,
- "blurhash": "UKLVj$9?CjIq$]Y4Q-VuE14:}@My58RRr@T0",
- "width": 512,
- "height": 768
- }
- ],
- "tag": [],
- "replies": {
- "id": "https://pony.social/users/cadey/statuses/109122208862903363/replies",
- "type": "Collection",
- "first": {
- "type": "CollectionPage",
- "next": "https://pony.social/users/cadey/statuses/109122208862903363/replies?only_other_accounts=true&page=true",
- "partOf": "https://pony.social/users/cadey/statuses/109122208862903363/replies",
- "items": []
- }
- }
-}
diff --git a/lib/xesite_types/src/testdata/post_hashtags.json b/lib/xesite_types/src/testdata/post_hashtags.json
deleted file mode 100644
index 5be859d..0000000
--- a/lib/xesite_types/src/testdata/post_hashtags.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- {
- "ostatus": "http://ostatus.org#",
- "atomUri": "ostatus:atomUri",
- "inReplyToAtomUri": "ostatus:inReplyToAtomUri",
- "conversation": "ostatus:conversation",
- "sensitive": "as:sensitive",
- "toot": "http://joinmastodon.org/ns#",
- "votersCount": "toot:votersCount",
- "Hashtag": "as:Hashtag"
- }
- ],
- "id": "https://pony.social/users/cadey/statuses/109133556398059513",
- "type": "Note",
- "summary": null,
- "inReplyTo": null,
- "published": "2022-10-08T16:18:36Z",
- "url": "https://pony.social/@cadey/109133556398059513",
- "attributedTo": "https://pony.social/users/cadey",
- "to": [
- "https://www.w3.org/ns/activitystreams#Public"
- ],
- "cc": [
- "https://pony.social/users/cadey/followers"
- ],
- "sensitive": false,
- "atomUri": "https://pony.social/users/cadey/statuses/109133556398059513",
- "inReplyToAtomUri": null,
- "conversation": "tag:pony.social,2022-10-08:objectId=5625805:objectType=Conversation",
- "content": "<p><a href=\"https://pony.social/tags/yolo\" class=\"mention hashtag\" rel=\"tag\">#<span>yolo</span></a> <a href=\"https://pony.social/tags/swag\" class=\"mention hashtag\" rel=\"tag\">#<span>swag</span></a></p>",
- "contentMap": {
- "en": "<p><a href=\"https://pony.social/tags/yolo\" class=\"mention hashtag\" rel=\"tag\">#<span>yolo</span></a> <a href=\"https://pony.social/tags/swag\" class=\"mention hashtag\" rel=\"tag\">#<span>swag</span></a></p>"
- },
- "attachment": [],
- "tag": [
- {
- "type": "Hashtag",
- "href": "https://pony.social/tags/yolo",
- "name": "#yolo"
- },
- {
- "type": "Hashtag",
- "href": "https://pony.social/tags/swag",
- "name": "#swag"
- }
- ],
- "replies": {
- "id": "https://pony.social/users/cadey/statuses/109133556398059513/replies",
- "type": "Collection",
- "first": {
- "type": "CollectionPage",
- "next": "https://pony.social/users/cadey/statuses/109133556398059513/replies?only_other_accounts=true&page=true",
- "partOf": "https://pony.social/users/cadey/statuses/109133556398059513/replies",
- "items": []
- }
- }
-}
diff --git a/lib/xesite_types/src/testdata/post_mention.json b/lib/xesite_types/src/testdata/post_mention.json
deleted file mode 100644
index c4473bd..0000000
--- a/lib/xesite_types/src/testdata/post_mention.json
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- {
- "ostatus": "http://ostatus.org#",
- "atomUri": "ostatus:atomUri",
- "inReplyToAtomUri": "ostatus:inReplyToAtomUri",
- "conversation": "ostatus:conversation",
- "sensitive": "as:sensitive",
- "toot": "http://joinmastodon.org/ns#",
- "votersCount": "toot:votersCount"
- }
- ],
- "id": "https://pony.social/users/robocadey/statuses/109133487137738104",
- "type": "Note",
- "summary": null,
- "inReplyTo": null,
- "published": "2022-10-08T16:00:59Z",
- "url": "https://pony.social/@robocadey/109133487137738104",
- "attributedTo": "https://pony.social/users/robocadey",
- "to": [
- "https://www.w3.org/ns/activitystreams#Public"
- ],
- "cc": [
- "https://pony.social/users/robocadey/followers",
- "https://pony.social/users/cadey"
- ],
- "sensitive": false,
- "atomUri": "https://pony.social/users/robocadey/statuses/109133487137738104",
- "inReplyToAtomUri": null,
- "conversation": "tag:pony.social,2022-10-08:objectId=5625572:objectType=Conversation",
- "content": "<p>Beep boop! I am Robocadey, a robotic shitposting accessory. I am owned by <span class=\"h-card\"><a href=\"https://pony.social/@cadey\" class=\"u-url mention\">@<span>cadey</span></a></span> and will occasionally brighten your day with new wisdom.</p>",
- "contentMap": {
- "en": "<p>Beep boop! I am Robocadey, a robotic shitposting accessory. I am owned by <span class=\"h-card\"><a href=\"https://pony.social/@cadey\" class=\"u-url mention\">@<span>cadey</span></a></span> and will occasionally brighten your day with new wisdom.</p>"
- },
- "attachment": [],
- "tag": [
- {
- "type": "Mention",
- "href": "https://pony.social/users/cadey",
- "name": "@cadey"
- }
- ],
- "replies": {
- "id": "https://pony.social/users/robocadey/statuses/109133487137738104/replies",
- "type": "Collection",
- "first": {
- "type": "CollectionPage",
- "next": "https://pony.social/users/robocadey/statuses/109133487137738104/replies?only_other_accounts=true&page=true",
- "partOf": "https://pony.social/users/robocadey/statuses/109133487137738104/replies",
- "items": []
- }
- }
-}
diff --git a/lib/xesite_types/src/testdata/robocadey.json b/lib/xesite_types/src/testdata/robocadey.json
deleted file mode 100644
index 3ef6f40..0000000
--- a/lib/xesite_types/src/testdata/robocadey.json
+++ /dev/null
@@ -1,97 +0,0 @@
-{
- "@context": [
- "https://www.w3.org/ns/activitystreams",
- "https://w3id.org/security/v1",
- {
- "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
- "toot": "http://joinmastodon.org/ns#",
- "featured": {
- "@id": "toot:featured",
- "@type": "@id"
- },
- "featuredTags": {
- "@id": "toot:featuredTags",
- "@type": "@id"
- },
- "alsoKnownAs": {
- "@id": "as:alsoKnownAs",
- "@type": "@id"
- },
- "movedTo": {
- "@id": "as:movedTo",
- "@type": "@id"
- },
- "schema": "http://schema.org#",
- "PropertyValue": "schema:PropertyValue",
- "value": "schema:value",
- "discoverable": "toot:discoverable",
- "Device": "toot:Device",
- "Ed25519Signature": "toot:Ed25519Signature",
- "Ed25519Key": "toot:Ed25519Key",
- "Curve25519Key": "toot:Curve25519Key",
- "EncryptedMessage": "toot:EncryptedMessage",
- "publicKeyBase64": "toot:publicKeyBase64",
- "deviceId": "toot:deviceId",
- "claim": {
- "@type": "@id",
- "@id": "toot:claim"
- },
- "fingerprintKey": {
- "@type": "@id",
- "@id": "toot:fingerprintKey"
- },
- "identityKey": {
- "@type": "@id",
- "@id": "toot:identityKey"
- },
- "devices": {
- "@type": "@id",
- "@id": "toot:devices"
- },
- "messageFranking": "toot:messageFranking",
- "messageType": "toot:messageType",
- "cipherText": "toot:cipherText",
- "suspended": "toot:suspended",
- "focalPoint": {
- "@container": "@list",
- "@id": "toot:focalPoint"
- }
- }
- ],
- "id": "https://pony.social/users/robocadey",
- "type": "Service",
- "following": "https://pony.social/users/robocadey/following",
- "followers": "https://pony.social/users/robocadey/followers",
- "inbox": "https://pony.social/users/robocadey/inbox",
- "outbox": "https://pony.social/users/robocadey/outbox",
- "featured": "https://pony.social/users/robocadey/collections/featured",
- "featuredTags": "https://pony.social/users/robocadey/collections/tags",
- "preferredUsername": "robocadey",
- "name": "Robocadey",
- "summary": "<p>Owned by <span class=\"h-card\"><a href=\"https://pony.social/@cadey\" class=\"u-url mention\">@<span>cadey</span></a></span>.</p><p>Toots GPT-2 generated shitposts from @theprincessxena@twitter.com tweets along with images created with Waifu Diffusion v1.3</p>",
- "url": "https://pony.social/@robocadey",
- "manuallyApprovesFollowers": false,
- "discoverable": false,
- "published": "2022-10-08T00:00:00Z",
- "devices": "https://pony.social/users/robocadey/collections/devices",
- "publicKey": {
- "id": "https://pony.social/users/robocadey#main-key",
- "owner": "https://pony.social/users/robocadey",
- "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIn1CxWOEh/EotQa1FED\nZvVPw2DxmmL48eZrE8xoWoBD7APi/oUk5EKITDMlLYWNb2rECX7FrunPP3f/lXPC\nkJvMIimQxBWX8IFxl1alVbwNYfwBjtLHUl5ZBqNFhWUAaauMVxkSSrpEgJUzJmea\nsJD1z9nm7R9jppNGdnUIz/gsO9DvC0kN0YlfLchbtfYIqqctSMHbOPyVcw5/xho/\nH6wAv9SEM/1ETQXPVXRdI7W/yN+9cituoB4NdQdOMtsBeo7c7/qH9WFOlTTA4N39\nTCRqYmvexaOmlDxKDmctJFLdT3noar3hHP3b/ICjbcvMNSBN1H0rs6n8GZMgzvQx\nnwIDAQAB\n-----END PUBLIC KEY-----\n"
- },
- "tag": [],
- "attachment": [],
- "endpoints": {
- "sharedInbox": "https://pony.social/inbox"
- },
- "icon": {
- "type": "Image",
- "mediaType": "image/png",
- "url": "https://cdn.pony.social/file/tscs37-pony-social/accounts/avatars/109/133/463/176/529/998/original/7231b4900b06513d.png"
- },
- "image": {
- "type": "Image",
- "mediaType": "image/png",
- "url": "https://cdn.pony.social/file/tscs37-pony-social/accounts/headers/109/133/463/176/529/998/original/ece50a6e21c9d773.png"
- }
-}