Added redirect on no params request
This commit is contained in:
parent
6df7eedc78
commit
5d98da52e5
4 changed files with 11 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ pom.xml.asc
|
||||||
/.nrepl-port
|
/.nrepl-port
|
||||||
.hgignore
|
.hgignore
|
||||||
.hg/
|
.hg/
|
||||||
|
/src/rss_thread_watch/ffs.clj
|
||||||
|
|
|
@ -14,6 +14,8 @@ Get notifications from your feed reader when your favourite /mlp/ thread is abou
|
||||||
|
|
||||||
** Getting custom URL
|
** Getting custom URL
|
||||||
|
|
||||||
|
URL without any params (just ~/feed.xml~) won't work. You must specify at least one ~q~. See bellow.
|
||||||
|
|
||||||
*** Crafting URL by hand
|
*** Crafting URL by hand
|
||||||
|
|
||||||
Right now there is no automated way to generate your feed url but making one by hand is fairly simple.
|
Right now there is no automated way to generate your feed url but making one by hand is fairly simple.
|
||||||
|
@ -59,10 +61,10 @@ This is an experimental project. There are several limitations:
|
||||||
|
|
||||||
** Feature set
|
** Feature set
|
||||||
|
|
||||||
- Planned/finnished features [15%]
|
- Planned/finnished features [23%]
|
||||||
- [X] [DONE] Super basic features done (feed, query, repeat)
|
- [X] [DONE] Super basic features done (feed, query, repeat)
|
||||||
- [X] Have proper sorting - The most likely to die threads first
|
- [X] Have proper sorting - The most likely to die threads first
|
||||||
- [ ] No params request should redirect to url generator or (for now) documentation
|
- [X] No params request should redirect to url generator or (for now) documentation
|
||||||
- [ ] Config file instead of hardcoding config values
|
- [ ] Config file instead of hardcoding config values
|
||||||
- [ ] Include time of latest data fetch
|
- [ ] Include time of latest data fetch
|
||||||
- [ ] Make threads have preview images taken from the actuall thread OP
|
- [ ] Make threads have preview images taken from the actuall thread OP
|
||||||
|
|
|
@ -62,4 +62,3 @@
|
||||||
;; (repl-main)
|
;; (repl-main)
|
||||||
;; Single cache update for repl
|
;; Single cache update for repl
|
||||||
;; (watcher/update-thread-cache! (:target CONFIG) (:starting-page CONFIG))
|
;; (watcher/update-thread-cache! (:target CONFIG) (:starting-page CONFIG))
|
||||||
;; (watcher/update-thread-cache! "/home/michal/Zdrojaky/Clojure/rss-thread-watch/resources/catalog-pts9.json" (:starting-page CONFIG))
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
(ns rss-thread-watch.feed-generator
|
(ns rss-thread-watch.feed-generator
|
||||||
"Generates feeds for requests"
|
"Generates feeds for requests"
|
||||||
(:require [ring.middleware.params :as rp]
|
(:require [ring.middleware.params :as rp]
|
||||||
|
[ring.util.response :as response]
|
||||||
[clj-rss.core :as rss]
|
[clj-rss.core :as rss]
|
||||||
[clojure.string :as s]
|
[clojure.string :as s]
|
||||||
[rss-thread-watch.watcher :as watcher])
|
[rss-thread-watch.watcher :as watcher])
|
||||||
|
@ -119,6 +120,11 @@
|
||||||
(throw (ex-info "404" {:status 404
|
(throw (ex-info "404" {:status 404
|
||||||
:header {"Content-Type" "text/plain"}
|
:header {"Content-Type" "text/plain"}
|
||||||
:body "404 This server has nothing but /feed.xml"})))
|
:body "404 This server has nothing but /feed.xml"})))
|
||||||
|
;; No url params -> we redirect to documentation about params
|
||||||
|
(when (empty? prms)
|
||||||
|
(throw (ex-info "302"
|
||||||
|
(response/redirect "https://git.treebrary.org/Treebrary.org/rss-thread-watcher#headline-4"))))
|
||||||
|
|
||||||
;; No querry specified - don't know what to search for
|
;; No querry specified - don't know what to search for
|
||||||
(when-not (prms "q")
|
(when-not (prms "q")
|
||||||
(throw (ex-info "400" {:status 400
|
(throw (ex-info "400" {:status 400
|
||||||
|
|
Loading…
Reference in a new issue