From: Jeremy Benoist Date: Mon, 1 Apr 2019 11:16:15 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' into 2.4 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=3620dae1e6b3fab5a4ba4001b4581ce7ed795996;hp=b886ee923d7e627da2ae0221271bedbcb495025a;p=github%2Fwallabag%2Fwallabag.git Merge remote-tracking branch 'origin/master' into 2.4 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index c116efb1..495bd1d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [2.3.7](https://github.com/wallabag/wallabag/tree/2.3.7) + [Full Changelog](https://github.com/wallabag/wallabag/compare/2.3.6...2.3.7) + +### Fixes + +- Jump to 2.3.7-dev [#3837](https://github.com/wallabag/wallabag/pull/3837) +- Fix bad order parameter in the API [#3841](https://github.com/wallabag/wallabag/pull/3841) +- Update composer.json to add php-tidy (ext-tidy) [#3853](https://github.com/wallabag/wallabag/pull/3853) +- Add dedicated email for site config issue [#3861](https://github.com/wallabag/wallabag/pull/3861) +- Fix read & starred status in Pocket import [#3819](https://github.com/wallabag/wallabag/pull/3819) +- Fix broken 2 factor auth logo image [#3869](https://github.com/wallabag/wallabag/pull/3869) +- Fix CORS for API [#3882](https://github.com/wallabag/wallabag/pull/3882) +- Add support of expect parameter to change return object when deleting entry [#3887](https://github.com/wallabag/wallabag/pull/3887) +- epub export: fix missing cover image, only for exports of one article [#3886](https://github.com/wallabag/wallabag/pull/3886) +- Allow optional --ignore-root-warning [#3885](https://github.com/wallabag/wallabag/pull/3885) +- material: fix left padding of content on medium screens [#3893](https://github.com/wallabag/wallabag/pull/3893) +- material: hide creation date from card actions on specific sizes [#3894](https://github.com/wallabag/wallabag/pull/3894) + ## [2.3.6](https://github.com/wallabag/wallabag/tree/2.3.6) [Full Changelog](https://github.com/wallabag/wallabag/compare/2.3.5...2.3.6) diff --git a/app/Resources/static/themes/material/css/cards.scss b/app/Resources/static/themes/material/css/cards.scss index 1acc03dc..c893b376 100644 --- a/app/Resources/static/themes/material/css/cards.scss +++ b/app/Resources/static/themes/material/css/cards.scss @@ -102,6 +102,11 @@ main { display: inline-flex; vertical-align: middle; + .card-reading-time, + .card-created-at { + display: inline-flex; + } + span { margin-right: 5px; } @@ -283,9 +288,3 @@ a.original:not(.waves-effect) { .settings .div_tabs { padding-bottom: 15px; } - -@media only screen and (min-width: 992px) { - .card-tag-labels li { - max-width: 50%; - } -} diff --git a/app/Resources/static/themes/material/css/media_queries.scss b/app/Resources/static/themes/material/css/media_queries.scss index 72584426..491eedce 100644 --- a/app/Resources/static/themes/material/css/media_queries.scss +++ b/app/Resources/static/themes/material/css/media_queries.scss @@ -12,6 +12,16 @@ .pagination { margin-left: auto; } + + .card-tag-labels li { + max-width: 50%; + } +} + +@media screen and (min-width: 993px) { + body.entry main #content { + padding-left: 70px; + } } @media only screen and (max-width: 992px) { @@ -164,3 +174,12 @@ padding: 0; } } + +@media screen and (max-width: 310px), + screen and (min-width: 601px) and (max-width: 660px), + screen and (min-width: 993px) and (max-width: 1050px), + screen and (min-width: 1201px) and (max-width: 1250px) { + .card .card-action .reading-time .card-created-at { + display: none; + } +} diff --git a/app/config/config.yml b/app/config/config.yml index 2d8f9bf0..078f277a 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -148,18 +148,18 @@ nelmio_cors: paths: '^/api/': allow_origin: ['*'] - allow_headers: ['X-Custom-Auth'] + allow_headers: ['Authorization','content-type'] allow_methods: ['POST', 'PUT', 'PATCH','GET', 'DELETE'] max_age: 3600 '^/oauth/': allow_origin: ['*'] - allow_headers: ['X-Custom-Auth'] + allow_headers: ['Authorization','content-type'] allow_methods: ['POST', 'PUT', 'GET', 'DELETE'] max_age: 3600 '^/': #origin_regex: true - allow_origin: ['^http://localhost:[0-9]+'] - allow_headers: ['X-Custom-Auth'] + allow_origin: ['*'] + allow_headers: ['Authorization','content-type'] allow_methods: ['POST', 'PUT', 'GET', 'DELETE'] max_age: 3600 hosts: ['^api\.'] diff --git a/app/config/wallabag.yml b/app/config/wallabag.yml index 09b2f3a2..96dfacf9 100644 --- a/app/config/wallabag.yml +++ b/app/config/wallabag.yml @@ -1,5 +1,5 @@ wallabag_core: - version: 2.3.7-dev + version: 2.3.8-dev paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb" languages: en: 'English' diff --git a/scripts/dev.sh b/scripts/dev.sh index 0703ced1..28453be0 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -3,10 +3,14 @@ # eg: `sh dev.sh` COMPOSER_COMMAND='composer' +REQUIRE_FILE='scripts/require.sh' -DIR="${BASH_SOURCE}" -if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi -. "$DIR/require.sh" +if [ ! -f "$REQUIRE_FILE" ]; then + echo "Cannot find $REQUIRE_FILE" + exit 1 +fi + +. "$REQUIRE_FILE" $COMPOSER_COMMAND install php bin/console wallabag:install diff --git a/scripts/install.sh b/scripts/install.sh index 8b7ea03f..affa715f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,9 +5,17 @@ IGNORE_ROOT_ARG="--ignore-root-warning" IGNORE_ROOT=0 -if [ "$1" == "$IGNORE_ROOT_ARG" ]; then - IGNORE_ROOT=1 -fi +while :; do + case $1 in + $IGNORE_ROOT_ARG) IGNORE_ROOT=1 + ;; + *[a-zA-Z]) ENV=$1 + ;; + *) break + ;; + esac + shift +done # Abort running this script if root if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then @@ -17,12 +25,15 @@ if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then fi COMPOSER_COMMAND='composer' +REQUIRE_FILE='scripts/require.sh' + +if [ ! -f "$REQUIRE_FILE" ]; then + echo "Cannot find $REQUIRE_FILE" + exit 1 +fi -DIR="${BASH_SOURCE}" -if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi -. "$DIR/require.sh" +. "$REQUIRE_FILE" -ENV=$1 TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) git checkout $TAG diff --git a/scripts/update.sh b/scripts/update.sh index c62d104a..3ef10439 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -5,9 +5,17 @@ IGNORE_ROOT_ARG="--ignore-root-warning" IGNORE_ROOT=0 -if [ "$1" == "$IGNORE_ROOT_ARG" ]; then - IGNORE_ROOT=1 -fi +while :; do + case $1 in + $IGNORE_ROOT_ARG) IGNORE_ROOT=1 + ;; + *[a-zA-Z]) ENV=$1 + ;; + *) break + ;; + esac + shift +done # Abort running this script if root if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then @@ -20,12 +28,14 @@ set -e set -u COMPOSER_COMMAND='composer' +REQUIRE_FILE='scripts/require.sh' -DIR="${BASH_SOURCE}" -if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi -. "$DIR/require.sh" +if [ ! -f "$REQUIRE_FILE" ]; then + echo "Cannot find $REQUIRE_FILE" + exit 1 +fi -ENV=$1 +. "$REQUIRE_FILE" rm -rf var/cache/* git fetch origin diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php index 16d8a40b..5c850091 100644 --- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php +++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php @@ -568,18 +568,31 @@ class EntryRestController extends WallabagRestController * @ApiDoc( * requirements={ * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} + * }, + * parameters={ + * {"name"="expect", "dataType"="string", "required"=false, "format"="id or entry", "description"="Only returns the id instead of the deleted entry's full entity if 'id' is specified. Default to entry"}, * } * ) * * @return JsonResponse */ - public function deleteEntriesAction(Entry $entry) + public function deleteEntriesAction(Entry $entry, Request $request) { + $expect = $request->query->get('expect', 'entry'); + if (!\in_array($expect, ['id', 'entry'], true)) { + throw new BadRequestHttpException(sprintf("expect: 'id' or 'entry' expected, %s given", $expect)); + } $this->validateAuthentication(); $this->validateUserAccess($entry->getUser()->getId()); - // We copy $entry to keep id in returned object - $e = $entry; + $response = $this->sendResponse([ + 'id' => $entry->getId(), + ]); + // We clone $entry to keep id in returned object + if ('entry' === $expect) { + $e = clone $entry; + $response = $this->sendResponse($e); + } $em = $this->getDoctrine()->getManager(); $em->remove($entry); @@ -588,7 +601,7 @@ class EntryRestController extends WallabagRestController // entry deleted, dispatch event about it! $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); - return $this->sendResponse($e); + return $response; } /** diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index d38811a2..31953f12 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php @@ -256,18 +256,17 @@ class ContentProxy $entry->setTitle($content['open_graph']['og_title']); } - $html = $content['html']; - if (false === $html) { - $html = $this->fetchingErrorMessage; + if (empty($content['html'])) { + $content['html'] = $this->fetchingErrorMessage; if (!empty($content['open_graph']['og_description'])) { - $html .= '

But we found a short description:

'; - $html .= $content['open_graph']['og_description']; + $content['html'] .= '

But we found a short description:

'; + $content['html'] .= $content['open_graph']['og_description']; } } - $entry->setContent($html); - $entry->setReadingTime(Utils::getReadingTime($html)); + $entry->setContent($content['html']); + $entry->setReadingTime(Utils::getReadingTime($content['html'])); if (!empty($content['status'])) { $entry->setHttpStatus($content['status']); diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 64591687..f981ee50 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -165,13 +165,6 @@ class EntriesExport $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'PHP'); $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'wallabag'); - /* - * Front page - */ - if (file_exists($this->logoPath)) { - $book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png'); - } - $entryIds = []; $entryCount = \count($this->entries); $i = 0; @@ -183,10 +176,19 @@ class EntriesExport // set tags as subjects foreach ($this->entries as $entry) { ++$i; + + /* + * Front page + * Set if there's only one entry in the given set + */ + if (1 === $entryCount && null !== $entry->getPreviewPicture()) { + $book->setCoverImage($entry->getPreviewPicture()); + } + foreach ($entry->getTags() as $tag) { $book->setSubject($tag->getLabel()); } - $filename = sha1($entry->getTitle()); + $filename = sha1(sprintf('%s:%s', $entry->getUrl(), $entry->getTitle())); $publishedBy = $entry->getPublishedBy(); $authors = $this->translator->trans('export.unknown'); diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig index 827f09d9..be764e10 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/_card_actions.html.twig @@ -1,9 +1,11 @@
- - {% include "@WallabagCore/themes/material/Entry/_reading_time.html.twig" with {'entry': entry} only %} - today -  {{ entry.createdAt|date('Y-m-d') }} - +
+
{% include "@WallabagCore/themes/material/Entry/_reading_time.html.twig" with {'entry': entry} only %}
+
+ today +  {{ entry.createdAt|date('Y-m-d') }} +
+