]> Pileus Git - vpaste/commitdiff
updates for vpaste.net
authorAndy Spencer <andy753421@gmail.com>
Sat, 10 Oct 2009 02:09:51 +0000 (02:09 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sat, 10 Oct 2009 02:09:51 +0000 (02:09 +0000)
index.cgi
vpaste

index c5482204103c0ff2f5087b399a2baf9bfe6139b6..1ede6211d384510a7d215a514c5961d828d6b5fc 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -87,7 +87,7 @@ function do_print {
 # Upload handler
 function do_upload {
        output="$(mktemp db/XXXXX)"
-       uri="$SCRIPT_URI$(basename "$output")${QUERY_STRING:+"?"}"
+       uri="$url$(basename "$output")${QUERY_STRING:+"?"}"
        (get_modeline; cut_file "$1") > "$output"
        echo "Status: 302 Found"
        echo "Location: $uri"
@@ -101,7 +101,7 @@ filetypes=$(
        ls /usr/share/vim/vim{72,files}/syntax/ /home/andy/.vim/after/syntax/ |
        sed -n 's/.vim$//p' | sort | uniq
 )
-uploads=$(ls -t db | head -n 5 | sed "s!^!$SCRIPT_URI!")
+uploads=$(ls -t db | head -n 5 | sed "s!^!$url!")
 
 header text/html
 cat - <<EOF
@@ -139,7 +139,7 @@ cat - <<EOF
                <pre> vpaste file [option=value,..]</pre>
                <pre> &lt;command&gt; | vpaste [option=value,..]</pre>
                <br>
-               <pre> &lt;command&gt; | curl -F 'x=<-' $SCRIPT_URI[?option=value,..]</pre>
+               <pre> &lt;command&gt; | curl -F 'x=<-' $url[?option=value,..]</pre>
                <br>
                <pre>:map vp :exec "w !vpaste ft=".&ft&lt;CR&gt;</pre>
                <pre>:vmap vp &lt;ESC&gt;:exec "'&lt;,'&gt;w !vpaste ft=".&ft&lt;CR&gt;</pre>
@@ -181,7 +181,9 @@ EOF
 }
 
 # Main
-pathinfo="${SCRIPT_URL/*\/}"
+url="http://$HTTP_HOST/$SCRIPT_URI"
+pathinfo="${REQUEST_URI/*\/}"
+pathinfo="${pathinfo/\?*}"
 
 if [ "$pathinfo" ]; then
        do_print "$pathinfo"
diff --git a/vpaste b/vpaste
index a24d02c49794bf4c65ffde6cba323cf602e9d3e5..30633e09899a0913f37ec7dee5c9f2880e6c2039 100755 (executable)
--- a/vpaste
+++ b/vpaste
@@ -1,5 +1,5 @@
 #!/bin/bash
-uri="http://andy753421.ath.cx/vpaste/"
+uri="http://vpaste.net/"
 if [ -f "$1" ]; then
        out=$(curl -s -F "x=<$1" "$uri?$2")
 else