Commit graph

507 commits

Author SHA1 Message Date
Felipe M 1d52569731
fix(ci): rc handling 2023-09-11 19:19:18 +02:00
Felipe Martin ef1d18d81f
fix(db): handle usage of special characters in searches (#721)
* handle full text search for failing cases

* added test

* test getbookmarkcount too

* replaceall, fix getbookmarkcount
2023-09-11 18:20:09 +02:00
Monirzadeh f4817cb9c3
fix: Ensure bookmark files are correctly downloaded before deleting current ones (#683)
* generate ebook get dstPath

* Archive and ebook can recover if download faild

* recover thumb if download faild

* thumb image create just if image processing is sucssesful

* create epub in tmp if it sucssesful copy to destination

* archive file create in tmp if it successful move to destination

* move to destination as function

* update ebook download api and remove .epub from file name

* report faild item to user

* not show dialog if error not happen

* update thumbnail based on last status of bookmark fix #524

* better warning massage

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* tmpFile without .epub

* MoveToDestination change to MoveFileToDestination

* return .epub

* log if downloadBookImage return error

* fix bug remove imgPath just if download last image be unsuccessful

* update old unit test

* add processing.go unit test

* small massage for report failded item to the user

* add some more unit test and samplefile

* use sample image in unit test

* use local sample file and unit test not need internet connection anymore

* update error to user and log that too

* add more comment

* update comment

* change variable name parentDir to dstDir

* more simpler error handling

* remove unneeded defer

* remvoe unneeded epubWriter.Close()

* more readable unit test in processing

* more readable unit test for ebooks

* delete all defer os.RemoveAll from unit tests

* Better comment

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* Better Error output

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* fix err.String() method

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-08-20 18:20:13 +02:00
Felipe Martin 8b015a3850
Swagger improvements (#666)
* refactor: swagger docs into a folder

* added scripts for the swaggger tasks

* check version and fmt

* CI

* formatted swag comments

* using custom delims

* revert custom delims

* swag 1.16.1

* update swagger docs

* avoid make swagger output

* swagger check

* test

* swag-fmt

* swagger run

* gofmt

* avoid swag-fmt check for now due to inconsistencies with gofmt

* re-enabled by using go fmt afterwards

* use newer swag in CI

* add gopath to path

* using go binary instead of unset env

* alternative

* correct swag version

* formatted

* formatted

* correct go fmt command

* make swagger

* swagger-check -> swag-check

* run swag-check on lint
2023-08-12 08:38:52 +02:00
arakimo 2e1016e5f1
preserve fragment in URLs (#315) (#687)
* preserve fragment in URLs (#315)

* fix: correctly handle URLs without a fragment

* simplify solution to (#315)
2023-08-05 09:04:25 +02:00
Felipe Martin e5f2de0930
Fix CI incorrectly tagging RC releases and disables docker builds on forks (#686)
* properly tag rc releases

* avoid builds on forked prs

* simplify condition
2023-07-30 08:12:23 +02:00
Felipe Martin 307f293430
chore: remove verbose logger (#685) 2023-07-30 07:59:36 +02:00
Felipe Martin e0d4537b37
default to sqlite, warn dbms users (#667) 2023-07-30 07:41:32 +02:00
Felipe Martin a60f65f24e
fix: title overwritten if user has defiend it (#684) 2023-07-29 09:24:12 +02:00
Felipe Martin faa1ae9435
chore: remove irc badge from readme (#674) 2023-07-26 09:10:35 +02:00
Felipe Martin 2cbc592ece
Show Shiori version on server command (#669)
Fixes #668
2023-07-22 18:44:03 +02:00
Felipe Martin 622d556fde
fix: title is never retrieved when adding bookmark (#664)
* fix: title is never retrieved when adding bookmark

Fixes #654
2023-07-21 16:14:34 +02:00
Felipe Martin 6c41661b61
fix: pr tag prune using other action (#656) 2023-07-21 10:40:43 +02:00
Felipe Martin b70ab19905
fix: package-name in cleanup tag (#655) 2023-07-21 09:51:30 +02:00
Felipe Martin c5c7a5f600
Show version in login page (#652) 2023-07-21 09:25:19 +02:00
Felipe Martin 7776881eef
fix: workflow delete tags input (#653) 2023-07-21 08:09:44 +02:00
Felipe Martin 888d053b2d
Allow JWT authentication into legacy APIs (#651)
* typo: letter in login page

* httpconfig set defaults for secret key with warn

* allow new authentication in old api

* Updated warn log
2023-07-21 07:57:42 +02:00
Felipe Martin 454f21789d
fix: docker buildx tags (#650) 2023-07-19 18:50:57 +02:00
Felipe Martin a60dbf3dc5
Run legacy API and new API at the same time. (#648)
* config: backwards comptabile dir

* remove duplicated frontend

* frontend: move assets to assets folder

* legacy routes handler in gin

* templates and asset in different embed

* new routes

* frontend routes serve old views

* added DTO for account object

* api auth calls legacy handler

* frontend: handle new error messages

* frontend: update urls

* frontend: login using new api

* updated frontend tests

* chore: remove debug route

* create shiori/gopher user if no owner is present

* server as default command

* serve -> server

* refactored database logic, allow database url

* removed unused configuration

* storage docs

* refactor cli to use cfg and deps

* check errors only in server

* log fatal instead of os exit

* dont default data directory to current dir

* fixed sqlite path

* trigger build on prs

* avoid releasing if lint/test fails

* pull request condition

* event -> event_name

* Get correct pull request number

* added workflow to delete dangling tags

* fix: nil error checking

* set gin mode first

* set gin mode before initialization

* fix logger

* allow version bump from custom ref

* Updated matrix link to workspace
2023-07-19 18:25:41 +02:00
Felipe Martin 6f19c12c95
Start working on new REST API. Refactor logic in domains. (#497)
* added 404 template

* added auth domain

* added embed file for frontend

* added base config and dependencies

* added basic new http server

* added separated server command

* updated go modules

* removed modd file

* Added shortcut to send internal server error response

* Added JWT support to Auth Domain

* Added JWT support to API

* docs: added comments to response struct

* naming

* inline returns

* updated dependencies

* production logger

* bookmarks endpoint

* reverted old views api path

* frontend for api v1

* proper 404 error (not working atm)

* use response

* removed 404 html

* server error handler

* login and basic auth

* adjusted session duration

* properly retrieve tags

* properly delete bookmark

* cleanup

* archiver domain

* debug routes

* bookmark routes

* expiration by parameter

* move to logrus

* logout

* frontend cache

* updated dependencies

* http: migrated to gin

* linted

* Added version command

* unit tests, docs

* response test utils and tests

* remove logout handler

* auth

* createtag

* improved http test utilities

* assert message equals

* Remove 1.19 from test matrix

* moved api to v1 folder

* docs: contribute docs

* updated makefile

* updated usage docs

* warn in server command

* updaed docs with shiori version command

* Updated documentation

* deps: update
2023-07-17 14:30:18 +01:00
Monirzadeh 78a7578f5c
fix download data image fix #645 (#646) 2023-07-15 19:04:14 +01:00
Ryan Gonzalez e02d3e7739
feat: add SHIORI_PG_SSLMODE (#536)
* feat: add SHIORI_PG_SSLMODE

Some managed hosting providers don't support sslmode=disabled.

* handle empty value

---------

Co-authored-by: Felipe M <me@fmartingr.com>
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-07-09 08:43:26 +02:00
Felipe Martin 6ab661520e
fix: prevent bookmark overwrite on download (#636) 2023-07-09 08:33:56 +02:00
Monirzadeh 249f4b89c8
Initial Ebook Support (#623)
* generate ebook

* serve ebook file

* Update ebook.go not download same image twice anymore

* download ebook request api/ui part

* fix typo

* add stylesheet

* update hasEbook status

* download link update after ebook generate

update bookmark command in ui

* download ebook with bookmark title

* Apply suggestions from code review for better error handling

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* Update internal/view/js/page/home.js fix typo

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* import error lib and retuen missing error

* move ebook download action to update cache

* replace io/ioutil with io

* add missing error handling

* update Archive now always update ebook

* replace panic error with 404

* remove ebook with delete action

* add download ebook link to content page

* remove tags that not work correctly right now

* if file is pdf not generate ebook

* update style.css

* Revert "update style.css"

This reverts commit 519e10d6ce.

* remove download limit for api

* fix missing fmt.Errorf and change to errors.Wrap

* fix double panic

* return 404 if bookmark not exist

* change function name to GenerateEbook

* not isFatalErr anymore

* add unit test

* remove uneeded field for unit test

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-07-09 08:29:32 +02:00
Felipe M ec86febdaa
docs: add matrix link to readme 2023-07-06 21:47:08 +02:00
Felipe M e839b69875
fix: goreleaser use go version from go.mod file and fix typo 2023-07-02 13:02:46 +02:00
Felipe Martin 8e9324ae8b
deps: update to go 1.20 + dependencies. Fixes CI (#628)
* deps: update go1.20 and dependencies

* fix: goreleaser archives

* ci: removed unused notify irc action

* ci: updated workflow dependency versions

* fix: typo
2023-07-02 12:50:29 +02:00
Monirzadeh 98c2d77257
thumb image will be not accesable anymore if it is private fix #578 (#627)
* thumb image will be not accesable anymore if it is private fix #578

* Update internal/webserver/handler-ui.go better error handling

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-07-02 10:58:57 +02:00
Tomi lla dde1b44e77
fix(log): record user real ip from headers (#603)
* fix(real_ip): get user real ip from headers of request

* fix(real_ip): compatible with those header with multiple IP values separated by commas

* test(real_ip): add benchmark for IPv4 and IPv6 private address check

* fix(real_ip): check empty, then remove leading and tailing comma char, finally locate first IP field

* test(real_ip): move checker logic into utils and add more unit test cases

* test(real_ip): write unit tests covering all code branches of the `util-ip` module

* refactor(real_ip): use one-line `testify.assert.Panics` to capture intended panic in test case

* chore(real_ip): add module private variable `UserRealIpHeaderCandidates`

put those headers together, make it easy to manage in one place

* doc(real_ip): write docstring for each function in the `utils-ip` module

* chore(real_ip): choose more concrete and unambiguous name for test helper function

It is to avoid polluting the module name-space with too general names.

* chore(naming): change function names according to code style

* refactor(real_ip): simplify the code indicated by 'gosimple' and `golangci`

* chore(naming): rename the `utils-ip` file to `utils_ip` to match with the rest of the file structure

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-06-11 21:25:23 +02:00
Monirzadeh a4b92504b0
fix direction in RTL language (#615)
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-06-11 21:18:12 +02:00
Felipe Martin 85534b62f8
Update dependencies (#616)
* Added contribute docs for tests
* deps: update
* mariadb using healthcheck script
* Restored health retries to 5
2023-06-11 21:10:15 +02:00
chain710 888e59dabf
Add log args for root command (#565)
- log-level: specify log level, default info
- log-caller: whether log `file:lineno` or not, default false
- log FullTimestamp
2023-03-17 13:37:23 +01:00
sdvcrx 3c1229d6ce
fix(frontend): prevent archive header covering up the archive content (#562) 2023-02-22 13:05:55 +01:00
Felipe Martin f6f3faf130
deps: update direct deps (#567)
* deps: update direct deps

* test on 1.20
2023-02-05 11:19:53 +01:00
Ivan Li 47f288fb1d
fix: browser ext cannot archive and update bookmark. (#560) 2023-02-05 10:58:00 +01:00
mox46 52d9a6322f
use UTC for cookie expiry date in backend (#566) 2023-02-05 10:56:34 +01:00
Katarn 257506ae19
feat: improve bookmark image detection (#554) 2023-01-21 09:53:19 +01:00
Felipe Martin 9344bbeb27
ci: fix goreleaser snapshots (#553) 2023-01-10 13:05:00 +01:00
Felipe Martin 6b99e1910c
deps: up to date (#552) 2023-01-10 12:53:29 +01:00
dependabot[bot] 3e1d3cd3aa
chore(deps): bump modernc.org/sqlite from 1.19.5 to 1.20.2 (#551)
---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 12:47:06 +01:00
dependabot[bot] 04a79dcf84
chore(deps): bump goreleaser/goreleaser-action from 3 to 4 (#544)
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 3 to 4.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 12:46:48 +01:00
dependabot[bot] e5846ca73b
chore(deps): bump github.com/go-sql-driver/mysql from 1.6.0 to 1.7.0 (#541)
Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.6.0 to 1.7.0.
- [Release notes](https://github.com/go-sql-driver/mysql/releases)
- [Changelog](https://github.com/go-sql-driver/mysql/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-sql-driver/mysql/compare/v1.6.0...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/go-sql-driver/mysql
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-10 12:46:38 +01:00
Ryan Welch 1b03cc48d6
Reset page when searching for new tag (#550) 2023-01-10 12:46:13 +01:00
dependabot[bot] 27c2fc74be
chore(deps): bump modernc.org/sqlite from 1.19.4 to 1.19.5 (#539)
---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-30 12:12:55 +01:00
Felipe Martin 3fcb295d72
Make migrations transparent to the user (#530)
* refactor: remove migrate command

* reafactor: avoid migration errors on no changes
2022-11-27 15:39:27 +01:00
dependabot[bot] 54fc9399b3
chore(deps): bump github.com/gofrs/uuid (#531)
Bumps [github.com/gofrs/uuid](https://github.com/gofrs/uuid) from 4.3.0+incompatible to 4.3.1+incompatible.
- [Release notes](https://github.com/gofrs/uuid/releases)
- [Commits](https://github.com/gofrs/uuid/compare/v4.3.0...v4.3.1)

---
updated-dependencies:
- dependency-name: github.com/gofrs/uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-10 08:52:45 +01:00
dependabot[bot] 48fb6f6395
chore(deps): bump modernc.org/sqlite from 1.19.3 to 1.19.4 (#532)
---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-10 08:52:33 +01:00
dependabot[bot] 9dac4bf1dc
chore(deps): bump modernc.org/sqlite from 1.19.2 to 1.19.3 (#529)
---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-04 21:26:01 +01:00
dependabot[bot] 278b4ce48d
chore(deps): bump github.com/spf13/cobra from 1.6.0 to 1.6.1 (#528)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-04 21:25:49 +01:00
dependabot[bot] 23e87f8430
chore(deps): bump actions/download-artifact from 2 to 3 (#523)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-28 09:10:49 +02:00