From 1b2dd7b541fbc0a3b01883beac6afd737ea6836f Mon Sep 17 00:00:00 2001 From: arne Date: Thu, 20 Jun 2024 18:38:36 +0200 Subject: [PATCH] Rename from memento to ephemera --- memento.clj => ephemera.clj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename memento.clj => ephemera.clj (93%) diff --git a/memento.clj b/ephemera.clj similarity index 93% rename from memento.clj rename to ephemera.clj index bdfe0ff..a64e9bc 100644 --- a/memento.clj +++ b/ephemera.clj @@ -1,4 +1,4 @@ -(ns memento +(ns ephemera (:require [cheshire.core :as json] [org.httpkit.client :as http] [clojure.string :as str]) @@ -8,9 +8,10 @@ (def acct (System/getenv "MASTODON_ACCOUNT")) (def auth-token (System/getenv "MASTODON_AUTH_TOKEN")) -(def assert-msg "Please set the MASTODON_ACCOUNT, MASTODON_AUTH_TOKEN and MEMENTO_ACCOUNT env vars.") +(def assert-msg "Please set the MASTODON_ACCOUNT, MASTODON_AUTH_TOKEN env vars.") (assert (not (empty? acct)) assert-msg) (assert (not (empty? auth-token)) assert-msg) +(assert (str/includes? acct "@") "Please include the instance url in MASTODON_ACCOUNT.") (def instance-url (format "https://%s" (last (str/split acct #"@")))) @@ -63,7 +64,7 @@ @(sleep 2500) ; we need to wait, otherwise media_ids are still "attached" and can't be reused (print "Recreating ") (prn-res (mastodon-api - (format "api/v1/statuses" #_(:id refiled)) + (format "api/v1/statuses") {:method :post :headers {"Content-Type" "application/json"} :body (json/encode