Skip to content
Permalink
Browse files
added image uploads
url input rather than file proper for now

clear your fltr_cache (`rm -r /tmp/fltr_cache`) for old posts to update with new :hover behaviour
  • Loading branch information
kfarwell committed Apr 6, 2016
1 parent f0f8823 commit 58aa83cd33e3152ec2172c13582cc12fc98eb2be
Showing 4 changed files with 87 additions and 7 deletions.
@@ -27,6 +27,28 @@ fn dirdir_init {
}
}

if(! ~ '' $"post_arg_file) {
if(~ $post_arg_file *.gif ||
~ $post_arg_file *.jpeg ||
~ $post_arg_file *.jpg ||
~ $post_arg_file *.png ||
~ $post_arg_file *.ff ||
~ $post_arg_file *.tif ||
~ $post_arg_file *.tiff ||
~ $post_arg_file *.bmp) {
file=`{basename $post_arg_file | sed 's/[^a-zA-Z0-9_.]//g'}
name=`{echo $file | sed 's/\.(gif|jpeg|jpg|png|ff|tif|tiff|bmp)$//'}
ext=`{echo $file | sed 's/.*\.(gif|jpeg|jpg|png|ff|tif|tiff|bmp)$/\1/'}

curl $post_arg_file > $postd/image.$ext

# make sure it's a real image
if(! convert $postd/image.$ext /tmp/tokumeiup.jpg ||
! convert $postd/image.$ext /tmp/tokumeiup.png)
rm $postd/image.$ext
}
}

if(! ~ '' $"post_arg_password) {
salt=`{cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 64 | head -n 1}
echo -n $post_arg_password$salt | sha256sum | sed 's/ -$//' > etc/passwords/$postn
@@ -9,7 +9,7 @@
<div class="input-field">
<input type="text" name="tags" id="tags">
<label for="tags">Tags (space separated)</label>
<label for="tags">Tags (comma separated)</label>
</div>
<!-- <div class="input-field file-field">
@@ -18,10 +18,15 @@
<input type="file">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="(optional)">
<input class="file-path validate" type="text">
</div>
</div> -->
<div class="input-field">
<input type="text" placeholder="https://example.com/image.png" name="file" id="file">
<label for="file">Attachment</label>
</div>
<div class="input-field">
<input type="password" name="password" id="password">
<label for="password">Deletion password</label>
@@ -43,7 +48,7 @@
<div class="input-field">
<input type="text" name="tags" id="tags">
<label for="tags">Tags (space separated)</label>
<label for="tags">Tags (comma separated)</label>
</div>
<script>
@@ -65,10 +70,16 @@
<input type="file">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="(optional)">
<input class="file-path validate" type="text">
</div>
</div> -->

<br /><br />
<div class="input-field">
<input type="text" placeholder="https://example.com/image.png" name="file" id="file">
<label for="file">Attachment</label>
</div>

<div class="input-field">
<input type="password" name="password" id="password">
<label for="password">Deletion password</label>
@@ -280,10 +280,10 @@ blockquote {
.card > a:hover {
color: initial !important;
}
.card-content {
.card-content.clicky {
cursor: pointer;
}
.card-content:hover {
.card-content.clicky:hover {
background-color: rgba(0, 0, 0, 0.05);
}

@@ -349,3 +349,8 @@ blockquote {
.sitemap-list {
padding-left: 2em;
}

.attachment {
width: 100%;
max-height: 80vh;
}
@@ -4,8 +4,22 @@
% if(~ $req_path /p/[0-9]*) echo '<br />'
% if(! test -f $postd/spam || ~ $req_path /p/[0-9]*) {
<div class="card">
<div class="card-content" onclick="window.location='/p/%($postn%)'">
% if(~ $req_path /p/[0-9]*) {
<div class="card-content">
% }
% if not {
<div class="card-content clicky" onclick="window.location='/p/%($postn%)'">
% }
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{basename `{ls $postd/image.*}}
% if(~ $req_path /p/[0-9]*) {
<br /><a href="%($postn%)_werc/%($file%)"><img src="%($postn%)_werc/%($file%)" class="attachment" /></a>
% }
% if not {
<br /><a href="%($postn%)_werc/%($file%)">%($file%)</a>
% }
% }
</div>
<div class="card-action">

@@ -145,6 +159,10 @@
<h5><a href="%($shareurl%)">%($shareurl%)</a></h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<div class="collection">
<a class="collection-item" href="http://twitter.com/home/?status=%($shareurl%)">
@@ -189,6 +207,10 @@
<h5><a href="%($shareurl%)">%($shareurl%)</a></h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<div class="collection">
<a class="collection-item" href="http://twitter.com/home/?status=%($shareurl%)">
@@ -253,6 +275,10 @@
<h5><a href="%($shareurl%)">%($shareurl%)</a></h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<div class="collection">
<form action="" method="post">
@@ -280,6 +306,10 @@
<h5><a href="%($shareurl%)">%($shareurl%)</a></h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<div class="collection">
<form action="" method="post">
@@ -309,6 +339,10 @@
<h5>If you wrote this post and set a password when you did, enter it below. If not, you're out of luck.</h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<form action="" method="post">
<input type="hidden" name="postn" value="%($postn%)">
@@ -328,6 +362,10 @@
<h5>If you wrote this post and set a password when you did, enter it below. If not, you're out of luck.</h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<br /><div class="input-field">
<input type="password" name="delete" id="delete%($postn%)">
@@ -349,6 +387,10 @@
<h5>If you wrote this post and set a password when you did, enter it below. If not, you're out of luck.</h5>
<p class="break-word">
% sed $postfilter < $postf
% if(test -f $postd/image.*) {
% file=`{ls $postd/image.*}
<br /><a href="%($postd%)/%($file%)">%($file%)</a>
% }
</p>
<br /><div class="input-field">
<input type="password" name="delete" id="delete%($postn%)">

0 comments on commit 58aa83c

Please sign in to comment.