Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ac74ce4f4 | |||
| e808f28554 | |||
| afcb88ae1b | |||
| def4e35cc9 | |||
| 2ba4066643 | |||
| 4cac81aab0 | |||
| c4947d24b8 | |||
| 194fc9eeb4 | |||
| 6f1ef7c75c |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
content/corpora/* linguist-vendored
|
||||||
72
.github/workflows/codeql-analysis.yml
vendored
Normal file
72
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
# 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
|
||||||
25
.github/workflows/go.yml
vendored
Normal file
25
.github/workflows/go.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
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 ./...
|
||||||
@@ -21,7 +21,7 @@ dockers:
|
|||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
- "--platform=linux/amd64"
|
- "--platform=linux/amd64"
|
||||||
nfpms:
|
nfpms:
|
||||||
-
|
-
|
||||||
id: default
|
id: default
|
||||||
package_name: linkwallet
|
package_name: linkwallet
|
||||||
file_name_template: "{{ .ConventionalFileName }}"
|
file_name_template: "{{ .ConventionalFileName }}"
|
||||||
@@ -86,6 +86,7 @@ changelog:
|
|||||||
sort: asc
|
sort: asc
|
||||||
filters:
|
filters:
|
||||||
exclude:
|
exclude:
|
||||||
|
- '^Merge:'
|
||||||
- '^docs:'
|
- '^docs:'
|
||||||
- '^test:'
|
- '^test:'
|
||||||
- '^[Bb]ump'
|
- '^[Bb]ump'
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -32,6 +32,14 @@ A self-hosted bookmark database with full-text page content search.
|
|||||||
mountpoint.
|
mountpoint.
|
||||||
* Run `docker-compose up -d`
|
* Run `docker-compose up -d`
|
||||||
|
|
||||||
|
## Packages (deb/rpm)
|
||||||
|
|
||||||
|
* Download the .deb or .rpm from the releases
|
||||||
|
* 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
|
||||||
|
|
||||||
* Download the appropriate binary from the releases page
|
* Download the appropriate binary from the releases page
|
||||||
@@ -44,10 +52,6 @@ A self-hosted bookmark database with full-text page content search.
|
|||||||
* Checkout the code
|
* Checkout the code
|
||||||
* `go build cmd/linkwallet/linkwallet.go`
|
* `go build cmd/linkwallet/linkwallet.go`
|
||||||
|
|
||||||
## deb/rpm packages
|
|
||||||
|
|
||||||
Coming soon.
|
|
||||||
|
|
||||||
# Using
|
# Using
|
||||||
|
|
||||||
linkwallet is a 100% web-driven app. After running, hit the web interface
|
linkwallet is a 100% web-driven app. After running, hit the web interface
|
||||||
@@ -66,5 +70,4 @@ will not work.
|
|||||||
* delete
|
* delete
|
||||||
* sorting
|
* sorting
|
||||||
* More tag options
|
* More tag options
|
||||||
* search for tags
|
|
||||||
* bookmarklet with pre-filled tags
|
* bookmarklet with pre-filled tags
|
||||||
@@ -131,8 +131,6 @@ func (m *BookmarkManager) Search(query string) ([]entity.Bookmark, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.Printf("counts: %#v", counts)
|
|
||||||
|
|
||||||
for k, v := range counts {
|
for k, v := range counts {
|
||||||
if v == uint8(len(words)) {
|
if v == uint8(len(words)) {
|
||||||
rets = append(rets, k)
|
rets = append(rets, k)
|
||||||
@@ -157,6 +155,7 @@ func (m *BookmarkManager) ScrapeAndIndex(bm *entity.Bookmark) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
words := content.Words(bm)
|
words := content.Words(bm)
|
||||||
|
words = append(words, bm.Tags...)
|
||||||
log.Printf("index for %d %s (%d words)", bm.ID, bm.URL, len(words))
|
log.Printf("index for %d %s (%d words)", bm.ID, bm.URL, len(words))
|
||||||
m.db.UpdateIndexForWordsByID(words, bm.ID)
|
m.db.UpdateIndexForWordsByID(words, bm.ID)
|
||||||
|
|
||||||
|
|||||||
@@ -92,3 +92,52 @@ func TestAddRemove(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTagIndexing(t *testing.T) {
|
||||||
|
ts := newTestServer()
|
||||||
|
defer ts.Close()
|
||||||
|
serverResponse = "<p>the quick brown fox</p>"
|
||||||
|
|
||||||
|
db := DB{}
|
||||||
|
f, _ := os.CreateTemp("", "test_boltdb_*")
|
||||||
|
f.Close()
|
||||||
|
defer os.Remove(f.Name())
|
||||||
|
db.Open(f.Name())
|
||||||
|
|
||||||
|
bmm := NewBookmarkManager(&db)
|
||||||
|
bm := entity.Bookmark{URL: ts.URL}
|
||||||
|
|
||||||
|
err := bmm.AddBookmark(&bm)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error adding: %s", err)
|
||||||
|
}
|
||||||
|
if bm.ID == 0 {
|
||||||
|
t.Error("bookmark did not get an id")
|
||||||
|
}
|
||||||
|
err = bmm.ScrapeAndIndex(&bm)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("scrape index returned %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
searchRes, err := bmm.Search("fox")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("search returned %s", err)
|
||||||
|
}
|
||||||
|
if len(searchRes) != 1 {
|
||||||
|
t.Error("did not get one id")
|
||||||
|
}
|
||||||
|
|
||||||
|
// add a tag
|
||||||
|
bm.Tags = []string{"sloth"}
|
||||||
|
err = bmm.ScrapeAndIndex(&bm)
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("scrape index returned %s", err)
|
||||||
|
}
|
||||||
|
searchRes, err = bmm.Search("sloth")
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("search returned %s", err)
|
||||||
|
}
|
||||||
|
if len(searchRes) != 1 {
|
||||||
|
t.Error("did not get one id for sloth")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"golang.org/x/mod/semver"
|
"golang.org/x/mod/semver"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Tag = "v0.0.15"
|
const Tag = "v0.0.16"
|
||||||
|
|
||||||
var versionInfo struct {
|
var versionInfo struct {
|
||||||
Local struct {
|
Local struct {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>linkwallet</title>
|
<title>linkwallet</title>
|
||||||
<link rel="stylesheet" href="/assets/css/foundation.css">
|
<link rel="stylesheet" href="/assets/css/foundation.min.css">
|
||||||
<link rel="stylesheet" href="/assets/css/app.css">
|
<link rel="stylesheet" href="/assets/css/app.css">
|
||||||
<script src="/assets/js/htmx.min.js" defer></script>
|
<script src="/assets/js/htmx.min.js" defer></script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user