Add html output type
This commit is contained in:
parent
5092706792
commit
cdf50c04e7
|
@ -29,7 +29,7 @@
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h1>Pantsu Paste</h1>
|
<h1>Pantsu Paste</h1>
|
||||||
</div>
|
</div>
|
||||||
<form action="/save" method="post" class="form-horizontal">
|
<form action="/save/html" method="post" class="form-horizontal">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<div class="form-group is-empty">
|
<div class="form-group is-empty">
|
||||||
|
@ -451,7 +451,7 @@
|
||||||
</form>
|
</form>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<code>$ <command> | curl -F 'p=<-' https://p.pantsu.cat/save</code><br/>
|
<code>$ <command> | curl -F 'p=<-' https://p.pantsu.cat/save</code><br/>
|
||||||
<code>https://p.pantsu.cat/save/(XML|JSON)</code><br/>
|
<code>https://p.pantsu.cat/save/(XML|JSON|HTML)</code><br/>
|
||||||
<code>https://p.pantsu.cat/p/(PASTE)/(lang)</code><br/>
|
<code>https://p.pantsu.cat/p/(PASTE)/(lang)</code><br/>
|
||||||
<code>https://p.pantsu.cat/del/(PASTE)/(DELKEY)</code<br/>
|
<code>https://p.pantsu.cat/del/(PASTE)/(DELKEY)</code<br/>
|
||||||
<p>Source: <a href="https://github.com/ewhal/Pastebin">Pastebin</a></p>
|
<p>Source: <a href="https://github.com/ewhal/Pastebin">Pastebin</a></p>
|
||||||
|
|
12
main.go
12
main.go
|
@ -21,11 +21,6 @@ import (
|
||||||
const (
|
const (
|
||||||
ADDRESS = "http://localhost:9900"
|
ADDRESS = "http://localhost:9900"
|
||||||
LENGTH = 6
|
LENGTH = 6
|
||||||
DELETE = ADDRESS + "/del/{PASTE}/{DELKEY}\n"
|
|
||||||
PASTEARGS = ADDRESS + "/p/{PASTE}/(python|language)\n"
|
|
||||||
URLARGS = ADDRESS + "/save/XML|JSON\n"
|
|
||||||
SOURCE = "Source: https://github.com/ewhal/Pastebin\n"
|
|
||||||
TEXT = "$ <command> | curl -F 'p=<-' " + ADDRESS + "/save" + "\n" + PASTEARGS + URLARGS + DELETE + SOURCE
|
|
||||||
PORT = ":9900"
|
PORT = ":9900"
|
||||||
USERNAME = ""
|
USERNAME = ""
|
||||||
PASS = ""
|
PASS = ""
|
||||||
|
@ -169,6 +164,13 @@ func saveHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
w.Header().Set("Content-Type", "application/xml")
|
w.Header().Set("Content-Type", "application/xml")
|
||||||
w.Write(x)
|
w.Write(x)
|
||||||
|
case "html":
|
||||||
|
w.Header().Set("Content-Type", "text/html")
|
||||||
|
io.WriteString(w, "<p>ID</p><p>"+b.ID+"</p><br/>")
|
||||||
|
io.WriteString(w, "<p>hash</p><p>"+b.HASH+"</p><br/>")
|
||||||
|
io.WriteString(w, "<p>URL</p><a href='"+b.URL+"'>"+b.URL+"</a><br/>")
|
||||||
|
io.WriteString(w, "<p>hash</p><p>"+b.SIZE+"</p><br/>")
|
||||||
|
io.WriteString(w, "<a href='"+b.URL+"/p/"+b.DELKEY+"'>"+b.DELKEY+"</a>")
|
||||||
|
|
||||||
default:
|
default:
|
||||||
io.WriteString(w, b.URL+"\n")
|
io.WriteString(w, b.URL+"\n")
|
||||||
|
|
Loading…
Reference in New Issue