summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/origin_check.clj8
-rwxr-xr-xsrc/site.clj10
-rw-r--r--template/directory.st101
-rwxr-xr-xtemplate/logged_dump.st11
-rwxr-xr-xtemplate/profile.st216
5 files changed, 159 insertions, 187 deletions
diff --git a/src/origin_check.clj b/src/origin_check.clj
deleted file mode 100644
index a24e43b..0000000
--- a/src/origin_check.clj
+++ /dev/null
@@ -1,8 +0,0 @@
-(ns origin-check)
-
-(defn with-origin-check
- "Middleware to validate that state-changing URL access
- originated from a page in the local domain."
- [handler]
- (fn [request]
- (handler request))) \ No newline at end of file
diff --git a/src/site.clj b/src/site.clj
index 2ed5892..f76531d 100755
--- a/src/site.clj
+++ b/src/site.clj
@@ -15,7 +15,6 @@
clojure.contrib.sql
clojure.contrib.str-utils
compojure
- origin-check
utils
cookie-login
session-sweeper
@@ -411,7 +410,7 @@
WHERE user_id = u.user_id
AND room_id = 1
AND is_image = true
- ORDER BY created_on LIMIT 1)")]
+ ORDER BY created_on DESC LIMIT 1)")]
(when (> (count user-ids) 0)
(let [res (do-select [qry])
keys (map :user_id res)
@@ -830,13 +829,11 @@
(with-mimetypes {:mimetypes mimetypes}))
(decorate pichat
- (with-origin-check)
(with-mimetypes {:mimetypes mimetypes})
(with-cookie-login (comp not logged-in?) make-login-token read-login-token)
(with-session {:type :memory, :expires (* 60 60)}))
(decorate multipart
- (with-origin-check)
(with-mimetypes {:mimetypes mimetypes})
(with-session {:type :memory, :expires (* 60 60)})
(with-multipart))
@@ -860,9 +857,10 @@
"Parses command-line arguments. First arg is script name,
second arg is port number (defaults to 8080)."
([script] {:port 8080})
- ([script port] {:port (maybe-parse-int port)}))
+ ([script port] {:port (Integer/parseInt port)}))
-(def options (apply parse-command-args *command-line-args*))
+(def options
+ (apply parse-command-args *command-line-args*))
(start-server (options :port))
(start-user-flusher!)
diff --git a/template/directory.st b/template/directory.st
index 37b1a2e..954c717 100644
--- a/template/directory.st
+++ b/template/directory.st
@@ -1,72 +1,65 @@
<html>
<head>
-
+
<title>dump.fm</title>
$head()$
- <link rel="stylesheet" type="text/css" href="/static/directory.css">
+ <link rel="stylesheet" type="text/css" href="/static/directory.css">
<script>
jQuery(document).ready(initDirectory);
</script>
-
+
</head>
<body>
$banner()$
- <div id="chatrap">
-
-
-
+ <div id="chatrap">
<div id="log">
<div id="loghead"></div>
<br>
-
- <div id="posts">
-
- <br>
- <center>
- <h2> &#x272D; &#x272D; DUMP STARS &#x272D; &#x272D;</h2>
- <div id="lolbanner">
- <img src="/static/welcomebanner.gif">
+
+ <div id="posts">
+ <br>
+ <center>
+ <h2>&#x272D; &#x272D; DUMP STARS &#x272D; &#x272D;</h2>
+ <div id="lolbanner">
+ <img src="/static/welcomebanner.gif">
</div>
-
- </center>
-
- $if(users)$
- $users:{ u |
- <div class="logged-dump">
- <a href="/u/$u.nick$">
- <b> $u.nick$</b>
- $if(u.avatar)$ <div style="border-image:url($u.avatar$)">
- <div id="logavatar"> <img height="50" width="50" src="$u.avatar$"></img></div>
+ </center>
+ $if(users)$
+ $users:{ u |
+ <div class="logged-dump">
+ <a href="/u/$u.nick$">
+ <b>$u.nick$</b>
+ $if(u.avatar)$
+ <div style="border-image:url($u.avatar$)">
+ <div id="logavatar">
+ <img height="50" width="50" src="$u.avatar$"></img>
+ </div>
+ $endif$
+ </a>
+ <div id="infotxt"><b>last post</b></div>
+ <span class="linkify">$u.content$</span>
+ <hr />
+ </div>
+ <a href="http://www.facebook.com/share.php?u=$u.content$&t=via dump.fm" target="_blank"><img src="/static/fbbutton.png"></a>
+ <a href="http://twitter.com/home?status=via dump.fm $u.content$" target="_blank"><img src="/static/twittericon.png"></a>
+ <a href="http://delicious.com/save?url=$u.content$&notes=via dump.fm&title=$u.content$" target="_blank"><img src="/static/delishicon.png"></a>
+ </div>
+ }$
+ $else$
+ <span>No more users!</span>
+ $endif$
+ <div id="pnav">
+ $if(prev)$
+ <div id="pnavn"><a href="/directory$prev$">BACK</a></div>
$endif$
- </a>
- <div id="infotxt"><b><div style="display:none;">Count: $u.cnt$ !!</div>
- last post </b></div>
- <span class="linkify">$u.content$</span>
- <hr /></div>
-
-
- <a href="http://www.facebook.com/share.php?u=$u.content$&t=via dump.fm" target="_blank"><img src="/static/fbbutton.png"></a>
-<a href="http://twitter.com/home?status=via dump.fm $u.content$" target="_blank"><img src="/static/twittericon.png"></a>
-<a href="http://delicious.com/save?url=$u.content$&notes=via dump.fm&title=$u.content$" target="_blank"><img src="/static/delishicon.png"></a>
-</div>
- }$
- $else$
- <span>No more users!</span>
- $endif$
- <div id="pnav">
-
- $if(prev)$
- <div id="pnavn"><a href="/directory$prev$">BACK</a></div>
- $endif$
- $if(users)$
- <div id="pnavo"> <a href="/directory$next$">MOAR!</a></div>
- $endif$
-
- </div>
- <div id="footer">
- $footer()$
- </div>
- </div>
+ $if(users)$
+ <div id="pnavo"> <a href="/directory$next$">MOAR!</a></div>
+ $endif$
+ </div>
+ <div id="footer">
+ $footer()$
+ </div>
+ </div>
</body>
</html>
diff --git a/template/logged_dump.st b/template/logged_dump.st
index f272e5f..d4df794 100755
--- a/template/logged_dump.st
+++ b/template/logged_dump.st
@@ -32,21 +32,16 @@ img{
</style>
<div class="logged-dump">
<div>$dump.created_on$ -- by <b><a href="/u/$dump.nick$">$dump.nick$</a></b></div>
- <a href="/u/$dump.nick$">
-
+ <a href="/u/$dump.nick$">
<div id="logavatar">
-
- $if(dump.avatar)$<img height="50" width="50" src="$dump.avatar$" />
-
+ $if(dump.avatar)$
+ <img height="50" width="50" src="$dump.avatar$">
$else$
-
<img height="50" width="50" src="/static/noinfo.png">
-
$endif$
</div></a>
<div class="content">$dump.content$</div>
<hr />
-
<a href="http://www.facebook.com/share.php?u=$dump.content$&t=via dump.fm" target="_blank"><img src="/static/fbbutton.png"></a>
<a href="http://twitter.com/home?status=via dump.fm $dump.content$" target="_blank"><img src="/static/twittericon.png"></a>
diff --git a/template/profile.st b/template/profile.st
index fad4b18..f6308b5 100755
--- a/template/profile.st
+++ b/template/profile.st
@@ -7,143 +7,137 @@
<script src="/static/jquery.editinplace.1.0.1.packed.js"
type="text/javascript"></script>
<script src="/static/js/ajaxupload.js"></script>
-
<script type="text/javascript" src="/static/jquery.editinplace.1.0.1.packed.js"></script>
-
<script>
jQuery(document).ready(initProfile);
</script>
-
+
</head>
<body>
$banner()$
<div id="chatrap">
- <div id="headerbar"></div>
+ <div id="headerbar"></div>
<div id="log">
<div id="loghead">
</div>
<br>
- <div id="posts">
-
+ <div id="posts">
<div id="cats">
- $if(dumps)$
-
- <div id="lolbanner">
- <img src="/static/welcomebanner.gif">
+ $if(dumps)$
+ <div id="lolbanner">
+ <img src="/static/welcomebanner.gif">
</div>
$dumps:{ d | $logged_dump(dump=d)$ }$
- <div id="profile">
+ <div id="profile">
+ <h2>$nick$</h2>
+ $if(avatar)$
+ <img id="avatarPic" src="$avatar$" width="150px"/>
+ $else$
+ <b id="avatarPic"><img src="/static/noinfo.png"></b>
+ $endif$
+
+ $if(is_home)$
+ <div id="avatar-editing" style="display: none">
+ <div id="avatar" class="editable">$avatar$</div>
+ <input id="upload" value="Upload Icon" type="submit">
+ <img id="spinner" src="/static/spinner.gif" style="display: none" />
+ </div>
+ $endif$
+
+ <h3>contact info</h3>
+ $if(contact)$
+ <div id="contact" class="linkify">$contact$</div>
+ $else$
+ <div><img id="contact" src="/static/noinfo.png"></div>
+ $endif$
+ <br>
+
+ <h3>bio</h3>
+ $if(bio)$
+ <div id="bio" class="linkify">$bio$</div>
+ $else$
+ <div><img id="bio" src="/static/noinfo.png"></div>
+ $endif$
+
+ $if(is_home)$
+ <br>
+ <div id="edit-toggle"><a href="#">edit profile</a></div>
+ $endif$
+
+ <br>
+ </div>
- <h2>$nick$</h2>
- $if(avatar)$
- <img id="avatarPic" src="$avatar$" width="150px"/>
- $else$
- <b id="avatarPic"><img src="/static/noinfo.png"></b>
- $endif$
-
- $if(is_home)$
- <div id="avatar-editing" style="display: none">
- <div id="avatar" class="editable">$avatar$</div>
- <input id="upload" value="Upload Icon" type="submit">
- <img id="spinner" src="/static/spinner.gif" style="display: none" />
- </div>
- $endif$
-
- <h3>contact info</h3>
- $if(contact)$
- <div id="contact" class="linkify">$contact$</div>
- $else$
- <div><img id="contact" src="/static/noinfo.png"></div>
- $endif$
- <br>
-
- <h3>bio</h3>
- $if(bio)$
- <div id="bio" class="linkify">$bio$</div>
$else$
- <div><img id="bio" src="/static/noinfo.png"></div>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <div id="newuser">
+ <h2>Welcome to dump.fm</h2>
+ <br><br>
+
+ <h1>Step &#x2776;</h1>
+ <h3>&#x261F; Find a sweet image for your avatar, paste the URL below &#x261F;</h3>
+ $if(avatar)$
+ <img id="avatarPic" src="$avatar$" width="150px"/>
+ $else$
+ <b id="avatarPic"></b>
+ $endif$
+
+ $if(is_home)$
+ <div id="avatar-editing">
+ <div id="avatar" class="editable">$avatar$</div>
+ <input id="upload" value="Upload Icon" type="submit">
+ <img id="spinner" src="/static/spinner.gif" style="display: none" />
+ </div>
+ $endif$
+
+ <h1>Step &#x2777;</h1>
+ <h3>&#x261F; Enter some contact info below &#x261F;</h3>
+ <div id="contact" class="$if(is_home)$editable$else$linkify$endif$">$contact$</div>
+ <br>
+
+ <h1>Step &#x2778;</h1>
+ <h3>&#x261F; Enter some personal info below &#x261F;</h3>
+ <div id="bio" class="$if(is_home)$editable$else$linkify$endif$">$bio$</div>
+ <br>
+ <h1>Step &#x2779;</h1>
+
+ <h3> <a href="/chat">Join the &#x2663; and start posting pictures!</a></h3>
+ <h3>&nbsp;</h3>
+ </div>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
+ <h3>&nbsp;</h3>
$endif$
+
+ <p>&nbsp;</p>
+ <div id="pnav">
- $if(is_home)$
- <br>
- <div id="edit-toggle"><a href="#">edit profile</a></div>
- $endif$
-
- <br>
- <div id="date">
- <div type="text" id="datepicker"></div></div>
- </div>
+ $if(next)$
+ <div id="pnavn"><a href="/u/$nick$/$next$">next &#9758;</a></div>
+ $endif$
- $else$
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <div id="newuser">
- <h2>Welcome to dump.fm</h2>
- <br><br>
-
- <h1>Step &#x2776;</h1>
- <h3>&#x261F; Find a sweet image for your avatar, paste the URL below &#x261F;</h3>
- $if(avatar)$
- <img id="avatarPic" src="$avatar$" width="150px"/>
- $else$
- <b id="avatarPic"></b>
- $endif$
-
- $if(is_home)$
- <div id="avatar-editing">
- <div id="avatar" class="editable">$avatar$</div>
- <input id="upload" value="Upload Icon" type="submit">
- <img id="spinner" src="/static/spinner.gif" style="display: none" />
+ &nbsp;
+ $if(prev)$
+ <div id="pnavo"> <a href="/u/$nick$/$prev$">&#9756; prev</a></div>
+ $endif$
+
+ <br><br>
</div>
- $endif$
-
- <h1>Step &#x2777;</h1>
- <h3>&#x261F; Enter some contact info below &#x261F;</h3>
- <div id="contact" class="$if(is_home)$editable$else$linkify$endif$">$contact$</div>
- <br>
-
- <h1>Step &#x2778;</h1>
- <h3>&#x261F; Enter some personal info below &#x261F;</h3>
- <div id="bio" class="$if(is_home)$editable$else$linkify$endif$">$bio$</div>
- <br>
- <h1>Step &#x2779;</h1>
-
- <h3> <a href="/chat">Join the &#x2663; and start posting pictures!</a></h3>
- <h3>&nbsp;</h3></div>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- <h3>&nbsp;</h3>
- $endif$
-
- <p>&nbsp;</p>
- <div id="pnav">
-
- $if(next)$
- <div id="pnavn"><a href="/u/$nick$/$next$">next &#9758;</a></div>
- $endif$
- &nbsp;
- $if(prev)$
- <div id="pnavo"> <a href="/u/$nick$/$prev$">&#9756; prev</a></div>
- $endif$
-
- <br><br>
+ <div id="footer">
+ $footer()$
+ </div>
</div>
-
- <div id="footer">
- $footer()$
- </div>
- </div>
</div></div></div>
-$preload()$
+ $preload()$
</body>
</html>