Commit graph

388 commits

Author SHA1 Message Date
Jeremy Benoist 709e21a3f4
Define storeArticleHeaders false by default
Fix tests which must use `$storeArticleHeaders`.
Fix CS
2017-11-21 10:37:36 +01:00
Jeremy Benoist 64a5a6cfc5
CS 2017-11-21 10:30:35 +01:00
Nicolas Lœuillet 8a21985474 Added internal setting to enable/disable headers storage 2017-11-20 18:47:48 +01:00
Kevin Decherf eae8138b33 Fix phpcs
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:26:13 +01:00
Kevin Decherf 65152fcb89 Improve EntryRestControllerTest for origin_url
Ensure that origin_url is initially null
Ensure patching entry with origin_url=''
Ensure patching entry with origin_url=null

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:02:11 +01:00
Kevin Decherf 97444566db Update EntryControllerTest to handle origin_url
Set an origin_url in testEditUpdate
Test origin_url deletion in testEditRemoveOriginUrl

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:02:11 +01:00
Kevin Decherf 00f2368f7a Add some tests for OriginUrl in EntryRestController
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:02:11 +01:00
Kevin Decherf e50e45d6fa Twig: add removeSchemeAndWww filter
This twig filter removes scheme (only http and https are supported) and
pass the result to removeWww filter to also remove 'www.' at the
beginning of an url.

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-11-19 15:02:11 +01:00
adev cc79712738 Fix phpcs 2017-11-11 23:55:13 +01:00
adev d81bf605af Fix tests 2017-11-11 23:37:57 +01:00
Jérémy Benoist 91f9bacf73 Merge pull request #3362 from sviande/fix_3361_api_warning
Fix #3361 check type for tags in entry repository
2017-10-18 11:16:50 +02:00
Nicolas Hart 9ca069a6fe Replace kernel.root_dir by kernel.project_dir
kernel.root_dir and Kernel::getRootDir() are deprecated since Symfony 3.3.
See https://symfony.com/blog/new-in-symfony-3-3-a-simpler-way-to-get-the-project-root-directory and https://github.com/symfony/symfony/blob/3.3/UPGRADE-3.3.md#httpkernel for more information.
2017-10-14 00:32:56 +02:00
Jeremy Benoist bb86dc6486 CS 2017-10-12 07:38:27 +02:00
Sébastien Viande d03b72f405 Fix #3361 add test 2017-10-12 07:38:27 +02:00
Jeremy Benoist f645d371ce
Fix MondeDiplo https url 2017-10-10 10:20:57 +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
Jeremy Benoist 33264c2d02
Fix tests 2017-09-06 22:49:16 +02:00
Jeremy Benoist 7c04b7396a
Multiple tag search was broken from API
First, the setParameter() were done on the same parameter which in fact
just duplicated the condition in the SQL query (like `where t.label =
'test' and t.label = 'test'`.

Changed the parameter doesn't help because the query was then wrong.

Changing the way to match associated tags for an entry and it worked.
2017-09-06 22:49:15 +02:00
Jérémy Benoist 3af5d41759 Merge pull request #3139 from Kdecherf/2502-tag-case
Ignore tag's case
2017-09-03 20:25:15 +02:00
Jeremy Benoist e437ad810b Fix tests
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-08-27 16:51:23 +02:00
Kevin Decherf 7036d91fe7 Tag: render tags case-insensitive by storing them in lowercase
Fixes #2502

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-08-27 16:51:23 +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 511f1ce1e8 Add reload entry command 2017-08-21 10:45:48 +02:00
Nicolas Hart f7a4b44136 add search argument and limit option to list users command 2017-07-31 23:20:41 +02:00
Nicolas Hart af31cfed76 Add list user command 2017-07-30 22:04:29 +02:00
Nicolas Hart e1b33efb3d Better rendering for all core commands 2017-07-29 11:09:02 +02:00
Jeremy Benoist ff9f89fd23
Add a test for updatePublishedAt
To avoid error when a content is re-submitted and it previously add a
published date.

Also, fix the `testPostSameEntry`
2017-07-24 17:07:47 +02:00
Jeremy Benoist c6c45673af
Put the final URL in data test 2017-07-24 11:13:53 +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 d0ec2ddd23
Fix validateAndSetPreviewPicture
Which wasn't covered by a test!
2017-07-03 13:45:04 +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 38520658ad
Fix tests 2017-07-03 07:30:54 +02:00
Jeremy Benoist f808b01692
Add a real configuration for CS-Fixer 2017-07-01 09:52:38 +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
Nicolas Lœuillet d0702f9fbd Merge pull request #3227 from wallabag/oauth-client-credentials
Add client_credentials oAuth2 auth method
2017-06-22 10:00:23 +02:00
Jeremy Benoist 11b8695663
Fix tests 2017-06-21 11:44:35 +02:00
Jeremy Benoist 18c38dffc6
Add RSS tags feeds 2017-06-21 11:44:35 +02:00
Jérémy Benoist 80784b782b Merge pull request #2683 from wallabag/credentials-in-db
Store credentials in DB
2017-06-20 16:40:48 +02:00
Thomas Citharel bead8b42da
Fix reviews
Encrypt username too
Redirect to list after saving credentials
Fix typos

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-06-20 16:03:39 +02:00
Jeremy Benoist 906424c1b6
Crypt site credential password 2017-06-20 16:03:35 +02:00
Jeremy Benoist 9de9f1e5ce
Add a live test for restricted article
It is not aimed to test if we can get the full article (since we aren't using real login/password)
but mostly to test the full work (with authentication, etc.)

Do not clean fixtured to avoid SQLite to re-use id for entry tag relation 😓
2017-06-20 16:03:20 +02:00
Jeremy Benoist b8427f22f0
Add menu access to site credentials CRUD 2017-06-20 16:03:14 +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
Thomas Citharel 41d45c6122 Fix empty language and preview pics 2017-06-12 16:46:33 +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 e8911f7c09
Add isPublic filter on entries 2017-06-10 15:00:52 +02:00
Jérémy Benoist 679aaf0836 Merge pull request #3173 from wallabag/domain-name-param
remove craueconfig domain name setting and add a proper one in parame…
2017-06-10 11:36:03 +02:00
Jérémy Benoist a899399989 Merge pull request #3192 from wallabag/validate-content-fields
Validate language & preview picture fields
2017-06-09 13:51:26 +02:00
Jeremy Benoist 1f7018e1fe
Cleanup test
Looks like we didn't ALWAYS get a value for language from 20minutes.
Ahem.
2017-06-09 11:52:41 +02:00
Jeremy Benoist 80e49ba7b0
Convert - to _ in language
Mostly to increase language supports
2017-06-09 11:42:09 +02:00
Jeremy Benoist 42f3bb2c63
Use Locale instead of Language 2017-06-09 11:28:04 +02:00
Jeremy Benoist 1a94252831
Promote https 2017-06-09 10:07:27 +02:00
Jeremy Benoist f81a34e379
Use a listener to catch auth failure 2017-06-09 09:45:43 +02:00
Jeremy Benoist e9056dd96f
Fix test
de_DE is not valid language.
Zataz doesn’t send a valid language in their content (they use `fr-FR`).
2017-06-08 22:51:30 +02:00
Jeremy Benoist 0d349ea670
Validate language & preview picture fields
Instead of saving the value of each field right into the content without any validation, it seems better to validate them.
This might sounds obvious now we say that.
2017-06-08 21:51:46 +02:00
Jeremy Benoist 80f4d85ac9
Review 2017-06-08 19:15:33 +02:00
Jeremy Benoist a8d3fe50df
Add ability to name the client 2017-06-08 14:25:44 +02:00
Jeremy Benoist eb570e49c8
CS 2017-06-07 23:31:14 +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
Nicolas Lœuillet 7bb3aa3177 Merge pull request #3093 from aaa2000/annotation-error-on-save
Displays an error with an annotation with a too long quote
2017-06-07 16:30:27 +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
Jérémy Benoist 4e4a5b534f Merge pull request #3184 from wallabag/better-way-image-extension
Use an alternative way to detect images
2017-06-07 13:41:25 +02:00
Jérémy Benoist a3f16a5685 Merge pull request #3179 from wallabag/show-user-command
Show user command
2017-06-07 09:40:56 +02:00
Jeremy Benoist 577c0b6dd8
Use an alternative way to detect image
When parsing content to retrieve images to save locally, we only check for the content-type of the image response.
In some case, that value is empty.
Now we’re also checking for the first few bytes of the content as an alternative to detect if it’s an image wallabag can handle.
We might get higher image supports using that alternative method.
2017-06-05 22:54:02 +02:00
Thomas Citharel 0d8ecb82a3 Fix review
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-06-04 17:57:40 +02:00
adev 2c3e148b00 Displays an error with an annotation with a too long quote
Fix #2762
2017-06-04 11:38:29 +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
Thomas Citharel d143fa243d Add show user command
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2017-06-02 16:53:03 +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
Jérémy Benoist a687c8d915 Merge pull request #2708 from jcharaoui/import-disablecontentupdate
Import disableContentUpdate
2017-06-02 11:26:37 +02:00
Jeremy Benoist fcad69a427
Replace images with &
Images with `&` in the path weren’t well replaced because they might be with `&amp;` in the html instead.

Replacing `&` with `&amp;` fix the problem.
2017-06-01 22:50:33 +02:00
Jeremy Benoist 6acadf8e98
Rewrote code & fix tests 2017-06-01 11:31:45 +02:00
Jeremy Benoist d5c2cc54b5
Fix tests 2017-06-01 09:49:15 +02:00
Jerome Charaoui 704803e182
Replace Wallabag v1 error strings with v2 strings 2017-06-01 09:48:14 +02:00
Jerome Charaoui d0e9b3d640
Add disableContentUpdate import option
This commit also decouples the "import" and "update" functions inside
ContentProxy. If a content array is available, it must be passed to the
new importEntry method.
2017-06-01 09:48:14 +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
Jérémy Benoist 2a0eec07a5 Merge pull request #3137 from aaa2000/isolated-tests
Isolated tests
2017-06-01 07:58:17 +02:00
adev 7ab5eb9508 Isolated tests
Use https://github.com/dmaicher/doctrine-test-bundle to have test isolation.
2017-05-31 16:03:54 +02:00
Jeremy Benoist 695af58857
Fix tests following rebase 2017-05-31 14:00:15 +02:00
Jeremy Benoist 38a04dee34
CS 2017-05-31 14:00:15 +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 0d6cfb884c
Remove htmlawed and use graby instead
Instead of using htmlawed (which is already used in graby) use graby directly (which require some refacto on graby side).
Still needs some tests.
2017-05-31 14:00:15 +02:00
Jeremy Benoist cf05a1ae34
Reduce imported entries
Down from 2.2 minutes to 1.39 minutes
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
Nicolas Lœuillet 4423b88c5b Merge pull request #3168 from wallabag/instapaper-tags-import
Add support for tag in Instapaper import
2017-05-31 12:32:09 +02:00
Nicolas Lœuillet d61fd8be4f Merge pull request #3138 from Kdecherf/2835-tags
Ignore ActionMarkAsRead when removing tag from entry
2017-05-31 11:48:42 +02:00
Nicolas Lœuillet 3f8578ded3 Merge pull request #3161 from wallabag/scrutinizer-2.3
Fix some Scrutinizer issues
2017-05-31 11:46:41 +02:00
Jeremy Benoist 31485bddb9
Ensure retrieved data are fresh 2017-05-31 11:11:02 +02:00
Jeremy Benoist bad7df8c00
CS & improve tags assertions 2017-05-31 10:38:15 +02:00
Jeremy Benoist 7a8ed3cee1
Add support for tag in Instapaper import 2017-05-31 10:38:00 +02:00
Nicolas Lœuillet 7aa5607f29 Merge pull request #3143 from wallabag/fix-wllbg2-import
Fixed is_starred for wallabag v2 import
2017-05-31 09:08:34 +02:00
Kevin Decherf 5dbf3f2326 TagController: ignore ActionMarkAsRead when removing tag from entry
Fixes #2835

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
2017-05-31 00:36:46 +02:00
Jeremy Benoist 047fdc767a
Add tests 2017-05-30 20:27:44 +02:00
Jérémy Benoist 2150576d86 Merge pull request #3065 from wallabag/api-creation-endpoint
Register through API
2017-05-30 15:26:11 +02:00
Jeremy Benoist 26650fdbf8
Use a better way to set input for command
Actually use the correct to way handle that

http://symfony.com/doc/current/components/console/helpers/questionhelper.html#testing-a-command-that-expects-input
2017-05-30 12:47:28 +02:00