diff options
Diffstat (limited to 'src/site.clj')
| -rw-r--r-- | src/site.clj | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/site.clj b/src/site.clj index 934e02d..6430cc2 100644 --- a/src/site.clj +++ b/src/site.clj @@ -569,6 +569,15 @@ FROM users u (boolean (and (re-find single-url-regex content) (re-find pic-regex (strip-params content))))) +;; admins can post arbitrary html if wrapped in <safe> +;; this is temporary so that i can test generating html messages +(defn validated-content [content session] + (if (.startsWith content "<safe>") + (if (is-vip? session) + (str content) + (str "<unsafe>" content "</unsafe>")) + (str content))) + (defn msg-db [user-id room-id content] (let [is-image (is-image? content) qry (str "INSERT INTO messages (user_id, room_id, content, is_image) " @@ -588,7 +597,8 @@ FROM users u (not nick) (resp-error "NOT_LOGGED_IN") mute (resp-error (format-mute mute)) :else - (let [msg-id (msg-db user-id (room :room_id) content)] + (let [content (validated-content content session) + msg-id (msg-db user-id (room :room_id) content)] (dosync (if (not (contains? (ensure (room :users)) nick)) (login-user (user-struct-from-session session) room)) |
