mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Merge branch '2.6'
This commit is contained in:
commit
e6ce9c524c
28 changed files with 611 additions and 280 deletions
2
.github/workflows/coding-standards.yml
vendored
2
.github/workflows/coding-standards.yml
vendored
|
@ -13,7 +13,7 @@ permissions:
|
|||
jobs:
|
||||
coding-standards:
|
||||
name: "CS Fixer, PHPStan & TwigCS"
|
||||
runs-on: "ubuntu-20.04"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
|
|
4
.github/workflows/continuous-integration.yml
vendored
4
.github/workflows/continuous-integration.yml
vendored
|
@ -16,7 +16,7 @@ env:
|
|||
jobs:
|
||||
phpunit:
|
||||
name: "PHP ${{ matrix.php }} using ${{ matrix.database }}"
|
||||
runs-on: "ubuntu-20.04"
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
rabbitmq:
|
||||
image: rabbitmq:3-alpine
|
||||
|
@ -93,7 +93,7 @@ jobs:
|
|||
|
||||
phpunit_no_prefix:
|
||||
name: "PHP ${{ matrix.php }} using ${{ matrix.database }} without prefix"
|
||||
runs-on: "ubuntu-20.04"
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
rabbitmq:
|
||||
image: rabbitmq:3-alpine
|
||||
|
|
2
.github/workflows/translations.yml
vendored
2
.github/workflows/translations.yml
vendored
|
@ -13,7 +13,7 @@ permissions:
|
|||
jobs:
|
||||
translations:
|
||||
name: "Translations"
|
||||
runs-on: "ubuntu-20.04"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
* **[BC BREAK]** Convert 403 errors to 404 errors by @yguedidi in https://github.com/wallabag/wallabag/pull/8075
|
||||
* `wallassets/` folder renamed to `build/`
|
||||
|
||||
## [2.6.11](https://github.com/wallabag/wallabag/tree/2.6.11)
|
||||
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.10...2.6.11)
|
||||
|
||||
### Security fix
|
||||
* Protect actions with a CSRF token by @yguedidi in https://github.com/wallabag/wallabag/commit/99c8a06594d6ee7480ce4d041ccff3025b353656
|
||||
|
||||
## [2.6.10](https://github.com/wallabag/wallabag/tree/2.6.10)
|
||||
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.9...2.6.10)
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ framework:
|
|||
handler_id: session.handler.native_file
|
||||
save_path: "%kernel.project_dir%/var/sessions/%kernel.environment%"
|
||||
cookie_secure: auto
|
||||
cookie_samesite: lax
|
||||
storage_factory_id: session.storage.factory.native
|
||||
fragments: ~
|
||||
http_method_override: true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
parameters:
|
||||
wallabag.version: 2.6.10
|
||||
wallabag.version: 2.6.11
|
||||
wallabag.paypal_url: "https://liberapay.com/wallabag/donate"
|
||||
wallabag.languages:
|
||||
en: 'English'
|
||||
|
|
|
@ -179,6 +179,7 @@ a.original:not(.waves-effect) {
|
|||
.card-entry-tags a,
|
||||
.card-entry-labels a,
|
||||
.card-tag-labels a,
|
||||
.card-tag-labels button,
|
||||
.card-entry-labels-hidden a,
|
||||
#list .chip a {
|
||||
text-decoration: none;
|
||||
|
|
|
@ -63,7 +63,9 @@
|
|||
.input-field input:focus,
|
||||
.results-item,
|
||||
.sidenav li > a,
|
||||
.sidenav li > a > i.material-icons {
|
||||
.sidenav li > a > i.material-icons,
|
||||
.sidenav li button,
|
||||
.sidenav li button > i.material-icons {
|
||||
color: #dfdfdf;
|
||||
}
|
||||
|
||||
|
@ -88,6 +90,7 @@
|
|||
|
||||
.mass-action-tags .mass-action-tags-input.mass-action-tags-input,
|
||||
.sidenav li:not(.logo) > a:hover,
|
||||
.sidenav li:not(.logo) button:hover,
|
||||
.sidenav .collapsible-header:hover,
|
||||
.sidenav.sidenav-fixed .collapsible-header:hover {
|
||||
background-color: #1d1d1d;
|
||||
|
|
|
@ -6,11 +6,32 @@ nav {
|
|||
line-height: initial;
|
||||
}
|
||||
|
||||
// adapted from anchor styles from node_modules/@materializecss/materialize/sass/components/_navbar.scss
|
||||
nav ul button {
|
||||
transition: background-color .3s;
|
||||
font-size: 1rem;
|
||||
color: #fff;
|
||||
display: block;
|
||||
padding: 0 15px;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: 0;
|
||||
|
||||
&:focus {
|
||||
background: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(0 0 0 / 10%);
|
||||
}
|
||||
}
|
||||
|
||||
nav {
|
||||
input {
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
ul button:hover,
|
||||
ul a:hover {
|
||||
background-color: initial;
|
||||
}
|
||||
|
@ -34,6 +55,7 @@ nav {
|
|||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
button,
|
||||
a {
|
||||
padding: 10px 15px;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
background: initial;
|
||||
}
|
||||
|
||||
& button > i.material-icons.theme-toggle-icon,
|
||||
& > a > i.material-icons.theme-toggle-icon {
|
||||
float: none;
|
||||
margin-left: 0;
|
||||
|
@ -22,6 +23,7 @@
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
&.sidenav-fixed button,
|
||||
&.sidenav-fixed a {
|
||||
font-size: 13px;
|
||||
line-height: 44px;
|
||||
|
@ -41,7 +43,35 @@
|
|||
}
|
||||
}
|
||||
|
||||
.bold > a {
|
||||
// adapted from anchor styles from node_modules/@materializecss/materialize/sass/components/_sidenav.scss
|
||||
.sidenav li button {
|
||||
color: rgba(0 0 0 / 87%);
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
padding: 0 (16px * 2);
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(0 0 0 / 5%);
|
||||
}
|
||||
|
||||
& > i,
|
||||
& > i.material-icons {
|
||||
float: left;
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
margin: 0 (16px * 2) 0 0;
|
||||
width: 24px;
|
||||
color: rgba(0 0 0 / 54%);
|
||||
}
|
||||
}
|
||||
|
||||
.bold > a,
|
||||
.bold > button {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
@use "variables";
|
||||
|
||||
/* ==========================================================================
|
||||
* Various
|
||||
* ========================================================================== */
|
||||
|
@ -38,3 +40,18 @@ nav .input-field input {
|
|||
.tab {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.btn-link {
|
||||
background: none;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
color: variables.$blue-accent-color;
|
||||
|
||||
&:focus {
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
|
||||
.inline-block {
|
||||
display: inline-block;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Wallabag\Controller\AbstractController;
|
||||
|
@ -73,7 +74,7 @@ class DeveloperController extends AbstractController
|
|||
public function deleteClientAction(Request $request, Client $client, EntityManagerInterface $entityManager, TranslatorInterface $translator)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('delete-client', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
if (null === $this->getUser() || $client->getUser()->getId() !== $this->getUser()->getId()) {
|
||||
|
|
|
@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Validator\Constraints\Locale as LocaleConstraint;
|
||||
|
@ -253,7 +254,7 @@ class ConfigController extends AbstractController
|
|||
public function disableOtpEmailAction(Request $request)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('otp', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$user = $this->getUser();
|
||||
|
@ -278,7 +279,7 @@ class ConfigController extends AbstractController
|
|||
public function otpEmailAction(Request $request)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('otp', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$user = $this->getUser();
|
||||
|
@ -306,7 +307,7 @@ class ConfigController extends AbstractController
|
|||
public function disableOtpAppAction(Request $request)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('otp', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$user = $this->getUser();
|
||||
|
@ -333,7 +334,7 @@ class ConfigController extends AbstractController
|
|||
public function otpAppAction(Request $request, GoogleAuthenticatorInterface $googleAuthenticator)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('otp', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$user = $this->getUser();
|
||||
|
@ -392,7 +393,7 @@ class ConfigController extends AbstractController
|
|||
public function otpAppCheckAction(Request $request, GoogleAuthenticatorInterface $googleAuthenticator)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('otp', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$isValid = $googleAuthenticator->checkCode(
|
||||
|
@ -425,20 +426,20 @@ class ConfigController extends AbstractController
|
|||
/**
|
||||
* @return RedirectResponse|JsonResponse
|
||||
*/
|
||||
#[Route(path: '/generate-token', name: 'generate_token', methods: ['GET'])]
|
||||
#[Route(path: '/generate-token', name: 'generate_token', methods: ['POST'])]
|
||||
#[IsGranted('EDIT_CONFIG')]
|
||||
public function generateTokenAction(Request $request)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('generate-token', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$config = $this->getConfig();
|
||||
$config->setFeedToken(Utils::generateToken());
|
||||
|
||||
$this->entityManager->persist($config);
|
||||
$this->entityManager->flush();
|
||||
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
return new JsonResponse(['token' => $config->getFeedToken()]);
|
||||
}
|
||||
|
||||
$this->addFlash(
|
||||
'notice',
|
||||
'flashes.config.notice.feed_token_updated'
|
||||
|
@ -450,20 +451,20 @@ class ConfigController extends AbstractController
|
|||
/**
|
||||
* @return RedirectResponse|JsonResponse
|
||||
*/
|
||||
#[Route(path: '/revoke-token', name: 'revoke_token', methods: ['GET'])]
|
||||
#[Route(path: '/revoke-token', name: 'revoke_token', methods: ['POST'])]
|
||||
#[IsGranted('EDIT_CONFIG')]
|
||||
public function revokeTokenAction(Request $request)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('revoke-token', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$config = $this->getConfig();
|
||||
$config->setFeedToken(null);
|
||||
|
||||
$this->entityManager->persist($config);
|
||||
$this->entityManager->flush();
|
||||
|
||||
if ($request->isXmlHttpRequest()) {
|
||||
return new JsonResponse();
|
||||
}
|
||||
|
||||
$this->addFlash(
|
||||
'notice',
|
||||
'flashes.config.notice.feed_token_revoked'
|
||||
|
@ -477,10 +478,14 @@ class ConfigController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/tagging-rule/delete/{taggingRule}', name: 'delete_tagging_rule', methods: ['GET'], requirements: ['taggingRule' => '\d+'])]
|
||||
#[Route(path: '/tagging-rule/delete/{taggingRule}', name: 'delete_tagging_rule', methods: ['POST'], requirements: ['taggingRule' => '\d+'])]
|
||||
#[IsGranted('DELETE', subject: 'taggingRule')]
|
||||
public function deleteTaggingRuleAction(TaggingRule $taggingRule)
|
||||
public function deleteTaggingRuleAction(Request $request, TaggingRule $taggingRule)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('delete-tagging-rule', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$this->entityManager->remove($taggingRule);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
@ -509,10 +514,14 @@ class ConfigController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/ignore-origin-user-rule/delete/{ignoreOriginUserRule}', name: 'delete_ignore_origin_rule', methods: ['GET'], requirements: ['ignoreOriginUserRule' => '\d+'])]
|
||||
#[Route(path: '/ignore-origin-user-rule/delete/{ignoreOriginUserRule}', name: 'delete_ignore_origin_rule', methods: ['POST'], requirements: ['ignoreOriginUserRule' => '\d+'])]
|
||||
#[IsGranted('DELETE', subject: 'ignoreOriginUserRule')]
|
||||
public function deleteIgnoreOriginRuleAction(IgnoreOriginUserRule $ignoreOriginUserRule)
|
||||
public function deleteIgnoreOriginRuleAction(Request $request, IgnoreOriginUserRule $ignoreOriginUserRule)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('delete-ignore-origin-rule', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$this->entityManager->remove($ignoreOriginUserRule);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
@ -546,7 +555,7 @@ class ConfigController extends AbstractController
|
|||
public function resetAction(Request $request, string $type, AnnotationRepository $annotationRepository, EntryRepository $entryRepository, TaggingRuleRepository $taggingRuleRepository)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('reset-area', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
|
@ -602,7 +611,7 @@ class ConfigController extends AbstractController
|
|||
public function deleteAccountAction(Request $request, UserRepository $userRepository, TokenStorageInterface $tokenStorage)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('delete-account', $request->request->get('token'))) {
|
||||
throw $this->createAccessDeniedException('Bad CSRF token.');
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$enabledUsers = $userRepository->getSumEnabledUsers();
|
||||
|
@ -627,10 +636,14 @@ class ConfigController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/config/view-mode', name: 'switch_view_mode', methods: ['GET'])]
|
||||
#[Route(path: '/config/view-mode', name: 'switch_view_mode', methods: ['POST'])]
|
||||
#[IsGranted('EDIT_CONFIG')]
|
||||
public function changeViewModeAction(Request $request)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('switch-view-mode', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$user = $this->getUser();
|
||||
$user->getConfig()->setListMode(!$user->getConfig()->getListMode());
|
||||
|
||||
|
@ -649,10 +662,14 @@ class ConfigController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/locale/{language}', name: 'changeLocale', methods: ['GET'])]
|
||||
#[Route(path: '/locale/{language}', name: 'changeLocale', methods: ['POST'])]
|
||||
#[IsGranted('PUBLIC_ACCESS')]
|
||||
public function setLocaleAction(Request $request, ValidatorInterface $validator, $language = null)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('change-locale', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$errors = $validator->validate($language, new LocaleConstraint(['canonicalize' => true]));
|
||||
|
||||
if (0 === \count($errors)) {
|
||||
|
|
|
@ -14,6 +14,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
|||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
@ -52,6 +53,10 @@ class EntryController extends AbstractController
|
|||
#[IsGranted('EDIT_ENTRIES')]
|
||||
public function massAction(Request $request, TagRepository $tagRepository)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('mass-action', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$values = $request->request->all();
|
||||
|
||||
$tagsToAdd = [];
|
||||
|
@ -395,10 +400,14 @@ class EntryController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/reload/{id}', name: 'reload_entry', methods: ['GET'], requirements: ['id' => '\d+'])]
|
||||
#[Route(path: '/reload/{id}', name: 'reload_entry', methods: ['POST'], requirements: ['id' => '\d+'])]
|
||||
#[IsGranted('RELOAD', subject: 'entry')]
|
||||
public function reloadAction(Entry $entry)
|
||||
public function reloadAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('reload-entry', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$this->updateEntry($entry, 'entry_reloaded');
|
||||
|
||||
// if refreshing entry failed, don't save it
|
||||
|
@ -422,10 +431,14 @@ class EntryController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/archive/{id}', name: 'archive_entry', methods: ['GET'], requirements: ['id' => '\d+'])]
|
||||
#[Route(path: '/archive/{id}', name: 'archive_entry', methods: ['POST'], requirements: ['id' => '\d+'])]
|
||||
#[IsGranted('ARCHIVE', subject: 'entry')]
|
||||
public function toggleArchiveAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('archive-entry', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$entry->toggleArchive();
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
@ -449,10 +462,14 @@ class EntryController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/star/{id}', name: 'star_entry', methods: ['GET'], requirements: ['id' => '\d+'])]
|
||||
#[Route(path: '/star/{id}', name: 'star_entry', methods: ['POST'], requirements: ['id' => '\d+'])]
|
||||
#[IsGranted('STAR', subject: 'entry')]
|
||||
public function toggleStarAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('star-entry', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$entry->toggleStar();
|
||||
$entry->updateStar($entry->isStarred());
|
||||
$this->entityManager->flush();
|
||||
|
@ -477,10 +494,14 @@ class EntryController extends AbstractController
|
|||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
#[Route(path: '/delete/{id}', name: 'delete_entry', methods: ['GET'], requirements: ['id' => '\d+'])]
|
||||
#[Route(path: '/delete/{id}', name: 'delete_entry', methods: ['POST'], requirements: ['id' => '\d+'])]
|
||||
#[IsGranted('DELETE', subject: 'entry')]
|
||||
public function deleteEntryAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('delete-entry', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
// generates the view url for this entry to check for redirection later
|
||||
// to avoid redirecting to the deleted entry. Ugh.
|
||||
$url = $this->generateUrl(
|
||||
|
@ -513,10 +534,14 @@ class EntryController extends AbstractController
|
|||
*
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/share/{id}', name: 'share', methods: ['GET'], requirements: ['id' => '\d+'])]
|
||||
#[Route(path: '/share/{id}', name: 'share', methods: ['POST'], requirements: ['id' => '\d+'])]
|
||||
#[IsGranted('SHARE', subject: 'entry')]
|
||||
public function shareAction(Entry $entry)
|
||||
public function shareAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('share-entry', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
if (null === $entry->getUid()) {
|
||||
$entry->generateUid();
|
||||
|
||||
|
@ -534,10 +559,14 @@ class EntryController extends AbstractController
|
|||
*
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/share/delete/{id}', name: 'delete_share', methods: ['GET'], requirements: ['id' => '\d+'])]
|
||||
#[Route(path: '/share/delete/{id}', name: 'delete_share', methods: ['POST'], requirements: ['id' => '\d+'])]
|
||||
#[IsGranted('UNSHARE', subject: 'entry')]
|
||||
public function deleteShareAction(Entry $entry)
|
||||
public function deleteShareAction(Request $request, Entry $entry)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('delete-share', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$entry->cleanUid();
|
||||
|
||||
$this->entityManager->persist($entry);
|
||||
|
|
|
@ -10,6 +10,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
|
|||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
@ -85,10 +86,14 @@ class TagController extends AbstractController
|
|||
*
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/remove-tag/{entry}/{tag}', name: 'remove_tag', methods: ['GET'], requirements: ['entry' => '\d+', 'tag' => '\d+'])]
|
||||
#[Route(path: '/remove-tag/{entry}/{tag}', name: 'remove_tag', methods: ['POST'], requirements: ['entry' => '\d+', 'tag' => '\d+'])]
|
||||
#[IsGranted('UNTAG', subject: 'entry')]
|
||||
public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('remove-tag', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$entry->removeTag($tag);
|
||||
$this->entityManager->flush();
|
||||
|
||||
|
@ -225,10 +230,14 @@ class TagController extends AbstractController
|
|||
*
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/search/{filter}', name: 'tag_this_search', methods: ['GET'])]
|
||||
#[Route(path: '/tag/search/{filter}', name: 'tag_this_search', methods: ['POST'])]
|
||||
#[IsGranted('CREATE_TAGS')]
|
||||
public function tagThisSearchAction($filter, Request $request, EntryRepository $entryRepository)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('tag-this-search', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
$currentRoute = $request->query->has('currentRoute') ? $request->query->get('currentRoute') : '';
|
||||
|
||||
/** @var QueryBuilder $qb */
|
||||
|
@ -260,11 +269,15 @@ class TagController extends AbstractController
|
|||
*
|
||||
* @return Response
|
||||
*/
|
||||
#[Route(path: '/tag/delete/{slug}', name: 'tag_delete', methods: ['GET'])]
|
||||
#[Route(path: '/tag/delete/{slug}', name: 'tag_delete', methods: ['POST'])]
|
||||
#[ParamConverter('tag', options: ['mapping' => ['slug' => 'slug']])]
|
||||
#[IsGranted('DELETE', subject: 'tag')]
|
||||
public function removeTagAction(Tag $tag, Request $request, EntryRepository $entryRepository)
|
||||
{
|
||||
if (!$this->isCsrfTokenValid('tag-delete', $request->request->get('token'))) {
|
||||
throw new BadRequestHttpException('Bad CSRF token.');
|
||||
}
|
||||
|
||||
foreach ($tag->getEntriesByUserId($this->getUser()->getId()) as $entry) {
|
||||
$entryRepository->removeTag($this->getUser()->getId(), $tag);
|
||||
}
|
||||
|
|
|
@ -182,48 +182,63 @@
|
|||
</div>
|
||||
|
||||
<div id="set2" class="col s12">
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ 'config.form_feed.description'|trans }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h6 class="grey-text">{{ 'config.form_feed.token_label'|trans }}</h6>
|
||||
<div>
|
||||
{% if feed.token %}
|
||||
{{ feed.token }}
|
||||
{% else %}
|
||||
<em>{{ 'config.form_feed.no_token'|trans }}</em>
|
||||
{% endif %}
|
||||
|
||||
{% if feed.token %}
|
||||
–
|
||||
<form action="{{ path('generate_token') }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('generate-token') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link">{{ 'config.form_feed.token_reset'|trans }}</button>
|
||||
</form>
|
||||
–
|
||||
<form action="{{ path('revoke_token') }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('revoke-token') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link">{{ 'config.form_feed.token_revoke'|trans }}</button>
|
||||
</form>
|
||||
{% else %}
|
||||
–
|
||||
<form action="{{ path('generate_token') }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('generate-token') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link">{{ 'config.form_feed.token_create'|trans }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if feed.token %}
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h6 class="grey-text">{{ 'config.form_feed.feed_links'|trans }}</h6>
|
||||
<ul>
|
||||
<li><a href="{{ path('unread_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.unread'|trans }}</a></li>
|
||||
<li><a href="{{ path('starred_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.starred'|trans }}</a></li>
|
||||
<li><a href="{{ path('archive_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.archive'|trans }}</a></li>
|
||||
<li><a href="{{ path('all_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.all'|trans }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ form_start(form.feed) }}
|
||||
{{ form_errors(form.feed) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ 'config.form_feed.description'|trans }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h6 class="grey-text">{{ 'config.form_feed.token_label'|trans }}</h6>
|
||||
<div>
|
||||
{% if feed.token %}
|
||||
{{ feed.token }}
|
||||
{% else %}
|
||||
<em>{{ 'config.form_feed.no_token'|trans }}</em>
|
||||
{% endif %}
|
||||
|
||||
{% if feed.token %}
|
||||
– <a href="{{ path('generate_token') }}">{{ 'config.form_feed.token_reset'|trans }}</a>
|
||||
– <a href="{{ path('revoke_token') }}">{{ 'config.form_feed.token_revoke'|trans }}</a>
|
||||
{% else %}
|
||||
– <a href="{{ path('generate_token') }}">{{ 'config.form_feed.token_create'|trans }}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if feed.token %}
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<h6 class="grey-text">{{ 'config.form_feed.feed_links'|trans }}</h6>
|
||||
<ul>
|
||||
<li><a href="{{ path('unread_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.unread'|trans }}</a></li>
|
||||
<li><a href="{{ path('starred_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.starred'|trans }}</a></li>
|
||||
<li><a href="{{ path('archive_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.archive'|trans }}</a></li>
|
||||
<li><a href="{{ path('all_feed', {'username': feed.username, 'token': feed.token}) }}">{{ 'config.form_feed.feed_link.all'|trans }}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="input-field col s12">
|
||||
{{ form_label(form.feed.feed_limit) }}
|
||||
|
@ -384,9 +399,13 @@
|
|||
<a href="{{ path('edit_tagging_rule', {taggingRule: tagging_rule.id}) }}" title="{{ 'config.form_rules.edit_rule_label'|trans }}" class="mode_edit_tagging_rule">
|
||||
<i class="tool grey-text material-icons">mode_edit</i>
|
||||
</a>
|
||||
<a href="{{ path('delete_tagging_rule', {taggingRule: tagging_rule.id}) }}" title="{{ 'config.form_rules.delete_rule_label'|trans }}" class="delete_tagging_rule">
|
||||
<i class="tool grey-text material-icons">delete</i>
|
||||
</a>
|
||||
<form action="{{ path('delete_tagging_rule', {taggingRule: tagging_rule.id}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-tagging-rule') }}"/>
|
||||
|
||||
<button type="submit" title="{{ 'config.form_rules.delete_rule_label'|trans }}" class="btn-link">
|
||||
<i class="tool grey-text material-icons">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
@ -564,9 +583,13 @@
|
|||
<a href="{{ path('edit_ignore_origin_rule', {ignoreOriginUserRule: ignore_origin_rule.id}) }}" title="{{ 'config.form_rules.edit_rule_label'|trans }}" class="mode_edit">
|
||||
<i class="tool grey-text material-icons">mode_edit</i>
|
||||
</a>
|
||||
<a href="{{ path('delete_ignore_origin_rule', {ignoreOriginUserRule: ignore_origin_rule.id}) }}" title="{{ 'config.form_rules.delete_rule_label'|trans }}" class="delete">
|
||||
<i class="tool grey-text material-icons">delete</i>
|
||||
</a>
|
||||
<form action="{{ path('delete_ignore_origin_rule', {ignoreOriginUserRule: ignore_origin_rule.id}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-ignore-origin-rule') }}"/>
|
||||
|
||||
<button type="submit" title="{{ 'config.form_rules.delete_rule_label'|trans }}" class="btn-link">
|
||||
<i class="tool grey-text material-icons">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<label class="entry-checkbox">
|
||||
<input type="checkbox" class="entry-checkbox-input" name="entry-checkbox[]" value="{{ entry.id }}" data-batch-edit-target="item" />
|
||||
<input type="checkbox" form="form_mass_action" class="entry-checkbox-input" name="entry-checkbox[]" value="{{ entry.id }}" data-batch-edit-target="item" />
|
||||
</label>
|
||||
|
|
|
@ -17,17 +17,35 @@
|
|||
{% endif %}
|
||||
{% if is_granted('ARCHIVE', entry) %}
|
||||
<li>
|
||||
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" data-action="archived" data-entry-id="{{ entry.id }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a>
|
||||
<form action="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('archive-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool grey-text" title="{{ 'entry.list.toogle_as_read'|trans }}">
|
||||
<i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('STAR', entry) %}
|
||||
<li>
|
||||
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" data-action="star" data-entry-id="{{ entry.id }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
|
||||
<form action="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('star-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool grey-text" title="{{ 'entry.list.toogle_as_star'|trans }}">
|
||||
<i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('DELETE', entry) %}
|
||||
<li>
|
||||
<a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" data-action-confirm="{{ 'entry.confirm.delete'|trans }}" class="tool grey-text delete" href="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" data-action="delete" data-entry-id="{{ entry.id }}"><i class="material-icons">delete</i></a>
|
||||
<form action="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool grey-text" title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -22,13 +22,31 @@
|
|||
<a title="{{ 'entry.list.show_same_domain'|trans }}" class="tool grey-text" href="{{ path('same_domain', {'id': entry.id, redirect: current_path}) }}"><i class="material-icons">language</i></a>
|
||||
{% endif %}
|
||||
{% if is_granted('ARCHIVE', entry) %}
|
||||
<a title="{{ 'entry.list.toogle_as_read'|trans }}" class="tool grey-text" href="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a>
|
||||
<form action="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('archive-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool grey-text" title="{{ 'entry.list.toogle_as_read'|trans }}">
|
||||
<i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if is_granted('STAR', entry) %}
|
||||
<a title="{{ 'entry.list.toogle_as_star'|trans }}" class="tool grey-text" href="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i></a>
|
||||
<form action="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('star-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool grey-text" title="{{ 'entry.list.toogle_as_star'|trans }}">
|
||||
<i class="material-icons">{% if entry.isStarred == 0 %}star_border{% else %}star{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if is_granted('DELETE', entry) %}
|
||||
<a title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" class="tool grey-text delete" href="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}"><i class="material-icons">delete</i></a>
|
||||
<form action="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool grey-text" title="{{ 'entry.list.delete'|trans }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -5,9 +5,13 @@
|
|||
<a class="chip-label" href="{{ path('tag_entries', {'slug': tag.slug}) }}">{{ tag.label }}</a>
|
||||
{% if withRemove is defined and withRemove == true and is_granted('DELETE', tag) %}
|
||||
{% set current_path = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
|
||||
<a class="chip-action" href="{{ path('remove_tag', {'entry': entryId, 'tag': tag.id, redirect: current_path}) }}" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')">
|
||||
<i class="material-icons vertical-align-middle">delete</i>
|
||||
</a>
|
||||
<form action="{{ path('remove_tag', {'entry': entryId, 'tag': tag.id, redirect: current_path}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('remove-tag') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link chip-action" onclick="return confirm('{{ 'entry.confirm.delete_tag'|trans|escape('js') }}')">
|
||||
<i class="material-icons vertical-align-middle">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -53,65 +53,80 @@
|
|||
{% if current_route == 'homepage' %}
|
||||
{% set current_route = 'unread' %}
|
||||
{% endif %}
|
||||
<form name="form_mass_action" action="{{ path('mass_action', {redirect: current_path}) }}" method="post" data-controller="batch-edit entries-navigation">
|
||||
<div class="results" data-entries-navigation-target="paginationWrapper">
|
||||
<div class="nb-results">
|
||||
{{ 'entry.list.number_on_the_page'|trans({'%count%': entries.count}) }}
|
||||
{% if entries.count > 0 %}
|
||||
<a class="results-item" href="{{ path('switch_view_mode', {redirect: current_path}) }}"><i class="material-icons">{% if list_mode == 0 %}view_list{% else %}view_module{% endif %}</i></a>
|
||||
<div data-controller="batch-edit entries-navigation">
|
||||
<form id="form_mass_action" name="form_mass_action" action="{{ path('mass_action', {redirect: current_path}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('mass-action') }}"/>
|
||||
</form>
|
||||
<div class="results" data-entries-navigation-target="paginationWrapper">
|
||||
<div class="nb-results">
|
||||
{{ 'entry.list.number_on_the_page'|trans({'%count%': entries.count}) }}
|
||||
{% if entries.count > 0 %}
|
||||
<form action="{{ path('switch_view_mode', {redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('switch-view-mode') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link results-item">
|
||||
<i class="material-icons">{% if list_mode == 0 %}view_list{% else %}view_module{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if entries.count > 0 and is_granted('EDIT_ENTRIES') %}
|
||||
<label for="mass-action-inputs-displayed" class="mass-action-toggle results-item" data-controller="materialize--tooltip" data-position="right" data-delay="50" data-tooltip="{{ 'entry.list.toggle_mass_action'|trans }}"><i class="material-icons">library_add_check</i></label>
|
||||
{% endif %}
|
||||
{% if app.user.config.feedToken %}
|
||||
{% include "Entry/_feed_link.html.twig" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if current_route == 'search' and is_granted('CREATE_TAGS') %}
|
||||
<form action="{{ path('tag_this_search', {'filter': searchTerm, 'currentRoute': app.request.get('currentRoute'), redirect: current_path}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('tag-this-search') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link" title="{{ 'entry.list.assign_search_tag'|trans }}">{{ 'entry.list.assign_search_tag'|trans }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if entries.count > 0 and is_granted('EDIT_ENTRIES') %}
|
||||
<label for="mass-action-inputs-displayed" class="mass-action-toggle results-item" data-controller="materialize--tooltip" data-position="right" data-delay="50" data-tooltip="{{ 'entry.list.toggle_mass_action'|trans }}"><i class="material-icons">library_add_check</i></label>
|
||||
{% endif %}
|
||||
{% if app.user.config.feedToken %}
|
||||
{% include "Entry/_feed_link.html.twig" %}
|
||||
{% if entries.getNbPages > 1 %}
|
||||
{{ pagerfanta(entries, 'default_wallabag') }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if current_route == 'search' and is_granted('CREATE_TAGS') %}<div><a href="{{ path('tag_this_search', {'filter': searchTerm, 'currentRoute': app.request.get('currentRoute'), redirect: current_path}) }}" title="{{ 'entry.list.assign_search_tag'|trans }}">{{ 'entry.list.assign_search_tag'|trans }}</a></div>{% endif %}
|
||||
|
||||
{% if entries.count > 0 %}
|
||||
<input id="mass-action-inputs-displayed" class="toggle-checkbox" type="checkbox" />
|
||||
<div class="mass-action">
|
||||
<div class="mass-action-group">
|
||||
<input type="checkbox" form="form_mass_action" class="entry-checkbox-input" data-action="batch-edit#toggleSelection" />
|
||||
<button class="mass-action-button btn cyan darken-1" type="submit" form="form_mass_action" name="toggle-read" title="{{ 'entry.list.toogle_as_read'|trans }}"><i class="material-icons">done</i></button>
|
||||
<button class="mass-action-button btn cyan darken-1" type="submit" form="form_mass_action" name="toggle-star" title="{{ 'entry.list.toogle_as_star'|trans }}" ><i class="material-icons">star</i></button>
|
||||
<button class="mass-action-button btn cyan darken-1" type="submit" form="form_mass_action" name="delete" onclick="return confirm('{{ 'entry.confirm.delete_entries'|trans|escape('js') }}')" title="{{ 'entry.list.delete'|trans }}"><i class="material-icons">delete</i></button>
|
||||
</div>
|
||||
|
||||
<div class="mass-action-tags">
|
||||
<button class="btn cyan darken-1 mass-action-button mass-action-button--tags" type="submit" form="form_mass_action" name="tag" title="{{ 'entry.list.add_tags'|trans }}" data-batch-edit-target="tagAction"><i class="material-icons">label</i></button>
|
||||
<input type="text" form="form_mass_action" class="mass-action-tags-input" name="tags" placeholder="{{ 'entry.list.mass_action_tags_input_placeholder'|trans }}" data-action="keydown.enter->batch-edit#tagSelection:prevent:stop" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ol class="entries {% if list_mode == 1 %}collection{% else %}row entries-row data{% endif %}">
|
||||
|
||||
{% for entry in entries %}
|
||||
<li id="entry-{{ entry.id|e }}" class="{% if list_mode != 0 %}col collection-item{% endif %} s12" data-entry-id="{{ entry.id|e }}" data-test="entry" data-entries-navigation-target="card">
|
||||
{% if list_mode == 1 %}
|
||||
{% include "Entry/_card_list.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
|
||||
{% elseif not entry.previewPicture is null and entry.mimetype starts with 'image/' %}
|
||||
{% include "Entry/_card_full_image.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
|
||||
{% else %}
|
||||
{% include "Entry/_card_preview.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
|
||||
{% if entries.getNbPages > 1 %}
|
||||
{{ pagerfanta(entries, 'default_wallabag') }}
|
||||
<div class="results">
|
||||
{{ pagerfanta(entries, 'default_wallabag') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if entries.count > 0 %}
|
||||
<input id="mass-action-inputs-displayed" class="toggle-checkbox" type="checkbox" />
|
||||
<div class="mass-action">
|
||||
<div class="mass-action-group">
|
||||
<input type="checkbox" class="entry-checkbox-input" data-action="batch-edit#toggleSelection" />
|
||||
<button class="mass-action-button btn cyan darken-1" type="submit" name="toggle-read" title="{{ 'entry.list.toogle_as_read'|trans }}"><i class="material-icons">done</i></button>
|
||||
<button class="mass-action-button btn cyan darken-1" type="submit" name="toggle-star" title="{{ 'entry.list.toogle_as_star'|trans }}" ><i class="material-icons">star</i></button>
|
||||
<button class="mass-action-button btn cyan darken-1" type="submit" name="delete" onclick="return confirm('{{ 'entry.confirm.delete_entries'|trans|escape('js') }}')" title="{{ 'entry.list.delete'|trans }}"><i class="material-icons">delete</i></button>
|
||||
</div>
|
||||
|
||||
<div class="mass-action-tags">
|
||||
<button class="btn cyan darken-1 mass-action-button mass-action-button--tags" type="submit" name="tag" title="{{ 'entry.list.add_tags'|trans }}" data-batch-edit-target="tagAction"><i class="material-icons">label</i></button>
|
||||
<input type="text" class="mass-action-tags-input" name="tags" placeholder="{{ 'entry.list.mass_action_tags_input_placeholder'|trans }}" data-action="keydown.enter->batch-edit#tagSelection:prevent:stop" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ol class="entries {% if list_mode == 1 %}collection{% else %}row entries-row data{% endif %}">
|
||||
|
||||
{% for entry in entries %}
|
||||
<li id="entry-{{ entry.id|e }}" class="{% if list_mode != 0 %}col collection-item{% endif %} s12" data-entry-id="{{ entry.id|e }}" data-test="entry" data-entries-navigation-target="card">
|
||||
{% if list_mode == 1 %}
|
||||
{% include "Entry/_card_list.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
|
||||
{% elseif not entry.previewPicture is null and entry.mimetype starts with 'image/' %}
|
||||
{% include "Entry/_card_full_image.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
|
||||
{% else %}
|
||||
{% include "Entry/_card_preview.html.twig" with {'entry': entry, 'currentRoute': current_route, 'routes': entries_with_archived_class_routes} only %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
{% if entries.getNbPages > 1 %}
|
||||
<div class="results">
|
||||
{{ pagerfanta(entries, 'default_wallabag') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Export -->
|
||||
{% if has_exports and is_granted('EXPORT_ENTRIES') %}
|
||||
<div id="export" class="sidenav" data-controller="materialize--sidenav" data-materialize--sidenav-edge-value="right">
|
||||
|
|
|
@ -27,16 +27,24 @@
|
|||
<ul class="right">
|
||||
{% if is_granted('ARCHIVE', entry) %}
|
||||
<li>
|
||||
<a class="waves-effect" title="{{ 'entry.view.left_menu.set_as_read'|trans }}" href="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" id="markAsRead">
|
||||
<i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
</a>
|
||||
<form action="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('archive-entry') }}"/>
|
||||
|
||||
<button type="submit" class="waves-effect" title="{{ 'entry.view.left_menu.set_as_read'|trans }}">
|
||||
<i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('STAR', entry) %}
|
||||
<li>
|
||||
<a class="waves-effect" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" href="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" id="setFav">
|
||||
<i class="material-icons small">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
|
||||
</a>
|
||||
<form action="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('star-entry') }}"/>
|
||||
|
||||
<button type="submit" class="waves-effect" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}">
|
||||
<i class="material-icons small">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
@ -61,10 +69,14 @@
|
|||
|
||||
{% if is_granted('RELOAD', entry) %}
|
||||
<li class="bold">
|
||||
<a class="waves-effect collapsible-header" onclick="return confirm('{{ 'entry.confirm.reload'|trans|escape('js') }}')" title="{{ 'entry.view.left_menu.re_fetch_content'|trans }}" href="{{ path('reload_entry', {'id': entry.id}) }}" id="reload">
|
||||
<i class="material-icons small">refresh</i>
|
||||
<span>{{ 'entry.view.left_menu.re_fetch_content'|trans }}</span>
|
||||
</a>
|
||||
<form action="{{ path('reload_entry', {'id': entry.id}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('reload-entry') }}"/>
|
||||
|
||||
<button type="submit" class="waves-effect collapsible-header" onclick="return confirm('{{ 'entry.confirm.reload'|trans|escape('js') }}')" title="{{ 'entry.view.left_menu.re_fetch_content'|trans }}">
|
||||
<i class="material-icons small">refresh</i>
|
||||
<span>{{ 'entry.view.left_menu.re_fetch_content'|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
<div class="collapsible-body"></div>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -76,30 +88,42 @@
|
|||
|
||||
{% if is_granted('ARCHIVE', entry) %}
|
||||
<li class="bold hide-on-med-and-down">
|
||||
<a class="waves-effect collapsible-header markasread" title="{{ mark_as_read_label|trans }}" href="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" id="markAsRead" data-shortcuts-target="markAsRead">
|
||||
<i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
<span>{{ mark_as_read_label|trans }}</span>
|
||||
</a>
|
||||
<form action="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('archive-entry') }}"/>
|
||||
|
||||
<button type="submit" class="waves-effect collapsible-header markasread" title="{{ mark_as_read_label|trans }}" data-shortcuts-target="markAsRead">
|
||||
<i class="material-icons small">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
<span>{{ mark_as_read_label|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
<div class="collapsible-body"></div>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('STAR', entry) %}
|
||||
<li class="bold hide-on-med-and-down">
|
||||
<a class="waves-effect collapsible-header favorite" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" href="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" id="setFav" data-shortcuts-target="markAsFavorite">
|
||||
<i class="material-icons small">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
|
||||
<span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span>
|
||||
</a>
|
||||
<form action="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('star-entry') }}"/>
|
||||
|
||||
<button type="submit" class="waves-effect collapsible-header favorite" title="{{ 'entry.view.left_menu.set_as_starred'|trans }}" data-shortcuts-target="markAsFavorite">
|
||||
<i class="material-icons spall">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
|
||||
<span>{{ 'entry.view.left_menu.set_as_starred'|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
<div class="collapsible-body"></div>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if is_granted('DELETE', entry) %}
|
||||
<li class="bold border-bottom">
|
||||
<a class="waves-effect collapsible-header delete" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" title="{{ 'entry.view.left_menu.delete'|trans }}" href="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" data-shortcuts-target="deleteEntry">
|
||||
<i class="material-icons small">delete</i>
|
||||
<span>{{ 'entry.view.left_menu.delete'|trans }}</span>
|
||||
</a>
|
||||
<form action="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-entry') }}"/>
|
||||
|
||||
<button type="submit" class="waves-effect collapsible-header delete" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')" title="{{ 'entry.view.left_menu.delete'|trans }}" data-shortcuts-target="deleteEntry">
|
||||
<i class="material-icons small">delete</i>
|
||||
<span>{{ 'entry.view.left_menu.delete'|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
<div class="collapsible-body"></div>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@ -149,16 +173,24 @@
|
|||
{% if craue_setting('share_public') %}
|
||||
{% if is_granted('SHARE', entry) %}
|
||||
<li>
|
||||
<a href="{{ path('share', {'id': entry.id}) }}" target="_blank" title="{{ 'entry.view.left_menu.public_link'|trans }}" class="tool icon-eye">
|
||||
<span>{{ 'entry.view.left_menu.public_link'|trans }}</span>
|
||||
</a>
|
||||
<form action="{{ path('share', {'id': entry.id}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('share-entry') }}"/>
|
||||
|
||||
<button type="submit" formtarget="_blank" class="btn-link tool icon-eye" title="{{ 'entry.view.left_menu.public_link'|trans }}">
|
||||
<span>{{ 'entry.view.left_menu.public_link'|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('UNSHARE', entry) %}
|
||||
<li>
|
||||
<a href="{{ path('delete_share', {'id': entry.id}) }}" title="{{ 'entry.view.left_menu.delete_public_link'|trans }}" class="tool icon-no-eye">
|
||||
<span>{{ 'entry.view.left_menu.delete_public_link'|trans }}</span>
|
||||
</a>
|
||||
<form action="{{ path('delete_share', {'id': entry.id}) }}" method="post">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-share') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link tool icon-no-eye" title="{{ 'entry.view.left_menu.delete_public_link'|trans }}">
|
||||
<span>{{ 'entry.view.left_menu.delete_public_link'|trans }}</span>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -344,13 +376,37 @@
|
|||
</a>
|
||||
<ul>
|
||||
{% if is_granted('ARCHIVE', entry) %}
|
||||
<li><a class="btn-floating" href="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}"><i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i></a></li>
|
||||
<li>
|
||||
<form action="{{ path('archive_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('archive-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-floating">
|
||||
<i class="material-icons">{% if entry.isArchived == 0 %}done{% else %}unarchive{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('STAR', entry) %}
|
||||
<li><a class="btn-floating" href="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}"><i class="material-icons">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i></a></li>
|
||||
<li>
|
||||
<form action="{{ path('star_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('star-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-floating">
|
||||
<i class="material-icons">{% if entry.isStarred == 0 %}star_outline{% else %}star{% endif %}</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if is_granted('DELETE', entry) %}
|
||||
<li><a class="btn-floating" href="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')"><i class="material-icons">delete</i></a></li>
|
||||
<li>
|
||||
<form action="{{ path('delete_entry', {'id': entry.id, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('delete-entry') }}"/>
|
||||
|
||||
<button type="submit" class="btn-floating" onclick="return confirm('{{ 'entry.confirm.delete'|trans|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -34,9 +34,13 @@
|
|||
</button>
|
||||
{% endif %}
|
||||
{% if is_granted('DELETE', tag) %}
|
||||
<a id="delete-{{ tag.slug }}" href="{{ path('tag_delete', {'slug': tag.slug, redirect: current_path}) }}" class="card-tag-icon card-tag-delete" onclick="return confirm('{{ 'tag.confirm.delete'|trans({'%name%': tag.label})|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</a>
|
||||
<form action="{{ path('tag_delete', {'slug': tag.slug, redirect: current_path}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('tag-delete') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link card-tag-icon card-tag-delete" onclick="return confirm('{{ 'tag.confirm.delete'|trans({'%name%': tag.label})|escape('js') }}')">
|
||||
<i class="material-icons">delete</i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if app.user.config.feedToken %}
|
||||
<a rel="alternate" type="application/atom+xml" href="{{ path('tag_feed', {'username': app.user.username, 'token': app.user.config.feedToken, 'slug': tag.slug}) }}" class="card-tag-icon"><i class="material-icons">rss_feed</i></a>
|
||||
|
|
|
@ -16,9 +16,23 @@
|
|||
{% endblock fos_user_content %}
|
||||
</div>
|
||||
<div class="center">
|
||||
<a href="{{ path('changeLocale', {'language': 'de'}) }}">Deutsch</a> –
|
||||
<a href="{{ path('changeLocale', {'language': 'en'}) }}">English</a> –
|
||||
<a href="{{ path('changeLocale', {'language': 'fr'}) }}">Français</a>
|
||||
<form action="{{ path('changeLocale', {'language': 'de'}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('change-locale') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link">Deutsch</button>
|
||||
</form>
|
||||
–
|
||||
<form action="{{ path('changeLocale', {'language': 'en'}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('change-locale') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link">English</button>
|
||||
</form>
|
||||
–
|
||||
<form action="{{ path('changeLocale', {'language': 'fr'}) }}" method="post" class="inline-block">
|
||||
<input type="hidden" name="token" value="{{ csrf_token('change-locale') }}"/>
|
||||
|
||||
<button type="submit" class="btn-link">Français</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -105,7 +105,7 @@ class DeveloperControllerTest extends WallabagTestCase
|
|||
|
||||
$this->logInAs('bob');
|
||||
$client->request('POST', '/developer/client/delete/' . $adminApiClient->getId());
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame(400, $client->getResponse()->getStatusCode());
|
||||
|
||||
// Try to remove the admin's client with the good user
|
||||
$this->logInAs('admin');
|
||||
|
|
|
@ -328,7 +328,8 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('config.form_feed.no_token', $body[0]);
|
||||
|
||||
$client->request('GET', '/generate-token');
|
||||
$client->submit($crawler->selectButton('config.form_feed.token_create')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$crawler = $client->followRedirect();
|
||||
|
@ -337,38 +338,34 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
$this->assertStringContainsString('config.form_feed.token_reset', $body[0]);
|
||||
}
|
||||
|
||||
public function testGenerateTokenAjax()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request(
|
||||
'GET',
|
||||
'/generate-token',
|
||||
[],
|
||||
[],
|
||||
['HTTP_X-Requested-With' => 'XMLHttpRequest']
|
||||
);
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
$content = json_decode((string) $client->getResponse()->getContent(), true);
|
||||
$this->assertArrayHasKey('token', $content);
|
||||
}
|
||||
|
||||
public function testRevokeTokenAjax()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request(
|
||||
'GET',
|
||||
'/revoke-token',
|
||||
[],
|
||||
[],
|
||||
['HTTP_X-Requested-With' => 'XMLHttpRequest']
|
||||
);
|
||||
// set the token
|
||||
$em = $client->getContainer()->get(EntityManagerInterface::class);
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
->findOneByUsername('admin');
|
||||
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
if (!$user) {
|
||||
$this->markTestSkipped('No user found in db.');
|
||||
}
|
||||
|
||||
$config = $user->getConfig();
|
||||
$config->setFeedToken('abcd1234');
|
||||
$em->persist($config);
|
||||
$em->flush();
|
||||
|
||||
$crawler = $client->request('GET', '/config');
|
||||
|
||||
$client->submit($crawler->selectButton('config.form_feed.token_revoke')->form());
|
||||
|
||||
$crawler = $client->followRedirect();
|
||||
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('config.form_feed.token_create', $body[0]);
|
||||
}
|
||||
|
||||
public function testFeedUpdate()
|
||||
|
@ -484,9 +481,8 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
|
||||
$this->assertStringContainsString('readingTime <= 30', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
|
||||
$deleteLink = $crawler->filter('.delete_tagging_rule')->last()->link();
|
||||
$crawler = $client->submit($crawler->filter('#set5')->selectButton('delete')->form());
|
||||
|
||||
$crawler = $client->click($deleteLink);
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$crawler = $client->followRedirect();
|
||||
|
@ -576,7 +572,7 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
->getRepository(TaggingRule::class)
|
||||
->findAll()[0];
|
||||
|
||||
$crawler = $client->request('GET', '/tagging-rule/delete/' . $rule->getId());
|
||||
$crawler = $client->request('POST', '/tagging-rule/delete/' . $rule->getId());
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
|
@ -646,9 +642,9 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
|
||||
$this->assertStringContainsString('host = "example.org"', $crawler->filter('body')->extract(['_text'])[0]);
|
||||
|
||||
$deleteLink = $crawler->filter('div[id=set6] a.delete')->last()->link();
|
||||
$form = $crawler->filter('#set6')->selectButton('delete')->form();
|
||||
|
||||
$crawler = $client->click($deleteLink);
|
||||
$crawler = $client->submit($form);
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$crawler = $client->followRedirect();
|
||||
|
@ -713,7 +709,7 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
->getRepository(IgnoreOriginUserRule::class)
|
||||
->findAll()[0];
|
||||
|
||||
$crawler = $client->request('GET', '/ignore-origin-user-rule/edit/' . $rule->getId());
|
||||
$crawler = $client->request('POST', '/ignore-origin-user-rule/delete/' . $rule->getId());
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
|
@ -768,7 +764,7 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
$this->assertStringNotContainsString('config.form_user.delete.button', $body[0]);
|
||||
|
||||
$client->request('POST', '/account/delete');
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame(400, $client->getResponse()->getStatusCode());
|
||||
|
||||
$user = $em
|
||||
->getRepository(User::class)
|
||||
|
@ -1113,37 +1109,38 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
$this->logInAs('admin');
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/unread/list');
|
||||
$crawler = $client->request('GET', '/unread/list');
|
||||
|
||||
$this->assertStringContainsString('row data', $client->getResponse()->getContent());
|
||||
|
||||
$client->request('GET', '/config/view-mode');
|
||||
$crawler = $client->followRedirect();
|
||||
$form = $crawler->filter('.nb-results')->selectButton('view_list')->form();
|
||||
|
||||
$client->request('GET', '/unread/list');
|
||||
$client->submit($form);
|
||||
|
||||
$client->followRedirect();
|
||||
|
||||
$this->assertStringContainsString('collection', $client->getResponse()->getContent());
|
||||
|
||||
$client->request('GET', '/config/view-mode');
|
||||
}
|
||||
|
||||
public function testChangeLocaleWithoutReferer()
|
||||
{
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/locale/de');
|
||||
$client->followRedirect();
|
||||
$crawler = $client->request('POST', '/locale/de');
|
||||
|
||||
$this->assertSame('de', $client->getRequest()->getLocale());
|
||||
$this->assertSame('de', $client->getContainer()->get(SessionInterface::class)->get('_locale'));
|
||||
$this->assertSame(400, $client->getResponse()->getStatusCode());
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('Bad CSRF token.', $body[0]);
|
||||
}
|
||||
|
||||
public function testChangeLocaleWithReferer()
|
||||
{
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/login');
|
||||
$client->request('GET', '/locale/de');
|
||||
$crawler = $client->request('GET', '/login');
|
||||
|
||||
$client->submit($crawler->selectButton('Deutsch')->form());
|
||||
|
||||
$client->followRedirect();
|
||||
|
||||
$this->assertSame('de', $client->getRequest()->getLocale());
|
||||
|
@ -1154,8 +1151,12 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
{
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/login');
|
||||
$client->request('GET', '/locale/yuyuyuyu');
|
||||
$crawler = $client->request('GET', '/login');
|
||||
$token = $crawler->filter('form[action="/locale/de"] input[name=token]')->attr('value');
|
||||
|
||||
$client->request('POST', '/locale/yuyuyuyu', [
|
||||
'token' => $token,
|
||||
]);
|
||||
$client->followRedirect();
|
||||
|
||||
$this->assertNotSame('yuyuyuyu', $client->getRequest()->getLocale());
|
||||
|
@ -1376,8 +1377,6 @@ class ConfigControllerTest extends WallabagTestCase
|
|||
$client->request('GET', '/unread/list');
|
||||
|
||||
$this->assertStringNotContainsString('class="preview"', $client->getResponse()->getContent());
|
||||
|
||||
$client->request('GET', '/config/view-mode');
|
||||
}
|
||||
|
||||
public function testGeneratedCSS()
|
||||
|
|
|
@ -541,7 +541,9 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/reload/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$client->submit($crawler->selectButton('entry.view.left_menu.re_fetch_content')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
|
@ -562,7 +564,9 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$this->getEntityManager()->persist($entry);
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$client->request('GET', '/reload/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$client->submit($crawler->selectButton('entry.view.left_menu.re_fetch_content')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
|
@ -674,7 +678,9 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/archive/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.set_as_read')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
|
@ -698,7 +704,9 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$client = $this->getTestClient();
|
||||
|
||||
$client->request('GET', '/star/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.set_as_starred')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
|
@ -720,13 +728,11 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$this->getEntityManager()->persist($entry);
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$client->request('GET', '/delete/' . $entry->getId());
|
||||
$crawler = $client->request('POST', '/delete/' . $entry->getId());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$client->request('GET', '/delete/' . $entry->getId());
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame(400, $client->getResponse()->getStatusCode());
|
||||
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
|
||||
$this->assertStringContainsString('Bad CSRF token.', $body[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -762,10 +768,11 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$em->persist($content);
|
||||
$em->flush();
|
||||
|
||||
$client->request('GET', '/view/' . $content->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $content->getId());
|
||||
$this->assertSame(200, $client->getResponse()->getStatusCode());
|
||||
|
||||
$client->request('GET', '/delete/' . $content->getId());
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.delete')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$client->followRedirect();
|
||||
|
@ -1211,7 +1218,10 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
// generating the uid
|
||||
$client->request('GET', '/share/' . $content->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $content->getId());
|
||||
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.public_link')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
$shareUrl = $client->getResponse()->getTargetUrl();
|
||||
|
@ -1238,12 +1248,19 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
// removing the share
|
||||
$client->request('GET', '/share/delete/' . $content->getId());
|
||||
$client->getContainer()->get(Config::class)->set('share_public', 1);
|
||||
$this->logInAs('admin');
|
||||
$crawler = $client->request('GET', '/view/' . $content->getId());
|
||||
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.delete_public_link')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
// share is now disable
|
||||
// share is now removed
|
||||
$client->request('GET', '/share/' . $content->getUid());
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
|
||||
$client->getContainer()->get(Config::class)->set('share_public', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1319,7 +1336,9 @@ class EntryControllerTest extends WallabagTestCase
|
|||
->getRepository(Entry::class)
|
||||
->findByUrlAndUserId($url, $this->getLoggedInUserId());
|
||||
|
||||
$client->request('GET', '/delete/' . $content->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $content->getId());
|
||||
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.delete')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
|
||||
|
@ -1342,8 +1361,9 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$client->request('GET', '/view/' . $entry->getId());
|
||||
$client->request('GET', '/archive/' . $entry->getId());
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.set_as_read')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame('/', $client->getResponse()->headers->get('location'));
|
||||
|
@ -1367,8 +1387,7 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
$link = $crawler->filter('a[id="markAsRead"]')->link();
|
||||
$client->click($link);
|
||||
$client->submit($crawler->filter('.left-bar')->selectButton('entry.view.left_menu.set_as_read')->form());
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertStringContainsString('/view/' . $entry->getId(), $client->getResponse()->headers->get('location'));
|
||||
|
@ -1504,7 +1523,8 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$this->assertCount(1, $crawler->filter($this->entryDataTestAttribute));
|
||||
$client->request('GET', '/delete/' . $entry->getId());
|
||||
|
||||
$client->submit($crawler->filter('.tools, .tools-list')->selectButton('delete')->form());
|
||||
|
||||
// test on list of all articles
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
|
@ -1586,8 +1606,8 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$crawler = $client->submit($form, $data);
|
||||
$currentUrl = $client->getRequest()->getUri();
|
||||
$element = $crawler->filter('a[data-action="delete"]')->link();
|
||||
$client->click($element);
|
||||
$form = $crawler->filter('.tools, .tools-list')->selectButton('delete')->form();
|
||||
$client->submit($form);
|
||||
$client->followRedirect();
|
||||
$nextUrl = $client->getRequest()->getUri();
|
||||
$this->assertSame($currentUrl, $nextUrl);
|
||||
|
@ -1760,7 +1780,7 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$this->assertSame('example.com', $content->getDomainName());
|
||||
}
|
||||
|
||||
public function testEntryDeleteTagLink()
|
||||
public function testEntryDeleteTagForm()
|
||||
{
|
||||
$this->logInAs('admin');
|
||||
$client = $this->getTestClient();
|
||||
|
@ -1771,10 +1791,7 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
|
||||
// As long as the deletion link of a tag is following
|
||||
// a link to the tag view, we take the second one to retrieve
|
||||
// the deletion link of the first tag
|
||||
$link = $crawler->filter('body div#article div.tools ul.tags li.chip a')->extract(['href'])[1];
|
||||
$link = $crawler->filter('body div#article div.tools ul.tags li.chip form')->extract(['action'])[0];
|
||||
|
||||
$this->assertStringStartsWith(\sprintf('/remove-tag/%s/%s', $entry->getId(), $tag->getId()), $link);
|
||||
}
|
||||
|
@ -1831,11 +1848,15 @@ class EntryControllerTest extends WallabagTestCase
|
|||
$client = $this->getTestClient();
|
||||
|
||||
$entries = [];
|
||||
$entries[] = $entry1->getId();
|
||||
$entries[] = $entry2->getId();
|
||||
$entries[] = $entry1Id = $entry1->getId();
|
||||
$entries[] = $entry2Id = $entry2->getId();
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$token = $crawler->filter('#form_mass_action input[name=token]')->attr('value');
|
||||
|
||||
// Mass actions : archive
|
||||
$client->request('POST', '/mass', [
|
||||
'token' => $token,
|
||||
'toggle-archive' => '',
|
||||
'entry-checkbox' => $entries,
|
||||
]);
|
||||
|
@ -1856,8 +1877,12 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$this->assertSame(1, $res->isArchived());
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$token = $crawler->filter('#form_mass_action input[name=token]')->attr('value');
|
||||
|
||||
// Mass actions : star
|
||||
$client->request('POST', '/mass', [
|
||||
'token' => $token,
|
||||
'toggle-star' => '',
|
||||
'entry-checkbox' => $entries,
|
||||
]);
|
||||
|
@ -1878,8 +1903,12 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$this->assertTrue($res->isStarred());
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$token = $crawler->filter('#form_mass_action input[name=token]')->attr('value');
|
||||
|
||||
// Mass actions : tag
|
||||
$client->request('POST', '/mass', [
|
||||
'token' => $token,
|
||||
'tag' => '',
|
||||
'tags' => 'foo',
|
||||
'entry-checkbox' => $entries,
|
||||
|
@ -1908,17 +1937,29 @@ class EntryControllerTest extends WallabagTestCase
|
|||
|
||||
$this->assertNotContains('foo', $res->getTagsLabel());
|
||||
|
||||
$crawler = $client->request('GET', '/all/list');
|
||||
$token = $crawler->filter('#form_mass_action input[name=token]')->attr('value');
|
||||
|
||||
// Mass actions : delete
|
||||
$client->request('POST', '/mass', [
|
||||
'token' => $token,
|
||||
'delete' => '',
|
||||
'entry-checkbox' => $entries,
|
||||
]);
|
||||
|
||||
$client->request('GET', '/delete/' . $entry1->getId());
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$res = $client->getContainer()
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry1Id);
|
||||
|
||||
$client->request('GET', '/delete/' . $entry2->getId());
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$this->assertNull($res);
|
||||
|
||||
$res = $client->getContainer()
|
||||
->get(EntityManagerInterface::class)
|
||||
->getRepository(Entry::class)
|
||||
->find($entry2Id);
|
||||
|
||||
$this->assertNull($res);
|
||||
}
|
||||
|
||||
public function testGetSameDomainEntries()
|
||||
|
|
|
@ -128,8 +128,8 @@ class TagControllerTest extends WallabagTestCase
|
|||
$crawler = $client->request('GET', '/view/' . $entry->getId());
|
||||
$entryUri = $client->getRequest()->getRequestUri();
|
||||
|
||||
$link = $crawler->filter('a[href^="/remove-tag/' . $entry->getId() . '/' . $tag->getId() . '"]')->link();
|
||||
$client->click($link);
|
||||
$form = $crawler->filter('form[action^="/remove-tag/' . $entry->getId() . '/' . $tag->getId() . '"]')->form();
|
||||
$client->submit($form);
|
||||
|
||||
$this->assertSame(302, $client->getResponse()->getStatusCode());
|
||||
$this->assertSame($entryUri, $client->getResponse()->getTargetUrl());
|
||||
|
@ -138,9 +138,8 @@ class TagControllerTest extends WallabagTestCase
|
|||
$entry = $this->getEntityManager()->getRepository(Entry::class)->find($entry->getId());
|
||||
$this->assertNotContains($this->tagName, $entry->getTagsLabel());
|
||||
|
||||
$client->request('GET', '/remove-tag/' . $entry->getId() . '/' . $tag->getId());
|
||||
|
||||
$this->assertSame(404, $client->getResponse()->getStatusCode());
|
||||
$client->request('GET', '/view/' . $entry->getId());
|
||||
$this->assertStringNotContainsString('/remove-tag/' . $entry->getId() . '/' . $tag->getId(), $client->getResponse()->getContent());
|
||||
|
||||
$tag = $client->getContainer()
|
||||
->get(EntityManagerInterface::class)
|
||||
|
@ -172,8 +171,8 @@ class TagControllerTest extends WallabagTestCase
|
|||
$client = $this->getTestClient();
|
||||
|
||||
$crawler = $client->request('GET', '/tag/list');
|
||||
$link = $crawler->filter('a[id="delete-' . $tag->getSlug() . '"]')->link();
|
||||
$client->click($link);
|
||||
$form = $crawler->filter('#tag-' . $tag->getId())->selectButton('delete')->form();
|
||||
$client->submit($form);
|
||||
|
||||
$tag = $client->getContainer()
|
||||
->get(EntityManagerInterface::class)
|
||||
|
@ -556,7 +555,7 @@ class TagControllerTest extends WallabagTestCase
|
|||
|
||||
$crawler = $client->submit($form, $data);
|
||||
|
||||
$client->click($crawler->selectLink('entry.list.assign_search_tag')->link());
|
||||
$client->submit($crawler->selectButton('entry.list.assign_search_tag')->form());
|
||||
$client->followRedirect();
|
||||
|
||||
$entries = $client->getContainer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue