Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c5957e38db | |||
| 5be599589a | |||
| da970239a5 | |||
| 451335e17d | |||
| 6175c77478 | |||
| 742f42115f | |||
| 9e7914c9a1 | |||
| fe9d8e71f4 | |||
| 0c3bf0701d | |||
| 0bc777c6f1 | |||
| 2055bba5f0 | |||
| a2a1f9c06d | |||
| 79280135a1 | |||
| 4422f3840e |
@@ -30,12 +30,12 @@ func main() {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
version.UpdateVersionInfo()
|
version.VersionInfo.UpdateVersionInfo()
|
||||||
time.Sleep(time.Hour * 6)
|
time.Sleep(time.Hour * 6)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
log.Printf("linkwallet version %s starting", version.Is())
|
log.Printf("linkwallet version %s starting", version.VersionInfo.Local.Tag)
|
||||||
|
|
||||||
server := web.Create(bmm, cmm)
|
server := web.Create(bmm, cmm)
|
||||||
go bmm.RunQueue()
|
go bmm.RunQueue()
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -32,6 +34,12 @@ func NewBookmarkManager(db *DB) *BookmarkManager {
|
|||||||
// if this bookmark already exists (based on URL match).
|
// if this bookmark already exists (based on URL match).
|
||||||
// The entity.Bookmark ID field will be updated.
|
// The entity.Bookmark ID field will be updated.
|
||||||
func (m *BookmarkManager) AddBookmark(bm *entity.Bookmark) error {
|
func (m *BookmarkManager) AddBookmark(bm *entity.Bookmark) error {
|
||||||
|
|
||||||
|
if strings.Index(bm.URL, "https://") != 0 &&
|
||||||
|
strings.Index(bm.URL, "http://") != 0 {
|
||||||
|
return errors.New("URL must begin with http:// or https://")
|
||||||
|
}
|
||||||
|
|
||||||
existing := entity.Bookmark{}
|
existing := entity.Bookmark{}
|
||||||
err := m.db.store.FindOne(&existing, bolthold.Where("URL").Eq(bm.URL))
|
err := m.db.store.FindOne(&existing, bolthold.Where("URL").Eq(bm.URL))
|
||||||
if err != bolthold.ErrNotFound {
|
if err != bolthold.ErrNotFound {
|
||||||
|
|||||||
1
go.mod
1
go.mod
@@ -37,6 +37,7 @@ require (
|
|||||||
github.com/gobwas/glob v0.2.3 // indirect
|
github.com/gobwas/glob v0.2.3 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
|
github.com/gomarkdown/markdown v0.0.0-20220627144906-e9a81102ebeb
|
||||||
github.com/google/go-github/v44 v44.1.0
|
github.com/google/go-github/v44 v44.1.0
|
||||||
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b
|
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b
|
||||||
github.com/kennygrant/sanitize v1.2.4 // indirect
|
github.com/kennygrant/sanitize v1.2.4 // indirect
|
||||||
|
|||||||
2
go.sum
2
go.sum
@@ -38,6 +38,8 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW
|
|||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
|
github.com/gomarkdown/markdown v0.0.0-20220627144906-e9a81102ebeb h1:5b/eFaSaKPFG9ygDBaPKkydKU5nFJYk08g9jPIVogMg=
|
||||||
|
github.com/gomarkdown/markdown v0.0.0-20220627144906-e9a81102ebeb/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
|
||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||||
|
|||||||
14
meta/meta.go
Normal file
14
meta/meta.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package meta
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
func MemInfo() string {
|
||||||
|
stats := runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(&stats)
|
||||||
|
|
||||||
|
return fmt.Sprintf("%.3fMb", float64(stats.Alloc)/1024.0/1024.0)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,15 +2,17 @@ package version
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/go-github/v44/github"
|
"github.com/google/go-github/v44/github"
|
||||||
"golang.org/x/mod/semver"
|
"golang.org/x/mod/semver"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Tag = "v0.0.23"
|
const Tag = "v0.0.29"
|
||||||
|
|
||||||
var versionInfo struct {
|
type Info struct {
|
||||||
Local struct {
|
Local struct {
|
||||||
Tag string
|
Tag string
|
||||||
}
|
}
|
||||||
@@ -18,51 +20,58 @@ var versionInfo struct {
|
|||||||
Valid bool
|
Valid bool
|
||||||
Tag string
|
Tag string
|
||||||
}
|
}
|
||||||
m sync.Mutex
|
UpgradeReleaseNotes string
|
||||||
|
m sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var VersionInfo Info
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
versionInfo.Remote.Valid = false
|
VersionInfo.Remote.Valid = false
|
||||||
versionInfo.Local.Tag = Tag
|
VersionInfo.Local.Tag = Tag
|
||||||
}
|
}
|
||||||
|
|
||||||
func Is() string {
|
func (vi *Info) UpgradeAvailable() bool {
|
||||||
return versionInfo.Local.Tag
|
vi.m.Lock()
|
||||||
}
|
defer vi.m.Unlock()
|
||||||
|
if !vi.Remote.Valid {
|
||||||
func UpgradeAvailable() (bool, string) {
|
return false
|
||||||
versionInfo.m.Lock()
|
|
||||||
defer versionInfo.m.Unlock()
|
|
||||||
if !versionInfo.Remote.Valid {
|
|
||||||
return false, ""
|
|
||||||
}
|
}
|
||||||
if semver.Compare(versionInfo.Local.Tag, versionInfo.Remote.Tag) < 0 {
|
if semver.Compare(vi.Local.Tag, vi.Remote.Tag) < 0 {
|
||||||
return true, versionInfo.Remote.Tag
|
return true
|
||||||
}
|
}
|
||||||
return false, ""
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpgradeAvailableString() string {
|
func (vi *Info) UpdateVersionInfo() {
|
||||||
upgrade, ver := UpgradeAvailable()
|
|
||||||
if upgrade {
|
|
||||||
return ver
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func UpdateVersionInfo() {
|
|
||||||
client := github.NewClient(nil)
|
client := github.NewClient(nil)
|
||||||
|
|
||||||
rels, _, err := client.Repositories.ListReleases(context.Background(), "tardisx", "linkwallet", nil)
|
rels, _, err := client.Repositories.ListReleases(context.Background(), "tardisx", "linkwallet", nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
return
|
||||||
}
|
}
|
||||||
if len(rels) == 0 {
|
if len(rels) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
versionInfo.m.Lock()
|
|
||||||
versionInfo.Remote.Tag = *rels[0].TagName
|
vi.m.Lock()
|
||||||
versionInfo.Remote.Valid = true
|
vi.Remote.Tag = *rels[0].TagName
|
||||||
versionInfo.m.Unlock()
|
vi.Remote.Valid = true
|
||||||
|
vi.UpgradeReleaseNotes = ""
|
||||||
|
for _, r := range rels {
|
||||||
|
if semver.Compare(VersionInfo.Local.Tag, *r.TagName) < 0 {
|
||||||
|
vi.UpgradeReleaseNotes += fmt.Sprintf("*Version %s*\n\n", *r.TagName)
|
||||||
|
bodyLines := strings.Split(*r.Body, "\n")
|
||||||
|
for _, l := range bodyLines {
|
||||||
|
if strings.Index(l, "#") == 0 && strings.Contains(l, "Changelog") {
|
||||||
|
// do nothing, ignore the changelog heading
|
||||||
|
} else {
|
||||||
|
vi.UpgradeReleaseNotes += l + "\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vi.m.Unlock()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="top-bar-right">
|
<div class="top-bar-right">
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
{{ if newVersion }}
|
|
||||||
<li>
|
<li>
|
||||||
<div><a href="https://github.com/tardisx/linkwallet/releases/tag/{{ newVersion }}">{{ newVersion }} available</a></div>
|
<a href="/releaseinfo">{{ version.Local.Tag }}
|
||||||
</li>
|
{{ if version.UpgradeAvailable }}
|
||||||
{{ end }}
|
❗
|
||||||
<li class="menu-text">
|
{{ end }}
|
||||||
{{ version }}
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/tardisx/linkwallet">
|
<a href="https://github.com/tardisx/linkwallet">
|
||||||
@@ -64,6 +63,8 @@
|
|||||||
{{ template "config.html" . }}
|
{{ template "config.html" . }}
|
||||||
{{ else if eq .page "edit" }}
|
{{ else if eq .page "edit" }}
|
||||||
{{ template "edit.html" . }}
|
{{ template "edit.html" . }}
|
||||||
|
{{ else if eq .page "releaseinfo" }}
|
||||||
|
{{ template "release_info.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{/* template "foundation_sample.html" . */}}
|
{{/* template "foundation_sample.html" . */}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
<div class="large-8 medium-8 cell" id="add-url-form" >
|
<div class="large-8 medium-8 cell" id="add-url-form" >
|
||||||
<div>
|
<div>
|
||||||
<h5 style="display:inline-block;">Add a new URL</h5>
|
<h5 style="display:inline-block;">Add a new URL</h5>
|
||||||
<p style="display:inline-block;">[<a hx-get="/bulk_add" hx-target="#add-url-form" href="#">bulk add</a>]</h5>
|
<div style="display:inline-block;">[<a hx-get="/bulk_add" hx-swap="outerHTML" hx-target="#add-url-form" href="#">bulk add</a>]</div></h5>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onsubmit="return false">
|
<form onsubmit="return false">
|
||||||
<div class="grid-x grid-padding-x">
|
<div class="grid-x grid-padding-x">
|
||||||
<div class="large-6 cell">
|
<div class="medium-6 cell">
|
||||||
<label>URL</label>
|
<label>URL</label>
|
||||||
<input type="text" name="url" value="{{ .url }}"
|
<input type="text" name="url" value="{{ .url }}"
|
||||||
hx-trigger=""
|
hx-trigger=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-6 cell">
|
<div class="medium-6 cell">
|
||||||
{{ template "tags_widget.html" . }}
|
{{ template "tags_widget.html" . }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-x grid-padding-x">
|
<div class="grid-x grid-padding-x">
|
||||||
<div class="medium-6 cell">
|
<div class="medium-6 cell">
|
||||||
<a href="#" class="button" hx-post="/add"
|
<a href="#" class="button" hx-post="/add"
|
||||||
hx-target="#add-url-form">add</a>
|
hx-target="#add-url-form">add</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
<div class="large-8 medium-8 cell" id="add-url-form" >
|
<div class="large-8 medium-8 cell" id="add-url-form" >
|
||||||
<div>
|
<div>
|
||||||
<h5 style="display:inline-block;">Add bulk URLs</h5>
|
<h5 style="display:inline-block;">Add bulk URLs</h5>
|
||||||
<p style="display:inline-block;">[<a hx-get="/single_add" hx-target="#add-url-form" href="#">single add</a>]</h5>
|
<p style="display:inline-block;">[<a hx-get="/single_add" hx-swap="outerHTML" hx-target="#add-url-form" href="#">single add</a>]</h5>
|
||||||
</div> <form onsubmit="return false">
|
</div>
|
||||||
|
<form onsubmit="return false">
|
||||||
<div class="grid-x grid-padding-x">
|
<div class="grid-x grid-padding-x">
|
||||||
<div class="large-12 cell">
|
<div class="large-12 cell">
|
||||||
<label>Paste URL's, one per line</label>
|
<label>Paste URL's, one per line</label>
|
||||||
<textarea type="text" name="urls" rows="10"
|
<textarea type="text" name="urls" rows="10"></textarea>
|
||||||
></textarea>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
<th hx-post="/manage/results?sort={{ .URLString }}" hx-target="#manage-results">{{ .Name }} {{ .TitleArrow }}
|
<th class="{{ .Class }}" hx-post="/manage/results?sort={{ .URLString }}" hx-target="#manage-results">{{ .Name }} {{ .TitleArrow }}
|
||||||
</th>
|
</th>
|
||||||
|
|||||||
26
web/templates/release_info.html
Normal file
26
web/templates/release_info.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<div class="grid-x grid-padding-x">
|
||||||
|
<div class="large-12 cell">
|
||||||
|
|
||||||
|
<h5>Memory Usage</h5>
|
||||||
|
<p>{{ meminfo }}</p>
|
||||||
|
|
||||||
|
<h5>Release info</h5>
|
||||||
|
{{ if not version.Remote.Valid }}
|
||||||
|
<p>GitHub version information not yet fetched.</p>
|
||||||
|
{{ else }}
|
||||||
|
{{ if version.UpgradeAvailable }}
|
||||||
|
<p>
|
||||||
|
A new version is available:
|
||||||
|
<a href="https://github.com/tardisx/linkwallet/releases/tag/{{ version.Remote.Tag }}">
|
||||||
|
{{ version.Remote.Tag }}
|
||||||
|
</a>
|
||||||
|
(you have {{ version.Local.Tag }}).
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{{ markdown version.UpgradeReleaseNotes }}
|
||||||
|
|
||||||
|
{{ else }}
|
||||||
|
<p>You are currently running the most recent version.</p>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
<div id="label-widget" >
|
<div id="label-widget" >
|
||||||
<div class="grid-x grid-padding-x">
|
<div class="grid-x grid-padding-x">
|
||||||
<div class="small-9 medium-10 large-5 cell"
|
<div class="small-6 cell"
|
||||||
hx-post="/tags"
|
hx-post="/tags"
|
||||||
hx-target="#label-widget"
|
hx-target="#label-widget"
|
||||||
hx-trigger="change">
|
hx-trigger="change queue:first">
|
||||||
<label for="tag-entry"
|
<label for="tag-entry"
|
||||||
class="">Tags</label>
|
class="">Tags</label>
|
||||||
|
|
||||||
<input id="tag-entry" type="text" name="tag" placeholder="enter tags" />
|
<input id="tag-entry" type="text" name="tag" placeholder="enter tags" />
|
||||||
</div>
|
</div>
|
||||||
<div class="small-12 large-6 cell" id="tags-list">
|
<div class="small-6 cell" id="tags-list">
|
||||||
{{ range .tags }}
|
{{ range .tags }}
|
||||||
<a href="#"
|
<a href="#"
|
||||||
class=""
|
class=""
|
||||||
|
|||||||
36
web/web.go
36
web/web.go
@@ -14,8 +14,10 @@ import (
|
|||||||
|
|
||||||
"github.com/tardisx/linkwallet/db"
|
"github.com/tardisx/linkwallet/db"
|
||||||
"github.com/tardisx/linkwallet/entity"
|
"github.com/tardisx/linkwallet/entity"
|
||||||
|
"github.com/tardisx/linkwallet/meta"
|
||||||
"github.com/tardisx/linkwallet/version"
|
"github.com/tardisx/linkwallet/version"
|
||||||
|
|
||||||
|
"github.com/gomarkdown/markdown"
|
||||||
"github.com/hako/durafmt"
|
"github.com/hako/durafmt"
|
||||||
|
|
||||||
"github.com/gin-contrib/gzip"
|
"github.com/gin-contrib/gzip"
|
||||||
@@ -46,6 +48,7 @@ type ColumnInfo struct {
|
|||||||
Name string
|
Name string
|
||||||
Param string
|
Param string
|
||||||
Sorted string
|
Sorted string
|
||||||
|
Class string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c ColumnInfo) URLString() string {
|
func (c ColumnInfo) URLString() string {
|
||||||
@@ -74,7 +77,15 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// templ := template.Must(template.New("").Funcs(template.FuncMap{"dict": dictHelper}).ParseFS(templateFiles, "templates/*.html"))
|
// 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, "join": strings.Join, "version": version.Is, "newVersion": version.UpgradeAvailableString}).ParseFS(templateFiles, "templates/*.html"))
|
templ := template.Must(template.New("").Funcs(
|
||||||
|
template.FuncMap{
|
||||||
|
"nicetime": niceTime,
|
||||||
|
"niceURL": niceURL,
|
||||||
|
"join": strings.Join,
|
||||||
|
"version": func() *version.Info { return &version.VersionInfo },
|
||||||
|
"meminfo": meta.MemInfo,
|
||||||
|
"markdown": func(s string) template.HTML { return template.HTML(string(markdown.ToHTML([]byte(s), nil, nil))) },
|
||||||
|
}).ParseFS(templateFiles, "templates/*.html"))
|
||||||
|
|
||||||
config, err := cmm.LoadConfig()
|
config, err := cmm.LoadConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -123,8 +134,8 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
|||||||
meta := gin.H{"config": config, "bookmarks": allBookmarks}
|
meta := gin.H{"config": config, "bookmarks": allBookmarks}
|
||||||
|
|
||||||
colTitle := &ColumnInfo{Name: "Title/URL", Param: "title"}
|
colTitle := &ColumnInfo{Name: "Title/URL", Param: "title"}
|
||||||
colCreated := &ColumnInfo{Name: "Created", Param: "created"}
|
colCreated := &ColumnInfo{Name: "Created", Param: "created", Class: "show-for-large"}
|
||||||
colScraped := &ColumnInfo{Name: "Scraped", Param: "scraped"}
|
colScraped := &ColumnInfo{Name: "Scraped", Param: "scraped", Class: "show-for-large"}
|
||||||
if sort == "title" {
|
if sort == "title" {
|
||||||
colTitle.Sorted = "asc"
|
colTitle.Sorted = "asc"
|
||||||
}
|
}
|
||||||
@@ -204,6 +215,13 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
|||||||
"bm": bm,
|
"bm": bm,
|
||||||
"error": err,
|
"error": err,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
data["url"] = url
|
||||||
|
data["tags"] = tags
|
||||||
|
data["tags_hidden"] = c.PostForm("tags_hidden")
|
||||||
|
}
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "add_url_form.html", data)
|
c.HTML(http.StatusOK, "add_url_form.html", data)
|
||||||
})
|
})
|
||||||
r.POST("/add_bulk", func(c *gin.Context) {
|
r.POST("/add_bulk", func(c *gin.Context) {
|
||||||
@@ -378,6 +396,13 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
r.GET("/releaseinfo", func(c *gin.Context) {
|
||||||
|
meta := gin.H{"page": "releaseinfo", "config": config}
|
||||||
|
c.HTML(http.StatusOK,
|
||||||
|
"_layout.html", meta,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
return server
|
return server
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +426,10 @@ func cleanupTags(tags []string) []string {
|
|||||||
keys := make(map[string]struct{})
|
keys := make(map[string]struct{})
|
||||||
for _, k := range tags {
|
for _, k := range tags {
|
||||||
if k != "" && k != "|" {
|
if k != "" && k != "|" {
|
||||||
keys[strings.ToLower(k)] = struct{}{}
|
for _, subKey := range strings.Split(k, ",") {
|
||||||
|
subKey := strings.Trim(subKey, " ")
|
||||||
|
keys[strings.ToLower(subKey)] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out := []string{}
|
out := []string{}
|
||||||
|
|||||||
Reference in New Issue
Block a user