Update Dependencies and Replace mattn/go-sqlite with modernc.org/sqlite (#345)

* No more CGO

* Update all dependencies to current

* Only test against go 1.17.
This commit is contained in:
n8225 2022-02-11 06:59:49 -06:00 committed by GitHub
parent 91e1bc85b4
commit f1c98a8e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 1054 additions and 63 deletions

10
.github/FUNDING.yml vendored
View file

@ -1,10 +0,0 @@
# These are supported funding model platforms
open_collective: # Replace with a single Open Collective username
# ko_fi: radhifadlillah
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
# custom: ['https://www.paypal.me/RadhiFadlillah']

View file

@ -14,7 +14,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
go-version: 1.17.x
- name: Check out code
uses: actions/checkout@v2
@ -29,7 +29,7 @@ jobs:
name: Unit tests
strategy:
matrix:
go-version: [1.12.x, 1.13.x, 1.14.x]
go-version: [1.17.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:

78
go.mod
View file

@ -1,29 +1,61 @@
module github.com/go-shiori/shiori
go 1.12
go 1.17
require (
github.com/PuerkitoBio/goquery v1.5.0
github.com/disintegration/imaging v1.6.0
github.com/fatih/color v1.7.0
github.com/go-shiori/go-readability v0.0.0-20190809152430-5413e9c4ec86
github.com/go-shiori/warc v0.0.0-20191003110312-7b3c5582fd83
github.com/go-sql-driver/mysql v1.4.1
github.com/gofrs/uuid v3.2.0+incompatible
github.com/jmoiron/sqlx v1.2.0
github.com/julienschmidt/httprouter v1.2.0
github.com/lib/pq v1.1.1
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mattn/go-isatty v0.0.7 // indirect
github.com/mattn/go-sqlite3 v1.10.0
github.com/muesli/go-app-paths v0.0.0-20181030220709-913f7f7ac60f
github.com/PuerkitoBio/goquery v1.8.0
github.com/disintegration/imaging v1.6.2
github.com/fatih/color v1.13.0
github.com/go-shiori/go-readability v0.0.0-20210627123243-82cc33435520
github.com/go-shiori/warc v0.0.0-20200621032813-359908319d1d
github.com/go-sql-driver/mysql v1.6.0
github.com/gofrs/uuid v4.2.0+incompatible
github.com/jmoiron/sqlx v1.3.4
github.com/julienschmidt/httprouter v1.3.0
github.com/lib/pq v1.10.4
github.com/muesli/go-app-paths v0.2.2
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414 // indirect
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect
golang.org/x/tools v0.0.0-20190809145639-6d4652c779c4 // indirect
google.golang.org/appengine v1.6.1 // indirect
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.3.0
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838
modernc.org/sqlite v1.14.6
)
require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/coreos/go-etcd v2.0.0+incompatible // indirect
github.com/cpuguy83/go-md2man v1.0.10 // indirect
github.com/go-shiori/dom v0.0.0-20210627111528-4e4722cd0d65 // indirect
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/tdewolff/parse v2.3.4+incompatible // indirect
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.9 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
lukechampine.com/uint128 v1.2.0 // indirect
modernc.org/cc/v3 v3.35.22 // indirect
modernc.org/ccgo/v3 v3.15.13 // indirect
modernc.org/libc v1.14.5 // indirect
modernc.org/mathutil v1.4.1 // indirect
modernc.org/memory v1.0.5 // indirect
modernc.org/opt v0.1.1 // indirect
modernc.org/strutil v1.1.1 // indirect
modernc.org/token v1.0.0 // indirect
)

1003
go.sum

File diff suppressed because it is too large Load diff

View file

@ -90,8 +90,8 @@ func getDataDir(portableMode bool) (string, error) {
}
// Try to use platform specific app path
userScope := apppaths.NewScope(apppaths.User, "shiori", "shiori")
dataDir, err := userScope.DataDir()
userScope := apppaths.NewScope(apppaths.User, "shiori")
dataDir, err := userScope.DataPath("shiori.db")
if err == nil {
return dataDir, nil
}

View file

@ -9,6 +9,7 @@ import (
"image/jpeg"
"io"
"math"
"net/url"
"os"
"path"
fp "path/filepath"
@ -66,9 +67,14 @@ func ProcessBookmark(req ProcessRequest) (model.Bookmark, bool, error) {
// If this is HTML, parse for readable content
var imageURLs []string
if strings.Contains(contentType, "text/html") {
isReadable := readability.IsReadable(readabilityCheckInput)
isReadable := readability.Check(readabilityCheckInput)
article, err := readability.FromReader(readabilityInput, book.URL)
nurl, err := url.Parse(book.URL)
if err != nil {
fmt.Errorf("Failed to parse url: %v", err)
}
article, err := readability.FromReader(readabilityInput, nurl)
if err != nil {
return book, false, fmt.Errorf("failed to parse article: %v", err)
}

View file

@ -20,7 +20,7 @@ type SQLiteDatabase struct {
// OpenSQLiteDatabase creates and open connection to new SQLite3 database.
func OpenSQLiteDatabase(databasePath string) (sqliteDB *SQLiteDatabase, err error) {
// Open database and start transaction
db := sqlx.MustConnect("sqlite3", databasePath)
db := sqlx.MustConnect("sqlite", databasePath)
tx, err := db.Beginx()
if err != nil {
@ -71,7 +71,7 @@ func OpenSQLiteDatabase(databasePath string) (sqliteDB *SQLiteDatabase, err erro
CONSTRAINT bookmark_id_FK FOREIGN KEY(bookmark_id) REFERENCES bookmark(id),
CONSTRAINT tag_id_FK FOREIGN KEY(tag_id) REFERENCES tag(id))`)
tx.MustExec(`CREATE VIRTUAL TABLE IF NOT EXISTS bookmark_content USING fts4(title, content, html)`)
tx.MustExec(`CREATE VIRTUAL TABLE IF NOT EXISTS bookmark_content USING fts5(title, content, html, docid)`)
// Alter table if needed
tx.Exec(`ALTER TABLE account ADD COLUMN owner INTEGER NOT NULL DEFAULT 0`)
@ -215,7 +215,7 @@ func (db *SQLiteDatabase) GetBookmarks(opts GetBookmarksOptions) ([]model.Bookma
`b.author`,
`b.public`,
`b.modified`,
`bc.content <> "" has_content`}
`bc.content <> "" has_content`,}
if opts.WithContent {
columns = append(columns, `bc.content`, `bc.html`)

View file

@ -9,7 +9,7 @@ import (
// Database driver
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
_ "modernc.org/sqlite"
// Add this to prevent it removed by go mod tidy
_ "github.com/shurcooL/vfsgen"