function format {
# Create a temp file with the provided modeline
tmp="$(mktemp)"
- sed "\$avim: $(get_modeline)" "$1" > "$tmp"
+ sed -e "1ivim: $(get_modeline)" \
+ -e "\$avim: $(get_modeline)" "$1" > "$tmp"
# Determine cache name
md5="$(cat index.cgi vimrc "$tmp" /usr/bin/ex | md5sum -b)"
'+sil! set iconstring= ruf= stl= tal=' \
"+sil! set titlestring=$1\ -\ vpaste.net" \
'+sil! set noml' \
- '+sil! $d|'$2 \
+ '+sil! 1d|$d|'$2 \
'+sil! %s/\r//g' \
'+sil! TOhtml' \
"+sav! $out" \
spam=$(echo -n "$body" | cut_file "ignoreme")
text=$(echo -n "$body" | cut_file "(text|x)")
bans=$(echo -n "$REMOTE_ADDR" | grep -f blacklist)
- [ ! -z "$spam" ] && respond "Spam check.."
- [ ! -z "$bans" ] && respond "You have been banned"
+
+ [ ! -z "$spam" ] && respond -h "Status: 403 Forbidden" "Spam check.."
+ [ ! -z "$bans" ] && respond -h "Status: 403 Forbidden" "You have been banned"
[ -z "$text" ] && respond "No text pasted"
# Format and save message
<meta name="description" content="vpaste: Vim based pastebin" />
<meta name="keywords" content="vpaste,paste,pastebin,vim" />
<meta name="google-site-verification" content="OvHF73zD7osJ1VSq9rJxnMFlja36944ud6CiP_iXQnI" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style type="text/css">
* { margin: 0;
padding: 0; }
- body { margin: 4em 8em 4em 8em;
- font-family: sans-serif; }
+ body { font-family: sans-serif; }
input { padding: 2px 6px 3px 6px; }
+ a { text-decoration: none; }
/* Items */
- textarea { width: 100%;
- margin-bottom: 0.5em; }
- .buttons { float: left; }
- .links { float: right; }
- .links * { text-decoration: none;
- margin-left: 0.5em; }
+ textarea { width: 100%; }
.box { display: none;
- clear: both;
- margin-top: 2.7em;
border-top: solid 1px #888; }
/* box contents */
h1 { margin-top: 1.0em;
ul,dd,dl,p { margin: 0 0 0 2em; }
dt { font-weight: bold;
padding: 0.5em 0 0 0; }
- span { font-family: monospace; }
+ .upload { font-family: monospace; }
.cmds dd { font-family: monospace; }
</style>
+ <style type="text/css" media="screen and (min-device-width:800px)">
+ body { margin: 4em 8em; }
+ textarea { margin-bottom: 0.5em; }
+ .buttons { float: left; }
+ .links { float: right; }
+ .links * { margin-left: 0.5em; }
+ .box { clear: both;
+ margin-top: 2.7em; }
+ </style>
+ <style type="text/css" media="screen and (max-device-width:800px)">
+ textarea, input, select, .links
+ { display: block;
+ width: 100%;
+ margin-bottom: 0.75em; }
+ body { margin: 1em; }
+ textarea { height: 17em; }
+ select { height: 2em; }
+ input { height: 3em; }
+ .links { text-align: center; }
+ .links a { margin: 0em 0.25em; }
+ #vpaste { font-size: large; }
+ .sep { display: block;
+ height: 0.5em;
+ visibility:hidden; }
+ </style>
<script type="text/javascript">
//<![CDATA[
function show(id) {
<input type="submit" value="Paste" />
</div>
<div class="links">
- <a href="">vpaste</a> <span>-</span>
+ <a href="" id="vpaste">vpaste</a> <span class="sep">-</span>
<a href="#usage" onclick="show('usage' )">Usage</a>
<a href="#devel" onclick="show('devel' )">Development</a>
<a href="#uploads" onclick="show('uploads')">Uploads</a>
<h1>Recent Uploads</h1>
<ul>$(for upload in ${uploads[@]}; do
echo -n "<li>"
- echo -n "<span>$upload</span> "
+ echo -n "<span class=\"upload\">$upload</span> "
echo -n "<a href='$upload?raw'>text</a> "
echo -n "<a href='$upload'>rainbow</a>"
echo "</li>"