From 34be2d5de44ade2a78be73decc0b90a2c1bca720 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 26 Jun 2019 22:31:47 +0200 Subject: Add ability to import/export tagging rules - Add missing translations - Add some tests - Add `/api/taggingrule/export` API endpoint - Add baggy theme - Add error message when importing tagging rules failed - Also fix all translations (I think we are good now) --- .../Controller/TaggingRuleRestController.php | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php (limited to 'src/Wallabag/ApiBundle/Controller') diff --git a/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php b/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php new file mode 100644 index 00000000..2496298a --- /dev/null +++ b/src/Wallabag/ApiBundle/Controller/TaggingRuleRestController.php @@ -0,0 +1,39 @@ +validateAuthentication(); + + $data = SerializerBuilder::create()->build()->serialize( + $this->getUser()->getConfig()->getTaggingRules(), + 'json', + SerializationContext::create()->setGroups(['export_tagging_rule']) + ); + + return Response::create( + $data, + 200, + [ + 'Content-type' => 'application/json', + 'Content-Disposition' => 'attachment; filename="tagging_rules_' . $this->getUser()->getUsername() . '.json"', + 'Content-Transfer-Encoding' => 'UTF-8', + ] + ); + } +} -- cgit v1.2.3