Compare commits

...

52 Commits

Author SHA1 Message Date
b50a2aefb6 Add test 2025-05-04 11:47:18 +09:30
0dccd9f0f0 In search results show URL if title is empty 2025-05-04 11:45:43 +09:30
dd681a1099 Do not use github workflows 2025-05-03 12:59:17 +09:30
d2aa6fdd2f Merge the feature branch to introduce the bleve indexing.
commit e8c2bc7e4ade56f893c8fb23eac4cdb754555389
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sat May 3 12:36:18 2025 +0930

    Clean up menu/version

commit 1993533a4613a5db7bbb2ecd6b7a2694f48acd52
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sat May 3 12:31:50 2025 +0930

    Update README

commit 044cc830dcb3d05b43ab770e8ea42959873823dd
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sat May 3 12:22:33 2025 +0930

    No longer needed

commit a7c37ad7c5c12fcac1d5589271e0e66af4f086e8
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sat May 3 12:14:59 2025 +0930

    Fixup version handling

commit ade0b748e978ce1d9533a928bd6369f1714ca8a8
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sat May 3 11:58:15 2025 +0930

    Use the correct analyser for searches

commit e5a65cf5cfdd82ba7aa3d2470c12c6e82c851a3f
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri May 2 19:51:54 2025 +0930

    Fix version in template

commit 0171be0ee4d11796cfc0419a00b412f8037f4d97
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri May 2 19:51:41 2025 +0930

    Rescrape all links if needed on startup

commit ae654998f751c3883f8b3bd76005afae38209edf
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri May 2 19:51:25 2025 +0930

    Spelling

commit bfe9bbee028e5515be5b6d406e9090c61cdbbebd
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri May 2 19:34:06 2025 +0930

    Make goreleaser set the version

commit 4436313413f52b2b29a08e510ac4496016aae8a0
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri May 2 11:43:58 2025 +0930

    Make release matrix sane

commit 7b467ecee7a3d74ba194b723034dd16bf1c53b53
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri May 2 11:40:07 2025 +0930

    I hate YAML, so much.

commit b578e0f044e754ca70cd4ace95fdc6dc3cdcfe07
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Thu May 1 23:47:07 2025 +0930

    Update goreleaser

commit fba84f0827d35359a450fb847b03f5fa78960a1f
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Thu May 1 23:45:46 2025 +0930

    Update version

commit e4edb08bd19c560b6f2ea5e572d5950896ac6062
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Thu May 1 23:42:59 2025 +0930

    Deps

commit 58b6692d1b397de91f3531c35c6518fb58ad285a
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Thu May 1 23:39:51 2025 +0930

    Mostly done, first cut

commit badbe5e92ffa415b444535eca385d87fa00afa68
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sun Apr 27 20:28:37 2025 +0930

    Remove unused code

commit 903240dd18cdcd7722705f04ff40b30661969d4d
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sun Apr 27 20:26:19 2025 +0930

    Update deps

commit de90b9951a82c420be0588e6c2c2b63fe0b10eff
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Sun Apr 27 20:21:33 2025 +0930

    Keep on bleving

commit 9b15528510a06661237249eaf7bf64c3ce71fc3c
Author: Justin Hawkins <justin@hawkins.id.au>
Date:   Fri Apr 25 23:57:04 2025 +0930

    Start of blevification
2025-05-03 12:37:44 +09:30
3a5fc1d66d Lint 2023-05-17 20:25:18 +09:30
76c5282695 Add some tests in preparation for new ways of indexing words 2023-05-17 20:09:28 +09:30
1ca348ab45 Update dependencies 2023-03-14 17:41:01 +10:30
aec791b943 Remove window chrome from screenshots 2022-12-28 11:37:35 +10:30
ec6c40802f Fix typo 2022-12-28 11:34:20 +10:30
05a7acf601 Resize images 2022-12-28 11:32:12 +10:30
ecd27b6d6b Add screenshots to the README 2022-12-28 11:28:14 +10:30
85b98b6a25 Show a graph for words indexed, clean up display. 2022-12-18 09:46:03 +10:30
8215eaa821 Add graph of bookmarks over time 2022-12-17 12:34:26 +10:30
b7044c13f7 Neaten edit form 2022-12-17 11:05:04 +10:30
62795261cb Bump version 2022-12-17 11:04:52 +10:30
c11ad6f6f7 Bump version 2022-08-21 17:07:23 +09:30
1301fe9545 Clean up HTML 2022-08-21 17:02:14 +09:30
03abcc1340 Show the number of searches ever performed, and increase the typing timeout on searching slightly. 2022-08-21 16:59:30 +09:30
e8936beea0 Clean up wording 2022-08-21 13:47:53 +09:30
f98df478bb Show database file size on info page 2022-08-21 13:24:52 +09:30
a03baca498 Do not search if query is empty 2022-08-21 10:56:15 +09:30
1904bfd265 Provide indicator when editing bookmarks 2022-08-21 09:45:27 +09:30
2d488ffdcc Clean up logging 2022-08-21 09:45:10 +09:30
f4c5834f0c Bump version 2022-08-21 09:39:41 +09:30
db72e8fb7d Show database statstics on the info page. 2022-08-21 09:38:44 +09:30
6f93f2ff50 Clean up release notes 2022-08-21 09:37:49 +09:30
2913d510bd Clean up logging 2022-08-21 09:36:50 +09:30
8bd2c87fc6 Add documentation for docker upgrades 2022-08-21 09:15:34 +09:30
ccf373b863 Record statistics on how many bookmarks and words are indexed, and the number of searches performed. 2022-08-20 23:44:47 +09:30
c5957e38db Bump version 2022-08-20 12:16:08 +09:30
5be599589a Show memory usage on the version page 2022-08-20 12:14:52 +09:30
da970239a5 Improve notification for a new version, show release notes 2022-07-03 12:12:32 +09:30
451335e17d Capture release notes of all versions above currently running one 2022-06-10 13:17:00 +09:30
6175c77478 Bump version 2022-06-10 11:24:29 +09:30
742f42115f Add error checking for URL validity 2022-06-10 11:23:55 +09:30
9e7914c9a1 Space cells so that tags do not go on a new row. 2022-06-10 11:14:21 +09:30
fe9d8e71f4 Bump version 2022-06-09 20:21:45 +09:30
0c3bf0701d Don't panic if we cannot fetch current version from github 2022-06-09 20:20:31 +09:30
0bc777c6f1 Bump version 2022-06-09 19:56:21 +09:30
2055bba5f0 Capture tag if URL added before tag submission, allow for tags to be comma separated. 2022-06-09 19:51:21 +09:30
a2a1f9c06d Fix some element positioning 2022-06-09 19:38:30 +09:30
79280135a1 Bump version 2022-06-07 20:00:12 +09:30
4422f3840e Fix bug where column headings were displayed incorrectly on small screens 2022-06-07 19:59:33 +09:30
ffcf7c0438 Bump version 2022-06-07 19:52:35 +09:30
a910aac946 Add reversible column sorting, with sort direction indicators 2022-06-07 19:51:56 +09:30
eed41aebbb Neaten the formatting of durations 2022-06-07 16:45:03 +09:30
037be4d7e8 Bump version 2022-06-07 16:26:39 +09:30
6cf327226d Add basic sorting to management interface 2022-06-07 16:25:45 +09:30
42fd1973b8 Clean up search code, limit bookmarks list by query and/or tags 2022-06-07 11:07:38 +09:30
1563c7b21d Manage list can be free-text searched and limited by tag. 2022-06-06 22:05:56 +09:30
65100459d6 Bump version 2022-06-05 16:15:36 +09:30
977e609b13 Fix - re-add needed javascript files 2022-06-05 16:15:00 +09:30
36 changed files with 1341 additions and 667 deletions

View File

@ -1,72 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '18 22 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@ -1,25 +0,0 @@
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

View File

@ -1,92 +1,77 @@
version: 2
before: before:
hooks: hooks:
# clean up/install modules
- go mod tidy - go mod tidy
- go test ./...
builds: builds:
- main: cmd/linkwallet/linkwallet.go - main: ./cmd/linkwallet/
ldflags:
- -s -w -X github.com/tardisx/linkwallet/version.version={{.Version}} -X github.com/tardisx/linkwallet/version.commit={{.Commit}} -X github.com/tardisx/linkwallet/version.date={{.Date}}
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
goos: goos:
- linux - linux
- windows - windows
- darwin - darwin
dockers: - freebsd
- goos: linux goarch:
goarch: amd64 - arm
image_templates: - arm64
- "tardisx/linkwallet:{{ .Tag }}" - amd64
- "tardisx/linkwallet:v{{ .Major }}" goarm:
- "tardisx/linkwallet:v{{ .Major }}.{{ .Minor }}" - 6
- "tardisx/linkwallet" - 7
build_flag_templates: ignore:
- "--platform=linux/amd64" - goos: darwin
nfpms: goarch: arm
- - goos: windows
id: default goarch: arm
package_name: linkwallet - goos: windows
file_name_template: "{{ .ConventionalFileName }}" goarch: arm64
builds: - goos: freebsd
replacements: goarch: arm
darwin: darwin
linux: linux
windows: windows
386: 386
amd64: amd64_v1
vendor:
maintainer: Justin Hawkins <justin@hawkins.id.au>
description: |-
A self-hosted bookmark database with full-text page content search.
formats:
# - apk
- deb
- rpm
dependencies:
recommends:
suggests:
conflicts:
replaces:
epoch:
prerelease:
version_metadata:
release:
section: default
priority: extra
meta: false
scripts:
preinstall: "etc/preinstall.sh"
postinstall: "etc/postinstall.sh"
preremove: "etc/preremove.sh"
postremove: "etc/postremove.sh"
contents:
- src: etc/linkwallet.service
dst: /lib/systemd/system/linkwallet.service
file_info:
mode: 0664
#mtime: 2008-01-02T15:04:05Z
owner: root
group: root
- dst: /var/lib/linkwallet
type: dir
file_info:
mode: 0700
owner: linkwallet
group: linkwallet
archives: archives:
- replacements: - formats: [tar.gz]
darwin: Darwin # this name template makes the OS and Arch compatible with the results of `uname`.
linux: Linux name_template: >-
windows: Windows {{ .ProjectName }}_
386: i386 {{- title .Os }}_
amd64: x86_64 {{- if eq .Arch "amd64" }}x86_64
checksum: {{- else if eq .Arch "386" }}i386
name_template: 'checksums.txt' {{- else }}{{ .Arch }}{{ end }}
snapshot: {{- if .Arm }}v{{ .Arm }}{{ end }}
name_template: "{{ incpatch .Version }}-next" # use zip for windows archives
format_overrides:
- goos: windows
formats: [zip]
changelog: changelog:
sort: asc disable: true
filters:
exclude: dockers:
- '^Merge:' - image_templates:
- '^docs:' - "tardisx/linkwallet:{{ .Tag }}-amd64"
- '^test:' use: buildx
- '^[Bb]ump' build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- image_templates:
- "tardisx/linkwallet:{{ .Tag }}-arm64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
goarch: arm64
docker_manifests:
- name_template: "tardisx/linkwallet:{{ .Tag }}"
image_templates:
- "tardisx/linkwallet:{{ .Tag }}-amd64"
- "tardisx/linkwallet:{{ .Tag }}-arm64"
- name_template: "tardisx/linkwallet:latest"
image_templates:
- "tardisx/linkwallet:{{ .Tag }}-amd64"
- "tardisx/linkwallet:{{ .Tag }}-arm64"

View File

@ -1,12 +1,17 @@
{ {
"cSpell.words": [ "cSpell.words": [
"bleve",
"bolthold", "bolthold",
"colly", "colly",
"htmx",
"incpatch", "incpatch",
"linkwallet", "linkwallet",
"nicetime", "nicetime",
"serialised", "serialised",
"stopword", "stopword",
"Upsert" "Upsert"
],
"cSpell.ignoreWords": [
"rescrape"
] ]
} }

View File

@ -1,7 +1,27 @@
# linkwallet # linkwallet
[![Go Report Card](https://goreportcard.com/badge/github.com/tardisx/linkwallet)](https://goreportcard.com/report/github.com/tardisx/linkwallet)
A self-hosted bookmark database with full-text page content search. A self-hosted bookmark database with full-text page content search.
linkwallet uses the [Bleve](https://blevesearch.com) indexing library, providing
excellent support for free-text queries over the content of all your bookmarked
pages.
![Search][screenshot_search]
linkwallet indexes the page content, and automatically re-scrapes the pages
periodically. Tags can be applied (though with the full-text search they are
often not needed). Bookmarks can be easily managed, and can be imported or
exported in bulk.
![Admin][screenshot_admin]
Bookmarks can be added with two clicks via the bookmarklet.
![Bookmarklet][screenshot_bookmarklet]
# Feature list # Feature list
* Simple cross-platform single binary deployment * Simple cross-platform single binary deployment
@ -12,14 +32,11 @@ A self-hosted bookmark database with full-text page content search.
* Page content periodically refreshed automatically * Page content periodically refreshed automatically
* Interactively search across titles and content * Interactively search across titles and content
* Rippingly fast results, as you type * Rippingly fast results, as you type
* full text search ~60ms (over full text content of 600 bookmarks) * full text search ~30ms (over full text content of 600 bookmarks)
* No need to remember how you filed something, you just need a keyword * No need to remember how you filed something, you just need a keyword
or two to discover it again or two to discover it again
* Embedded database, no separate database required * Embedded database, no separate database required
* Light on resources * Extremely light on resources
* ~21Mb binary
* ~40Mb memory
* ~24Mb database (600 bookmarks, full text content indexed)
* Easily export your bookmarks to a plain text file - your data is yours * Easily export your bookmarks to a plain text file - your data is yours
# Installation # Installation
@ -32,13 +49,14 @@ A self-hosted bookmark database with full-text page content search.
mountpoint. mountpoint.
* Run `docker-compose up -d` * Run `docker-compose up -d`
To upgrade:
* `docker-compose pull`
* `docker-compose up -d`
## Packages (deb/rpm) ## Packages (deb/rpm)
* Download the .deb or .rpm from the releases [not yet migrated to new goreleaser - please message me if you need packages]
* Install using apt/dpkg/rpm
* Automatically creates a systemd service, enabled and started
* Runs as user `linkwallet`
* Database stored in `/var/lib/linkwallet`
## Binary ## Binary
@ -71,3 +89,8 @@ will not work.
* More tag options * More tag options
* bookmarklet with pre-filled tags * bookmarklet with pre-filled tags
* search/filter on tags * search/filter on tags
[screenshot_search]: https://raw.githubusercontent.com/tardisx/linkwallet/main/screenshot_search.png
[screenshot_admin]: https://raw.githubusercontent.com/tardisx/linkwallet/main/screenshot_admin.png
[screenshot_bookmarklet]: https://raw.githubusercontent.com/tardisx/linkwallet/main/screenshot_bookmarklet.png

View File

@ -6,7 +6,7 @@ import (
"time" "time"
"github.com/tardisx/linkwallet/db" "github.com/tardisx/linkwallet/db"
"github.com/tardisx/linkwallet/version" v "github.com/tardisx/linkwallet/version"
"github.com/tardisx/linkwallet/web" "github.com/tardisx/linkwallet/web"
) )
@ -21,24 +21,50 @@ func main() {
} }
dbh := db.DB{} dbh := db.DB{}
err := dbh.Open(dbPath) rescrape, err := dbh.Open(dbPath)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
bmm := db.NewBookmarkManager(&dbh) bmm := db.NewBookmarkManager(&dbh)
cmm := db.NewConfigManager(&dbh) cmm := db.NewConfigManager(&dbh)
go func() { go func() {
for { for {
version.UpdateVersionInfo() v.VersionInfo.UpdateVersionInfo()
time.Sleep(time.Hour * 6) time.Sleep(time.Hour * 6)
} }
}() }()
log.Printf("linkwallet version %s starting", version.Is()) // update stats every 5 minutes
go func() {
for {
err := dbh.UpdateBookmarkStats()
if err != nil {
panic(err)
}
time.Sleep(time.Minute * 5)
}
}()
log.Printf("linkwallet version %s starting", v.VersionInfo.Local.Version)
server := web.Create(bmm, cmm) server := web.Create(bmm, cmm)
go bmm.RunQueue() go bmm.RunQueue()
go bmm.UpdateContent() go bmm.UpdateContent()
if rescrape {
log.Printf("queueing all bookmarks for rescraping, as index was just created")
bookmarks, err := bmm.AllBookmarks()
if err != nil {
log.Printf("could not load all bookmarks: %s", err.Error())
} else {
for _, bm := range bookmarks {
bmm.QueueScrape(&bm)
}
}
log.Printf("queued %d bookmarks for scraping", len(bookmarks))
}
server.Start() server.Start()
} }

View File

@ -2,14 +2,11 @@ package content
import ( import (
"log" "log"
"strings"
"time" "time"
"unicode"
"github.com/tardisx/linkwallet/entity" "github.com/tardisx/linkwallet/entity"
"github.com/gocolly/colly" "github.com/gocolly/colly"
snowballeng "github.com/kljensen/snowball/english"
) )
func FetchPageInfo(bm entity.Bookmark) entity.PageInfo { func FetchPageInfo(bm entity.Bookmark) entity.PageInfo {
@ -33,11 +30,8 @@ func FetchPageInfo(bm entity.Bookmark) entity.PageInfo {
c.OnResponse(func(r *colly.Response) { c.OnResponse(func(r *colly.Response) {
info.StatusCode = r.StatusCode info.StatusCode = r.StatusCode
info.Size = len(r.Body) info.Size = len(r.Body)
// log.Printf("content type for %s: %s (%d)", r.Request.URL.String(), r.Headers.Get("Content-Type"), info.Size)
}) })
// Before making a request print "Visiting ..."
c.OnRequest(func(r *colly.Request) { c.OnRequest(func(r *colly.Request) {
// log.Println("Visiting", r.URL.String()) // log.Println("Visiting", r.URL.String())
}) })
@ -49,49 +43,3 @@ func FetchPageInfo(bm entity.Bookmark) entity.PageInfo {
c.Visit(url) c.Visit(url)
return info return info
} }
func Words(bm *entity.Bookmark) []string {
words := []string{}
words = append(words, StringToSearchWords(bm.Info.RawText)...)
words = append(words, StringToSearchWords(bm.Info.Title)...)
words = append(words, StringToSearchWords(bm.URL)...)
return words
}
func StringToSearchWords(s string) []string {
words := []string{}
words = append(words, stemmerFilter(stopwordFilter(tokenize(s)))...)
return words
}
func tokenize(text string) []string {
return strings.FieldsFunc(text, func(r rune) bool {
// Split on any character that is not a letter or a number.
return !unicode.IsLetter(r) && !unicode.IsNumber(r)
})
}
func stemmerFilter(tokens []string) []string {
r := make([]string, len(tokens))
for i, token := range tokens {
r[i] = snowballeng.Stem(token, false)
}
return r
}
var stopwords = map[string]struct{}{ // I wish Go had built-in sets.
"a": {}, "and": {}, "be": {}, "have": {}, "i": {},
"in": {}, "of": {}, "that": {}, "the": {}, "to": {},
}
func stopwordFilter(tokens []string) []string {
r := make([]string, 0, len(tokens))
for _, token := range tokens {
if _, ok := stopwords[token]; !ok {
r = append(r, token)
}
}
return r
}

View File

@ -47,28 +47,45 @@ func TestSimpleScrape(t *testing.T) {
} }
} }
func TestWords(t *testing.T) { // func TestWords(t *testing.T) {
bm := entity.Bookmark{ // bm := entity.Bookmark{
// ID: 0, // // ID: 0,
// URL: "", // // URL: "",
Info: entity.PageInfo{RawText: "the quick brown fox jumped over the lazy dog"}, // Info: entity.PageInfo{RawText: "the quick brown fox jumped over the lazy dog"},
// Tags: []string{}, // // Tags: []string{},
} // }
words := Words(&bm) // words := Words(&bm)
if len(words) != 7 { // if len(words) != 7 {
t.Errorf("got %d words not 7", len(words)) // t.Errorf("got %d words not 7", len(words))
} else { // } else {
if words[0] != "quick" || // if words[0] != "quick" ||
words[1] != "brown" || // words[1] != "brown" ||
words[2] != "fox" || // words[2] != "fox" ||
words[3] != "jump" || // words[3] != "jump" ||
words[4] != "over" || // words[4] != "over" ||
words[5] != "lazi" || // words[5] != "lazi" ||
words[6] != "dog" { // words[6] != "dog" {
t.Error("incorrect words returned") // t.Error("incorrect words returned")
} // }
// }
// }
} // func TestStemmer(t *testing.T) {
// s := `quick quick fox 😂 smile http://google.com`
// words1 := StringToStemmedSearchWords(s)
// t.Log(words1)
// if len(words1) != 7 {
// t.Error("wrong number of words")
// }
// if words1[0] != "quick" ||
// words1[1] != "quick" ||
// words1[2] != "fox" ||
// words1[3] != "smile" ||
// words1[4] != "http" ||
// words1[5] != "googl" ||
// words1[6] != "com" {
// t.Error("bad words")
// }
} // }

View File

@ -1,12 +1,21 @@
package db package db
import ( import (
"errors"
"fmt" "fmt"
"html/template"
"io" "io"
"log" "log"
"os"
"path/filepath"
"strconv"
"strings"
"sync" "sync"
"time" "time"
"github.com/blevesearch/bleve/v2"
"github.com/blevesearch/bleve/v2/analysis/lang/en"
"github.com/blevesearch/bleve/v2/search/query"
"github.com/tardisx/linkwallet/content" "github.com/tardisx/linkwallet/content"
"github.com/tardisx/linkwallet/entity" "github.com/tardisx/linkwallet/entity"
@ -18,6 +27,12 @@ type BookmarkManager struct {
scrapeQueue chan *entity.Bookmark scrapeQueue chan *entity.Bookmark
} }
type SearchOptions struct {
All bool
Query string
Results int
}
func NewBookmarkManager(db *DB) *BookmarkManager { func NewBookmarkManager(db *DB) *BookmarkManager {
return &BookmarkManager{db: db, scrapeQueue: make(chan *entity.Bookmark)} return &BookmarkManager{db: db, scrapeQueue: make(chan *entity.Bookmark)}
} }
@ -26,6 +41,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 {
@ -48,19 +69,19 @@ func (m *BookmarkManager) DeleteBookmark(bm *entity.Bookmark) error {
// delete it // delete it
m.db.store.DeleteMatching(bm, bolthold.Where("ID").Eq(bm.ID)) m.db.store.DeleteMatching(bm, bolthold.Where("ID").Eq(bm.ID))
// delete all the index entries // delete all the index entries
m.db.UpdateIndexForWordsByID([]string{}, bm.ID) return m.db.bleve.Delete(fmt.Sprint(bm.ID))
return nil
} }
// ListBookmarks returns all bookmarks. // ListBookmarks returns all bookmarks.
func (m *BookmarkManager) ListBookmarks() ([]entity.Bookmark, error) { // func (m *BookmarkManager) ListBookmarks() ([]entity.Bookmark, error) {
bookmarks := make([]entity.Bookmark, 0, 0) // bookmarks := make([]entity.Bookmark, 0)
err := m.db.store.Find(&bookmarks, &bolthold.Query{}) // err := m.db.store.Find(&bookmarks, &bolthold.Query{})
if err != nil { // if err != nil {
panic(err) // panic(err)
} // }
return bookmarks, nil // log.Printf("found %d bookmarks", len(bookmarks))
} // return bookmarks, nil
// }
// ExportBookmarks exports all bookmarks to an io.Writer // ExportBookmarks exports all bookmarks to an io.Writer
func (m *BookmarkManager) ExportBookmarks(w io.Writer) error { func (m *BookmarkManager) ExportBookmarks(w io.Writer) error {
@ -86,7 +107,6 @@ func (m *BookmarkManager) SaveBookmark(bm *entity.Bookmark) error {
func (m *BookmarkManager) LoadBookmarkByID(id uint64) entity.Bookmark { func (m *BookmarkManager) LoadBookmarkByID(id uint64) entity.Bookmark {
// log.Printf("loading %v", ids) // log.Printf("loading %v", ids)
ret := entity.Bookmark{} ret := entity.Bookmark{}
log.Printf("loading id %d", id)
err := m.db.store.Get(id, &ret) err := m.db.store.Get(id, &ret)
if err != nil { if err != nil {
panic(err) panic(err)
@ -94,53 +114,53 @@ func (m *BookmarkManager) LoadBookmarkByID(id uint64) entity.Bookmark {
return ret return ret
} }
func (m *BookmarkManager) LoadBookmarksByIDs(ids []uint64) []entity.Bookmark { func (m *BookmarkManager) Search(opts SearchOptions) ([]entity.BookmarkSearchResult, error) {
// log.Printf("loading %v", ids) found := []entity.BookmarkSearchResult{}
ret := make([]entity.Bookmark, 0, 0) if opts.All && opts.Query != "" {
panic("can't fetch all with query")
s := make([]interface{}, len(ids))
for i, v := range ids {
s[i] = v
} }
err := m.db.store.Find(&ret, bolthold.Where("ID").In(s...)) var q query.Query
if opts.All {
q = bleve.NewMatchAllQuery()
} else {
mq := bleve.NewMatchQuery(opts.Query)
mq.Analyzer = en.AnalyzerName
tq := bleve.NewTermQuery(opts.Query)
q = bleve.NewDisjunctionQuery(mq, tq)
}
req := bleve.NewSearchRequest(q)
if opts.Results > 0 {
req.Size = opts.Results
}
req.Highlight = bleve.NewHighlightWithStyle("html")
sr, err := m.db.bleve.Search(req)
if err != nil { if err != nil {
panic(err) panic(err)
} }
return ret // log.Printf("%#v", m.db.bleve.StatsMap())
}
func (m *BookmarkManager) Search(query string) ([]entity.Bookmark, error) { if sr.Total > 0 {
rets := make([]uint64, 0, 0) for _, dm := range sr.Hits {
counts := make(map[uint64]uint8) id, _ := strconv.ParseUint(dm.ID, 10, 64)
bm := m.LoadBookmarkByID(id)
words := content.StringToSearchWords(query) bsr := entity.BookmarkSearchResult{
Bookmark: bm,
for _, word := range words { Score: dm.Score,
var wi *entity.WordIndex Highlight: template.HTML(strings.Join(dm.Fragments["Info.RawText"], "\n")),
err := m.db.store.Get("word_index_"+word, &wi)
if err == bolthold.ErrNotFound {
continue
} }
if err != nil { found = append(found, bsr)
return nil, fmt.Errorf("error retrieving index: %w", err)
}
for k := range wi.Bitmap {
counts[k]++
} }
} }
for k, v := range counts { m.db.IncrementSearches()
if v == uint8(len(words)) {
rets = append(rets, k)
if len(rets) > 10 {
break
}
}
}
return m.LoadBookmarksByIDs(rets), nil return found, nil
} }
func (m *BookmarkManager) ScrapeAndIndex(bm *entity.Bookmark) error { func (m *BookmarkManager) ScrapeAndIndex(bm *entity.Bookmark) error {
@ -164,10 +184,11 @@ func (m *BookmarkManager) ScrapeAndIndex(bm *entity.Bookmark) error {
} }
func (m *BookmarkManager) UpdateIndexForBookmark(bm *entity.Bookmark) { func (m *BookmarkManager) UpdateIndexForBookmark(bm *entity.Bookmark) {
words := content.Words(bm) log.Printf("inserting into bleve data for %s", bm.URL)
words = append(words, bm.Tags...) err := m.db.bleve.Index(fmt.Sprint(bm.ID), bm)
log.Printf("index for %d %s (%d words)", bm.ID, bm.URL, len(words)) if err != nil {
m.db.UpdateIndexForWordsByID(words, bm.ID) panic(err)
}
} }
func (m *BookmarkManager) QueueScrape(bm *entity.Bookmark) { func (m *BookmarkManager) QueueScrape(bm *entity.Bookmark) {
@ -240,3 +261,49 @@ func (m *BookmarkManager) UpdateContent() {
time.Sleep(time.Second * 5) time.Sleep(time.Second * 5)
} }
} }
// AllBookmarks returns all bookmarks. It does not use the index for this
// operation.
func (m *BookmarkManager) AllBookmarks() ([]entity.Bookmark, error) {
bookmarks := make([]entity.Bookmark, 0)
err := m.db.store.Find(&bookmarks, &bolthold.Query{})
if err != nil {
panic(err)
}
return bookmarks, nil
}
func (m *BookmarkManager) Stats() (entity.DBStats, error) {
stats := entity.DBStats{}
err := m.db.store.Get("stats", &stats)
if err != nil && err != bolthold.ErrNotFound {
return stats, fmt.Errorf("could not load stats: %s", err)
}
// get the DB size
fi, err := os.Stat(m.db.file)
if err != nil {
return stats, fmt.Errorf("could not load db file size: %s", err)
}
stats.FileSize = int(fi.Size())
indexSize, err := getBleveIndexSize(m.db.file + ".bleve")
if err != nil {
return entity.DBStats{}, err
}
stats.IndexSize = int(indexSize)
return stats, nil
}
func getBleveIndexSize(path string) (int64, error) {
var size int64
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
size += info.Size()
}
return nil
})
return size, err
}

View File

@ -73,7 +73,7 @@ func BenchmarkOneWordSearch(b *testing.B) {
bmm := NewBookmarkManager(&dbh) bmm := NewBookmarkManager(&dbh)
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
bmm.Search("hello") bmm.Search(SearchOptions{Query: "hello"})
} }
} }
@ -84,7 +84,7 @@ func BenchmarkTwoWordSearch(b *testing.B) {
bmm := NewBookmarkManager(&dbh) bmm := NewBookmarkManager(&dbh)
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
bmm.Search("human relate") bmm.Search(SearchOptions{Query: "human relate"})
} }
} }
@ -95,6 +95,6 @@ func BenchmarkThreeWordSearch(b *testing.B) {
bmm := NewBookmarkManager(&dbh) bmm := NewBookmarkManager(&dbh)
b.ResetTimer() b.ResetTimer()
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
bmm.Search("human wiki editor") bmm.Search(SearchOptions{Query: "human wiki editor"})
} }
} }

144
db/db.go
View File

@ -2,34 +2,162 @@ package db
import ( import (
"fmt" "fmt"
"log" "time"
"github.com/blevesearch/bleve/v2"
"github.com/blevesearch/bleve/v2/analysis/analyzer/keyword"
"github.com/blevesearch/bleve/v2/analysis/lang/en"
"github.com/blevesearch/bleve/v2/mapping"
"github.com/tardisx/linkwallet/entity" "github.com/tardisx/linkwallet/entity"
bolthold "github.com/timshannon/bolthold" bolthold "github.com/timshannon/bolthold"
) )
type DB struct { type DB struct {
store *bolthold.Store store *bolthold.Store
file string
bleve bleve.Index
} }
func (db *DB) Open(path string) error { // Open opens the bookmark boltdb, and the bleve index. It returns
// true if the index was newly created, so the caller knows all bookmarks
// need to be re-scraped
func (db *DB) Open(path string) (bool, error) {
// options := bolthold.DefaultOptions // options := bolthold.DefaultOptions
// options.Dir = dir // options.Dir = dir
// options.ValueDir = dir // options.ValueDir = dir
rescrapeNeeded := false
store, err := bolthold.Open(path, 0666, nil) store, err := bolthold.Open(path, 0666, nil)
if err != nil { if err != nil {
return fmt.Errorf("cannot open '%s' - %s", path, err) return false, fmt.Errorf("cannot open '%s' - %s", path, err)
} }
blevePath := path + ".bleve"
index, err := bleve.New(blevePath, createIndexMapping())
if err != nil {
if err == bleve.ErrorIndexPathExists {
index, err = bleve.Open(blevePath)
if err != nil {
return false, fmt.Errorf("cannot open bleve '%s' - %s", path, err)
}
} else {
return false, fmt.Errorf("cannot open bleve '%s' - %s", path, err)
}
} else {
// we just created an index, one didn't exist, so we need to queue
// all bookmarks to be scraped
rescrapeNeeded = true
}
db.store = store db.store = store
return nil db.file = path
db.bleve = index
return rescrapeNeeded, nil
}
func createIndexMapping() mapping.IndexMapping {
indexMapping := bleve.NewIndexMapping()
englishTextFieldMapping := bleve.NewTextFieldMapping()
englishTextFieldMapping.Analyzer = en.AnalyzerName
// a generic reusable mapping for keyword text
keywordFieldMapping := bleve.NewTextFieldMapping()
keywordFieldMapping.Analyzer = keyword.Name
pageInfoMapping := bleve.NewDocumentMapping()
pageInfoMapping.AddFieldMappingsAt("Title", englishTextFieldMapping)
pageInfoMapping.AddFieldMappingsAt("Size", bleve.NewNumericFieldMapping())
pageInfoMapping.AddFieldMappingsAt("RawText", englishTextFieldMapping)
bookmarkMapping := bleve.NewDocumentMapping()
bookmarkMapping.AddFieldMappingsAt("URL", bleve.NewTextFieldMapping())
bookmarkMapping.AddFieldMappingsAt("Tags", keywordFieldMapping)
bookmarkMapping.AddSubDocumentMapping("Info", pageInfoMapping)
indexMapping.AddDocumentMapping("bookmark", bookmarkMapping)
return indexMapping
} }
func (db *DB) Close() { func (db *DB) Close() {
db.store.Close() db.store.Close()
} }
func (db *DB) Dumpy() { // func (db *DB) Dumpy() {
res := make([]entity.Bookmark, 0, 0) // res := make([]entity.Bookmark, 0, 0)
db.store.Find(&res, &bolthold.Query{}) // db.store.Find(&res, &bolthold.Query{})
log.Printf("%v", res) // log.Printf("%v", res)
// }
// IncrementSearches increments the number of searches we have ever performed by one.
func (db *DB) IncrementSearches() error {
txn, err := db.store.Bolt().Begin(true)
if err != nil {
return fmt.Errorf("could not start transaction for increment searches: %s", err)
}
stats := entity.DBStats{}
err = db.store.TxGet(txn, "stats", &stats)
if err != nil && err != bolthold.ErrNotFound {
txn.Rollback()
return fmt.Errorf("could not get stats for incrementing searches: %s", err)
}
stats.Searches += 1
err = db.store.TxUpsert(txn, "stats", &stats)
if err != nil {
txn.Rollback()
return fmt.Errorf("could not upsert stats for incrementing searches: %s", err)
}
err = txn.Commit()
if err != nil {
return fmt.Errorf("could not commit increment searches transaction: %s", err)
}
return nil
}
// UpdateBookmarkStats updates the history on the number of bookmarks and words indexed.
func (db *DB) UpdateBookmarkStats() error {
txn, err := db.store.Bolt().Begin(true)
if err != nil {
return fmt.Errorf("could not start transaction for update stats: %s", err)
}
// count bookmarks and words indexed
bmI := entity.Bookmark{}
bookmarkCount, err := db.store.TxCount(txn, &bmI, &bolthold.Query{})
if err != nil {
txn.Rollback()
return fmt.Errorf("could not get bookmark count: %s", err)
}
// bucket these stats by day
now := time.Now().Truncate(time.Hour * 24)
stats := entity.DBStats{}
err = db.store.TxGet(txn, "stats", &stats)
if err != nil && err != bolthold.ErrNotFound {
txn.Rollback()
return fmt.Errorf("could not get stats: %s", err)
}
if stats.History == nil {
stats.History = make(map[time.Time]entity.BookmarkInfo)
}
stats.History[now] = entity.BookmarkInfo{Bookmarks: bookmarkCount}
err = db.store.TxUpsert(txn, "stats", &stats)
if err != nil {
txn.Rollback()
return fmt.Errorf("could not upsert stats: %s", err)
}
err = txn.Commit()
if err != nil {
return fmt.Errorf("could not commit stats transaction: %s", err)
}
return nil
} }

View File

@ -1,68 +1,24 @@
package db package db
import (
"log"
"github.com/tardisx/linkwallet/entity"
bolthold "github.com/timshannon/bolthold"
)
func (db *DB) InitIndices() { func (db *DB) InitIndices() {
wi := entity.WordIndex{} panic("unimplemented")
db.store.DeleteMatching(wi, &bolthold.Query{}) // wi := entity.WordIndex{}
// db.store.DeleteMatching(wi, &bolthold.Query{})
} }
func (db *DB) UpdateIndexForWordsByID(words []string, id uint64) { // func (db *DB) IndexDocument(id uint64, info entity.PageInfo) {
// delete this id from all indices // log.Printf("I am indexing!")
txn, err := db.store.Bolt().Begin(true) // err := db.bleve.Index(fmt.Sprint(id), info)
if err != nil { // if err != nil {
panic(err) // panic(err)
} // }
db.store.TxForEach(txn, &bolthold.Query{}, func(wi *entity.WordIndex) error { // }
delete(wi.Bitmap, id)
db.store.TxUpdate(txn, "word_index_"+wi.Word, wi)
return nil
})
// adding // func (db *DB) UpdateIndexForWordsByID(words []string, id uint64) {
for i, word := range words { // panic("I should not be called")
// log.Printf("indexing %s", word) // }
thisWI := entity.WordIndex{Word: word}
err := db.store.TxGet(txn, "word_index_"+word, &thisWI)
if err == bolthold.ErrNotFound {
// create it
thisWI.Bitmap = map[uint64]bool{}
} else if err != nil {
panic(err)
}
thisWI.Bitmap[id] = true
err = db.store.TxUpsert(txn, "word_index_"+word, thisWI)
if err != nil {
panic(err)
}
if i > 0 && i%100 == 0 {
txn.Commit()
txn, err = db.store.Bolt().Begin(true)
if err != nil {
panic(err)
}
}
}
txn.Commit()
}
func (db *DB) DumpIndex() { func (db *DB) DumpIndex() {
panic("unimplemented")
// delete this id from all indices
err := db.store.ForEach(&bolthold.Query{}, func(wi *entity.WordIndex) error {
log.Printf("%10s: %v", wi.Word, wi.Bitmap)
return nil
})
if err != nil {
panic(err)
}
} }

View File

@ -5,6 +5,10 @@ import (
"net/http/httptest" "net/http/httptest"
"os" "os"
"testing" "testing"
"time"
"github.com/blevesearch/bleve/v2"
"github.com/blevesearch/bleve/v2/search/query"
"github.com/tardisx/linkwallet/entity" "github.com/tardisx/linkwallet/entity"
) )
@ -47,7 +51,7 @@ func TestAddRemove(t *testing.T) {
t.Errorf("scrape index returned %s", err) t.Errorf("scrape index returned %s", err)
} }
searchRes, err := bmm.Search("fox") searchRes, err := bmm.Search(SearchOptions{Query: "fox"})
if err != nil { if err != nil {
t.Errorf("search returned %s", err) t.Errorf("search returned %s", err)
} }
@ -62,7 +66,7 @@ func TestAddRemove(t *testing.T) {
t.Errorf("scrape index returned %s", err) t.Errorf("scrape index returned %s", err)
} }
searchRes, err = bmm.Search("fox") searchRes, err = bmm.Search(SearchOptions{Query: "fox"})
if err != nil { if err != nil {
t.Errorf("search returned %s", err) t.Errorf("search returned %s", err)
} }
@ -70,7 +74,7 @@ func TestAddRemove(t *testing.T) {
t.Error("got result when should not") t.Error("got result when should not")
} }
searchRes, err = bmm.Search("rabbit") searchRes, err = bmm.Search(SearchOptions{Query: "rabbit"})
if err != nil { if err != nil {
t.Errorf("search returned %s", err) t.Errorf("search returned %s", err)
} }
@ -83,7 +87,7 @@ func TestAddRemove(t *testing.T) {
t.Errorf("got error when deleting: %s", err) t.Errorf("got error when deleting: %s", err)
} }
searchRes, err = bmm.Search("rabbit") searchRes, err = bmm.Search(SearchOptions{Query: "rabbit"})
if err != nil { if err != nil {
t.Errorf("search returned %s", err) t.Errorf("search returned %s", err)
} }
@ -119,7 +123,7 @@ func TestTagIndexing(t *testing.T) {
t.Errorf("scrape index returned %s", err) t.Errorf("scrape index returned %s", err)
} }
searchRes, err := bmm.Search("fox") searchRes, err := bmm.Search(SearchOptions{Query: "fox"})
if err != nil { if err != nil {
t.Errorf("search returned %s", err) t.Errorf("search returned %s", err)
} }
@ -133,7 +137,7 @@ func TestTagIndexing(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("scrape index returned %s", err) t.Errorf("scrape index returned %s", err)
} }
searchRes, err = bmm.Search("sloth") searchRes, err = bmm.Search(SearchOptions{Query: "sloth"})
if err != nil { if err != nil {
t.Errorf("search returned %s", err) t.Errorf("search returned %s", err)
} }
@ -141,3 +145,113 @@ func TestTagIndexing(t *testing.T) {
t.Error("did not get one id for sloth") t.Error("did not get one id for sloth")
} }
} }
func testBM() entity.Bookmark {
return entity.Bookmark{
ID: 1,
URL: "https://one.com",
Info: entity.PageInfo{
Fetched: time.Time{},
Title: "one web",
Size: 200,
StatusCode: 200,
RawText: "one web site is great for all humans",
},
Tags: []string{"hello", "big friends"},
PreserveTitle: false,
TimestampCreated: time.Time{},
TimestampLastScraped: time.Time{},
}
}
func TestMappings(t *testing.T) {
mapping := createIndexMapping()
idx, err := bleve.NewMemOnly(mapping)
if err != nil {
t.Error(err)
t.FailNow()
}
bm := testBM()
err = idx.Index("1", bm)
if err != nil {
panic(err)
}
type tc struct {
query query.Query
expHits int
}
tcs := []tc{
{query: bleve.NewMatchQuery("human"), expHits: 1},
{query: bleve.NewMatchQuery("humanoid"), expHits: 0},
{query: bleve.NewMatchQuery("hello"), expHits: 1},
{query: bleve.NewMatchQuery("big"), expHits: 0},
{query: bleve.NewMatchQuery("friends"), expHits: 0},
{query: bleve.NewMatchQuery("big friend"), expHits: 0},
{query: bleve.NewTermQuery("big friends"), expHits: 1},
{query: bleve.NewMatchQuery("web great"), expHits: 1},
}
for i := range tcs {
q := tcs[i].query
sr, err := idx.Search(bleve.NewSearchRequest(q))
if err != nil {
t.Error(err)
} else {
if len(sr.Hits) != tcs[i].expHits {
t.Errorf("wrong hits - expected %d got %d for %s", tcs[i].expHits, len(sr.Hits), tcs[i].query)
}
}
}
}
func TestMappingsDisjunctionQuery(t *testing.T) {
mapping := createIndexMapping()
idx, err := bleve.NewMemOnly(mapping)
if err != nil {
t.Error(err)
t.FailNow()
}
bm := testBM()
err = idx.Index("1", bm)
if err != nil {
panic(err)
}
type tc struct {
query string
expHits int
}
tcs := []tc{
{query: "human", expHits: 1},
{query: "humanoid", expHits: 0},
{query: "hello", expHits: 1},
{query: "big", expHits: 0},
{query: "friends", expHits: 0},
{query: "big friend", expHits: 0},
{query: "big friends", expHits: 1},
{query: "web great", expHits: 1},
}
for i := range tcs {
q := tcs[i].query
req := bleve.NewDisjunctionQuery(
bleve.NewMatchQuery(q),
bleve.NewTermQuery(q),
)
sr, err := idx.Search(bleve.NewSearchRequest(req))
if err != nil {
t.Error(err)
} else {
if len(sr.Hits) != tcs[i].expHits {
t.Errorf("wrong hits - expected %d got %d for %s", tcs[i].expHits, len(sr.Hits), tcs[i].query)
}
}
}
}

View File

@ -1,6 +1,10 @@
package entity package entity
import "time" import (
"html/template"
"strings"
"time"
)
type Bookmark struct { type Bookmark struct {
ID uint64 `boltholdKey:"ID"` ID uint64 `boltholdKey:"ID"`
@ -12,6 +16,17 @@ type Bookmark struct {
TimestampLastScraped time.Time TimestampLastScraped time.Time
} }
func (bm Bookmark) Type() string {
return "bookmark"
}
func (bm Bookmark) DisplayTitle() string {
if strings.TrimSpace(bm.Info.Title) == "" {
return bm.URL
}
return bm.Info.Title
}
type PageInfo struct { type PageInfo struct {
Fetched time.Time Fetched time.Time
Title string Title string
@ -19,3 +34,13 @@ type PageInfo struct {
StatusCode int StatusCode int
RawText string RawText string
} }
func (pi PageInfo) Type() string {
return "info"
}
type BookmarkSearchResult struct {
Bookmark Bookmark
Score float64
Highlight template.HTML
}

22
entity/bookmark_test.go Normal file
View File

@ -0,0 +1,22 @@
package entity
import (
"testing"
)
func TestTitle(t *testing.T) {
bm := Bookmark{
URL: "http://example.org",
Info: PageInfo{
Title: "",
},
}
if bm.DisplayTitle() != "http://example.org" {
t.Errorf("title incorrect - got %s", bm.DisplayTitle())
}
bm.Info.Title = "Example Site"
if bm.DisplayTitle() != "Example Site" {
t.Errorf("title incorrect - got %s", bm.DisplayTitle())
}
}

View File

@ -1,39 +1 @@
package entity package entity
type WordIndex struct {
Word string `bolthold:"index"`
// Bitmap roaring.Bitmap
Bitmap map[uint64]bool
}
// func (wi WordIndex) GobEncode() ([]byte, error) {
// bmBuf := new(bytes.Buffer)
// wi.Bitmap.WriteTo(bmBuf) // we omit error handling
// wordBytes := []byte(wi.Word)
// serialised := make([]byte, 4, 4)
// binary.BigEndian.PutUint32(serialised, uint32(len(wordBytes)))
// serialised = append(serialised, wordBytes...)
// serialised = append(serialised, bmBuf.Bytes()...)
// // log.Printf("serialised: %v", serialised)
// // log.Printf("serialised to %d bytes for word %w\n%#v", len(serialised), wi.Word, serialised)
// return serialised, nil
// }
// func (wi *WordIndex) GobDecode(b []byte) error {
// size := binary.BigEndian.Uint32(b[0:4])
// wi.Word = string(b[4 : size+4])
// // log.Printf("word is %s size was %d\n%v", wi.Word, size, b)
// bmBuf := bytes.NewReader(b[size+4:])
// wi.Bitmap = *roaring.New()
// _, err := wi.Bitmap.ReadFrom(bmBuf)
// // log.Printf("N: %d, err: %s", n, err)
// return err
// }

48
entity/meta.go Normal file
View File

@ -0,0 +1,48 @@
package entity
import (
"fmt"
"sort"
"time"
)
type DBStats struct {
History map[time.Time]BookmarkInfo
FileSize int
IndexSize int
Searches int
}
type BookmarkInfo struct {
Bookmarks int
}
func (stats DBStats) String() string {
out := fmt.Sprintf("searches: %d\n", stats.Searches)
dates := []time.Time{}
for k := range stats.History {
dates = append(dates, k)
}
sort.Slice(dates, func(i, j int) bool { return dates[i].Before(dates[j]) })
for _, k := range dates {
out += fmt.Sprintf("%s - %d bookmarks\n", k, stats.History[k].Bookmarks)
}
return out
}
func (stats DBStats) MostRecentBookmarkInfo() BookmarkInfo {
mostRecent := time.Time{}
for k := range stats.History {
if k.After(mostRecent) {
mostRecent = k
}
}
if !mostRecent.IsZero() {
return stats.History[mostRecent]
}
return BookmarkInfo{}
}

112
go.mod
View File

@ -1,53 +1,95 @@
module github.com/tardisx/linkwallet module github.com/tardisx/linkwallet
go 1.18 go 1.23.0
toolchain go1.24.1
require ( require (
github.com/gin-gonic/gin v1.7.7 github.com/gin-gonic/gin v1.10.0
github.com/gocolly/colly v1.2.0 github.com/gocolly/colly v1.2.0
github.com/kljensen/snowball v0.6.0 gonum.org/v1/plot v0.16.0
) )
require ( require (
github.com/gin-contrib/sse v0.1.0 // indirect codeberg.org/go-fonts/liberation v0.5.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect codeberg.org/go-latex/latex v0.1.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect codeberg.org/go-pdf/fpdf v0.11.1 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect git.sr.ht/~sbinet/gg v0.6.0 // indirect
github.com/RoaringBitmap/roaring/v2 v2.4.5 // indirect
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
github.com/bits-and-blooms/bitset v1.22.0 // indirect
github.com/blevesearch/bleve_index_api v1.2.8 // indirect
github.com/blevesearch/geo v0.2.0 // indirect
github.com/blevesearch/go-faiss v1.0.25 // indirect
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
github.com/blevesearch/gtreap v0.1.1 // indirect
github.com/blevesearch/mmap-go v1.0.4 // indirect
github.com/blevesearch/scorch_segment_api/v2 v2.3.10 // indirect
github.com/blevesearch/segment v0.9.1 // indirect
github.com/blevesearch/snowballstem v0.9.0 // indirect
github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect
github.com/blevesearch/vellum v1.1.0 // indirect
github.com/blevesearch/zapx/v11 v11.4.1 // indirect
github.com/blevesearch/zapx/v12 v12.4.1 // indirect
github.com/blevesearch/zapx/v13 v13.4.1 // indirect
github.com/blevesearch/zapx/v14 v14.4.1 // indirect
github.com/blevesearch/zapx/v15 v15.4.1 // indirect
github.com/blevesearch/zapx/v16 v16.2.3 // indirect
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/campoy/embedmd v1.0.0 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-querystring v1.1.0 // indirect
github.com/json-iterator/go v1.1.9 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.1.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/leodido/go-urn v1.2.0 // indirect github.com/kr/pretty v0.3.1 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect github.com/leodido/go-urn v1.4.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/stretchr/testify v1.7.0 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect github.com/mschoch/smat v0.2.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect github.com/ugorji/go/codec v1.2.12 // indirect
go.etcd.io/bbolt v1.4.0 // indirect
golang.org/x/arch v0.16.0 // indirect
golang.org/x/crypto v0.37.0 // indirect
golang.org/x/image v0.26.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
) )
require ( require (
github.com/PuerkitoBio/goquery v1.8.0 // indirect github.com/PuerkitoBio/goquery v1.10.3 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect github.com/andybalholm/cascadia v1.3.3 // indirect
github.com/antchfx/htmlquery v1.2.4 // indirect github.com/antchfx/htmlquery v1.3.4 // indirect
github.com/antchfx/xmlquery v1.3.10 // indirect github.com/antchfx/xmlquery v1.4.4 // indirect
github.com/antchfx/xpath v1.2.0 // indirect github.com/antchfx/xpath v1.3.4 // indirect
github.com/gin-contrib/gzip v0.0.5 github.com/blevesearch/bleve/v2 v2.5.0
github.com/gin-contrib/gzip v1.2.3
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-20241129210726-2c02b8208cf8 // indirect
github.com/golang/protobuf v1.5.2 // indirect github.com/golang/protobuf v1.5.4 // indirect
github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b
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
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
github.com/temoto/robotstxt v1.1.2 // indirect github.com/temoto/robotstxt v1.1.2 // indirect
github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a github.com/timshannon/bolthold v0.0.0-20240314194003-30aac6950928
golang.org/x/mod v0.5.1 golang.org/x/mod v0.24.0
golang.org/x/net v0.0.0-20220517181318-183a9ca12b87 // indirect golang.org/x/net v0.39.0 // indirect
golang.org/x/sys v0.0.0-20220519141025-dcacdad47464 // indirect golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.24.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.27.1 // indirect google.golang.org/protobuf v1.36.6 // indirect
) )

351
go.sum
View File

@ -1,132 +1,311 @@
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U= codeberg.org/go-fonts/dejavu v0.4.0 h1:2yn58Vkh4CFK3ipacWUAIE3XVBGNa0y1bc95Bmfx91I=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI= codeberg.org/go-fonts/dejavu v0.4.0/go.mod h1:abni088lmhQJvso2Lsb7azCKzwkfcnttl6tL1UTWKzg=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= codeberg.org/go-fonts/latin-modern v0.4.0 h1:vkRCc1y3whKA7iL9Ep0fSGVuJfqjix0ica9UflHORO8=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= codeberg.org/go-fonts/latin-modern v0.4.0/go.mod h1:BF68mZznJ9QHn+hic9ks2DaFl4sR5YhfM6xTYaP9vNw=
github.com/antchfx/htmlquery v1.2.4 h1:qLteofCMe/KGovBI6SQgmou2QNyedFUW+pE+BpeZ494= codeberg.org/go-fonts/liberation v0.5.0 h1:SsKoMO1v1OZmzkG2DY+7ZkCL9U+rrWI09niOLfQ5Bo0=
github.com/antchfx/htmlquery v1.2.4/go.mod h1:2xO6iu3EVWs7R2JYqBbp8YzG50gj/ofqs5/0VZoDZLc= codeberg.org/go-fonts/liberation v0.5.0/go.mod h1:zS/2e1354/mJ4pGzIIaEtm/59VFCFnYC7YV6YdGl5GU=
github.com/antchfx/xmlquery v1.3.10 h1:U2yMwr8U0KmGM2iDG2Ky/3LfxNsiK4uw1bSBkeMO9+g= codeberg.org/go-latex/latex v0.1.0 h1:hoGO86rIbWVyjtlDLzCqZPjNykpWQ9YuTZqAzPcfL3c=
github.com/antchfx/xmlquery v1.3.10/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks= codeberg.org/go-latex/latex v0.1.0/go.mod h1:LA0q/AyWIYrqVd+A9Upkgsb+IqPcmSTKc9Dny04MHMw=
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8= codeberg.org/go-pdf/fpdf v0.11.1 h1:U8+coOTDVLxHIXZgGvkfQEi/q0hYHYvEHFuGNX2GzGs=
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= codeberg.org/go-pdf/fpdf v0.11.1/go.mod h1:Y0DGRAdZ0OmnZPvjbMp/1bYxmIPxm0ws4tfoPOc4LjU=
git.sr.ht/~sbinet/cmpimg v0.1.0 h1:E0zPRk2muWuCqSKSVZIWsgtU9pjsw3eKHi8VmQeScxo=
git.sr.ht/~sbinet/cmpimg v0.1.0/go.mod h1:FU12psLbF4TfNXkKH2ZZQ29crIqoiqTZmeQ7dkp/pxE=
git.sr.ht/~sbinet/gg v0.6.0 h1:RIzgkizAk+9r7uPzf/VfbJHBMKUr0F5hRFxTUGMnt38=
git.sr.ht/~sbinet/gg v0.6.0/go.mod h1:uucygbfC9wVPQIfrmwM2et0imr8L7KQWywX0xpFMm94=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
github.com/RoaringBitmap/roaring/v2 v2.4.5 h1:uGrrMreGjvAtTBobc0g5IrW1D5ldxDQYe2JW2gggRdg=
github.com/RoaringBitmap/roaring/v2 v2.4.5/go.mod h1:FiJcsfkGje/nZBZgCu0ZxCPOKD/hVXDS2dXi7/eUFE0=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw=
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kktS1LM=
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
github.com/antchfx/htmlquery v1.3.4 h1:Isd0srPkni2iNTWCwVj/72t7uCphFeor5Q8nCzj1jdQ=
github.com/antchfx/htmlquery v1.3.4/go.mod h1:K9os0BwIEmLAvTqaNSua8tXLWRWZpocZIH73OzWQbwM=
github.com/antchfx/xmlquery v1.4.4 h1:mxMEkdYP3pjKSftxss4nUHfjBhnMk4imGoR96FRY2dg=
github.com/antchfx/xmlquery v1.4.4/go.mod h1:AEPEEPYE9GnA2mj5Ur2L5Q5/2PycJ0N9Fusrx9b12fc=
github.com/antchfx/xpath v1.3.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/antchfx/xpath v1.3.4 h1:1ixrW1VnXd4HurCj7qnqnR0jo14g8JMe20Fshg1Vgz4=
github.com/antchfx/xpath v1.3.4/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bits-and-blooms/bitset v1.22.0 h1:Tquv9S8+SGaS3EhyA+up3FXzmkhxPGjQQCkcs2uw7w4=
github.com/bits-and-blooms/bitset v1.22.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/blevesearch/bleve/v2 v2.5.0 h1:HzYqBy/5/M9Ul9ESEmXzN/3Jl7YpmWBdHM/+zzv/3k4=
github.com/blevesearch/bleve/v2 v2.5.0/go.mod h1:PcJzTPnEynO15dCf9isxOga7YFRa/cMSsbnRwnszXUk=
github.com/blevesearch/bleve_index_api v1.2.8 h1:Y98Pu5/MdlkRyLM0qDHostYo7i+Vv1cDNhqTeR4Sy6Y=
github.com/blevesearch/bleve_index_api v1.2.8/go.mod h1:rKQDl4u51uwafZxFrPD1R7xFOwKnzZW7s/LSeK4lgo0=
github.com/blevesearch/geo v0.2.0 h1:f+IE3/C3mGeXDyhtMbWel6BgqBqaOUz43GtWg26GlB0=
github.com/blevesearch/geo v0.2.0/go.mod h1:k8Hyfz12kM8QmeWLhgX7VMMCoVFmttBnr62V5zniXak=
github.com/blevesearch/go-faiss v1.0.25 h1:lel1rkOUGbT1CJ0YgzKwC7k+XH0XVBHnCVWahdCXk4U=
github.com/blevesearch/go-faiss v1.0.25/go.mod h1:OMGQwOaRRYxrmeNdMrXJPvVx8gBnvE5RYrr0BahNnkk=
github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo=
github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M=
github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y=
github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgYICSZ3w0tYk=
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
github.com/blevesearch/scorch_segment_api/v2 v2.3.10 h1:Yqk0XD1mE0fDZAJXTjawJ8If/85JxnLd8v5vG/jWE/s=
github.com/blevesearch/scorch_segment_api/v2 v2.3.10/go.mod h1:Z3e6ChN3qyN35yaQpl00MfI5s8AxUJbpTR/DL8QOQ+8=
github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU=
github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw=
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs=
github.com/blevesearch/upsidedown_store_api v1.0.2 h1:U53Q6YoWEARVLd1OYNc9kvhBMGZzVrdmaozG2MfoB+A=
github.com/blevesearch/upsidedown_store_api v1.0.2/go.mod h1:M01mh3Gpfy56Ps/UXHjEO/knbqyQ1Oamg8If49gRwrQ=
github.com/blevesearch/vellum v1.1.0 h1:CinkGyIsgVlYf8Y2LUQHvdelgXr6PYuvoDIajq6yR9w=
github.com/blevesearch/vellum v1.1.0/go.mod h1:QgwWryE8ThtNPxtgWJof5ndPfx0/YMBh+W2weHKPw8Y=
github.com/blevesearch/zapx/v11 v11.4.1 h1:qFCPlFbsEdwbbckJkysptSQOsHn4s6ZOHL5GMAIAVHA=
github.com/blevesearch/zapx/v11 v11.4.1/go.mod h1:qNOGxIqdPC1MXauJCD9HBG487PxviTUUbmChFOAosGs=
github.com/blevesearch/zapx/v12 v12.4.1 h1:K77bhypII60a4v8mwvav7r4IxWA8qxhNjgF9xGdb9eQ=
github.com/blevesearch/zapx/v12 v12.4.1/go.mod h1:QRPrlPOzAxBNMI0MkgdD+xsTqx65zbuPr3Ko4Re49II=
github.com/blevesearch/zapx/v13 v13.4.1 h1:EnkEMZFUK0lsW/jOJJF2xOcp+W8TjEsyeN5BeAZEYYE=
github.com/blevesearch/zapx/v13 v13.4.1/go.mod h1:e6duBMlCvgbH9rkzNMnUa9hRI9F7ri2BRcHfphcmGn8=
github.com/blevesearch/zapx/v14 v14.4.1 h1:G47kGCshknBZzZAtjcnIAMn3oNx8XBLxp8DMq18ogyE=
github.com/blevesearch/zapx/v14 v14.4.1/go.mod h1:O7sDxiaL2r2PnCXbhh1Bvm7b4sP+jp4unE9DDPWGoms=
github.com/blevesearch/zapx/v15 v15.4.1 h1:B5IoTMUCEzFdc9FSQbhVOxAY+BO17c05866fNruiI7g=
github.com/blevesearch/zapx/v15 v15.4.1/go.mod h1:b/MreHjYeQoLjyY2+UaM0hGZZUajEbE0xhnr1A2/Q6Y=
github.com/blevesearch/zapx/v16 v16.2.3 h1:7Y0r+a3diEvlazsncexq1qoFOcBd64xwMS7aDm4lo1s=
github.com/blevesearch/zapx/v16 v16.2.3/go.mod h1:wVJ+GtURAaRG9KQAMNYyklq0egV+XJlGcXNCE0OFjjA=
github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY=
github.com/campoy/embedmd v1.0.0/go.mod h1:oxyr9RCiSXg0M3VJ3ks0UGfp98BpSSGr0kpiX3MzVl8=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gin-contrib/gzip v0.0.5 h1:mhnVU32YnnBh2LPH2iqRqsA/eR7SAqRaD388jL2s/j0= github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
github.com/gin-contrib/gzip v0.0.5/go.mod h1:OPIK6HR0Um2vNmBUTlayD7qle4yVVRZT0PyhdUigrKk= github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/gzip v1.2.3 h1:dAhT722RuEG330ce2agAs75z7yB+NKvX/ZM1r8w0u2U=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-contrib/gzip v1.2.3/go.mod h1:ad72i4Bzmaypk8M762gNXa2wkxxjbz0icRNnuLJ9a/c=
github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI= github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI=
github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA= github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
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/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b h1:EY/KpStFl60qA17CptGXhwfZ+k1sFNJIUNR8DdbcuUk=
github.com/gomarkdown/markdown v0.0.0-20250311123330-531bef5e742b/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.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v44 v44.1.0 h1:shWPaufgdhr+Ad4eo/pZv9ORTxFpsxPEPEuuXAKIQGA= github.com/google/go-github/v44 v44.1.0 h1:shWPaufgdhr+Ad4eo/pZv9ORTxFpsxPEPEuuXAKIQGA=
github.com/google/go-github/v44 v44.1.0/go.mod h1:iWn00mWcP6PRWHhXm0zuFJ8wbEjE5AGO5D5HXYM4zgw= github.com/google/go-github/v44 v44.1.0/go.mod h1:iWn00mWcP6PRWHhXm0zuFJ8wbEjE5AGO5D5HXYM4zgw=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b h1:wDUNC2eKiL35DbLvsDhiblTUXHxcOPwQSCzi7xpQUN4= github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b h1:wDUNC2eKiL35DbLvsDhiblTUXHxcOPwQSCzi7xpQUN4=
github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b/go.mod h1:VzxiSdG6j1pi7rwGm/xYI5RbtpBgM8sARDXlvEvxlu0= github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b/go.mod h1:VzxiSdG6j1pi7rwGm/xYI5RbtpBgM8sARDXlvEvxlu0=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o= github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak= github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
github.com/kljensen/snowball v0.6.0 h1:6DZLCcZeL0cLfodx+Md4/OLC6b/bfurWUOUGs1ydfOU= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/kljensen/snowball v0.6.0/go.mod h1:27N7E8fVU5H68RlUmnWwZCfxgt4POBJfENGMvNRhldw= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca h1:NugYot0LIVPxTvN8n+Kvkn6TrbMyxQiuvKdEwFdR9vI= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d h1:hrujxIzL1woJ7AwssoOcM/tq5JjjG2yYOc8odClEiXA=
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/temoto/robotstxt v1.1.2 h1:W2pOjSJ6SWvldyEuiFXNxz3xZ8aiWX5LbfDiOFd7Fxg= github.com/temoto/robotstxt v1.1.2 h1:W2pOjSJ6SWvldyEuiFXNxz3xZ8aiWX5LbfDiOFd7Fxg=
github.com/temoto/robotstxt v1.1.2/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo= github.com/temoto/robotstxt v1.1.2/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo=
github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a h1:oIi7H/bwFUYKYhzKbHc+3MvHRWqhQwXVB4LweLMiVy0= github.com/timshannon/bolthold v0.0.0-20240314194003-30aac6950928 h1:zjNCuOOhh1TKRU0Ru3PPPJt80z7eReswCao91gBLk00=
github.com/timshannon/bolthold v0.0.0-20210913165410-232392fc8a6a/go.mod h1:iSvujNDmpZ6eQX+bg/0X3lF7LEmZ8N77g2a/J/+Zt2U= github.com/timshannon/bolthold v0.0.0-20240314194003-30aac6950928/go.mod h1:PCFYfAEfKT+Nd6zWvUpsXduMR1bXFLf0uGSlEF05MCI=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.etcd.io/bbolt v1.4.0 h1:TU77id3TnN/zKr7CO/uk+fBCwF2jGcMuw2B/FMAzYIk=
go.etcd.io/bbolt v1.4.0/go.mod h1:AsD+OCi/qPN1giOX1aiLAha3o1U8rAz65bvN4j0sRuk=
go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M=
golang.org/x/arch v0.16.0 h1:foMtLTdyOmIniqWCHjY6+JxuC54XP1fDwx4N0ASyW+U=
golang.org/x/arch v0.16.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
golang.org/x/image v0.26.0 h1:4XjIFEZWQmCZi6Wv8BoxsDhRU3RVnLX04dToTDAEPlY=
golang.org/x/image v0.26.0/go.mod h1:lcxbMFAovzpnJxzXS3nyL83K27tmqtKzIJpctK8YO5c=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220517181318-183a9ca12b87 h1:cCR+9mKLOGyX4Zx+uBZDXEDAQsvKQ/XbW4vreG5v1jU= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.0.0-20220517181318-183a9ca12b87/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220519141025-dcacdad47464 h1:MpIuURY70f0iKp/oooEFtB2oENcHITo/z1b6u41pKCw= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220519141025-dcacdad47464/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
gonum.org/v1/plot v0.16.0 h1:dK28Qx/Ky4VmPUN/2zeW0ELyM6ucDnBAj5yun7M9n1g=
gonum.org/v1/plot v0.16.0/go.mod h1:Xz6U1yDMi6Ni6aaXILqmVIb6Vro8E+K7Q/GeeH+Pn0c=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=

14
meta/meta.go Normal file
View File

@ -0,0 +1,14 @@
package meta
import (
"fmt"
"runtime"
)
func MemInfo() string {
stats := runtime.MemStats{}
runtime.ReadMemStats(&stats)
return fmt.Sprintf("%.1fMb", float64(stats.Alloc)/1024.0/1024.0)
}

View File

@ -1,15 +0,0 @@
#!/usr/bin/perl
open my $fh, "<", "version/version.go" || die "oops";
while (my $l = <$fh>) {
if ($l =~ m/const Tag = "(.+)"/) {
$tag = $1;
system ('git', 'tag', '-a', $tag, '-m', "version $tag for release") ;
die "could not tag?\n" if $? != 0;
system ('git', 'push', 'origin', $tag);
die "could not push tag?\n" if $? != 0;
exit 0;
}
}
die "no version in version/version.go?\n";

BIN
screenshot_admin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

BIN
screenshot_bookmarklet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
screenshot_search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -2,67 +2,92 @@ package version
import ( import (
"context" "context"
"fmt"
"log"
"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.19" var version string // populated by goreleaser, without leading 'v'
var commit string
var date string
var versionInfo struct { var VersionInfo Info
func init() {
VersionInfo.Remote.Valid = false
VersionInfo.Local.Version = "v" + version
}
type Info struct {
Local struct { Local struct {
Tag string Version string
} }
Remote struct { Remote struct {
Valid bool Valid bool
Tag string Tag string
} }
UpgradeReleaseNotes string
m sync.Mutex m sync.Mutex
} }
func init() { func (vi *Info) UpgradeAvailable() bool {
versionInfo.Remote.Valid = false vi.m.Lock()
versionInfo.Local.Tag = Tag defer vi.m.Unlock()
} if !vi.Remote.Valid {
return false
func Is() string {
return versionInfo.Local.Tag
}
func UpgradeAvailable() (bool, string) {
versionInfo.m.Lock()
defer versionInfo.m.Unlock()
if !versionInfo.Remote.Valid {
return false, ""
} }
if semver.Compare(versionInfo.Local.Tag, versionInfo.Remote.Tag) < 0 {
return true, versionInfo.Remote.Tag log.Printf("checking if upgrade available - local %s remote %s", vi.Local.Version, vi.Remote.Tag)
localValid := semver.IsValid(vi.Local.Version)
remoteValid := semver.IsValid(vi.Remote.Tag)
if !localValid {
log.Printf("version %s invalid", vi.Local.Version)
} }
return false, "" if !remoteValid {
log.Printf("version %s invalid", vi.Remote.Tag)
}
if !localValid || !remoteValid {
return false
}
return semver.Compare(vi.Local.Version, vi.Remote.Tag) < 0
} }
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.Version, *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()
} }

View File

@ -23,6 +23,7 @@
<li> <li>
<a href="#">Admin</a> <a href="#">Admin</a>
<ul class="menu vertical"> <ul class="menu vertical">
<li><a href="/info">System Info</a></li>
<li><a href="/config">Configuration</a></li> <li><a href="/config">Configuration</a></li>
<li><a href="/manage">Manage links</a></li> <li><a href="/manage">Manage links</a></li>
<li><a href="/export">Export all URLs</a></li> <li><a href="/export">Export all URLs</a></li>
@ -34,13 +35,11 @@
</div> </div>
<div class="top-bar-right"> <div class="top-bar-right">
<ul class="menu"> <ul class="menu">
{{ if newVersion }}
<li>
<div><a href="https://github.com/tardisx/linkwallet/releases/tag/{{ newVersion }}">{{ newVersion }} available</a></div>
</li>
{{ end }}
<li class="menu-text"> <li class="menu-text">
{{ version }} {{ version.Local.Version }}
{{ if version.UpgradeAvailable }}
<a href="/info"></a>
{{ end }}
</li> </li>
<li> <li>
<a href="https://github.com/tardisx/linkwallet"> <a href="https://github.com/tardisx/linkwallet">
@ -64,14 +63,15 @@
{{ 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 "info" }}
{{ template "info.html" . }}
{{ end }} {{ end }}
{{/* template "foundation_sample.html" . */}} {{/* template "foundation_sample.html" . */}}
</div> </div>
<!-- <script src="/assets/js/vendor/jquery.js"></script>
<script src="/assets/js/vendor/what-input.js"></script> <script src="/assets/js/vendor/what-input.js"></script>
<script src="/assets/js/vendor/jquery.js"></script>
<script src="/assets/js/vendor/foundation.js"></script> <script src="/assets/js/vendor/foundation.js"></script>
<script src="/assets/js/app.js"></script> --> <script src="/assets/js/app.js"></script>
</body> </body>
</html> </html>

View File

@ -1,18 +1,18 @@
<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>

View File

@ -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

View File

@ -14,7 +14,7 @@
<td>{{ .bookmark.URL }}</td> <td>{{ .bookmark.URL }}</td>
</tr> </tr>
<tr> <tr>
<th>tags</th> <th>Tags</th>
<td> <td>
{{ template "tags_widget.html" .tw }} {{ template "tags_widget.html" .tw }}
</td> </td>
@ -30,7 +30,10 @@
</tr> </tr>
</table> </table>
<p> <p>
<button type="button" hx-confirm="Delete this bookmark permanently?" hx-delete="/edit/{{.bookmark.ID}}" class="alert button">delete</button> <button type="button" hx-confirm="Delete this bookmark permanently?" hx-delete="/edit/{{.bookmark.ID}}" class="alert button">Delete</button>
<button type="button" class="button" hx-post="/edit/{{.bookmark.ID}}">save</button> <button type="button" class="button" hx-indicator="#saving" hx-post="/edit/{{.bookmark.ID}}"> {{ if .saved }} Saved {{ else }} Save {{ end }}</button>
<span id="saving" class="htmx-indicator">
<img style="height:1em;" src="/assets/image/beating.gif" /> Saving...
</span>
</p> </p>
</form> </form>

39
web/templates/info.html Normal file
View File

@ -0,0 +1,39 @@
<div class="grid-x grid-padding-x">
<div class="large-6 medium-12 cell">
<h5>System information</h5>
<table>
<tr><th>Memory in use</th><td>{{ meminfo }}</td></tr>
<tr><th>Bookmarks DB size</th><td>{{ niceSizeMB .stats.FileSize }}Mb</td></tr>
<tr><th>Bookmarks index size</th><td>{{ niceSizeMB .stats.IndexSize }}Mb</td></tr>
<tr><th>Bookmarks</th><td>{{ .stats.MostRecentBookmarkInfo.Bookmarks }}</td></tr>
<tr><th>Total searches</th><td>{{ .stats.Searches }}</td></tr>
</table>
<h5>Database information</h5>
<img src="/graph/bookmarks">
</div>
<div class="large-6 medium-12 cell">
<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.Version }}).
</p>
{{ markdown version.UpgradeReleaseNotes }}
{{ else }}
<p>You are currently running the most recent version.</p>
{{ end }}
{{ end }}
</div>

View File

@ -1,38 +1,19 @@
<div class="grid-x grid-padding-x"> <div class="grid-x grid-padding-x" id="manage">
<div class="large-12 cell"> <div class="large-12 cell">
<h5>Manage links</h5> <h5>Manage links</h5>
<table> <form onsubmit="return false">
<tr> <div class="grid-x grid-padding-x">
<th>&nbsp;</th> <div class="large-12 cell">
<th>title/url</th> <label>Filter</label>
<th>tags</th> <input type="text" name="query" placeholder="" hx-post="/manage/results" hx-swap="outerHTML"
<th class="show-for-large">created</th> hx-trigger="keyup changed delay:500ms, tag_update" hx-target="#manage-results"
<th class="show-for-large">scraped</th> hx-indicator="#htmx-indicator-search" id="manage-search" />
</tr> </div>
{{ range .bookmarks }} </div>
<tr> {{ template "manage_results.html" . }}
<th><a class="button" href="/edit/{{ .ID }}">edit</a></th> </form>
<td>
<a href="{{ .URL }}">{{ .Info.Title }}</a>
<br>
<a href="{{ .URL }}">{{ niceURL .URL }}</a>
</td>
<td>
{{ range .Tags }}
<span class="label primary">{{ . }}</span>
{{ end }}
</td>
<td class="show-for-large">{{ (nicetime .TimestampCreated).HumanDuration }} ago</td>
<td class="show-for-large">{{ (nicetime .TimestampLastScraped).HumanDuration }} ago</td>
<td>
<a class="button" hx-swap="outerHTML" hx-post="/scrape/{{ .ID }}">scrape</button>
</td>
</tr>
{{ end }}
</table>
</div> </div>
</div> </div>

View File

@ -0,0 +1,31 @@
<table id="manage-results">
<tr>
<th>&nbsp;</th>
<th>title</th>
<th>tags</th>
<th>created</th>
<th>scraped</th>
</tr>
{{ range .results }}
<tr>
<th><a class="button" href="/edit/{{ .Bookmark.ID }}">edit</a></th>
<td>
<a href="{{ .Bookmark.URL }}">{{ .Bookmark.Info.Title }}</a>
<br>
<a href="{{ .Bookmark.URL }}">{{ niceURL .Bookmark.URL }}</a>
</td>
<td>
{{ range .Bookmark.Tags }}
<span class="label primary">{{ . }}</span>
{{ end }}
</td>
<td class="show-for-large">{{ (nicetime .Bookmark.TimestampCreated).HumanDuration }} ago</td>
<td class="show-for-large">{{ (nicetime .Bookmark.TimestampLastScraped).HumanDuration }} ago</td>
<td>
<a class="button" hx-swap="outerHTML" hx-post="/scrape/{{ .Bookmark.ID }}">scrape</button>
</td>
</tr>
{{ end }}
</table>

View File

@ -11,7 +11,7 @@
<div class="large-12 cell"> <div class="large-12 cell">
<label>Free text</label> <label>Free text</label>
<input type="text" name="query" placeholder="" hx-post="/search" <input type="text" name="query" placeholder="" hx-post="/search"
hx-trigger="keyup changed delay:50ms, search" hx-target="#search-results" hx-trigger="keyup changed delay:250ms, search" hx-target="#search-results"
hx-indicator="#htmx-indicator-search" /> hx-indicator="#htmx-indicator-search" />
</div> </div>
</div> </div>

View File

@ -1,5 +1,8 @@
<ul> <ul>
{{ range .results }} {{ range .results }}
<li><a href="{{ .URL }}">{{ .Info.Title }}</a> - {{ .URL }}</li> <li>
<a href="{{ .Bookmark.URL }}">{{ .Bookmark.DisplayTitle }}</a><br>
{{ .Highlight }}
</li>
{{ end }} {{ end }}
</ul> </ul>

View File

@ -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"> <div class="small-6 cell" id="tags-list">
{{ range .tags }} {{ range .tags }}
<a href="#" <a href="#"
class="" class=""
@ -20,7 +20,7 @@
<span class="label primary">{{ . }}</span> <span class="label primary">{{ . }}</span>
{{ end }} {{ end }}
<input type="hidden" name="tags_hidden" value="{{ .tags_hidden }}"> <input _="on load send tag_update to #manage-search" type="hidden" id="tags-hidden" name="tags_hidden" value="{{ .tags_hidden }}">
</div> </div>
</div> </div>
</div> </div>

View File

@ -14,12 +14,19 @@ 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"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"gonum.org/v1/plot"
"gonum.org/v1/plot/font"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/vg"
) )
//go:embed static/* //go:embed static/*
@ -42,9 +49,21 @@ type Server struct {
bmm *db.BookmarkManager bmm *db.BookmarkManager
} }
type ColumnInfo struct {
Name string
Param string
Class string
}
// Create creates a new web server instance and sets up routing. // Create creates a new web server instance and sets up routing.
func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server { func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
// Set the default font for graphs
plot.DefaultFont = font.Font{
Typeface: "Liberation",
Variant: "Mono",
}
// setup routes for the static assets (vendor includes) // setup routes for the static assets (vendor includes)
staticFS, err := fs.Sub(staticFiles, "static") staticFS, err := fs.Sub(staticFiles, "static")
if err != nil { if err != nil {
@ -52,7 +71,16 @@ 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,
"niceSizeMB": func(s int) string { return fmt.Sprintf("%.1f", float32(s)/1024/1024) },
"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 {
@ -81,13 +109,39 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
}) })
r.GET("/manage", func(c *gin.Context) { r.GET("/manage", func(c *gin.Context) {
allBookmarks, _ := bmm.ListBookmarks() results, _ := bmm.Search(db.SearchOptions{All: true})
meta := gin.H{"page": "manage", "config": config, "bookmarks": allBookmarks} meta := gin.H{"page": "manage", "config": config, "results": results}
c.HTML(http.StatusOK, c.HTML(http.StatusOK,
"_layout.html", meta, "_layout.html", meta,
) )
}) })
r.POST("/manage/results", func(c *gin.Context) {
query := c.PostForm("query")
results := make([]entity.BookmarkSearchResult, 0)
if query == "" {
results, _ = bmm.Search(db.SearchOptions{All: true, Results: 100})
} else {
results, _ = bmm.Search(db.SearchOptions{Query: query})
}
meta := gin.H{"config": config, "results": results}
colTitle := &ColumnInfo{Name: "Title/URL", Param: "title"}
colCreated := &ColumnInfo{Name: "Created", Param: "created", Class: "show-for-large"}
colScraped := &ColumnInfo{Name: "Scraped", Param: "scraped", Class: "show-for-large"}
cols := gin.H{
"title": colTitle,
"created": colCreated,
"scraped": colScraped,
}
meta["column"] = cols
c.HTML(http.StatusOK, "manage_results.html", meta)
})
r.GET("/config", func(c *gin.Context) { r.GET("/config", func(c *gin.Context) {
meta := gin.H{"page": "config", "config": config} meta := gin.H{"page": "config", "config": config}
c.HTML(http.StatusOK, c.HTML(http.StatusOK,
@ -107,7 +161,14 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
r.POST("/search", func(c *gin.Context) { r.POST("/search", func(c *gin.Context) {
query := c.PostForm("query") query := c.PostForm("query")
sr, err := bmm.Search(query) // no query, return an empty response
if len(query) == 0 {
c.Status(http.StatusNoContent)
c.Writer.Write([]byte{})
return
}
sr, err := bmm.Search(db.SearchOptions{Query: query})
data := gin.H{ data := gin.H{
"results": sr, "results": sr,
"error": err, "error": err,
@ -135,8 +196,16 @@ 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) {
urls := c.PostForm("urls") urls := c.PostForm("urls")
@ -284,7 +353,7 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
bmm.SaveBookmark(&bookmark) bmm.SaveBookmark(&bookmark)
bmm.UpdateIndexForBookmark(&bookmark) // because title may have changed bmm.UpdateIndexForBookmark(&bookmark) // because title may have changed
meta := gin.H{"page": "edit", "bookmark": bookmark, "tw": gin.H{"tags": bookmark.Tags, "tags_hidden": strings.Join(bookmark.Tags, "|")}} meta := gin.H{"page": "edit", "bookmark": bookmark, "saved": true, "tw": gin.H{"tags": bookmark.Tags, "tags_hidden": strings.Join(bookmark.Tags, "|")}}
c.HTML(http.StatusOK, c.HTML(http.StatusOK,
"edit_form.html", meta, "edit_form.html", meta,
@ -309,9 +378,80 @@ func Create(bmm *db.BookmarkManager, cmm *db.ConfigManager) *Server {
) )
}) })
r.GET("/info", func(c *gin.Context) {
dbStats, err := bmm.Stats()
if err != nil {
panic("could not load stats for info page")
}
meta := gin.H{"page": "info", "stats": dbStats, "config": config}
c.HTML(http.StatusOK,
"_layout.html", meta,
)
})
r.GET("/graph/:type", func(c *gin.Context) {
graphType := c.Param("type")
p := plot.New()
dbStats, err := bmm.Stats()
if err != nil {
panic("could not load stats for graph page")
}
sortedKeys := make([]time.Time, 0)
for k := range dbStats.History {
sortedKeys = append(sortedKeys, k)
}
sort.Slice(sortedKeys, func(i, j int) bool {
return sortedKeys[i].Before(sortedKeys[j])
})
xTicks := plot.TimeTicks{Format: "2006-01-02"}
p.X.Tick.Marker = xTicks
plotPoints(sortedKeys, dbStats, p, graphType)
writerTo, err := p.WriterTo(vg.Points(640), vg.Points(480), "png")
if err != nil {
panic("error creating WriterTo: " + err.Error())
}
c.Header("Content-Type", "image/png")
writerTo.WriteTo(c.Writer)
})
return server return server
} }
func plotPoints(sortedKeys []time.Time, dbStats entity.DBStats, p *plot.Plot, k string) {
if k == "bookmarks" {
p.Title.Text = "Bookmarks over time"
p.Y.Label.Text = "Bookmarks"
} else {
panic("bad k")
}
p.X.Label.Text = "Date"
pts := make(plotter.XYs, len(sortedKeys))
for i := range sortedKeys {
pts[i].X = float64(sortedKeys[i].Unix())
if k == "bookmarks" {
pts[i].Y = float64(dbStats.History[sortedKeys[i]].Bookmarks)
} else {
panic("bad key")
}
}
l, err := plotter.NewLine(pts)
if err != nil {
panic(err)
}
p.Add(l)
}
// headersByURI sets the headers for some special cases, set a custom long cache time for // headersByURI sets the headers for some special cases, set a custom long cache time for
// static resources. // static resources.
func headersByURI() gin.HandlerFunc { func headersByURI() gin.HandlerFunc {
@ -332,7 +472,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{}
@ -356,6 +499,7 @@ func niceTime(t time.Time) timeVariations {
panic(err) panic(err)
} }
ago := durafmt.Parse(time.Since(t)).LimitFirstN(1).Format(units) ago := durafmt.Parse(time.Since(t)).LimitFirstN(1).Format(units)
ago = strings.ReplaceAll(ago, " ", "")
return timeVariations{HumanDuration: ago} return timeVariations{HumanDuration: ago}
} }