aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/ApiBundle/Controller/EntryRestController.php45
-rw-r--r--src/Wallabag/CoreBundle/Controller/RssController.php36
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml22
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig10
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig12
6 files changed, 101 insertions, 25 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/EntryRestController.php b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
index c5bf1df8..1a726b6e 100644
--- a/src/Wallabag/ApiBundle/Controller/EntryRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/EntryRestController.php
@@ -286,6 +286,51 @@ class EntryRestController extends WallabagRestController
286 } 286 }
287 287
288 /** 288 /**
289 * Reload an entry.
290 * A response with HTTP Status 400 will be return if we weren't able to update the content (because it hasn't changed or we got an error).
291 *
292 * @ApiDoc(
293 * requirements={
294 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
295 * }
296 * )
297 *
298 * @return JsonResponse
299 */
300 public function patchEntriesReloadAction(Entry $entry)
301 {
302 $this->validateAuthentication();
303 $this->validateUserAccess($entry->getUser()->getId());
304
305 try {
306 $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
307 } catch (\Exception $e) {
308 $this->get('logger')->error('Error while saving an entry', [
309 'exception' => $e,
310 'entry' => $entry,
311 ]);
312
313 return new JsonResponse(['error' => 'Error while trying to fetch content'], 400);
314 }
315
316 // if refreshing entry failed, don't save it
317 if ($this->getParameter('wallabag_core.fetching_error_message') === $entry->getContent()) {
318 return new JsonResponse(['error' => 'Error while trying to extract content'], 400);
319 }
320
321 $em = $this->getDoctrine()->getManager();
322 $em->persist($entry);
323 $em->flush();
324
325 // entry saved, dispatch event about it!
326 $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry));
327
328 $json = $this->get('serializer')->serialize($entry, 'json');
329
330 return (new JsonResponse())->setJson($json);
331 }
332
333 /**
289 * Delete **permanently** an entry. 334 * Delete **permanently** an entry.
290 * 335 *
291 * @ApiDoc( 336 * @ApiDoc(
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php
index 38e3b5a0..2290386f 100644
--- a/src/Wallabag/CoreBundle/Controller/RssController.php
+++ b/src/Wallabag/CoreBundle/Controller/RssController.php
@@ -3,12 +3,15 @@
3namespace Wallabag\CoreBundle\Controller; 3namespace Wallabag\CoreBundle\Controller;
4 4
5use Pagerfanta\Adapter\DoctrineORMAdapter; 5use Pagerfanta\Adapter\DoctrineORMAdapter;
6use Pagerfanta\Exception\OutOfRangeCurrentPageException;
6use Pagerfanta\Pagerfanta; 7use Pagerfanta\Pagerfanta;
7use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; 8use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 9use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
10use Symfony\Component\HttpFoundation\Request;
9use Symfony\Bundle\FrameworkBundle\Controller\Controller; 11use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10use Wallabag\CoreBundle\Entity\Entry; 12use Wallabag\CoreBundle\Entity\Entry;
11use Wallabag\UserBundle\Entity\User; 13use Wallabag\UserBundle\Entity\User;
14use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
12 15
13class RssController extends Controller 16class RssController extends Controller
14{ 17{
@@ -20,9 +23,9 @@ class RssController extends Controller
20 * 23 *
21 * @return \Symfony\Component\HttpFoundation\Response 24 * @return \Symfony\Component\HttpFoundation\Response
22 */ 25 */
23 public function showUnreadAction(User $user) 26 public function showUnreadAction(Request $request, User $user)
24 { 27 {
25 return $this->showEntries('unread', $user); 28 return $this->showEntries('unread', $user, $request->query->get('page', 1));
26 } 29 }
27 30
28 /** 31 /**
@@ -33,9 +36,9 @@ class RssController extends Controller
33 * 36 *
34 * @return \Symfony\Component\HttpFoundation\Response 37 * @return \Symfony\Component\HttpFoundation\Response
35 */ 38 */
36 public function showArchiveAction(User $user) 39 public function showArchiveAction(Request $request, User $user)
37 { 40 {
38 return $this->showEntries('archive', $user); 41 return $this->showEntries('archive', $user, $request->query->get('page', 1));
39 } 42 }
40 43
41 /** 44 /**
@@ -46,9 +49,9 @@ class RssController extends Controller
46 * 49 *
47 * @return \Symfony\Component\HttpFoundation\Response 50 * @return \Symfony\Component\HttpFoundation\Response
48 */ 51 */
49 public function showStarredAction(User $user) 52 public function showStarredAction(Request $request, User $user)
50 { 53 {
51 return $this->showEntries('starred', $user); 54 return $this->showEntries('starred', $user, $request->query->get('page', 1));
52 } 55 }
53 56
54 /** 57 /**
@@ -57,10 +60,11 @@ class RssController extends Controller
57 * 60 *
58 * @param string $type Entries type: unread, starred or archive 61 * @param string $type Entries type: unread, starred or archive
59 * @param User $user 62 * @param User $user
63 * @param int $page
60 * 64 *
61 * @return \Symfony\Component\HttpFoundation\Response 65 * @return \Symfony\Component\HttpFoundation\Response
62 */ 66 */
63 private function showEntries($type, User $user) 67 private function showEntries($type, User $user, $page = 1)
64 { 68 {
65 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); 69 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
66 70
@@ -87,8 +91,26 @@ class RssController extends Controller
87 $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); 91 $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit');
88 $entries->setMaxPerPage($perPage); 92 $entries->setMaxPerPage($perPage);
89 93
94 $url = $this->generateUrl(
95 $type.'_rss',
96 [
97 'username' => $user->getUsername(),
98 'token' => $user->getConfig()->getRssToken(),
99 ],
100 UrlGeneratorInterface::ABSOLUTE_URL
101 );
102
103 try {
104 $entries->setCurrentPage((int) $page);
105 } catch (OutOfRangeCurrentPageException $e) {
106 if ($page > 1) {
107 return $this->redirect($url.'?page='.$entries->getNbPages(), 302);
108 }
109 }
110
90 return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [ 111 return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [
91 'type' => $type, 112 'type' => $type,
113 'url' => $url,
92 'entries' => $entries, 114 'entries' => $entries,
93 ]); 115 ]);
94 } 116 }
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 0036f45e..0280bc18 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -110,6 +110,7 @@ services:
110 host: '%redis_host%' 110 host: '%redis_host%'
111 port: '%redis_port%' 111 port: '%redis_port%'
112 path: '%redis_path%' 112 path: '%redis_path%'
113 password: '%redis_password%'
113 114
114 wallabag_core.exception_controller: 115 wallabag_core.exception_controller:
115 class: Wallabag\CoreBundle\Controller\ExceptionController 116 class: Wallabag\CoreBundle\Controller\ExceptionController
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 38fc4ceb..c124b744 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -61,7 +61,7 @@ config:
61 save: 'Zapisz' 61 save: 'Zapisz'
62 form_settings: 62 form_settings:
63 theme_label: 'Temat' 63 theme_label: 'Temat'
64 items_per_page_label: 'Ilość elementóœ na stronie' 64 items_per_page_label: 'Ilość elementów na stronie'
65 language_label: 'Język' 65 language_label: 'Język'
66 reading_speed: 66 reading_speed:
67 label: 'Prędkość czytania' 67 label: 'Prędkość czytania'
@@ -76,11 +76,11 @@ config:
76 redirect_current_page: 'do bieżącej strony' 76 redirect_current_page: 'do bieżącej strony'
77 pocket_consumer_key_label: 'Klucz klienta Pocket do importu zawartości' 77 pocket_consumer_key_label: 'Klucz klienta Pocket do importu zawartości'
78 android_configuration: Skonfiguruj swoją androidową aplikację 78 android_configuration: Skonfiguruj swoją androidową aplikację
79 # help_theme: "wallabag is customizable. You can choose your prefered theme here." 79 help_theme: "Dopasuj wallabag do swoich potrzeb. Tutaj możesz wybr preferowany przez ciebie motyw."
80 # help_items_per_page: "You can change the number of articles displayed on each page." 80 help_items_per_page: "Możesz zmienić ilość artykułów wyświetlanych na każdej stronie."
81 # help_reading_speed: "wallabag calculates a reading time for each article. You can define here, thanks to this list, if you are a fast or a slow reader. wallabag will recalculate the reading time for each article." 81 help_reading_speed: "wallabag oblicza czas czytania każdego artykułu. Dzięki tej liście możesz określić swoje tempo. Wallabag przeliczy ponownie czas potrzebny, na przeczytanie każdego z artykułów."
82 # help_language: "You can change the language of wallabag interface." 82 help_language: "Możesz zmienić język interfejsu wallabag."
83 # help_pocket_consumer_key: "Required for Pocket import. You can create it in your Pocket account." 83 help_pocket_consumer_key: "Wymagane dla importu z Pocket. Możesz go stworzyć na swoim koncie Pocket."
84 form_rss: 84 form_rss:
85 description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌' 85 description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌'
86 token_label: 'Token RSS' 86 token_label: 'Token RSS'
@@ -98,7 +98,7 @@ config:
98 name_label: 'Nazwa' 98 name_label: 'Nazwa'
99 email_label: 'Adres email' 99 email_label: 'Adres email'
100 twoFactorAuthentication_label: 'Autoryzacja dwuetapowa' 100 twoFactorAuthentication_label: 'Autoryzacja dwuetapowa'
101 # help_twoFactorAuthentication: "If you enable 2FA, each time you want to login to wallabag, you'll receive a code by email." 101 help_twoFactorAuthentication: "Jeżeli włączysz autoryzację dwuetapową. Za każdym razem, kiedy będziesz chciał się zalogować, dostaniesz kod na swój e-mail."
102 delete: 102 delete:
103 title: Usuń moje konto (niebezpieczna strefa !) 103 title: Usuń moje konto (niebezpieczna strefa !)
104 description: Jeżeli usuniesz swoje konto, wszystkie twoje artykuły, tagi, adnotacje, oraz konto zostaną trwale usunięte (operacja jest NIEODWRACALNA). Następnie zostaniesz wylogowany. 104 description: Jeżeli usuniesz swoje konto, wszystkie twoje artykuły, tagi, adnotacje, oraz konto zostaną trwale usunięte (operacja jest NIEODWRACALNA). Następnie zostaniesz wylogowany.
@@ -112,7 +112,7 @@ config:
112 entries: usuń WSZYTSTKIE wpisy 112 entries: usuń WSZYTSTKIE wpisy
113 confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć) 113 confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć)
114 form_password: 114 form_password:
115 # description: "You can change your password here. Your new password should by at least 8 characters long." 115 description: "Tutaj możesz zmienić swoje hasło. Twoje nowe hasło powinno mieć conajmniej 8 znaków."
116 old_password_label: 'Stare hasło' 116 old_password_label: 'Stare hasło'
117 new_password_label: 'Nowe hasło' 117 new_password_label: 'Nowe hasło'
118 repeat_new_password_label: 'Powtórz nowe hasło' 118 repeat_new_password_label: 'Powtórz nowe hasło'
@@ -162,7 +162,7 @@ entry:
162 archived: 'Zarchiwizowane wpisy' 162 archived: 'Zarchiwizowane wpisy'
163 filtered: 'Odfiltrowane wpisy' 163 filtered: 'Odfiltrowane wpisy'
164 filtered_tags: 'Filtrowane po tagach:' 164 filtered_tags: 'Filtrowane po tagach:'
165 # filtered_search: 'Filtered by search:' 165 filtered_search: 'Filtrowanie po wyszukiwaniu:'
166 untagged: 'Odtaguj wpisy' 166 untagged: 'Odtaguj wpisy'
167 list: 167 list:
168 number_on_the_page: '{0} Nie ma wpisów.|{1} Jest jeden wpis.|]1,Inf[ Są %count% wpisy.' 168 number_on_the_page: '{0} Nie ma wpisów.|{1} Jest jeden wpis.|]1,Inf[ Są %count% wpisy.'
@@ -186,7 +186,7 @@ entry:
186 preview_picture_label: 'Posiada podgląd obrazu' 186 preview_picture_label: 'Posiada podgląd obrazu'
187 preview_picture_help: 'Podgląd obrazu' 187 preview_picture_help: 'Podgląd obrazu'
188 language_label: 'Język' 188 language_label: 'Język'
189 # http_status_label: 'HTTP status' 189 http_status_label: 'Status HTTP'
190 reading_time: 190 reading_time:
191 label: 'Czas czytania w minutach' 191 label: 'Czas czytania w minutach'
192 from: 'od' 192 from: 'od'
@@ -229,7 +229,7 @@ entry:
229 form_new: 229 form_new:
230 url_label: Url 230 url_label: Url
231 search: 231 search:
232 # placeholder: 'What are you looking for?' 232 placeholder: 'Czego szukasz?'
233 edit: 233 edit:
234 page_title: 'Edytuj wpis' 234 page_title: 'Edytuj wpis'
235 title_label: 'Tytuł' 235 title_label: 'Tytuł'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
index 288bb54f..16ecaa97 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
@@ -2,7 +2,15 @@
2<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/"> 2<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
3 <channel> 3 <channel>
4 <title>wallabag — {{type}} feed</title> 4 <title>wallabag — {{type}} feed</title>
5 <link>{{ url('unread') }}</link> 5 <link>{{ url(type) }}</link>
6 <link rel="self" href="{{ app.request.uri }}"/>
7 {% if entries.hasPreviousPage -%}
8 <link rel="previous" href="{{ url }}?page={{ entries.previousPage }}"/>
9 {% endif -%}
10 {% if entries.hasNextPage -%}
11 <link rel="next" href="{{ url }}?page={{ entries.nextPage }}"/>
12 {% endif -%}
13 <link rel="last" href="{{ url }}?page={{ entries.nbPages }}"/>
6 <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate> 14 <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate>
7 <generator>wallabag</generator> 15 <generator>wallabag</generator>
8 <description>wallabag {{type}} elements</description> 16 <description>wallabag {{type}} elements</description>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig
index c8a303a6..b7a48551 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/common/Static/quickstart.html.twig
@@ -15,7 +15,7 @@
15 <li class="col l4 m6 s12"> 15 <li class="col l4 m6 s12">
16 <div class="card teal darken-1"> 16 <div class="card teal darken-1">
17 <div class="card-content white-text"> 17 <div class="card-content white-text">
18 <span class="card-title">{{ 'quickstart.configure.title'|trans }}</span> 18 <span class="card-title white-text">{{ 'quickstart.configure.title'|trans }}</span>
19 <p>{{ 'quickstart.configure.description'|trans }}</p> 19 <p>{{ 'quickstart.configure.description'|trans }}</p>
20 </div> 20 </div>
21 <div class="card-action"> 21 <div class="card-action">
@@ -31,7 +31,7 @@
31 <li class="col l4 m6 s12"> 31 <li class="col l4 m6 s12">
32 <div class="card green darken-1"> 32 <div class="card green darken-1">
33 <div class="card-content white-text"> 33 <div class="card-content white-text">
34 <span class="card-title">{{ 'quickstart.first_steps.title'|trans }}</span> 34 <span class="card-title white-text">{{ 'quickstart.first_steps.title'|trans }}</span>
35 <p>{{ 'quickstart.first_steps.description'|trans }}</p> 35 <p>{{ 'quickstart.first_steps.description'|trans }}</p>
36 </div> 36 </div>
37 <div class="card-action"> 37 <div class="card-action">
@@ -46,7 +46,7 @@
46 <li class="col l4 m6 s12"> 46 <li class="col l4 m6 s12">
47 <div class="card light-green darken-1"> 47 <div class="card light-green darken-1">
48 <div class="card-content white-text"> 48 <div class="card-content white-text">
49 <span class="card-title">{{ 'quickstart.migrate.title'|trans }}</span> 49 <span class="card-title white-text">{{ 'quickstart.migrate.title'|trans }}</span>
50 <p>{{ 'quickstart.migrate.description'|trans }}</p> 50 <p>{{ 'quickstart.migrate.description'|trans }}</p>
51 </div> 51 </div>
52 <div class="card-action"> 52 <div class="card-action">
@@ -63,7 +63,7 @@
63 <li class="col l4 m6 s12"> 63 <li class="col l4 m6 s12">
64 <div class="card blue darken-1"> 64 <div class="card blue darken-1">
65 <div class="card-content white-text"> 65 <div class="card-content white-text">
66 <span class="card-title">{{ 'quickstart.developer.title'|trans }}</span> 66 <span class="card-title white-text">{{ 'quickstart.developer.title'|trans }}</span>
67 <p>{{ 'quickstart.developer.description'|trans }}</p> 67 <p>{{ 'quickstart.developer.description'|trans }}</p>
68 </div> 68 </div>
69 <div class="card-action"> 69 <div class="card-action">
@@ -79,7 +79,7 @@
79 <li class="col l4 m6 s12"> 79 <li class="col l4 m6 s12">
80 <div class="card light-blue darken-1"> 80 <div class="card light-blue darken-1">
81 <div class="card-content white-text"> 81 <div class="card-content white-text">
82 <span class="card-title">{{ 'quickstart.docs.title'|trans }}</span> 82 <span class="card-title white-text">{{ 'quickstart.docs.title'|trans }}</span>
83 <p>{{ 'quickstart.docs.description'|trans }}</p> 83 <p>{{ 'quickstart.docs.description'|trans }}</p>
84 </div> 84 </div>
85 <div class="card-action"> 85 <div class="card-action">
@@ -95,7 +95,7 @@
95 <li class="col l4 m6 s12"> 95 <li class="col l4 m6 s12">
96 <div class="card cyan darken-1"> 96 <div class="card cyan darken-1">
97 <div class="card-content white-text"> 97 <div class="card-content white-text">
98 <span class="card-title">{{ 'quickstart.support.title'|trans }}</span> 98 <span class="card-title white-text">{{ 'quickstart.support.title'|trans }}</span>
99 <p>{{ 'quickstart.support.description'|trans }}</p> 99 <p>{{ 'quickstart.support.description'|trans }}</p>
100 </div> 100 </div>
101 <div class="card-action"> 101 <div class="card-action">