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