Remove fetchLink handler
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2020-07-04 15:07:41 +02:00
parent 0fa2756b1b
commit 9a772809ba

13
main.go
View File

@ -859,19 +859,6 @@ func main() {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
http.ServeFile(w, r, filepath.Join(dataDir, LinksFile)) http.ServeFile(w, r, filepath.Join(dataDir, LinksFile))
}) })
http.HandleFunc("/fetchLink", func(w http.ResponseWriter, r *http.Request) {
link := r.URL.Query().Get("url")
u, err := url.Parse(link)
if err != nil {
http.Error(w, err.Error(), 400)
return
}
var response LinkResponse
response.Success = 1
response.Link = u.String()
response.Meta.Title = "Test"
json.NewEncoder(w).Encode(response)
})
http.Handle("/search/", sh) http.Handle("/search/", sh)
http.Handle("/public/", http.StripPrefix("/public/", http.FileServer(http.Dir("./dist")))) http.Handle("/public/", http.StripPrefix("/public/", http.FileServer(http.Dir("./dist"))))
http.Handle("/save/", &saveHandler{}) http.Handle("/save/", &saveHandler{})