Commit graph

551 commits

Author SHA1 Message Date
Felipe Martin
5f1adc6c34
fix(db): avoid using dash in fts5 queries (#514)
* fix(sqlite): avoid using dash in fts5 queries

* test(db): get bookmarks and count with dash in keyword

* test(db): common and ad-hoc sqlite test case
2022-10-15 11:33:29 +02:00
Felipe Martin Garcia
4de21eaf40
fix: avoid panic usage when downloading bookmark (#513)
Removed the usage of `panic()` when downloading a bookmark and simply
return an error that has to be checked by implementations.

Right now the API will continue if the bookmark download fails (either
sync or async) but will leave a log with the error cause, so the users
have the bookmark stored even if the archival didn't actually happen
(but can be done manually later on).

Fixes #459
2022-10-14 13:37:24 +02:00
Acelya
ed5a3bcbb9
fix: failed to save bookmark: constraint failed: UNIQUE constraint failed: bookmark.url (#515)
After a first bookmark save, all subsequent ones fail because the update
query does not include an identifier and the update is done on all rows.

Introduced by 05fee53bd0
2022-10-13 19:18:40 +02:00
Felipe Martin Garcia
4ea81a446a
chore(deps): updated go and github actions dependencies (#511)
* deps(go): updated dependencies

* deps(github_actions): updated dependencies
2022-10-12 00:10:55 +02:00
Felipe Martin Garcia
20b4efa49b
Added dependabot configuration 2022-10-11 23:55:18 +02:00
Felipe Martin Garcia
05fee53bd0
fix: saving bookmarks inconsistencies (#500)
* chore: updated go-migrate dependencies

* fix: specify if we're saving bookmarks expecting a creation

up until now the SaveBookmarks method was doing some "magic" to do
"upserts" on the databases, but consistency between engines was scarce
and not knowing if we were expecting saving a new bookmark or updating
an existing one was leading to errors and inconsistencies in logic all
around the place. Now we need to specify a creation boolean when
saving and a differnt query will be make (INSERT vs UPDATE).

* fix(api): using incorrect bookmark for content downlaod

* test(db): added test pipeline for databases

Added functions that will share logic among the engines and will be
called on fresh databases on each test run

* dev: added basic docker-compose for development

* chore: uncommented tests

* ci(test): added mysql service

* typo

* test(mysql): select database after reset

* fix(mysql): ignore empty row errors when parsing tags

* fix(mysql): handle insert errors

* chore: added mysql variables to compose

* ci: explicit mysql service port exposed
2022-10-11 23:47:38 +02:00
Acelya
040dc5c5d1
fix: failed to save bookmark: context canceled (#499)
When the HTTP request completes, the asynchronous bookmarks save may be incomplete.
In this case, the shared context is canceled and saving bookmarks fails.

Introduced by 09f2465065
2022-10-11 18:08:21 +02:00
Felipe Martin Garcia
222fc14fe2
fix: remove CreateNewID usage from api handlers (#486) 2022-10-09 18:56:12 +02:00
Felipe Martin Garcia
158c52a325
fix: data dir permissions having execute for all (#493) 2022-10-09 18:50:42 +02:00
Felipe Martin Garcia
d0210447d2
fix: import should respect add_date or last_modified fields (#490)
* fix: handle last_modified and add_date in imports

* refactor: moved date format to a constant

* fix: use provided modified date when set
2022-10-09 17:05:52 +02:00
Felipe Martin Garcia
dc73cd825b
fix(psql): save bookmarks not using passed bookmark id for the insert (#484)
* fix(psql): get last inserted id from insert query

book.ID was not being used, so inserts were failing.
the check for book.ID was removed and it is filled with the returning
id from the insert query

* test(psql): added save bookmarks simple test

* ci: added postgresql service

* fix(typo): QueryRow -> QueryRowContext

* ci: explicit postgresql port

* ci(test): 1.19 only

* ci: bind psql to localhost

* test(pg): migrate before test

* test(pg): migrate database before test

* fix(pg): check no rows error on get query
2022-10-09 17:05:30 +02:00
hulb
821b69d76c
fix err in keyword searching (#494) 2022-10-09 17:05:01 +02:00
Felipe Martin Garcia
d15dc18674
Update issue templates 2022-10-08 13:12:02 +02:00
Felipe Martin Garcia
460014581c
fix(import): check for no rows error (#487) 2022-10-04 13:54:33 +02:00
hulb
09f2465065
refactor:pass ctx to db layer, return err instead of recover panic (#450) 2022-09-30 12:19:36 +02:00
Bastien Rivière
39cb64222f
docs: fix remember represented as a number instead of a bool (#472)
Changed in pull request: https://github.com/go-shiori/shiori/pull/346
2022-09-30 12:17:05 +02:00
Felipe Martin Garcia
3deeda7151
feat: upgrade to go 1.19 (#469)
* feat: upgrade to go 1.19

* fix: ioutil deprecation notice
2022-08-11 14:22:10 +02:00
Felipe Martin Garcia
c8fec2a265
fix: remove manual transaction on sqlite migration 2 (#468) 2022-08-11 13:40:17 +02:00
Andriy Kushnir
0246e10dff
feat: improve performance for sqlite queries (#425)
* [sqlite] Added has_content column and relevant migration

* Fix typo in docstring

* [sqlite] Fetch content for bookmarks separately

* [sqlite] Store has_content alongside with bookmark

* [sqlite] Rename variable to distinguish it from main query

* [sqlite] Use by-reference instead of no-op copy

* [sqlite] Reduce queries count from ≈30 to 1 to fetch tags

* Lint fixes

* Make minor logging improvements

* Wrap entire migration in transaction block

* Added «down» migration

* Drop workaround for old SQLite versions
2022-08-08 20:52:33 +02:00
Kim Kar
f5652a5bbf
Fix docker migration script example (#451)
The example docker command given was invalid, as `docker run` operates on images, not containers.
2022-07-23 12:26:32 +02:00
Felipe Martin Garcia
cba5046231
feat: session expire time from backend (#437)
* feat: session expire time from backend

Deduplicated logic from backend and frontend where we needed to take the
login checkbox into account for both back and front codebases. Now the
backend will send the frontend the expire time calculated only in one
place.

This is part of a multi-step process that will store sessions in
database, but this will ease the maintenance of this section for now.

* chore: remove test logger
2022-07-23 11:32:53 +02:00
hulb
7e1824a8b5
fix invalid assets path when use webroot (#448)
Co-authored-by: hulb <hulb@RD-NeoHu.netis.com.cn>
2022-07-08 11:26:37 +02:00
jmbmkn
f000f11bfa
Update Usage.md (#435)
Fix tiny typo in Wallabag import commands
2022-06-23 09:08:05 +02:00
Felipe Martin Garcia
3422035bfa
docs: updated pocket import script
The import script was pointing to a faulty gist with an error, I've forked and fixed the error as @questor pointed out in the comments and #426.

Fixes #426
2022-05-26 21:42:55 +02:00
Felipe Martin
f72f050835
docs: fixed outdated volume path reference 2022-05-26 21:35:29 +02:00
Felipe Martin Garcia
0bf1a4875c
docs: migrate documentation from the wiki (#394)
* docs: migrate documentation from the wiki

* docs: updated docker image url

* docs: added migrations section

* docs: fixed index link
2022-05-26 19:49:30 +02:00
hulb
2b1ddd093d
replace assets generation with embed (#423) 2022-05-26 19:36:23 +02:00
Felipe Martin Garcia
9397832485
fix: amd64 build paths (#429) 2022-05-26 19:29:11 +02:00
Felipe Martin Garcia
7394b1060a
chore: update go dependencies (#424) 2022-05-05 21:15:52 +02:00
hulb
8732fd7b6d
implement migration for mysql & postgres (#422) 2022-05-03 23:30:28 +02:00
Felipe Martin Garcia
ce8a172682
fix: bookmark content download (#413)
Fixed a bug where the content of the article would archive but the
reader version would not be saved due to variable passing. Also made the
code easier to follow by following return principles.

Fixes #406
2022-03-27 21:01:49 +02:00
Felipe Martin Garcia
0fe24d2598
fix: url modification when query param is empty (#411)
This commit fixes URL malformation when trying to remove the utm social
query parameters from an URL, which upon finishing and reconstructing
would attach the equal symbol even if the original URL didn't have it.

This is a known Go "bug" [1] that isn't going to be "fixed". I quote
that because server side should behave the same for `?a=&b=1` and
`?a&b=1` for the `a` parameter, but sometimes that's not the case.

[1]: https://github.com/golang/go/issues/20820

Fixes #409
2022-03-27 21:01:39 +02:00
Felipe Martin Garcia
81d52a2e24
feat: sqlite migrations (#398)
- Moved migrations from code to SQL files
- Using golang-migrate/v4
- Added a new CLI command: migrate
2022-03-26 08:33:57 +01:00
Tung Le
ca3cc11b2d
sqlite: remove unneeded LEFT JOIN to improve performance (#387)
* sqlite: remove unneeded LEFT JOIN to improve performance

* Fix handling join clause in GetBookmarks

* Revert changes in GetBookmarks
2022-03-10 23:32:58 +01:00
My6UoT9
b68092c6b4
Heroku buildpack support in go.mod (#388) 2022-03-01 13:40:42 +01:00
Felipe Martin Garcia
560a677f50
fix: trying to mkdir over an incorrect data path (#378) 2022-02-23 19:00:16 +01:00
Emmanuel Frecon
e1e2c7bfd8
Web Server and CI Improvements (#374)
* Fix for infinite redirect loop

path.Join trims the trailing slash if the path isn't /, use configured
root instead.

* Add repo root independence

This makes the workflows agnostic of the repository root, making it
possible to build in forked repos.

* Add HTTP request logging

* Fix proper RootPath handler

* Add logging for all resources

This adds proper logging for all resources, including errors. Logging
is on by default, but can be turned off.

* Report effective length of written data
2022-02-19 08:22:50 +01:00
Felipe M
feb150f8c6
ci: github action to notify releases via irc 2022-02-15 17:39:02 +01:00
Felipe M
3c8a66f8f8
chore: updated readme 2022-02-14 20:00:45 +01:00
n8225
2b4fd9f0cb
Remove unneeded alter table transactions from sqlite (#372) 2022-02-14 19:49:46 +01:00
Felipe Martin Garcia
0bd297d63c
fix: update bookmark on sqlite database (#367)
It used an update and insert at the same time, since the virtual table
cannot have constrants nor upserts we need to try an update the
bookmark content to check for it's existence, inserting it only if the
update fails (don't affect any rows).

This will need to be improved in the future, since not all bookmark
updates require modification of the content table (in my case, I was
testing only updating tags).
2022-02-13 21:28:40 +01:00
Felipe Martin Garcia
fb0bf38b7e
feat: async content download when creating via api (#368)
* feat: async content download when creating via api

Invoking the content download code in a goroutine after saving the
bookmark, this way we can return a response to the user quickly while
the webpage is donwloaded and archived.

Cache api endpont (/api/cache) remains untouched until I understand
the logic behind it.

Also updated the API endpoint for the extension, though I'm unsure why
there's a difference between the "regular" API and the webext API,
they should be using the same APIs.
2022-02-13 21:09:42 +01:00
n8225
d05d1ad2c0
Setup new CI/CD workflows (#365)
* CI/CD setup
* Setup for go-shiori
* Fix docker image
* Dockerfile adjustments
2022-02-13 16:38:54 +01:00
Felipe Martin Garcia
a76b121098
fix: golangci-lint errors (#366) 2022-02-13 16:38:27 +01:00
Felipe M
2ca628b7fe
hotfix: fixes session duration from #346 2022-02-11 16:00:38 +01:00
Felipe M
2dc462b010
docs: updated readme docker links 2022-02-11 14:12:15 +01:00
Felipe Martin Garcia
d56993292b
fix: remember me session duration (#346)
- Default session duration is 1h
- Increased session duration (when remember me is checked) is
  increased to 30d.
2022-02-11 14:05:34 +01:00
n8225
f1c98a8e98
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.
2022-02-11 13:59:49 +01:00
Felipe M
91e1bc85b4
chore: stalebot for pull requests 2022-02-10 23:03:49 +01:00
Felipe M
d70a8f2692
chore: configuration for stale bot 2022-02-10 22:55:54 +01:00