mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 02:51:04 +00:00
Merge remote-tracking branch 'origin/master' into 2.4
This commit is contained in:
commit
3620dae1e6
14 changed files with 185 additions and 66 deletions
18
CHANGELOG.md
18
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)
|
||||
|
||||
|
|
|
@ -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%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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\.']
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
||||
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"
|
||||
|
||||
ENV=$1
|
||||
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
|
||||
git checkout $TAG
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 .= '<p><i>But we found a short description: </i></p>';
|
||||
$html .= $content['open_graph']['og_description'];
|
||||
$content['html'] .= '<p><i>But we found a short description: </i></p>';
|
||||
$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']);
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<div class="card-action">
|
||||
<span class="reading-time grey-text">
|
||||
{% include "@WallabagCore/themes/material/Entry/_reading_time.html.twig" with {'entry': entry} only %}
|
||||
<i class="material-icons hide-on-med-and-down" title="{{ 'entry.view.created_at'|trans }}">today</i>
|
||||
<span class="hide-on-med-and-down"> {{ entry.createdAt|date('Y-m-d') }}</span>
|
||||
</span>
|
||||
<div class="reading-time grey-text">
|
||||
<div class="card-reading-time">{% include "@WallabagCore/themes/material/Entry/_reading_time.html.twig" with {'entry': entry} only %}</div>
|
||||
<div class="card-created-at">
|
||||
<i class="material-icons" title="{{ 'entry.view.created_at'|trans }}">today</i>
|
||||
<span> {{ entry.createdAt|date('Y-m-d') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="tools right">
|
||||
<li>
|
||||
|
|
|
@ -400,29 +400,71 @@ class EntryRestControllerTest extends WallabagApiTestCase
|
|||
|
||||
public function testDeleteEntry()
|
||||
{
|
||||
$entry = $this->client->getContainer()
|
||||
->get('doctrine.orm.entity_manager')
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->findOneByUser($this->getUserId(), ['id' => 'asc']);
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$entry = new Entry($em->getReference(User::class, 1));
|
||||
$entry->setUrl('http://0.0.0.0/test-delete-entry');
|
||||
$entry->setTitle('Test delete entry');
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
if (!$entry) {
|
||||
$this->markTestSkipped('No content found in db.');
|
||||
}
|
||||
$em->clear();
|
||||
|
||||
$this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json');
|
||||
$e = [
|
||||
'title' => $entry->getTitle(),
|
||||
'url' => $entry->getUrl(),
|
||||
'id' => $entry->getId(),
|
||||
];
|
||||
|
||||
$this->client->request('DELETE', '/api/entries/' . $e['id'] . '.json');
|
||||
|
||||
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
|
||||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertSame($entry->getTitle(), $content['title']);
|
||||
$this->assertSame($entry->getUrl(), $content['url']);
|
||||
$this->assertSame($entry->getId(), $content['id']);
|
||||
$this->assertSame($e['title'], $content['title']);
|
||||
$this->assertSame($e['url'], $content['url']);
|
||||
$this->assertSame($e['id'], $content['id']);
|
||||
|
||||
// We'll try to delete this entry again
|
||||
$this->client->request('DELETE', '/api/entries/' . $entry->getId() . '.json');
|
||||
$client = $this->createAuthorizedClient();
|
||||
$client->request('DELETE', '/api/entries/' . $e['id'] . '.json');
|
||||
|
||||
$this->assertSame(404, $this->client->getResponse()->getStatusCode());
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testDeleteEntryExpectId()
|
||||
{
|
||||
$em = $this->client->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$entry = new Entry($em->getReference(User::class, 1));
|
||||
$entry->setUrl('http://0.0.0.0/test-delete-entry-id');
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
$em->clear();
|
||||
|
||||
$id = $entry->getId();
|
||||
|
||||
$this->client->request('DELETE', '/api/entries/' . $id . '.json?expect=id');
|
||||
|
||||
$this->assertSame(200, $this->client->getResponse()->getStatusCode());
|
||||
|
||||
$content = json_decode($this->client->getResponse()->getContent(), true);
|
||||
|
||||
$this->assertSame($id, $content['id']);
|
||||
$this->assertArrayNotHasKey('url', $content);
|
||||
|
||||
// We'll try to delete this entry again
|
||||
$client = $this->createAuthorizedClient();
|
||||
$client->request('DELETE', '/api/entries/' . $id . '.json');
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testDeleteEntryExpectBadRequest()
|
||||
{
|
||||
$this->client->request('DELETE', '/api/entries/1.json?expect=badrequest');
|
||||
|
||||
$this->assertSame(400, $this->client->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
public function testPostEntry()
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue