Merge release Beta 1 into stable #21
2 changed files with 17 additions and 10 deletions
|
@ -3,6 +3,7 @@
|
|||
{:port 6969
|
||||
:default-board "/mlp/" ;Board to be used when no board=x param given
|
||||
:board-disabled-message "This board is not enabled for feed generation.\n\nYou can contact me here: [contact]"
|
||||
:enable-board-listing true ;Whether to show list of enabled boards in /boards
|
||||
;; /$board/catalog.json will be appended to this link
|
||||
:target "https://api.4chan.org"
|
||||
:boards-defaults {:refresh-rate 300
|
||||
|
|
|
@ -13,20 +13,26 @@
|
|||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(ns rss-thread-watch.core
|
||||
(:require [ring.adapter.jetty :as jetty]
|
||||
(:require [clojure.java.io :As io]
|
||||
[ring.adapter.jetty :as jetty]
|
||||
[ring.middleware.params :as rp]
|
||||
[rss-thread-watch.watcher :as watcher]
|
||||
[rss-thread-watch.feed-generator :as feed])
|
||||
(:gen-class))
|
||||
|
||||
;; Internal default config
|
||||
(def CONFIG
|
||||
(def CONFIG-DEFAULT
|
||||
"Internal default config"
|
||||
{:target "https://api.4chan.org/mlp/catalog.json" ;Where to download catalog from
|
||||
:starting-page 7 ;only monitor threads from this from this page and up
|
||||
:refresh-delay (* 60 5) ;Redownload catalog every 5 mins
|
||||
:port 6969 ;Listen on 6969
|
||||
})
|
||||
{:port 6969
|
||||
:default-board "/mlp/"
|
||||
:enable-board-listing true
|
||||
:board-disabled-message "This board is not enabled for feed generation.\n\nYou can contact me here: [contact]"
|
||||
:target "https://api.4chan.org"
|
||||
:boards-defaults {:refresh-rate 300
|
||||
:starting-page 7
|
||||
:default-chod 94}
|
||||
:boards-enabled {"/mlp/" {}
|
||||
"/g/" {}}})
|
||||
|
||||
(defn set-interval
|
||||
"Calls function every ms"
|
||||
|
@ -36,14 +42,14 @@
|
|||
(println "Recached")
|
||||
(catch Exception e
|
||||
(binding [*out* *err*]
|
||||
(println "Error while updating cache: " e ", retrying in 5 minutes"))))
|
||||
(println "Error while updating cache: " e ", retrying in " (/ ms 1000 60) " minutes"))))
|
||||
(Thread/sleep ms)))))
|
||||
|
||||
(defn -main
|
||||
"Entry point, starts webserver"
|
||||
[& args]
|
||||
(println "Starting on port: " (:port CONFIG)
|
||||
"\nGonna recache every: " (:refresh-delay CONFIG) "s")
|
||||
;; Parse and validate config
|
||||
;; Think of a way to start repeated download for every catalog efficiently
|
||||
(set-interval (fn []
|
||||
(println "Starting cache update")
|
||||
(watcher/update-thread-cache! (:target CONFIG) (:starting-page CONFIG)))
|
||||
|
|
Loading…
Reference in a new issue