Add bookmarklet support, show tags in manage list.

This commit is contained in:
2022-05-26 06:41:17 +09:30
parent be10f5238e
commit adbf2ef450
8 changed files with 60 additions and 27 deletions

View File

@@ -50,7 +50,7 @@ func Create(bmm *db.BookmarkManager) *Server {
}
// templ := template.Must(template.New("").Funcs(template.FuncMap{"dict": dictHelper}).ParseFS(templateFiles, "templates/*.html"))
templ := template.Must(template.New("").Funcs(template.FuncMap{"nicetime": niceTime, "niceURL": niceURL}).ParseFS(templateFiles, "templates/*.html"))
templ := template.Must(template.New("").Funcs(template.FuncMap{"nicetime": niceTime, "niceURL": niceURL, "join": strings.Join}).ParseFS(templateFiles, "templates/*.html"))
r := gin.Default()
@@ -186,7 +186,7 @@ func Create(bmm *db.BookmarkManager) *Server {
idNum, _ := strconv.ParseInt(id, 10, 32)
bm := bmm.LoadBookmarkByID(uint64(idNum))
bmm.QueueScrape(&bm)
c.String(http.StatusOK, "queued")
c.String(http.StatusOK, "<p>scrape queued</p>")
})
r.GET("/export", func(c *gin.Context) {
@@ -199,6 +199,15 @@ func Create(bmm *db.BookmarkManager) *Server {
}
})
r.GET("/bookmarklet", func(c *gin.Context) {
url := c.Query("url")
log.Printf(url)
meta := gin.H{"page": "bookmarklet_click", "url": url}
c.HTML(http.StatusOK,
"_layout.html", meta,
)
})
return server
}