A free, self-hostable news aggregator…
Interface to enable/disable API and unsafe automatic login
Alexandre Alapetite670ee57b6288
diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.phpindex b03989cd7..fa967cedc 100644--- a/app/Controllers/usersController.php+++ b/app/Controllers/usersController.php@@ -69,13 +69,19 @@ class FreshRSS_users_Controller extends Minz_ActionController {$anon_refresh = Minz_Request::param('anon_refresh', false);$anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no');$auth_type = Minz_Request::param('auth_type', 'none');+ $unsafe_autologin = Minz_Request::param('unsafe_autologin', false);+ $api_enabled = Minz_Request::param('api_enabled', false);if ($anon != Minz_Configuration::allowAnonymous() ||$auth_type != Minz_Configuration::authType() ||- $anon_refresh != Minz_Configuration::allowAnonymousRefresh()) {+ $anon_refresh != Minz_Configuration::allowAnonymousRefresh() ||+ $unsafe_autologin != Minz_Configuration::unsafeAutologinEnabled() ||+ $api_enabled != Minz_Configuration::apiEnabled()) {Minz_Configuration::_authType($auth_type);Minz_Configuration::_allowAnonymous($anon);Minz_Configuration::_allowAnonymousRefresh($anon_refresh);+ Minz_Configuration::_enableAutologin($unsafe_autologin);+ Minz_Configuration::_enableApi($api_enabled);$ok &= Minz_Configuration::writeFile();}}diff --git a/app/Models/Feed.php b/app/Models/Feed.phpindex 73f9c32fb..bce3bd24f 100644--- a/app/Models/Feed.php+++ b/app/Models/Feed.php@@ -254,11 +254,12 @@ class FreshRSS_Feed extends Minz_Model {$elinks = array();foreach ($item->get_enclosures() as $enclosure) {$elink = $enclosure->get_link();- if (array_key_exists($elink, $elinks)) continue;- $elinks[$elink] = '1';- $mime = strtolower($enclosure->get_type());- if (strpos($mime, 'image/') === 0) {- $content .= '<br /><img src="' . $elink . '" alt="" />';+ if (empty($elinks[$elink])) {+ $elinks[$elink] = '1';+ $mime = strtolower($enclosure->get_type());+ if (strpos($mime, 'image/') === 0) {+ $content .= '<br /><img src="' . $elink . '" alt="" />';+ }}}diff --git a/app/i18n/en.php b/app/i18n/en.phpindex d504ffc11..69247165f 100644--- a/app/i18n/en.php+++ b/app/i18n/en.php@@ -180,6 +180,8 @@ return array ('persona_connection_email' => 'Login mail address<br /><small>(for <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>','allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)','allow_anonymous_refresh' => 'Allow anonymous refresh of the articles',+ 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ',+ 'api_enabled' => 'Allow <abbr>API</abbr> access <small>(required for mobile apps)</small>','auth_token' => 'Authentication token','explain_token' => 'Allows to access RSS output of the default user without authentication.<br /><kbd>%s?output=rss&token=%s</kbd>','login_configuration' => 'Login',diff --git a/app/i18n/fr.php b/app/i18n/fr.phpindex c5581a78b..e364ed130 100644--- a/app/i18n/fr.php+++ b/app/i18n/fr.php@@ -180,6 +180,8 @@ return array ('persona_connection_email' => 'Adresse courriel de connexion<br /><small>(pour <a href="https://persona.org/" rel="external">Mozilla Persona</a>)</small>','allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)','allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux',+ 'unsafe_autologin' => 'Autoriser les connexion automatiques non-sûres au format : ',+ 'api_enabled' => 'Autoriser l’accès par <abbr>API</abbr> <small>(nécessaire pour les applis mobiles)</small>','auth_token' => 'Jeton d’identification','explain_token' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier.<br /><kbd>%s?output=rss&token=%s</kbd>','login_configuration' => 'Identification',diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtmlindex 3f3f19418..1a02b0e90 100644--- a/app/views/configure/users.phtml+++ b/app/views/configure/users.phtml@@ -90,6 +90,17 @@</div></div>+ <div class="form-group">+ <div class="group-controls">+ <label class="checkbox" for="unsafe_autologin">+ <input type="checkbox" name="unsafe_autologin" id="unsafe_autologin" value="1"<?php echo Minz_Configuration::unsafeAutologinEnabled() ? ' checked="checked"' : '',+ Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> />+ <?php echo Minz_Translate::t('unsafe_autologin'); ?>+ <kbd>p/i/?a=formLogin&u=Alice&p=1234</kbd>+ </label>+ </div>+ </div>+<?php if (Minz_Configuration::canLogIn()) { ?><div class="form-group"><label class="group-name" for="token"><?php echo Minz_Translate::t('auth_token'); ?></label>@@ -102,6 +113,16 @@</div><?php } ?>+ <div class="form-group">+ <div class="group-controls">+ <label class="checkbox" for="api_enabled">+ <input type="checkbox" name="api_enabled" id="api_enabled" value="1"<?php echo Minz_Configuration::apiEnabled() ? ' checked="checked"' : '',+ Minz_Configuration::needsLogin() ? '' : ' disabled="disabled"'; ?> />+ <?php echo Minz_Translate::t('api_enabled'); ?>+ </label>+ </div>+ </div>+<div class="form-group form-actions"><div class="group-controls"><button type="submit" class="btn btn-important"><?php echo Minz_Translate::t('save'); ?></button>