Commit graph

94 commits

Author SHA1 Message Date
Monirzadeh
6c94d56bf0
feat: Home button clear search query (#916)
* click on home will clear searchbox

* clearHome when mounted

* clearHomePage just when you are in homepage

* check clearHomePage signal out of clearHomePage method

* fix style
2024-05-26 15:33:17 +02:00
Felipe Martin
ceb392d22e
fix: use relative path for all API calls (#872)
Fixes #870
2024-04-07 21:33:22 +02:00
Zlendy
5a166906db
fix: use correct endpoint in rename tags operation (#868) 2024-03-25 23:54:55 +01:00
Felipe Martin
cc7c75116d
refactor: migrate bookmark static pages to new http server (#775)
* migrate bookmark content route to new http server

* new archive page

* remove unused go generate comment

* database mock

* utils cleanup

* unused var

* domains refactor and tests

* fixed secret key type

* redirect to login on ui errors

* fixed archive folder with storage domain

* webroot documentation

* some bookmark route tests

* fixed error in bookmark domain for non existant bookmarks

* centralice errors

* add coverage data to unittests

* added tests, refactor storage to use afero

* removed mock to avoid increasing complexity

* using deps to copy files around

* remove config usage (to deps)

* remove handler-ui file
2023-12-28 18:18:32 +01:00
istiak101
f01f2dbc0d
fix: use noreferer to prevent exposing shiori instance url to archived websites (#802) 2023-12-27 11:59:16 +01:00
cbe
7765e5bf42
chore: frontend formatting (#764)
* Install `prettier`

Ignore everything in the first step as I want to see the size of changes
that are going to happen first

* Configure prettier

- use tabs as the whole project prefers tabs
- ignore a bunch of files that shouldn't be formatted

* Check & format with prettier when compiling less

* Update docs to use bun

Since bun handles the dependencies used for the CSS compilation this
should be the preferred method from now on.

* Check actual result of prettier

* Use LF line endings

All files where formatted in LF and since it's most common in git repos
we should probably keep it this way

* Limit prettier to `internal/view/`

See pull request review
https://github.com/go-shiori/shiori/pull/764#pullrequestreview-1702935417

* Format code with prettier
2023-11-05 11:02:31 +01:00
cbe
f16dd42e10
Make suggestion clickable in bookmark creation (#765)
This was especially noticeable when using the web app on mobile devices
as the suggestion looks like it's clickable. It should be also a little
bit more convenient UX-wise when it's allowed to be clicked in non-
mobile context as well.

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-10-29 15:26:39 +01:00
Monirzadeh
5e9847a288
refactor: migrate ebook routes to new http server (#742)
* add new api

* UI use new API

* remove legacy route

* fix request to new api destination and read that response

* feat: allow authentication using cookies

* fix: return proper error on validatesession

* typo: secret key envionment variable in makefile

* serve ebook file with new api

* cache update use new api path

* add skipexist and batch download use same route as cache

* fix bug - update hasebook status

* remove unneeded part of code

* add swagger documentation

* fix swagger documentation

* fix swagger response

* better statuscode

* fix swagger documentation

* covert to snake_case

* recover coverage.txt that remove

---------

Co-authored-by: Felipe M <me@fmartingr.com>
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-10-29 11:57:07 +01:00
Yuta Hayashibe
c64e858a23
Fix typos (#756)
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-10-22 17:43:49 +02:00
cbe
1ae82f48a3
fix: Actions in overlays on mobile hard to press (#759)
* fix: Actions in overlays on mobile hard to press

Buttons on mobile devices could've been cut off, depending on the browsers
chrome size which rendered them either completely off-screen or at least hard
to reach. Using `dvh` (dynamic viewport height) should fix this issue for
most newer browsers.

* fix: provide fallback values for newer dynamic viewport units

Since `dvh` and `dvw` are rather new and required an up-to-date browser
providing percentage values is a bit safer

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-10-22 13:37:25 +02:00
Monirzadeh
f82b97dec5
add create ebook by default in settings (#761)
* add create ebook by default in settings

* ebook automatic generate for new bookmark

* fix empty ebook for new bookmark
2023-10-22 13:25:16 +02:00
Monirzadeh
106bf163ca
refactor: remove unneeded variable and unify the way send token in header (#763) 2023-10-17 18:36:55 +02:00
Monirzadeh
c05d617fbd
feat: allow per-user settings and store them in database (#639)
* create needed field in sqlite database

* update account model

* update Account struct for save Account options

* update sqlite database return account settings

* save configure in sqlite as text and return that

* read configure from user account and defualt configure for shiori

* add api/ui for update settings in database user can save settings in database (in sqlite database)

* check configures be in json format before save in database

* support MariaDB

* fix wrong comment

* support PostgreSQL

* revert unneeded change in new logic

* change configures to config

* change SaveAccount to SaveAccountSettings

* add migrate database scripts

* change default in migration scrtipts

* update model

* read config field as json from database

* fix parse value config value & update config update

* update default value for new user

* update settings variable name to reflect database value in UI

* fix typo

* not panic if user not exist and update worng comment

* visitor user can update there settings now

* remove unneeded loading dialog

* fix typo

* update function for pg and mysql

* remove IsJson

* move scan method to model

* simplify jsonify

* simplify assignees value to account.Config

* missing part of function

* fix some typo and unneeded field in struct

* add down migrate script for all database

* change createEbook to CreateEbook

* use json instead of text in mysql and postgres

* implement

* remove unneeded part

* remove unneeded jsonify in code

* return SelectContext and GetContext

* remove defualt config in reques for new user it will be set in backend

* New API

* remove legacy API

* remove validateSessionWithoutOwnerStatus

* remove Jsonify function don't need that anymore

* add unit test for database

* update migrate script name

* change put to patch

* return PUT

* fix Patch problem and now use PATCH instead of PUT

* remove unneeded retuen

* more cleaner code for request new settings

* fix bug to handle string in Scan method thanks to fmartingr

* fix Authorization & use GetAccount & remove username from request

* shiori-settings remove and it read from shiori-account

* add swagger documentation

* API unit test

* fix typo

* remove unneeded coment

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

* better Documentation

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

* shiori-toke remove on logout

* fix typo

* add unit test check update config in database

* update swag documentation

* fix swag formaing error

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-10-15 15:27:54 +02:00
Monirzadeh
46c1a6ae8f
feat: allow resize the dialogbox for bigger/hidpi screens (#732)
* resize dialogbox with drag corner of box

* update style.css

* resizable just for more than full HD display

* fix size for initial size for small and big size

* full screen dialog box on mobile device - wider dialogbox on device

* remvoe custom-dialog.css that combine with style.css

* disable resize for moile device

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

* use new generated style.css

* not limit minimum size to 400px

* set default value in .custom-dialog

---------

Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
2023-10-09 16:07:37 +00:00
Felipe Martin
eb666cd2f5
feat: use new JWT auth in all frontend API calls (#743)
* properly store jwt token

* use a secret in the local dev server

* send jwt token in all api calls
2023-09-30 12:45:35 +02:00
Felipe Martin
4df7e1dd8e
feat: build css from less files locally (#735)
* build less using lessc and bun

* build

* make styles-check

* Added workflow to check updates

* avoid embed less files

* docs

* updated tests to reflect changes

* typo

* fixed archive page css

* call styles check on pull requests

* comments in style.less

* fix archive styles affecting other pages

* minify using clean-css

* Split archive.css and style.css

* Updated docs
2023-09-16 19:58:55 +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
c5c7a5f600
Show version in login page (#652) 2023-07-21 09:25:19 +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
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
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
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
sdvcrx
3c1229d6ce
fix(frontend): prevent archive header covering up the archive content (#562) 2023-02-22 13:05:55 +01:00
Ryan Welch
1b03cc48d6
Reset page when searching for new tag (#550) 2023-01-10 12:46:13 +01:00
Felipe Martin
77269b7a64
feat(frontend): username autofocus on login (#519) 2022-10-16 12:17:02 +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
Felipe M
2ca628b7fe
hotfix: fixes session duration from #346 2022-02-11 16:00:38 +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
Dean Jackson
a5cb2c6e40 Fix login autofill
Add <form> element, as some browsers won't autofill fields
not contained in form.

Remove username and password bindings, and explicitly read
inputs instead. Some browsers do not fire onChange events
when a field is autofilled for security reasons, so Vue
bindings don't register the change.

https://github.com/facebook/react/issues/1159#issuecomment-506584346
2019-12-13 08:36:16 +01:00
Ninh Pham
98353369f7
Fix: grid layout on dialog 2019-10-14 10:51:11 +07:00
Radhi Fadlillah
7a2bcacf51 Fix: hasArchive icon gone after update bookmark 2019-10-13 08:37:10 +07:00
Radhi Fadlillah
7d938f3893 Fix: checkbox in dialog doesn't work 2019-10-13 08:22:17 +07:00
Ninh Pham
ef248c8fc4
Fix: Bookmark content displays Invalid Date if database is PostgreSQL #201 2019-10-12 20:15:11 +07:00
Radhi Fadlillah
d2906b126a Fix wrong cookie path 2019-10-11 14:14:17 +07:00
Ninh Pham
e41cea6642
Fix: Safari does not accept document.baseURI for cookie path 2019-10-11 13:28:25 +07:00
Radhi Fadlillah
9e962f0b2d Fix: now cookie set per subpath #39 2019-10-07 15:33:32 +07:00
Radhi Fadlillah
99d27930ea Initial support for subpath #39 2019-10-07 13:38:40 +07:00
Radhi Fadlillah
3077c7fbb8 Use tab instead of spaces 2019-10-04 16:51:08 +07:00
Radhi Fadlillah
bf974facdc Add border around table in content view 2019-10-04 16:36:41 +07:00
Radhi Fadlillah
b315c48acf Fix content with double braces not rendered #171 2019-09-25 07:32:03 +07:00
Radhi Fadlillah
752d1ba4f6 In no-thumbnail mode, make margin more consistent 2019-09-24 21:59:17 +07:00
Radhi Fadlillah
a82b8820bd Add options to hide excerpt #166 2019-09-24 21:16:03 +07:00
Radhi Fadlillah
c77b17caf8 Use formatter in LESS files 2019-09-24 11:56:35 +07:00
Radhi Fadlillah
bccc70b3f8 Add option to hide thumbnail image #166 2019-09-24 09:47:50 +07:00
Radhi Fadlillah
531c66c955 When session expired and user login, return him to previous page 2019-08-29 16:14:19 +07:00
Radhi Fadlillah
3f43424af0 Make search result share-able by URL 2019-08-29 15:44:03 +07:00
Radhi Fadlillah
af2949b2d9 Tagged and untagged shouldn't be able to renamed 2019-08-27 20:50:40 +07:00
Radhi Fadlillah
abcdfc9d13 Fix failed to rename tag in web interface 2019-08-27 20:42:13 +07:00
Radhi Fadlillah
f50d0cca5d Better error handle in JS 2019-08-20 14:29:55 +07:00