Compare commits
2 Commits
8b30fa89f9
...
2c70e467bc
Author | SHA1 | Date | |
---|---|---|---|
2c70e467bc | |||
0178de7a14 |
14
main.go
14
main.go
@ -60,15 +60,21 @@ type Template struct {
|
||||
templates *template.Template
|
||||
}
|
||||
|
||||
type IndexData struct {
|
||||
Host string
|
||||
UploadOnly bool
|
||||
}
|
||||
|
||||
func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
|
||||
return t.templates.ExecuteTemplate(w, name, data)
|
||||
}
|
||||
|
||||
func Index(c echo.Context) error {
|
||||
return c.Render(http.StatusOK, "index", map[string]interface{}{
|
||||
"host": c.Request().Host,
|
||||
"upload_only": true,
|
||||
})
|
||||
data := IndexData{
|
||||
Host: c.Request().Host,
|
||||
UploadOnly: false,
|
||||
}
|
||||
return c.Render(http.StatusOK, "index", data)
|
||||
}
|
||||
|
||||
func Files(c echo.Context) error {
|
||||
|
@ -19,15 +19,15 @@
|
||||
|
||||
<p>
|
||||
To upload files use curl:
|
||||
<code>curl -F "file=@/path/to/file" "{{index . "host"}}"</code>
|
||||
<code>curl -F "file=@/path/to/file" "{{.Host}}"</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To delete a file using curl:
|
||||
<code>curl "{{index . "host"}}/delete/file_name"</code>
|
||||
<code>curl "{{.Host}}/delete/file_name"</code>
|
||||
</p>
|
||||
|
||||
{{if index . "upload_only"}}
|
||||
{{if .UploadOnly}}
|
||||
<p>
|
||||
NOTE: This is an upload only instance, if you wan't a file on the instance
|
||||
deleted ask the hoster to delete the file.
|
||||
|
Loading…
Reference in New Issue
Block a user