ShareX URL Delete compatibility
This commit is contained in:
parent
df5b563de5
commit
0f0753ad60
|
@ -10,9 +10,13 @@ import (
|
||||||
|
|
||||||
func deleteHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
func deleteHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
requestKey := r.Header.Get("Linx-Delete-Key")
|
requestKey := r.Header.Get("Linx-Delete-Key")
|
||||||
|
urlRequestKey := r.URL.Query().Get("linx-delete-key")
|
||||||
|
if len(urlRequestKey) > 0 {
|
||||||
|
requestKey := urlRequestKey
|
||||||
|
}
|
||||||
|
|
||||||
filename := c.URLParams["name"]
|
filename := c.URLParams["name"]
|
||||||
|
|
||||||
// Ensure that file exists and delete key is correct
|
// Ensure that file exists and delete key is correct
|
||||||
metadata, err := storageBackend.Head(filename)
|
metadata, err := storageBackend.Head(filename)
|
||||||
if err == backends.NotFoundErr {
|
if err == backends.NotFoundErr {
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"Version": "13.1.0",
|
||||||
|
"DestinationType": "ImageUploader, FileUploader",
|
||||||
|
"RequestMethod": "PUT",
|
||||||
|
"RequestURL": "https://put.icu/upload/",
|
||||||
|
"Headers": {
|
||||||
|
"Accept": "application/json"
|
||||||
|
},
|
||||||
|
"Body": "Binary",
|
||||||
|
"URL": "$json:url$"
|
||||||
|
}
|
|
@ -212,7 +212,9 @@ func setup() *web.Mux {
|
||||||
mux.Put(Config.sitePath+"upload/:name", uploadPutHandler)
|
mux.Put(Config.sitePath+"upload/:name", uploadPutHandler)
|
||||||
|
|
||||||
mux.Delete(Config.sitePath+":name", deleteHandler)
|
mux.Delete(Config.sitePath+":name", deleteHandler)
|
||||||
|
// Adding new delete path method to make linx-server usable with ShareX.
|
||||||
|
mux.Get(Config.sitePath+"delete/:name", deleteHandler)
|
||||||
|
|
||||||
mux.Get(Config.sitePath+"static/*", staticHandler)
|
mux.Get(Config.sitePath+"static/*", staticHandler)
|
||||||
mux.Get(Config.sitePath+"favicon.ico", staticHandler)
|
mux.Get(Config.sitePath+"favicon.ico", staticHandler)
|
||||||
mux.Get(Config.sitePath+"robots.txt", staticHandler)
|
mux.Get(Config.sitePath+"robots.txt", staticHandler)
|
||||||
|
|
Loading…
Reference in New Issue