From e9eca6aff6c7e2e2349b3b6cf714e2e7eb99405e Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Wed, 5 Mar 2014 20:22:03 -0500 Subject: Sharing optimization Change the storage and display of sharings to improve the time needed to generate the page. Instead of looking for a default value when displaying the sharing links, they are added during the configuration. --- app/Models/Configuration.php | 15 +++++++++++---- app/Models/Share.php | 3 --- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'app/Models') diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 827a1d166..85e891b64 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -193,7 +193,9 @@ class FreshRSS_Configuration { if (!is_array($value)) { continue; } - if (array_key_exists('url', $value)) { + + // Verify URL and add default value when needed + if (array_key_exists('url', $value) && $value['url'] !== null) { $is_url = ( filter_var ($value['url'], FILTER_VALIDATE_URL) || (version_compare(PHP_VERSION, '5.3.3', '<') && @@ -203,10 +205,15 @@ class FreshRSS_Configuration { if (!$is_url) { continue; } - if (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) { - $value['name'] = $value['type']; - } + } else { + $value['url'] = null; } + + // Add a default name + if (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) { + $value['name'] = $value['type']; + } + $this->data['sharing'][] = $value; } } diff --git a/app/Models/Share.php b/app/Models/Share.php index 887fcef05..b146db722 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -3,9 +3,6 @@ class FreshRSS_Share { static public function generateUrl($options, $selected, $link, $title) { - if (!array_key_exists('url', $selected)) { - $selected['url'] = ''; - } $share = $options[$selected['type']]; $matches = array( '~URL~', -- cgit v1.2.3 From b0a3610db735c7f719e8c35d84ffdc5a4e4987af Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 7 Mar 2014 21:04:16 -0500 Subject: Change test --- app/Models/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models') diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 85e891b64..3e5cd8bad 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -210,7 +210,7 @@ class FreshRSS_Configuration { } // Add a default name - if (!array_key_exists('name', $value) || strcmp($value['name'], '') === 0) { + if (empty($value['name'])) { $value['name'] = $value['type']; } -- cgit v1.2.3 From 339a0dd49c79b9adba67483a3cab55c4cb2e2066 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 8 Mar 2014 09:23:59 -0500 Subject: Change test on URL parameter --- app/Models/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models') diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 3e5cd8bad..80031369e 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -195,7 +195,7 @@ class FreshRSS_Configuration { } // Verify URL and add default value when needed - if (array_key_exists('url', $value) && $value['url'] !== null) { + if (isset($value['url'])) { $is_url = ( filter_var ($value['url'], FILTER_VALIDATE_URL) || (version_compare(PHP_VERSION, '5.3.3', '<') && -- cgit v1.2.3 From 670ee57b6288549ac611d53d86d8f5ffee641b0e Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 8 Mar 2014 20:16:10 +0100 Subject: Interface to enable/disable API and unsafe automatic login https://github.com/marienfressinaud/FreshRSS/issues/13 https://github.com/marienfressinaud/FreshRSS/issues/440 --- app/Controllers/usersController.php | 8 +++++++- app/Models/Feed.php | 11 ++++++----- app/i18n/en.php | 2 ++ app/i18n/fr.php | 2 ++ app/views/configure/users.phtml | 21 +++++++++++++++++++++ 5 files changed, 38 insertions(+), 6 deletions(-) (limited to 'app/Models') diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php index 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.php index 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 .= '
'; + if (empty($elinks[$elink])) { + $elinks[$elink] = '1'; + $mime = strtolower($enclosure->get_type()); + if (strpos($mime, 'image/') === 0) { + $content .= '
'; + } } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 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
(for Mozilla Persona)', '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 API access (required for mobile apps)', 'auth_token' => 'Authentication token', 'explain_token' => 'Allows to access RSS output of the default user without authentication.
%s?output=rss&token=%s', 'login_configuration' => 'Login', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 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
(pour Mozilla Persona)', '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 API (nécessaire pour les applis mobiles)', '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.
%s?output=rss&token=%s', 'login_configuration' => 'Identification', diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 3f3f19418..1a02b0e90 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -90,6 +90,17 @@ +
+
+ +
+
+
@@ -102,6 +113,16 @@
+
+
+ +
+
+
-- cgit v1.2.3 From 1af723ca68e2558232ef4c4eb5a7c8f41a07bd0c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 15 Mar 2014 07:08:58 -0400 Subject: Add a button to reveal/hide password I add a button on the configure user interface to reveal the password for 2 seconds and hide it after that period. See #442 I am not sure if the fallback unicode text for the icon is correct. I can not make it work. --- app/Models/Themes.php | 1 + app/views/configure/users.phtml | 2 ++ p/scripts/main.js | 12 ++++++++++++ p/themes/icons/key.svg | 7 +++++++ 4 files changed, 22 insertions(+) create mode 100644 p/themes/icons/key.svg (limited to 'app/Models') diff --git a/app/Models/Themes.php b/app/Models/Themes.php index c7099a1df..ed746b7e9 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -77,6 +77,7 @@ class FreshRSS_Themes extends Minz_Model { 'down' => '▽', 'favorite' => '★', 'help' => 'ⓘ', + 'key' => '⚿', 'link' => '↗', 'login' => '🔒', 'logout' => '🔓', diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 1a02b0e90..fdc94cd18 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -21,6 +21,7 @@
/> +
@@ -178,6 +179,7 @@
+
diff --git a/p/scripts/main.js b/p/scripts/main.js index 799d46625..57618c29b 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -998,6 +998,17 @@ function init_feed_observers() { }); }; +function init_password_observers() { + $('input[type="password"] + a.btn.toggle-password').on('click', function(e){ + e.preventDefault(); + var passwordField = $(this).siblings('input[type="password"]'); + passwordField.attr('type','text'); + setTimeout(function(){ + passwordField.attr('type','password'); + },2000); + }); +}; + function init_all() { if (!(window.$ && window.url_freshrss && ((!full_lazyload) || $.fn.lazyload))) { if (window.console) { @@ -1030,6 +1041,7 @@ function init_all() { } else { init_share_observers(); init_feed_observers(); + init_password_observers(); } if (window.console) { diff --git a/p/themes/icons/key.svg b/p/themes/icons/key.svg new file mode 100644 index 000000000..9193f4552 --- /dev/null +++ b/p/themes/icons/key.svg @@ -0,0 +1,7 @@ + + + + + + + -- cgit v1.2.3