* 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
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
* 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
* [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
* 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
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
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
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/20820Fixes#409
* 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
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).
* 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.