From 454643675f260e5c681b69129a29165a0aa2c2b3 Mon Sep 17 00:00:00 2001 From: Felisp Date: Fri, 13 Sep 2024 21:17:23 +0200 Subject: [PATCH 01/12] Add fkmap and vectorize macro --- src/rss_thread_watch/utils.clj | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/rss_thread_watch/utils.clj b/src/rss_thread_watch/utils.clj index db53c12..afab99f 100644 --- a/src/rss_thread_watch/utils.clj +++ b/src/rss_thread_watch/utils.clj @@ -47,6 +47,11 @@ ~x result#))) +(defmacro vectorize + "If arg is not a vector, put into vector, otherwise return it" + [v] + (if (vector? v) v [v])) + ;; ===== Generic functions ==== (defn indices @@ -71,13 +76,25 @@ (defn fmap "Applies function [f] to every key and value in map [m] - Function signature should be (f [key value])." + Function signature should be (f [key value]). + Key stays unchanged" [f m] (into (empty m) (for [[key val] m] [key (f key val)]))) +(defn fkmap + ;; I am horrible with docstrings, I don't deny that + "Applies function [f] to every key and value in map [m] + Function signature should be (f [key value]). + Unlike fmap, you can change key too, so return both {key value} in map" + [f m] + (into + (empty m) + (for [[key val] m] + (f key val)))) + (defn expand-home "Expands ~ to home directory" ;;modified from sauce: https://stackoverflow.com/questions/29585928/how-to-substitute-path-to-home-for From 2464a66ac73d243a81430fdfc91739ccff7c74e9 Mon Sep 17 00:00:00 2001 From: Felisp Date: Fri, 13 Sep 2024 21:17:48 +0200 Subject: [PATCH 02/12] Add filters for q and Q params --- src/rss_thread_watch/filters.clj | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/rss_thread_watch/filters.clj diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj new file mode 100644 index 0000000..2df2b06 --- /dev/null +++ b/src/rss_thread_watch/filters.clj @@ -0,0 +1,32 @@ +;; Copyright (C) 2024 Felisp +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU Affero General Public License as published by +;; the Free Software Foundation, version 3 of the License. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU Affero General Public License for more details. +;; +;; You should have received a copy of the GNU Affero General Public License +;; along with this program. If not, see . + +(ns rss-thread-watch.filters + "Functions filtering posts" + (:require [clojure.string :as cs] + [rss-thread-watch.utils :as u]) + (:gen-class)) + +(defn case-sensitive-filter + "Returns true if string [s] is matched by any query. It's case insensitive" + [s queries] + (some (fn [querry] + (cs/includes? s querry)) + queries)) + +(defn case-insensitive-filter + "Returns true if string [s] is case-matched by query" + [s queries] + (basic-filter (cs/lower-case s) (cs/lower-case s))) + From ee3ad0a6e91d727b12a383d84bb0ce17bcb681c4 Mon Sep 17 00:00:00 2001 From: Felisp Date: Fri, 13 Sep 2024 21:18:23 +0200 Subject: [PATCH 03/12] Initial filter implementation attempt --- src/rss_thread_watch/feed_generator.clj | 51 ++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index 6f34a62..89aeb3f 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -20,7 +20,8 @@ [clojure.string :as s] [rss-thread-watch.watcher :as watcher] [rss-thread-watch.utils :as ut] - [rss-thread-watch.config :as conf]) + [rss-thread-watch.config :as conf] + [rss-thread-watch.filters :as f]) (:gen-class)) (def boards-enabled-cache @@ -56,12 +57,48 @@ (:last-modified thread) (:chod thread)))) +(defn make-filters + "Creates map of functions and filters from query string" + ;; In future predicates could return matched parts of string instead of + ;; t/nil values which could be used for coloring of results + [query-map] + (let [filtering-params '("q" "Q") ;Later add "r" for regex + filter-map (select-keys query-map filtering-params)] + (ut/fkmap (fn [k v] + {(case k + ;; regex filter here + "q" f/case-insensitive-filter + "Q" f/case-sensitive-filter) v}) + filter-map))) + + +(defn x [cache filters] + ;;must return fitlered cache + ;; {fun [key dfe dw kwd"]} + (filter + (fn [thread] + ;; run every function for each thread + (let [title (get thread :title)] + (some (fn [filter] + (let [queries (get filters filter)] + (some (fn [q] + (filter title queries)) + queries) + ;; some again? + ;; try some-map? + )) + (keys filters))) + ;;RESUME + ) cache + )) + + + (defn filter-chod-posts "Return list of all threads with equal or higher ChoD than requested - + ;;resume READS FROM GLOBALS: watcher.time-of-cache" [query-vec chod-treshold repeat? board-cache] - (let [{time-of-generation :time cache :data} board-cache guid-fn (case repeat? @@ -72,6 +109,7 @@ cache)) ;; So we don't have to search thru everything we have cached needed-cache-part (subvec cache cache-start-index) + ;; Here we gonna run fmap but not really actuall-matches (keep (fn [t] (let [title (:title t)] ;; Todo: Man, wouldn't it be cool to know which querry matched the thread? @@ -130,10 +168,11 @@ query :query-string scheme :scheme server-name :server-name} rqst - qrs (prms "q") + filters (make-filters prms) + ;; qrs (prms "q") self-uri (str (s/replace-first scheme ":" "") "://" server-name uri "?" query) - queries (if (vector? qrs) qrs [qrs]) ; to always return vector + ;; queries (if (vector? qrs) qrs [qrs]) ; to always return vector real-chod (if-let [ch (or (and (vector? chod) (first chod)) chod)] @@ -167,7 +206,7 @@ (when-not (prms "q") (throw (ex-info "400" {:status 400 :header {"Content-Type" "text/plain"} - :body (str "400 You MUST specify query with one OR more'q=searchTerm' url parameter(s)\n\n\n" + :body (str "400 You MUST specify query with one OR more'q=searchTerm' (or 'Q=SeARChteRm' for case sensitive) url parameter(s)\n\n\n" "Exmple: '" served-filename "?q=pony&q=IWTCIRD' will show in your feed all threads with 'pony' or 'IWTCIRD'" " in their title that are about to die.")}))) ;; Whether cache has been generated yet From b88a471a0ed494520bbb4e365a099de1413798df Mon Sep 17 00:00:00 2001 From: Felisp Date: Thu, 19 Sep 2024 16:41:51 +0200 Subject: [PATCH 04/12] Fix case-insensitive-filter --- src/rss_thread_watch/filters.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj index 2df2b06..afc7d7a 100644 --- a/src/rss_thread_watch/filters.clj +++ b/src/rss_thread_watch/filters.clj @@ -28,5 +28,6 @@ (defn case-insensitive-filter "Returns true if string [s] is case-matched by query" [s queries] - (basic-filter (cs/lower-case s) (cs/lower-case s))) + (case-sensitive-filter (cs/lower-case s) (map cs/lower-case queries))) + From 5178ab7366e2f32c611346a62bb827e80a0db25a Mon Sep 17 00:00:00 2001 From: Felisp Date: Thu, 19 Sep 2024 16:57:22 +0200 Subject: [PATCH 05/12] Improve make-filters function --- src/rss_thread_watch/feed_generator.clj | 41 +++++-------------------- src/rss_thread_watch/filters.clj | 3 ++ 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index 89aeb3f..f5689c4 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -58,41 +58,14 @@ (:chod thread)))) (defn make-filters - "Creates map of functions and filters from query string" - ;; In future predicates could return matched parts of string instead of - ;; t/nil values which could be used for coloring of results - [query-map] - (let [filtering-params '("q" "Q") ;Later add "r" for regex - filter-map (select-keys query-map filtering-params)] + "Creates map of functions and filters from query string. + Return format is: {filter-fun ['words' 'to' 'filter' 'using this function]}" + [query-string known-filter-map] + (let [filterable (select-keys query-string + (keys known-filter-map))] (ut/fkmap (fn [k v] - {(case k - ;; regex filter here - "q" f/case-insensitive-filter - "Q" f/case-sensitive-filter) v}) - filter-map))) - - -(defn x [cache filters] - ;;must return fitlered cache - ;; {fun [key dfe dw kwd"]} - (filter - (fn [thread] - ;; run every function for each thread - (let [title (get thread :title)] - (some (fn [filter] - (let [queries (get filters filter)] - (some (fn [q] - (filter title queries)) - queries) - ;; some again? - ;; try some-map? - )) - (keys filters))) - ;;RESUME - ) cache - )) - - + {(get known-filter-map k) v}) + filterable))) (defn filter-chod-posts "Return list of all threads with equal or higher ChoD than requested diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj index afc7d7a..fe006c1 100644 --- a/src/rss_thread_watch/filters.clj +++ b/src/rss_thread_watch/filters.clj @@ -30,4 +30,7 @@ [s queries] (case-sensitive-filter (cs/lower-case s) (map cs/lower-case queries))) +(def known-filters + {"Q" case-sensitive-filter + "q" case-insensitive-filter}) From 817790cfb403cf73a05a92845ee9c3e4399082ee Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 00:26:28 +0200 Subject: [PATCH 06/12] Fix repl-main, add bunch of TODOs --- src/rss_thread_watch/config.clj | 2 ++ src/rss_thread_watch/core.clj | 7 +++++++ src/rss_thread_watch/feed_generator.clj | 6 +++--- src/rss_thread_watch/utils.clj | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/rss_thread_watch/config.clj b/src/rss_thread_watch/config.clj index 0626b83..0f2c959 100644 --- a/src/rss_thread_watch/config.clj +++ b/src/rss_thread_watch/config.clj @@ -78,6 +78,8 @@ boards)))) (defn config-fill-board-defaults + ;; TODO: must have check that if board is default, it's enabled, if it's not, give some big fat warning + ;; that users must always specify board, maybe change the error? "Fills every enabled board with default config values" [config] (let [defaults (:boards-defaults config)] diff --git a/src/rss_thread_watch/core.clj b/src/rss_thread_watch/core.clj index 4fab9df..c59a33e 100644 --- a/src/rss_thread_watch/core.clj +++ b/src/rss_thread_watch/core.clj @@ -72,6 +72,7 @@ (let [config (conf/get-some-config (:config options))] ;; TODO: probably refactor to use separate config.clj file when validation will be added ;; Init the few globals we have + ;; TODO: this all needs to go in separate function so it doesnt have to duplicated in repl-main (reset! conf/GLOBAL-CONFIG config) (reset! feed/boards-enabled-cache (set (keys (get config :boards-enabled)))) (reset! watcher/chod-threads-cache (watcher/generate-chod-cache-structure config)) @@ -83,6 +84,12 @@ (defn repl-main "Development entry point" [] + (let [config (conf/get-some-config nil)] + ;; TODO: probably refactor to use separate config.clj file when validation will be added + ;; Init the few globals we have + (reset! conf/GLOBAL-CONFIG config) + (reset! feed/boards-enabled-cache (set (keys (get config :boards-enabled)))) + (reset! watcher/chod-threads-cache (watcher/generate-chod-cache-structure config))) (jetty/run-jetty (rp/wrap-params #'feed/http-handler) {:port (:port conf/CONFIG-DEFAULT) ;; Dont block REPL thread diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index f5689c4..3ed7414 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -35,8 +35,8 @@ This is done by always making new GUID - (concat thread-number UNIX-time-of-data-update)" [thread time] (assoc thread :guid (str (:no thread) - "-" - time))) + "-" + time))) (defn new-guid-paranoid "Generate unique GUID on EVERY request to the feed. @@ -79,7 +79,7 @@ "true" (fn [x] (new-guid-always x time-of-generation)) update-only-guid) cache-start-index (first (ut/indices (fn [x] (>= (:chod x) chod-treshold)) - cache)) + cache)) ;; So we don't have to search thru everything we have cached needed-cache-part (subvec cache cache-start-index) ;; Here we gonna run fmap but not really diff --git a/src/rss_thread_watch/utils.clj b/src/rss_thread_watch/utils.clj index afab99f..5d81d9b 100644 --- a/src/rss_thread_watch/utils.clj +++ b/src/rss_thread_watch/utils.clj @@ -74,6 +74,7 @@ {k (map-apply-defaults conf-val default-val)} {k (nil?-else conf-val default-val)}))))) +;; This is a shitty version of reduce-kv (defn fmap "Applies function [f] to every key and value in map [m] Function signature should be (f [key value]). From 8d61968dc9329f998cadfb2d4da49e53a6e7c43e Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 00:27:16 +0200 Subject: [PATCH 07/12] Make filters take the whole thread to be more flexible --- src/rss_thread_watch/feed_generator.clj | 2 +- src/rss_thread_watch/filters.clj | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index 3ed7414..ed9cbe5 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -64,7 +64,7 @@ (let [filterable (select-keys query-string (keys known-filter-map))] (ut/fkmap (fn [k v] - {(get known-filter-map k) v}) + {(get known-filter-map k) (ut/vectorize v)}) filterable))) (defn filter-chod-posts diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj index fe006c1..1573583 100644 --- a/src/rss_thread_watch/filters.clj +++ b/src/rss_thread_watch/filters.clj @@ -20,15 +20,15 @@ (defn case-sensitive-filter "Returns true if string [s] is matched by any query. It's case insensitive" - [s queries] + [{:keys [title]} queries] (some (fn [querry] - (cs/includes? s querry)) + (cs/includes? title querry)) queries)) (defn case-insensitive-filter "Returns true if string [s] is case-matched by query" - [s queries] - (case-sensitive-filter (cs/lower-case s) (map cs/lower-case queries))) + [{:keys [title]} queries] + (case-sensitive-filter {:title (cs/lower-case title)} (map cs/lower-case queries))) (def known-filters {"Q" case-sensitive-filter From 18cc3e730cf414b69ff45930e4ac8090ea308a0e Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 00:53:47 +0200 Subject: [PATCH 08/12] Refactored that horrible abomination of a code I don't do drugs but I must have or something, otherwise that is just unexplainable, I'm sorry if you had to see that, I really am --- src/rss_thread_watch/feed_generator.clj | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index ed9cbe5..9b0bf83 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -145,18 +145,12 @@ ;; qrs (prms "q") self-uri (str (s/replace-first scheme ":" "") "://" server-name uri "?" query) - ;; queries (if (vector? qrs) qrs [qrs]) ; to always return vector - real-chod (if-let [ch (or (and (vector? chod) - (first chod)) - chod)] - (try ;If we can't parse number from chod, use default 94 - (if (or (vector? chod) - ;; TODO: Do we seriously parse this twice? - (<= (Integer/parseInt chod) 60)) ; Never accept chod lower than 60 TODO: don't hardcode this - 60 (Integer/parseInt chod)) - (catch Exception e - 94))) board-config (get-in @conf/GLOBAL-CONFIG [:boards-enabled board]) + real-chod (try (max (Integer/parseInt (or (and (vector? chod) + (first chod)) + chod)) 60) ;HARDCODED CHoD + (catch Exception _ + (get board-config :default-chod))) cache @watcher/chod-threads-cache] (println "\n\nRCVD: " rqst) ;; (println rqst) From 1890f14f9ea3c600e0c52a1d128735c6916a60a5 Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 00:58:24 +0200 Subject: [PATCH 09/12] Implement support for multiple filters Allows for adding more filters so regex or searching by thread number will be much easier --- src/rss_thread_watch/feed_generator.clj | 39 +++++++++++-------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index 9b0bf83..c5528c3 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -69,9 +69,8 @@ (defn filter-chod-posts "Return list of all threads with equal or higher ChoD than requested - ;;resume READS FROM GLOBALS: watcher.time-of-cache" - [query-vec chod-treshold repeat? board-cache] + [filters chod-treshold repeat? board-cache] (let [{time-of-generation :time cache :data} board-cache guid-fn (case repeat? @@ -82,25 +81,21 @@ cache)) ;; So we don't have to search thru everything we have cached needed-cache-part (subvec cache cache-start-index) - ;; Here we gonna run fmap but not really - actuall-matches (keep (fn [t] - (let [title (:title t)] - ;; Todo: Man, wouldn't it be cool to know which querry matched the thread? - ;; Would be so much easier for user to figure out why is it showing - ;; and it would solve the problem of super long titles (or OPs instead of titles) - (when (some (fn [querry] - (s/includes? (s/lower-case title) (s/lower-case querry))) - query-vec) - t))) + actuall-matches (keep (fn [thread] + (some + (fn [fun] + (when (fun thread (get filters fun)) + thread)) + (keys filters))) (reverse needed-cache-part))] ;; Finally generate and append GUIDs (map guid-fn actuall-matches))) (defn thread-to-rss-item "Converts cached thread item to feed item which can be serialized into RSS" - [t host board] - (let [link-url (s/replace host "{threadnum}" (str (:no t)))] ;Hardcode emergency bugfix - {:title (format "%.2f%% - %s" (:chod t) (:title t)) ;TODO: Generate link from the target somehow, or just include it from API response + [t host] + (let [link-url (s/replace host "{threadnum}" (str (:no t)))] + {:title (format "%.2f%% - %s" (:chod t) (:title t)) ;; :url link-url <- this is supposed to be for images according to: https://cyber.harvard.edu/rss/rss.html :description (format "The thread: '%s' has %.2f%% chance of dying" (:title t) (:chod t)) :link link-url @@ -108,9 +103,8 @@ (defn generate-feed "Generates feed from matching items" - [query-vec chod-treshold repeat? cache board-config self-link] - (let [items (filter-chod-posts query-vec chod-treshold repeat? cache) - served-filename (get @conf/GLOBAL-CONFIG :served-filename) + [filters chod-treshold repeat? cache board-config self-link] + (let [items (filter-chod-posts filters chod-treshold repeat? cache) head {:title (str "RSS Thread watcher v" conf/VERSION) ;; :link is the homepage of the channel :link (get @conf/GLOBAL-CONFIG :homepage) @@ -141,9 +135,10 @@ query :query-string scheme :scheme server-name :server-name} rqst - filters (make-filters prms) - ;; qrs (prms "q") - self-uri (str (s/replace-first scheme ":" "") + filters (make-filters prms f/known-filters) + ;; BUG if local fileserver not running -> FileNotFound exception is thrown and it fucks up the feed generation + ;; Should be handled because wrong config and thus url generation could do the same + self-uri (str (s/replace-first scheme ":" "") ; "://" server-name uri "?" query) board-config (get-in @conf/GLOBAL-CONFIG [:boards-enabled board]) real-chod (try (max (Integer/parseInt (or (and (vector? chod) @@ -187,7 +182,7 @@ ;; There shouldn't be any problems with this mime type but if there are ;; replace with "text/xml", or even better, get RSS reader that is not utter shit :header {"Content-Type" "application/rss+xml"} - :body (generate-feed queries real-chod repeat? (watcher/get-thread-data board @conf/GLOBAL-CONFIG) board-config self-uri)}) + :body (generate-feed filters real-chod repeat? (watcher/get-thread-data board @conf/GLOBAL-CONFIG) board-config self-uri)}) (catch Exception e ;; Ex-info has been crafted to match HTTP response body so we can send it (if-let [caught (ex-data e)] From a951e4f4701dcc1b2f9aa85e739aefa1875f9834 Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 01:57:52 +0200 Subject: [PATCH 10/12] Fix query detector to support Q and all future query types --- src/rss_thread_watch/feed_generator.clj | 2 +- src/rss_thread_watch/filters.clj | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index c5528c3..2094262 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -165,7 +165,7 @@ (response/redirect (get @conf/GLOBAL-CONFIG :homepage))))) ;; No querry specified - don't know what to search for - (when-not (prms "q") + (when-not (some f/known-filter-set (keys prms)) (throw (ex-info "400" {:status 400 :header {"Content-Type" "text/plain"} :body (str "400 You MUST specify query with one OR more'q=searchTerm' (or 'Q=SeARChteRm' for case sensitive) url parameter(s)\n\n\n" diff --git a/src/rss_thread_watch/filters.clj b/src/rss_thread_watch/filters.clj index 1573583..071da96 100644 --- a/src/rss_thread_watch/filters.clj +++ b/src/rss_thread_watch/filters.clj @@ -34,3 +34,5 @@ {"Q" case-sensitive-filter "q" case-insensitive-filter}) +(def known-filter-set (set (keys known-filters))) + From 64a0f88ac4510aa628327212be894581fbed98c8 Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 01:58:17 +0200 Subject: [PATCH 11/12] Fixed bug where user-specified port was ignored --- src/rss_thread_watch/core.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rss_thread_watch/core.clj b/src/rss_thread_watch/core.clj index c59a33e..892f85a 100644 --- a/src/rss_thread_watch/core.clj +++ b/src/rss_thread_watch/core.clj @@ -77,7 +77,7 @@ (reset! feed/boards-enabled-cache (set (keys (get config :boards-enabled)))) (reset! watcher/chod-threads-cache (watcher/generate-chod-cache-structure config)) (clojure.pprint/pprint config) - (jetty/run-jetty (rp/wrap-params feed/http-handler) {:port (:port conf/CONFIG-DEFAULT) + (jetty/run-jetty (rp/wrap-params feed/http-handler) {:port (:port config) :join? true})))) ;; Docs: https://github.com/ring-clojure/ring/wiki/Getting-Started From 55ca8f0d47d5095c620ad3dc394bca5878147152 Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 02:03:53 +0200 Subject: [PATCH 12/12] Fix incorrect number of args --- src/rss_thread_watch/feed_generator.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index 2094262..c9b340c 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -113,8 +113,7 @@ :description "RSS based thread watcher"} body (map #(thread-to-rss-item %1 - (get board-config :host) - (get board-config :name)) items)] + (get board-config :host)) items)] (rss/channel-xml head body))) (defn http-handler @@ -172,6 +171,7 @@ "Exmple: '" served-filename "?q=pony&q=IWTCIRD' will show in your feed all threads with 'pony' or 'IWTCIRD'" " in their title that are about to die.")}))) ;; Whether cache has been generated yet + (when (empty? cache) (throw (ex-info "503" {:status 503 :header {"Content-Type" "text/plain"}