Commit graph

22 commits

Author SHA1 Message Date
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
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
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
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
Radhi Fadlillah
99d27930ea Initial support for subpath #39 2019-10-07 13:38:40 +07:00
Radhi Fadlillah
0bf5772022 Remove unneeded local variables 2019-09-21 16:19:45 +07:00
Radhi Fadlillah
806a3cff40 Add flag to specify custom address 2019-08-27 12:36:24 +07:00
Radhi Fadlillah
02699ab460 Increase write timeout 2019-08-20 15:34:53 +07:00
Radhi Fadlillah
39bf9840a2 Add API for web extension 2019-08-19 18:22:21 +07:00
Radhi Fadlillah
ea73eaff64 Add method for renaming tag 2019-08-07 23:30:17 +07:00
Radhi Fadlillah
1399e0fc9f Fix: archive is never closed 2019-08-06 20:51:06 +07:00
Radhi Fadlillah
43040a9bc4 Initial archive page 2019-08-05 18:26:37 +07:00
Radhi Fadlillah
3345d8db29 Initial bookmark content 2019-08-04 21:34:23 +07:00
Radhi Fadlillah
7bdebf3108 Add archival in web interface 2019-06-11 10:59:08 +07:00
Radhi Fadlillah
3503484c2b Add account management in web interface 2019-05-31 22:41:29 +07:00
Radhi Fadlillah
05504c2317 Implement batch edit in web interface 2019-05-30 16:35:18 +07:00
Radhi Fadlillah
a040b85ee2 Implement update archive in web interface 2019-05-30 13:58:58 +07:00
Radhi Fadlillah
3b8dead04d Implement edit bookmark in web interface 2019-05-30 10:07:20 +07:00
Radhi Fadlillah
7ab6c533a3 Implement delete in web interface 2019-05-29 20:08:58 +07:00
Radhi Fadlillah
093b398b2f Implement add bookmark in web interface 2019-05-28 17:05:11 +07:00
Radhi Fadlillah
61bd8244a6 Initial new web interfaces 2019-05-27 17:01:53 +07:00
Radhi Fadlillah
1e099fbd27 Restructure project directories 2019-05-21 10:31:40 +07:00