Commit graph

219 commits

Author SHA1 Message Date
Kevin Decherf 2a0e0a47d8 TagRestController: rewrite delete actions to only retrieve tags related to the user
Fixes #3815

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2018-12-30 01:34:49 +01:00
Jeremy Benoist 877787e5fe
Fix utf8mb4 on vendor tables
When creating the schema for test these tables use default length for
string: 255. Which fail when using utf8mb4.

> Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Also move the `setKeepStaticConnections` in before and after class to
avoid:

> SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist

See https://github.com/dmaicher/doctrine-test-bundle#troubleshooting
2018-11-28 22:04:55 +01:00
Jeremy Benoist 115de64e5b
Jump to Symfony 3.4
Thanks to the BC compatibility, almost nothing have to be changed.
All changes are related to new bundle version of:
- SensioFrameworkExtraBundle
- DoctrineFixturesBundle
2018-10-04 14:11:57 +02:00
Sébastien Viande 0e70e81227
Entry: add sort parameter archived 2018-09-21 10:33:33 +02:00
Sébastien Viande 7975395d10
Entry: add archived_at property and updateArchived method 2018-09-21 10:33:33 +02:00
Kevin Decherf 2a1ceb67b4 php-cs-fixer
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2018-09-05 14:25:32 +02:00
Kevin Decherf f5ea67e4cf api: copy entry object before sending, to keep id
Workaround for https://github.com/wallabag/android-app/issues/646

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-12-17 21:07:46 +01:00
Kevin Decherf af29e1bf07 Fix empty title and domain_name when exception is thrown during fetch
Add a new helper to set a default title when it's empty:
1/ use basename part of entry's path, if any
2/ or use domain name

Fixes #2053

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-12-13 22:44:31 +01:00
Jeremy Benoist 4ac0e65963
Fix bad key matching
I didn't try to find which package introduced a BC (might be user-bundle
or jms serializer)
2017-12-08 12:10:28 +01:00
Kevin Decherf 3b771f51a6 Improve origin_url field description and translations
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:02:11 +01:00
Kevin Decherf e0ef1a1c8b Add originUrl property to Entry, handle that in EntryRestController, handle migration
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:02:11 +01:00
Sébastien Viande 0978bd849e Fix #3361 Entry Rest controller getEntries cast tags params to string 2017-10-13 10:28:05 +02:00
Jeremy Benoist 3ef055ced3
CS 2017-10-09 16:47:15 +02:00
Jeremy Benoist f40c88eb1f
Jump to Symfony 3.3 & update others deps
Also update tests urls
2017-10-09 16:45:12 +02:00
François D a991c46eed Set a starred_at field when an entry is starred.
This date is used to sort starred entries.

Can not use Entry::timestamps method otherwise starred_at will be updated each time entry is updated.
Add an updateStar method into Entry class
A migration script has been added in order to set starred_at field.
2017-08-25 21:19:47 +02:00
Nicolas Hart 52b84c11a5 Fix some namespaces and phpdoc 2017-07-29 22:51:50 +02:00
Jérémy Benoist f39152ad6e Merge pull request #3266 from egilli/export-domain-as-author
Use the article publisher as author for exported files
2017-07-11 09:21:49 +02:00
Étienne Gilli 07320a2bd2 Use the article domain as author for export files
When exporting an entry, use the domain name as author name for epub,
mobi and pdf formats, instead of 'wallabag'.
Change the author from array to string, because for now, there is always
only one author.
2017-07-08 19:53:43 +02:00
Jeremy Benoist 2e5b2fa808
Revert client_credentials grant types 2017-07-08 19:28:12 +02:00
Jeremy Benoist c18a2476b6
CS 2017-07-03 13:56:39 +02:00
Jeremy Benoist a05b61159e
Fix PATCH method
The PATCH method for the entry should only update what user sent to us and not the whole entry as it was before.
Also, sending tags when patching an entry will now remove all current tags & assocatied new ones.
2017-07-03 13:45:04 +02:00
Jeremy Benoist f808b01692
Add a real configuration for CS-Fixer 2017-07-01 09:52:38 +02:00
Jérémy Benoist 331e5b0261 CS 2017-06-28 09:18:22 +02:00
Jeremy Benoist 39ffaba323
Return null instead of false 2017-06-28 08:15:06 +02:00
Jeremy Benoist 18696f77fd
Avoid BC on exists endpoint 2017-06-23 08:30:23 +02:00
Thomas Citharel caa0b1765b Add client_credentials oAuth2 auth method
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-06-14 17:30:12 +02:00
Jeremy Benoist d9da186fb8
CS 2017-06-10 16:08:24 +02:00
Jeremy Benoist a9c6577f0c
Few fixes 2017-06-10 15:37:25 +02:00
Jeremy Benoist 1112e54772
Add public filter/field in the API
Listing entries can now be filtered by “public”.
Creating or patching an entry can now set is to public or remove the public.
Entry response now include “is_public” boolean field
2017-06-10 15:31:57 +02:00
Jeremy Benoist a8d3fe50df
Add ability to name the client 2017-06-08 14:25:44 +02:00
Jeremy Benoist 0c00e52516
Create a client when creating a user using the api
While creating a new user using the API, we also create a new client for the current user.
So the app which just create the user can use its newly created client to configure the app.

That new client is only return after creating the user.
When calling the endpoint /api/user to get user information, the new client information won’t be return.
2017-06-07 23:23:28 +02:00
Jérémy Benoist c0d756f67d Merge pull request #3181 from wallabag/api-content-patch
Add ability to patch an entry with more fields
2017-06-07 15:40:59 +02:00
Jeremy Benoist db0c48af36
Refactorize the way to save an Entry in the API 2017-06-07 15:07:55 +02:00
Jeremy Benoist 645291e8fe
Add ability to patch an entry with more fields
Like when we create an entry, we can now patch an entry with new fields:
- content
- language
- preview_picture
- published_at
- authors
2017-06-02 20:52:49 +02:00
Jeremy Benoist a1e6187406
Return 201 on user creation 2017-06-02 20:03:25 +02:00
Jeremy Benoist 1b9cd91782
Add translation 2017-06-02 11:32:38 +02:00
Jeremy Benoist 426bb453d2
API user creation behing a toggle
I've added a toggle feature (in internal settings) so that user api creation can be disabled while form registration still can be enabled.
Also, the /api/user endpoint shouldn't require authentication. Even if we check the authentication when sending a GET request, to retrieve current user information.

I've moved all the internal settings definition to config to avoid duplicated place to define them.
I don't know why we didn't did that earlier.
2017-06-02 11:32:38 +02:00
Jeremy Benoist d5c2cc54b5
Fix tests 2017-06-01 09:49:15 +02:00
Jerome Charaoui 7aba665e48
Avoid returning objects passed by reference.
Objects are always passed by reference, so it doesn't make sense to
return an object which is passed by reference as it will always be the
same object. This change makes the code a bit more readable.
2017-06-01 09:43:01 +02:00
Jeremy Benoist f0378b4d7c
Forced date can now be a timestamp too
Add adding more tests for forced content
2017-05-31 14:00:15 +02:00
Jeremy Benoist 9e349f08a6
Improve docs 2017-05-31 14:00:15 +02:00
Jeremy Benoist 74a75f7d43
Use graby ContentExtractor to clean html
It might be better to re-use some graby functionalities to clean html instead of building a new system.
2017-05-31 14:00:15 +02:00
Jeremy Benoist fb436e8ca0
Add support for authors 2017-05-31 13:59:45 +02:00
Jeremy Benoist e668a8124c
Allow other fields to be send using API
Entry API can now have these new fields:
- content
- language
- preview_picture
- published_at

Re-use the ContentProxy to be able to do the same using the web UI (in the future).
htmLawed is used to clean stuff from content, I hope it’ll be enough to avoid security breach.

Lower content validation when we want to update an entry with content already defined. Before, language & content_type were required. If there weren’t provided, we re-fetched the content using graby. I think these fields aren’t required for an entry to be created. So I removed them.
Which means some import from the v1 export won’t be re-fetched since they provide content, url & title.

Also, remove liberation link from Readability import to avoid overlaping import (from wallabag v1, which had the same link)
2017-05-31 13:59:45 +02:00
Jeremy Benoist 5709ecb368
Re-use NewUserType to validate registration
The only ugly things is how we handle error by generating the view and then parse the content to retrieve all errors…

Fix exposition fields in User entity
2017-05-30 07:56:01 +02:00
Thomas Citharel 2251045901
WIP
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-05-29 10:16:23 +02:00
Thomas Citharel 6bc6fb1f60 Move Tags assigner to a separate file
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-05-27 22:08:14 +02:00
Jeremy Benoist 4ab0d25f65
Merge remote-tracking branch 'origin/master' into 2.3 2017-05-19 11:25:19 +02:00
Thomas Citharel 91ba9a5975 Merge pull request #3095 from aaa2000/api-error-on-fail-fetch-content
Create a new entry via API even when its content can't be retrieved
2017-05-10 09:38:55 +02:00
Jeremy Benoist 1594a79fc5
Retrieve tag / tags value from query or request
It allows to request to delete a tag using query string instead of body parameter (which seems to be the standard).
Instead of breaking the previous behavior, I used a generic way to retrieve parameter (which looks into request attributes, query parameters and request parameters)
2017-05-09 23:15:25 +02:00
Jeremy Benoist 54c2d164a3
Merge remote-tracking branch 'origin/master' into 2.3 2017-05-09 13:55:31 +02:00
adev b60a666df2 Fix API pagination is broken if perPage is custom value
Fix #2720
2017-05-08 16:27:16 +02:00
adev 08f29ae7b6 Create a new entry via API even when its content can't be retrieved
Fix #2988
2017-05-08 14:57:25 +02:00
Jeremy Benoist 72db15ca5d
Little refacto and send 400 on reaching urls limit 2017-05-05 12:05:50 +02:00
adev ab9eb5cdb7 Fix display the form errors correctly
Use `property_path` form option to map underscored form fields
to object properties

@see https://github.com/symfony/symfony/issues/9162#issuecomment-25431148

Fix #3067
2017-05-05 00:12:16 +02:00
Nicolas Lœuillet efd351c98f Added limit 2017-05-01 09:26:12 +02:00
Jeremy Benoist 719ba257d3 Fix tests 2017-05-01 09:26:12 +02:00
Nicolas Lœuillet a7abcc7b7a Splitted the endpoint in two 2017-05-01 09:26:12 +02:00
Nicolas Lœuillet 1eca7831a6 Added API endpoint to handle a list of URL
By passing an array, you can add / delete URL in mass (bulk request)
2017-05-01 09:25:34 +02:00
Jeremy Benoist dcbebc17aa
Fix tests 2017-04-29 12:58:39 +02:00
Nicolas Lœuillet 80299ed282
Added endpoint to handle URL list to add/delete tags 2017-04-24 12:24:17 +02:00
Nicolas Lœuillet d1fc590211
Added API endpoint to handle a list of URL and to add/delete tags 2017-04-24 11:12:41 +02:00
Thomas Citharel ca9a83ee51 return id of article instead of true if entry exists 2017-02-24 11:31:31 +01:00
Jeremy Benoist 3ef75cc4e3
Be consistent between migration & schema definition 2016-12-19 14:24:19 +01:00
Jeremy Benoist 21e7ccef3d
Fix tests & deprecation notice 2016-12-15 21:38:16 +01:00
Jeremy Benoist 5cd0857e3c
Return 304 when content isn't reloaded using the API
Previously it was a 400 but this is more related to a real error.
Using the API user should only know the content got reloaded or not.
If reloaded: 200 otherwise: 304.
2016-11-22 10:45:19 +01:00
Jeremy Benoist 56da73969a
Return an explicit error if reload fail 2016-11-20 16:25:13 +01:00
Jeremy Benoist 70584b42aa
Fixing tests 2016-11-20 15:15:13 +01:00
Jeremy Benoist 0a6f4568b5
Add ability to reload entry from API 2016-11-20 13:08:41 +01:00
Jeremy Benoist 001cc7168a
Cleanup 2016-11-03 18:01:25 +01:00
Jeremy Benoist 864c1dd23a
Fix rest controller merge 2016-11-03 17:29:16 +01:00
Jeremy Benoist 5a619812ca
Merge remote-tracking branch 'origin/master' into 2.2 2016-11-03 16:41:29 +01:00
Jeremy Benoist 7816eb622d
Add entry.saved event to import & rest 2016-11-02 07:10:23 +01:00
Nicolas Lœuillet bc4564a709
Removed useless route 2016-10-28 15:24:58 +02:00
Nicolas Lœuillet 900c844861
Exploded WallabagRestController into many controllers
Fix #2503
2016-10-28 14:46:30 +02:00
Nicolas Lœuillet 23406ca3f1
Added relation between API Client and User
Fix #2062
2016-10-24 21:56:28 +02:00
Jeremy Benoist aa4741091f
Add test on /api/annotations
Fix controller forward in WallabagRestController.
Update PHPDoc so it is sorted the same way as others one
Duplicate all annotations test to use both api & normal way
Also, make annotation tests independent to each other
2016-10-22 12:09:20 +02:00
Jeremy Benoist 3199ec4702
CS 2016-10-22 09:17:01 +02:00
Nicolas Lœuillet d9b7768dca
Added a missing namespace 2016-10-22 09:06:07 +02:00
Thomas Citharel 0c271b9eb0
fix cs and phpdoc 2016-10-22 09:06:07 +02:00
Thomas Citharel b1e92f8c14
cs 2016-10-22 09:06:07 +02:00
Thomas Citharel 1eea248bb0
move code 2016-10-22 09:06:07 +02:00
Thomas Citharel c7935f32d2
cs 2016-10-22 09:06:07 +02:00
Thomas Citharel 351eb8d97e
bring annotations to API 2016-10-22 09:06:07 +02:00
Jeremy Benoist 5960aa1ffc
CS 2016-10-15 18:00:08 +02:00
Jeremy Benoist f1c3f68e90
ApiDoc & Route annotation were conflicted
The generated error was “Unable to guess how to get a Doctrine instance from the request information.”.

I haven’t checked deeper in Doctrine (I know it was coming from the DoctrineParamConverter).

Anyway, I check for FosRest possiblity to add extra format without allowing them for every route (like it was done in the first place).

I finally found a way but it then seems all request goes to the FormatListener of FosRest so I needed to add a custom rules to match all request to be sure we don’t get  a 406 error from FosRest.

Should be ok now …
2016-10-15 16:46:42 +02:00
Jeremy Benoist b1b561da51 Merge pull request #2372 from pmartin/api-get-entry-as-epub
API: ability to export entry in all available format (epub, pdf, etc...)
2016-10-12 14:06:33 +02:00
Nicolas Lœuillet 2a5ff7f554 Merge pull request #2411 from wallabag/fix-entities
Fix entities definition
2016-10-10 08:02:25 +02:00
Jeremy Benoist 8dc4cd0f25
Fix entities definition
As per Doctrine said in the debug tool bar:

- The field Wallabag\ApiBundle\Entity\Client#refreshTokens is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity Wallabag\ApiBundle\Entity\RefreshToken#client does not contain the required 'inversedBy="refreshTokens"' attribute.

- The field Wallabag\ApiBundle\Entity\Client#accessTokens is on the inverse side of a bi-directional relationship, but the specified mappedBy association on the target-entity Wallabag\ApiBundle\Entity\AccessToken#client does not contain the required 'inversedBy="accessTokens"' attribute.
2016-10-09 20:51:37 +02:00
Jeremy Benoist 28bb48905a
Optimize the way tag list is rendered
Instead of retrieve all informations about entries of a tag to just count them, we’ll count them before with a fastest query.

Also change the layout of the tag list in material design
2016-10-09 18:55:22 +02:00
Nicolas Lœuillet 93a95c09bf Merge pull request #2351 from wallabag/fix-api-client-deletion
Changed relation between API client and refresh token
2016-10-08 13:31:54 +02:00
Nicolas Lœuillet 4ad6f5878a Merge pull request #2393 from wallabag/api-urls-exist
Ability to check multiple urls in API
2016-10-08 13:31:31 +02:00
Jeremy Benoist 3f3a60879e
Add entry export in API
Export isn't available for json & xml because user can use the default
entry endpoint instead.
2016-10-08 12:59:19 +02:00
Pascal MARTIN 24de866534
API: getEntry can return EPUB 2016-10-08 12:05:41 +02:00
Pascal MARTIN 3d4b0b3064
Routing: epub format is allowed for API 2016-10-08 12:05:40 +02:00
Jeremy Benoist ee32248f43
Ensure access_token are removed
When we remove the client, we should ensure that access_token are also removed.

To ensure that, I created a test that generated an access_token. So when we remove the client, this association should be cascaded and shouldn’t generate an error.

Also I moved some Api related stuff to the ApiBundle (like the developer controler and ClientType form)
2016-10-08 00:05:41 +02:00
Jeremy Benoist ac8cf632bb
Ensure orphan tag are remove in API
When the association between a tag and an entry is removed, if the tag doesn’t have other entries, we can remove it.

Also add more tests for that part and ensure TagControllerTest is isolated from the rest of the test suite (finally!)
2016-10-07 23:31:53 +02:00
Jeremy Benoist f0abc22d09
Ability to check multiple urls in API 2016-10-07 20:37:01 +02:00
Jeremy Benoist 0b174d69d7
Fix typo & add test 2016-10-05 19:30:56 +02:00
Thomas Citharel 5d39243068 Fix exists API call
Boo
2016-10-05 15:28:36 +02:00