add api endpoint to restart nostr
This commit is contained in:
parent
bea3e72c10
commit
7f6911b73e
3 changed files with 17 additions and 6 deletions
|
|
@ -4,10 +4,11 @@
|
||||||
[micro-blog.config :refer [config]]
|
[micro-blog.config :refer [config]]
|
||||||
micro-blog.mastodon
|
micro-blog.mastodon
|
||||||
micro-blog.blue-sky
|
micro-blog.blue-sky
|
||||||
|
micro-blog.nostr
|
||||||
[taoensso.telemere :as tel]))
|
[taoensso.telemere :as tel]))
|
||||||
|
|
||||||
(defn mastodon-proc-handler [_request]
|
(defn mastodon-proc-handler [_request]
|
||||||
(let [msg "Proceding Mastodon Scrape"]
|
(let [msg "Procding Mastodon Scrape"]
|
||||||
(tel/log! :info msg)
|
(tel/log! :info msg)
|
||||||
(micro-blog.mastodon/run)
|
(micro-blog.mastodon/run)
|
||||||
{:status 200
|
{:status 200
|
||||||
|
|
@ -20,9 +21,18 @@
|
||||||
{:status 200
|
{:status 200
|
||||||
:body msg}))
|
:body msg}))
|
||||||
|
|
||||||
|
(defn nostr-proc-handler [_request]
|
||||||
|
(let [msg "Restarting Nostr scraper"]
|
||||||
|
(tel/log! :info msg)
|
||||||
|
(micro-blog.nostr/close)
|
||||||
|
(micro-blog.nostr/start)
|
||||||
|
{:status 200
|
||||||
|
:body msg}))
|
||||||
|
|
||||||
(def routes
|
(def routes
|
||||||
#{["/bluesky" :get blue-sky-proc-handler :route-name :blue-sky]
|
#{["/bluesky" :get blue-sky-proc-handler :route-name :blue-sky]
|
||||||
["/mastodon" :get mastodon-proc-handler :route-name :mastodon]})
|
["/mastodon" :get mastodon-proc-handler :route-name :mastodon]
|
||||||
|
["/nostr" :get nostr-proc-handler :route-name :nostr]})
|
||||||
|
|
||||||
(defn create-connector []
|
(defn create-connector []
|
||||||
(-> (conn/default-connector-map (:api-host @config) (Integer/parseInt (str (:api-port @config))))
|
(-> (conn/default-connector-map (:api-host @config) (Integer/parseInt (str (:api-port @config))))
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@
|
||||||
(.get (ws/send! @socket msg))))
|
(.get (ws/send! @socket msg))))
|
||||||
|
|
||||||
(defn close []
|
(defn close []
|
||||||
|
(tel/log! :info "Closing nostr socket")
|
||||||
(ws/close! @socket))
|
(ws/close! @socket))
|
||||||
|
|
||||||
(defn start []
|
(defn start []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue