diff --git a/index.php b/index.php index a6eaab2..a9d506d 100644 --- a/index.php +++ b/index.php @@ -496,10 +496,21 @@ Router\get_action('add', function() { }); -// Add the feed -Router\post_action('add', function() { +// Add a feed with the form or directly from the url, it can be used by a bookmarklet by example +Router\action('subscribe', function() { - $result = Model\import_feed(trim($_POST['url']), isset($_POST['download_content']) && $_POST['download_content'] == 1); + if (Request\param('url')) { + $values = array(); + $url = Request\param('url'); + } + else { + $values = Request\values(); + $url = isset($values['url']) ? $values['url'] : ''; + } + + $values += array('download_content' => 0); + $url = trim($url); + $result = Model\import_feed($url, $values['download_content']); if ($result) { @@ -512,7 +523,7 @@ Router\post_action('add', function() { } Response\html(Template\layout('add', array( - 'values' => array('url' => $_POST['url']), + 'values' => array('url' => $url), 'menu' => 'feeds', 'title' => t('Subscriptions') ))); diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index 3798320..8ec548a 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -1,6 +1,9 @@ 'Bookmarklet :', + 'Subscribe with Miniflux' => 'S\'abonner avec Miniflux', + 'Drag and drop this link to your bookmarks' => 'Glisser-déposer ce lien dans vos favoris', 'The content grabber is enabled successfully.' => 'Le téléchargement de contenu est activé avec succès.', 'Unable to activate the content grabber for this subscription.' => 'Impossible d\'activer le téléchargement de contenu pour cet abonnement.', 'enable full content' => 'télécharger le contenu complet', diff --git a/templates/add.php b/templates/add.php index 291f9a8..a0b9e53 100644 --- a/templates/add.php +++ b/templates/add.php @@ -7,7 +7,7 @@ -
+
diff --git a/templates/config.php b/templates/config.php index a813680..e50d899 100644 --- a/templates/config.php +++ b/templates/config.php @@ -40,7 +40,11 @@