diff options
| author | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2012-07-17 21:40:57 -0400 |
|---|---|---|
| committer | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2012-07-17 21:40:57 -0400 |
| commit | da15cfb1e452a0af4902272ba351d5a6d0d0b56a (patch) | |
| tree | 8525e56790625ab7b67e4c534fdf1739d0f592b6 /src | |
| parent | 38091d8e194aa48f6bd64e2cf8ccba6fd27c36a2 (diff) | |
update src, scripts, etc from 2012
Diffstat (limited to 'src')
| -rw-r--r-- | src/admin.clj | 19 | ||||
| -rw-r--r-- | src/config.clj | 2 | ||||
| -rw-r--r-- | src/email.clj | 3 | ||||
| -rw-r--r-- | src/redisload.clj | 4 | ||||
| -rw-r--r-- | src/site.clj | 8 | ||||
| -rwxr-xr-x | src/utils.clj | 2 |
6 files changed, 32 insertions, 6 deletions
diff --git a/src/admin.clj b/src/admin.clj index 0daf66a..53efedf 100644 --- a/src/admin.clj +++ b/src/admin.clj @@ -31,6 +31,10 @@ (def mute-refresh-period-sec 60) +(def fetch-new-users-query " +SELECT * FROM users ORDER BY created_on DESC LIMIT 200 +") + (def fetch-active-mutes-query " SELECT m.*, (m.set_on + m.duration) AS expiry, @@ -68,6 +72,8 @@ AND a.user_id = m.admin_id LIMIT 1 ") +(defn fetch-new-users [] + (do-select [fetch-new-users-query])) (defn fetch-active-mutes [] (do-select [fetch-active-mutes-query])) @@ -158,6 +164,9 @@ AND cancelled = false :expiry format-date-first-timestamp :cancelled #(if % "Cancelled" "Expired")}) +(def user-formatter {:created_on format-date-first-timestamp + }) + (defn show-mutes [session] (if-vip (let [st (fetch-template "mutes" session) @@ -169,6 +178,16 @@ AND cancelled = false (.setAttribute st "inactive" (f inactive)) (.toString st)))) +;; Recent users list + +(defn show-users [session] + (if-vip + (let [st (fetch-template "users" session) + users (fetch-new-users) + formatter (partial apply-formats user-formatter) + f #(map (comp stringify-and-escape formatter) %)] + (.setAttribute st "users" (f users)) + (.toString st)))) ;; Debug Page diff --git a/src/config.clj b/src/config.clj index 1cf5ae6..b6abfb5 100644 --- a/src/config.clj +++ b/src/config.clj @@ -17,7 +17,7 @@ (def db-server (if (= *server-user* "dumpfmprod") - "192.168.162.138" + "localhost"; "192.168.162.138" "localhost")) (def redis-server diff --git a/src/email.clj b/src/email.clj index 3231b60..8a29418 100644 --- a/src/email.clj +++ b/src/email.clj @@ -67,7 +67,8 @@ :mime (classify-mimetype text))) (def *admin-lists* {"dumpfmprod" ["info@dump.fm"] - "sostler" ["sbostler@gmail.com"]}) + "sostler" ["sbostler@gmail.com"] + "jules" ["julescarbon@gmail.com"]}) (defn get-admins [] (or (*admin-lists* (System/getProperty "user.name")) diff --git a/src/redisload.clj b/src/redisload.clj index c08cb32..abb0252 100644 --- a/src/redisload.clj +++ b/src/redisload.clj @@ -166,5 +166,7 @@ WHERE (doseq [dt (get-fav-date-range)] (build-daily-hall dt))) -;(build-daily-hall (parse-yyyy-mm-dd-date "2010-05-30")) +(build-daily-hall (parse-yyyy-mm-dd-date "2011-02-22")) +(build-daily-hall (parse-yyyy-mm-dd-date "2011-02-23")) + ;(build-all-daily-hall) diff --git a/src/site.clj b/src/site.clj index f386f2a..44b0c07 100644 --- a/src/site.clj +++ b/src/site.clj @@ -225,6 +225,7 @@ (if-let [[prev-date cur-date next-date] (parse-front-page-date dt-str)] (cond (.before cur-date earliest-daily-hall) (redirect-to "/") (.after cur-date today) (redirect-to "/") + ;(not (:nick session)) (serve-meme session "fullscreen") :else (let [st (fetch-template "frontpage" session) dumps (map process-message-for-output (if (:nick session) @@ -237,6 +238,7 @@ (if-not (.before prev-date earliest-daily-hall) (.setAttribute st "prev_date" (format-yyyymmdd prev-date))) (.setAttribute st "current_date" (format-yyyymmdd cur-date)) + (.setAttribute st "timestamp" (System/currentTimeMillis)) (.toString st))) (redirect-to "/"))))) @@ -952,8 +954,9 @@ WHERE user_id IN (str "select url from image_urls where url ilike " (str-join " and url ilike " (take num-tokens (repeat "?"))) " - order by last_posted desc + order by random() limit 200;")) +;; order by last_posted desc ;; note: _ is a wildcard in a postgres 'like' query... (defn search-replace-weird-chars [token] @@ -1268,7 +1271,7 @@ WHERE user_id IN ;; TODO: add form tokens for all destructive actions (POST "/msg" (validated-msg session params request)) - (POST "/submit-registration" (register session params request)) + (POST "/dubmit-registration" (register session params request)) (POST "/update-profile" (update-profile session params)) (GET "/directory" (directory session 0)) (GET "/directory/:offset" @@ -1282,6 +1285,7 @@ WHERE user_id IN (GET "/debug" (debug-page session flash)) (POST "/debug" (debug-commmand! session params)) (GET "/mutes" (show-mutes session)) + (GET "/users" (show-users session)) (GET "/roomlist" (show-rooms session)) (POST "/mute" (mute! session params)) (POST "/cancel-mute" (handle-cancel-mute! session params)) diff --git a/src/utils.clj b/src/utils.clj index 1bccb09..aa73ba9 100755 --- a/src/utils.clj +++ b/src/utils.clj @@ -421,7 +421,7 @@ (defn is-vip? [session] (session :is_admin)) -(def super-vips #{"timb" "scottbot" "ryder"}) +(def super-vips #{"timb" "scottbot" "ryder" "ryz"}) (defn is-super-vip? [session] (contains? super-vips (:nick session))) |
