summaryrefslogtreecommitdiff
path: root/src/site.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/site.clj')
-rw-r--r--src/site.clj16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/site.clj b/src/site.clj
index 30aa90e..560565a 100644
--- a/src/site.clj
+++ b/src/site.clj
@@ -1096,10 +1096,7 @@ WHERE u.user_id = ANY(?)"
;; Upload
-(def max-upload-dimensions [2000 2000])
(def max-avatar-dimensions [800 800])
-(def max-vip-file-size (mbytes 5)) ; don't be nuts guys
-(def max-file-size (mbytes 1))
(def max-avatar-size (kbytes 500))
(defn is-file-too-big? [f limit]
@@ -1125,12 +1122,10 @@ WHERE u.user_id = ANY(?)"
(defn image-url-from-file [dir date file]
(str-join "/" [*server-url* dir date (.getName file)]))
-(defn validate-upload-file [f vip]
- (let [file-limit (if vip
- max-vip-file-size
- max-file-size)]
- (or (is-file-too-big? f file-limit)
- (invalid-image-dimensions? f max-upload-dimensions))))
+(defn validate-upload-file [f room]
+ (or (is-file-too-big? f (:max_file_size room))
+ (invalid-image-dimensions? f [(:max_image_width room)
+ (:max_image_height room)])))
(defn validate-avatar-file [f]
(or (is-file-too-big? f max-avatar-size)
@@ -1145,7 +1140,7 @@ WHERE u.user_id = ANY(?)"
; responses. Therefore, return strings should not be JSON-encoded.
(defn do-upload [session image room]
- (if-let [err (validate-upload-file (image :tempfile) (is-vip? session))]
+ (if-let [err (validate-upload-file (image :tempfile) room)]
(resp-error err)
(let [filename (format-filename (:filename image) (session :nick))
date (today)
@@ -1290,6 +1285,7 @@ WHERE u.user_id = ANY(?)"
(GET "/debug" (debug-page session flash))
(POST "/debug" (debug-commmand! session params))
(GET "/mutes" (show-mutes session))
+ (GET "/roomlist" (show-rooms session))
(POST "/mute" (mute! session params))
(POST "/cancel-mute" (handle-cancel-mute! session params))
(GET "/profile-test/:t" (profile session "ryder" (params :t)))