Browse Source

hide version for bundled plugins because it's meaningless; for everything else support showing version using git (if about[0] is null)

pull/11/head
Andrew Dolgov 3 months ago
parent
commit
20a844085f
  1. 61
      classes/pref/prefs.php
  2. 2
      plugins/af_comics/init.php
  3. 2
      plugins/af_fsckportal/init.php
  4. 2
      plugins/af_proxy_http/init.php
  5. 2
      plugins/af_psql_trgm/init.php
  6. 2
      plugins/af_readability/init.php
  7. 2
      plugins/af_redditimgur/init.php
  8. 2
      plugins/af_unburn/init.php
  9. 2
      plugins/af_youtube_embed/init.php
  10. 2
      plugins/af_zz_noautoplay/init.php
  11. 2
      plugins/af_zz_vidmute/init.php
  12. 2
      plugins/auth_internal/init.php
  13. 2
      plugins/auth_remote/init.php
  14. 2
      plugins/auto_assign_labels/init.php
  15. 2
      plugins/bookmarklets/init.php
  16. 2
      plugins/cache_starred_images/init.php
  17. 2
      plugins/close_button/init.php
  18. 2
      plugins/hotkeys_force_top/init.php
  19. 2
      plugins/hotkeys_noscroll/init.php
  20. 2
      plugins/hotkeys_swap_jk/init.php
  21. 2
      plugins/mail/init.php
  22. 2
      plugins/mailto/init.php
  23. 2
      plugins/no_iframes/init.php
  24. 2
      plugins/no_title_counters/init.php
  25. 2
      plugins/no_url_hashes/init.php
  26. 2
      plugins/note/init.php
  27. 2
      plugins/nsfw/init.php
  28. 2
      plugins/scored_oldest_first/init.php
  29. 2
      plugins/share/init.php
  30. 2
      plugins/shorten_expanded/init.php
  31. 2
      plugins/toggle_sidebar/init.php
  32. 2
      plugins/vf_shared/init.php

61
classes/pref/prefs.php

@ -795,6 +795,7 @@ class Pref_Prefs extends Handler_Protected {
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
$about = $plugin->about();
$version = htmlspecialchars($this->_get_plugin_version($plugin));
if ($about[3] ?? false) {
$is_checked = in_array($name, $system_enabled) ? "checked" : "";
@ -811,9 +812,11 @@ class Pref_Prefs extends Handler_Protected {
<i class='material-icons'>open_in_new</i> <?= __("More info...") ?></button>
<?php } ?>
<div dojoType='dijit.Tooltip' connectId='PLABEL-<?= htmlspecialchars($name) ?>' position='after'>
<?= htmlspecialchars(T_sprintf("v%.2f, by %s", $about[0], $about[2])) ?>
</div>
<?php if ($version) { ?>
<div dojoType='dijit.Tooltip' connectId='PLABEL-<?= htmlspecialchars($name) ?>' position='after'>
<?= $version ?>
</div>
<?php } ?>
</fieldset>
<?php
}
@ -829,6 +832,7 @@ class Pref_Prefs extends Handler_Protected {
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
$about = $plugin->about();
$version = htmlspecialchars($this->_get_plugin_version($plugin));
if (empty($about[3]) || $about[3] == false) {
@ -875,9 +879,11 @@ class Pref_Prefs extends Handler_Protected {
<i class='material-icons'>open_in_new</i> <?= __("More info...") ?></button>
<?php } ?>
<div dojoType='dijit.Tooltip' connectId="PLABEL-<?= htmlspecialchars($name) ?>" position='after'>
<?= htmlspecialchars(T_sprintf("v%.2f, by %s", $about[0], $about[2])) ?>
</div>
<?php if ($version) { ?>
<div dojoType='dijit.Tooltip' connectId='PLABEL-<?= htmlspecialchars($name) ?>' position='after'>
<?= $version ?>
</div>
<?php } ?>
</fieldset>
<?php
@ -1093,6 +1099,49 @@ class Pref_Prefs extends Handler_Protected {
set_pref(Prefs::_ENABLED_PLUGINS, $plugins);
}
function _get_version_from_git(string $dir) {
$descriptorspec = [
1 => ["pipe", "w"], // STDOUT
2 => ["pipe", "w"], // STDERR
];
$proc = proc_open("git --no-pager log --pretty=\"%ct %h\" -n1 HEAD",
$descriptorspec, $pipes, $dir);
if (is_resource($proc)) {
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
$status = proc_close($proc);
if ($status == 0) {
list($timestamp, $commit) = explode(" ", $stdout);
return trim(strftime("%y.%m", (int)$timestamp) . "-$commit");
} else {
return T_sprintf("Git error [RC=%d]: %s", $status, $stderr);
}
}
}
function _get_plugin_version(Plugin $plugin) {
$about = $plugin->about();
if (!empty($about[0])) {
return T_sprintf("v%.2f, by %s", $about[0], $about[2]);
} else {
$ref = new ReflectionClass(get_class($plugin));
$plugin_dir = dirname($ref->getFileName());
if (basename($plugin_dir) == "plugins") {
return "";
}
if (is_dir("$plugin_dir/.git")) {
return T_sprintf("v%s, by %s", $this->_get_version_from_git($plugin_dir), $about[2]);
}
}
}
static function _get_updated_plugins() {
$root_dir = dirname(dirname(__DIR__)); # we're in classes/pref/
$plugin_dirs = array_filter(glob("$root_dir/plugins.local/*"), "is_dir");

2
plugins/af_comics/init.php

@ -5,7 +5,7 @@ class Af_Comics extends Plugin {
private $filters = array();
function about() {
return array(2.0,
return array(null,
"Fixes RSS feeds of assorted comic strips",
"fox");
}

2
plugins/af_fsckportal/init.php

@ -4,7 +4,7 @@ class Af_Fsckportal extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Remove feedsportal spamlinks from article content",
"fox");
}

2
plugins/af_proxy_http/init.php

@ -8,7 +8,7 @@ class Af_Proxy_Http extends Plugin {
private $cache;
function about() {
return array(1.0,
return array(null,
"Loads media served over plain HTTP via built-in secure proxy",
"fox");
}

2
plugins/af_psql_trgm/init.php

@ -7,7 +7,7 @@ class Af_Psql_Trgm extends Plugin {
private $default_min_length = 32;
function about() {
return array(1.0,
return array(null,
"Marks similar articles as read (requires pg_trgm)",
"fox");
}

2
plugins/af_readability/init.php

@ -10,7 +10,7 @@ class Af_Readability extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Try to inline article content using Readability",
"fox");
}

2
plugins/af_redditimgur/init.php

@ -8,7 +8,7 @@ class Af_RedditImgur extends Plugin {
private $fallback_preview_urls = [];
function about() {
return array(1.0,
return array(null,
"Inline images (and other content) in Reddit RSS feeds",
"fox");
}

2
plugins/af_unburn/init.php

@ -3,7 +3,7 @@ class Af_Unburn extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Resolves feedburner and similar feed redirector URLs (requires CURL)",
"fox");
}

2
plugins/af_youtube_embed/init.php

@ -3,7 +3,7 @@ class Af_Youtube_Embed extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Embed videos in Youtube RSS feeds (and whitelist Youtube iframes)",
"fox");
}

2
plugins/af_zz_noautoplay/init.php

@ -3,7 +3,7 @@ class Af_Zz_NoAutoPlay extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Don't autoplay HTML5 videos",
"fox");
}

2
plugins/af_zz_vidmute/init.php

@ -3,7 +3,7 @@ class Af_Zz_VidMute extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Mute audio in HTML5 videos",
"fox");
}

2
plugins/auth_internal/init.php

@ -4,7 +4,7 @@ class Auth_Internal extends Auth_Base {
private $host;
function about() {
return array(1.0,
return array(null,
"Authenticates against internal tt-rss database",
"fox",
true);

2
plugins/auth_remote/init.php

@ -4,7 +4,7 @@ class Auth_Remote extends Auth_Base {
private $host;
function about() {
return array(1.0,
return array(null,
"Authenticates against remote password (e.g. supplied by Apache)",
"fox",
true);

2
plugins/auto_assign_labels/init.php

@ -5,7 +5,7 @@ class Auto_Assign_Labels extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Assign labels automatically based on article title, content, and tags",
"fox");
}

2
plugins/bookmarklets/init.php

@ -3,7 +3,7 @@ class Bookmarklets extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Easy feed subscription and web page sharing using bookmarklets",
"fox",
false,

2
plugins/cache_starred_images/init.php

@ -8,7 +8,7 @@ class Cache_Starred_Images extends Plugin {
private $max_cache_attempts = 5; // per-article
function about() {
return array(1.0,
return array(null,
"Automatically cache media files in Starred articles",
"fox");
}

2
plugins/close_button/init.php

@ -9,7 +9,7 @@ class Close_Button extends Plugin {
}
function about() {
return array(1.0,
return array(null,
"Adds a button to close article panel",
"fox");
}

2
plugins/hotkeys_force_top/init.php

@ -3,7 +3,7 @@ class Hotkeys_Force_Top extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Force open article to the top",
"itsamenathan");
}

2
plugins/hotkeys_noscroll/init.php

@ -3,7 +3,7 @@ class Hotkeys_Noscroll extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"n/p (and up/down) hotkeys move between articles without scrolling",
"fox");
}

2
plugins/hotkeys_swap_jk/init.php

@ -4,7 +4,7 @@ class Hotkeys_Swap_JK extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Swap j and k hotkeys (for vi brethren)",
"fox");
}

2
plugins/mail/init.php

@ -5,7 +5,7 @@ class Mail extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Share article via email",
"fox");
}

2
plugins/mailto/init.php

@ -3,7 +3,7 @@ class MailTo extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Share article via email (using mailto: links, invoking your mail client)",
"fox");
}

2
plugins/no_iframes/init.php

@ -3,7 +3,7 @@ class No_Iframes extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Remove embedded iframes (unless whitelisted)",
"fox");
}

2
plugins/no_title_counters/init.php

@ -3,7 +3,7 @@ class No_Title_Counters extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Remove counters from window title (prevents tab flashing on new articles)",
"fox");
}

2
plugins/no_url_hashes/init.php

@ -3,7 +3,7 @@ class No_URL_Hashes extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Disable URL hash usage (e.g. #f=10, etc)",
"fox");
}

2
plugins/note/init.php

@ -5,7 +5,7 @@ class Note extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Adds support for setting article notes",
"fox");
}

2
plugins/nsfw/init.php

@ -3,7 +3,7 @@ class NSFW extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Hide article content based on tags",
"fox",
false);

2
plugins/scored_oldest_first/init.php

@ -21,7 +21,7 @@ class Scored_Oldest_First extends Plugin {
}
function about() {
return array(1.0,
return array(null,
"Consider article score while sorting by oldest first",
"fox",
false,

2
plugins/share/init.php

@ -3,7 +3,7 @@ class Share extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Share article by unique URL",
"fox");
}

2
plugins/shorten_expanded/init.php

@ -3,7 +3,7 @@ class Shorten_Expanded extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Shorten overly long articles in CDM/expanded",
"fox");
}

2
plugins/toggle_sidebar/init.php

@ -4,7 +4,7 @@ class Toggle_Sidebar extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Adds a main toolbar button to toggle sidebar",
"fox");
}

2
plugins/vf_shared/init.php

@ -5,7 +5,7 @@ class VF_Shared extends Plugin {
private $host;
function about() {
return array(1.0,
return array(null,
"Feed for all articles actively shared by URL",
"fox",
false);

Loading…
Cancel
Save