Commit graph

45 commits

Author SHA1 Message Date
Hazhar Galeh
dbd99f310f
Resolve PHP 8.1 deprecations (#1866)
Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
Co-authored-by: ArthurHoaro <arthur@hoa.ro>
2022-09-14 08:17:07 +02:00
nodiscc
cf9031da22 tests: phpcs: fix 'Opening brace must not be followed by a blank line' error
- fixes https://github.com/shaarli/Shaarli/issues/1818
2022-01-13 20:50:39 +01:00
ArthurHoaro
bcba6bd353 New plugin hook: ability to add custom filters to Shaarli search engine
A new plugin hook has been added: hook_test_filter_search_entry
This hook allows to filter out bookmark with custom plugin code when a search is performed.

Related to #143
2021-02-04 11:02:50 +01:00
ArthurHoaro
9b8c0a4560 Handle pagination through BookmarkService
Handle all search results through SearchResult object.
This is a required step toward implementing a BookmarkService based on SQL database.

Related to #953
2021-01-20 15:01:29 +01:00
ArthurHoaro
0640c1a6db API: POST/PUT Link - properly parse tags string
Even though the documentation specify that tags should be passed as an array, tags string is actually allowed. So this adds a proper parsing with configured separator.

Related to #1651
2020-12-29 13:01:04 +01:00
ArthurHoaro
53054b2bf6 Apply PHP Code Beautifier on source code for linter automatic fixes 2020-11-09 10:56:24 +01:00
ArthurHoaro
dff039092d
Merge pull request #1616 from dimtion/fix-api-redirect
API postLink: change relative path to absolute path
2020-10-29 16:03:07 +01:00
Loïc Carr
b37ca79072 postLink: change relative path to absolute path 2020-10-28 20:08:18 -07:00
ArthurHoaro
efb7d21b52 Add strict types for bookmarks management
Parameters typing and using strict types overall increase the codebase
quality by enforcing the a given parameter will have the expected type.

It also removes the need to unnecessary unit tests checking methods
behavior with invalid input.
2020-10-13 13:50:11 +02:00
ArthurHoaro
fd1ddad98d Add mutex on datastore I/O operations
To make sure that there is no concurrent operation on the datastore file.

Fixes #1132
2020-10-13 12:38:19 +02:00
ArthurHoaro
543b16b4f4
Merge pull request #1525 from ArthurHoaro/feature/rest-api-bookmark-dates
REST API: allow override of creation and update dates
2020-10-13 12:26:01 +02:00
ArthurHoaro
255b2264a1 Revert unrelated changes and add unit tests 2020-09-30 15:57:57 +02:00
Christoph Stoettner
25cb75552b Fix identation 2020-09-30 12:29:54 +02:00
Christoph Stoettner
d8ef4a893f Change to ->container->environment 2020-09-30 12:27:44 +02:00
Christoph Stoettner
676571dab9 Workaround for hoster (ionos)
The hoster writes the environment variable with bearer token to
REDIRECT_HTTP_AUTHORIZATION and needs to provide RewriteBase / to
.htaccess
2020-09-29 12:15:04 +02:00
ArthurHoaro
b06fc28aa3 REST API: allow override of creation and update dates
Note that if they're not provided, default behaviour will apply:
creation and update dates will be autogenerated, and not empty.

Fixes #1223
2020-08-29 11:45:08 +02:00
ArthurHoaro
301c7ab1a0 Better support for notes permalink 2020-07-28 20:46:11 +02:00
ArthurHoaro
1a8ac737e5 Process main page (linklist) through Slim controller
Including a bunch of improvements on the container,
and helper used across new controllers.
2020-07-23 21:19:21 +02:00
ArthurHoaro
cf92b4dd15 Apply the new system (Bookmark + Service) to the whole code base
See https://github.com/shaarli/Shaarli/issues/1307
2020-01-18 09:55:59 +01:00
ArthurHoaro
def39d0dd7 Run Unit Tests against PHP 7.4
Bump PHPUnit version and fix unit test

  - Globals are handled differently and are persistent through tests
  - Tests without assertions are marked as risky: some of them are just
meant to check that no error is raised.
2020-01-17 18:34:37 +01:00
ArthurHoaro
cc69aad4a9
Merge pull request #1271 from ArthurHoaro/hotfix/thumb-note-retrieve
Do not try to retrieve thumbnails for internal link
2019-03-02 10:54:06 +01:00
ArthurHoaro
a8e7da0114 Do not try to retrieve thumbnails for internal link
Also adds a helper function to determine if a link is a note and apply it across multiple files.
2019-02-24 12:25:50 +01:00
ArthurHoaro
520d29578c Remove the redirector setting
Fixes #1239
2019-02-09 13:55:11 +01:00
VirtualTam
dea72c711f Optimize and cleanup imports
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2019-01-13 00:04:42 +01:00
VirtualTam
f24896b237 namespacing: \Shaarli\Bookmark\LinkDB
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2019-01-12 22:47:48 +01:00
VirtualTam
00af48d9d2 namespacing: \Shaarli\Http\Base64Url
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2019-01-12 22:47:48 +01:00
VirtualTam
bdc5152d48 namespacing: \Shaarli\History
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2019-01-12 22:47:48 +01:00
VirtualTam
f211e417bf lint: apply phpcbf to application/
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2018-12-02 22:39:16 +01:00
ArthurHoaro
d3f42ca487 Implements Tags endpoints for Shaarli's REST API
Endpoints:

 * List All Tags [GET]
 * Get a tag [GET]
 * Update a tag [PUT]
 * Delete a tag [DELETE]

Fixes #904
References shaarli/api-documentation#34
2018-06-04 18:51:22 +02:00
ArthurHoaro
d2d4f993e1 PSR: use elseif instead of else if
See https://www.php-fig.org/psr/psr-2/\#51-if-elseif-else
2018-02-28 22:34:40 +01:00
ArthurHoaro
6bc90f50af History: fix entries order 2017-05-07 17:11:25 +02:00
ArthurHoaro
813849e521 Add history entries for API endpoint
CHANGED: datetime is now store as an object in history store file
2017-05-07 17:11:22 +02:00
ArthurHoaro
61d406933e API: Get History endpoint
See http://shaarli.github.io/api-documentation/#links-history-get
2017-05-07 16:03:40 +02:00
ArthurHoaro
0843848c1d API: add DELETE endpoint
Based on #840

See http://shaarli.github.io/api-documentation/\#links-link-delete
2017-05-07 15:58:49 +02:00
ArthurHoaro
cf9181dddf REST API: implement PUT method
* Related to #609
  * Documentation: http://shaarli.github.io/api-documentation/#links-link-put
2017-05-07 15:49:16 +02:00
ArthurHoaro
68016e3798 REST API: implement POST link service 2017-03-27 18:44:50 +02:00
VirtualTam
3c66e56435 application: introduce the Shaarli\Config namespace
Namespaces have been introduced with the REST API, and should be generalized
to the whole codebase to manage object scope and benefit from autoloading.

See:
- https://secure.php.net/manual/en/language.namespaces.php
- http://www.php-fig.org/psr/psr-4/

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2017-03-04 17:07:52 +01:00
ArthurHoaro
16e3d006e9 REST API: implements getLink by ID service
See http://shaarli.github.io/api-documentation/#links-link-get
2017-02-19 16:45:59 +01:00
ArthurHoaro
c37a6f820b REST API - getLinks: support the visibility parameter 2017-01-17 18:53:18 +01:00
ArthurHoaro
7f96d9ec21 Update LinkFilter to be able to filter only public links
No update regarding the UI or the API for now

Fixes #758
2017-01-16 13:57:11 +01:00
ArthurHoaro
9977c418d6 Merge pull request #727 from ArthurHoaro/api/getlinks
REST API: implement getLinks service
2017-01-15 16:49:50 +01:00
ArthurHoaro
c3b00963fe REST API: implement getLinks service
See http://shaarli.github.io/api-documentation/#links-links-collection-get
2017-01-15 13:55:22 +01:00
VirtualTam
63ef549749 API: expect JWT in the Authorization header
Relates to https://github.com/shaarli/Shaarli/pull/731

Added:
- require the presence of the 'Authorization' header

Changed:
- use the HTTP Bearer Token authorization schema

See:
- https://jwt.io/introduction/#how-do-json-web-tokens-work-
- https://tools.ietf.org/html/rfc6750
- http://security.stackexchange.com/q/108662

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2017-01-15 13:41:04 +01:00
VirtualTam
7a9daac56d API: fix JWT signature verification
Fixes https://github.com/shaarli/Shaarli/issues/737

Added:
- Base64Url utilities

Fixed:
- use URL-safe Base64 encoding/decoding functions
- use byte representations for HMAC digests
- all JWT parts are Base64Url-encoded

See:
- https://en.wikipedia.org/wiki/JSON_Web_Token
- https://tools.ietf.org/html/rfc7519
- https://scotch.io/tutorials/the-anatomy-of-a-json-web-token
- https://jwt.io/introduction/
- https://en.wikipedia.org/wiki/Base64#URL_applications
- https://secure.php.net/manual/en/function.base64-encode.php#103849

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
2017-01-04 16:59:47 +01:00
ArthurHoaro
18e6796726 REST API structure using Slim framework
* REST API routes are handle by Slim.
  * Every API controller go through ApiMiddleware which handles security.
  * First service implemented `/info`, for tests purpose.
2016-12-15 10:36:00 +01:00