diff --git a/project.clj b/project.clj index 2ecf576..2b80241 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject rss-thread-watch "0.4.7-SNAPSHOT" +(defproject rss-thread-watch "0.4.8-SNAPSHOT" :description "RSS based thread watcher" :url "http://example.com/FIXME" :license {:name "AGPL-3.0-only" diff --git a/res/ExampleConfig-documented.edn b/res/ExampleConfig-documented.edn index c0ed0e3..b5a82fe 100644 --- a/res/ExampleConfig-documented.edn +++ b/res/ExampleConfig-documented.edn @@ -5,6 +5,9 @@ ;; :enable-board-listing true ;Whether to show list of enabled boards in /boards UNIMPLEMENTED ;; The watcher feed will be served by this url, everything else will be 404 :served-filename "/feed" + ;; This is homepage for your feed, it should probably redirect somewhere where you mention + ;; What things you have enabled and where to find full docs + :homepage "https://git.treebrary.org/Treebrary.org/rss-thread-watcher" ;; This map defines default values for all enabled boards, if you wish for some board ;; to use different values, specify them bellow in :borads-enabled :boards-defaults { diff --git a/src/rss_thread_watch/config.clj b/src/rss_thread_watch/config.clj index 17ee98f..0626b83 100644 --- a/src/rss_thread_watch/config.clj +++ b/src/rss_thread_watch/config.clj @@ -22,7 +22,7 @@ ;; Verification TODO: check if all required keys are included so we don't get nils -(def VERSION "0.4.7") +(def VERSION "0.4.8") (def GLOBAL-CONFIG "Global config with defaults for missing entires" @@ -37,6 +37,7 @@ :default-board "/mlp/" :enable-board-listing true :served-filename "/feed" + :homepage "https://git.treebrary.org/Treebrary.org/rss-thread-watcher" :board-disabled-message "This board is not enabled for feed generation.\n\nYou can contact me here: [contact] and I may enable it for you" :boards-defaults {:refresh-rate 300 :starting-page 7 diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index ee4f168..a2b6144 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -97,13 +97,14 @@ (defn generate-feed "Generates feed from matching items" - [query-vec chod-treshold repeat? cache board-config] + [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) head {:title (str "RSS Thread watcher v" conf/VERSION) - ;; TODO: hardcoded homepage - :link (str "https://tools.treebrary.org/thread-watcher/" served-filename) - :feed-url (str "https://tools.treebrary.org/thread-watcher/" served-filename) + ;; :link is the homepage of the channel + :link (get @conf/GLOBAL-CONFIG :homepage) + ;; :feed-url is where you can get new items, must much the url this is served at + :feed-url self-link :description "RSS based thread watcher"} body (map #(thread-to-rss-item %1 @@ -125,8 +126,13 @@ board (get @conf/GLOBAL-CONFIG :default-board) repeat? false} :as prms} :params - uri :uri} rqst + uri :uri + query :query-string + scheme :scheme + server-name :server-name} rqst 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)) @@ -175,7 +181,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)}) + :body (generate-feed queries 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)]