diff options
Diffstat (limited to 'src/site.clj')
| -rwxr-xr-x | src/site.clj | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/src/site.clj b/src/site.clj index 4ba5981..b1774fd 100755 --- a/src/site.clj +++ b/src/site.clj @@ -9,20 +9,10 @@ org.antlr.stringtemplate.StringTemplateGroup) (:use clojure.contrib.str-utils clojure.contrib.duck-streams - clojure.contrib.json.write clojure.contrib.sql compojure cookie-login - )) - -(let [db-host "localhost" - db-port 5432 - db-name "dumpfm"] - (def db {:classname "org.postgresql.Driver" - :subprotocol "postgresql" - :subname (str "//" db-host ":" db-port "/" db-name) - :user "postgres" - :password "root"})) + utils)) (def template-group (new StringTemplateGroup "dumpfm" "template")) (.setRefreshInterval template-group 3) @@ -74,12 +64,6 @@ (def formatter (new SimpleDateFormat "h:mm EEE M/d")) -(defn resp-error [message] - {:status 400 :headers {} :body message}) - -(defn resp-success [message] - {:status 200 :headers {} :body (json-str message)}) - (defn non-empty-string? [s] (and s (> (count s) 0))) @@ -98,19 +82,6 @@ (.setTimeZone df (TimeZone/getTimeZone "GMT")) (.format df dt)))) -;; Database - -(defn do-select [query] - (with-connection db - (with-query-results rs query - (doall rs)))) - -(defn do-count [query] - ((first (with-connection db - (with-query-results rs query - (doall rs)))) - :count)) - ;; User authentication (def nick-regex #"^[A-Za-z0-9\-_∆˚†]*$") @@ -586,6 +557,7 @@ (-> request :route-params :room) (-> request :route-params :offset) params)) + (GET "/stats" (validated-stats session params)) ;; TODO: validate POST Referrer headers for POSTs (POST "/msg" (validated-msg session params)) (POST "/submit-registration" (register session params)) |
