Update: Register blocklist version with update manager

This commit is contained in:
zzz
2016-12-16 17:56:18 +00:00
parent 328f544de1
commit 4615fce28e
3 changed files with 9 additions and 4 deletions

View File

@ -142,6 +142,9 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
notifyInstalled(ROUTER_SIGNED, "", RouterVersion.VERSION); notifyInstalled(ROUTER_SIGNED, "", RouterVersion.VERSION);
notifyInstalled(ROUTER_SIGNED_SU3, "", RouterVersion.VERSION); notifyInstalled(ROUTER_SIGNED_SU3, "", RouterVersion.VERSION);
notifyInstalled(ROUTER_DEV_SU3, "", RouterVersion.FULL_VERSION); notifyInstalled(ROUTER_DEV_SU3, "", RouterVersion.FULL_VERSION);
String blist = _context.getProperty(NewsFetcher.PROP_BLOCKLIST_TIME);
if (blist != null)
notifyInstalled(BLOCKLIST, "", blist);
// hack to init from the current news file... do this before we register Updaters // hack to init from the current news file... do this before we register Updaters
// This will not kick off any Updaters as none are yet registered // This will not kick off any Updaters as none are yet registered
(new NewsFetcher(_context, this, Collections.<URI> emptyList())).checkForUpdates(); (new NewsFetcher(_context, this, Collections.<URI> emptyList())).checkForUpdates();
@ -789,7 +792,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
UpdateType type, String id, UpdateType type, String id,
Map<UpdateMethod, List<URI>> sourceMap, Map<UpdateMethod, List<URI>> sourceMap,
String newVersion, String minVersion) { String newVersion, String minVersion) {
if (type == NEWS || type == NEWS_SU3) { if (type == NEWS || type == NEWS_SU3 || type == BLOCKLIST) {
// shortcut // shortcut
notifyInstalled(type, "", newVersion); notifyInstalled(type, "", newVersion);
return true; return true;

View File

@ -77,7 +77,7 @@ class NewsFetcher extends UpdateRunner {
private boolean _success; private boolean _success;
private static final String TEMP_NEWS_FILE = "news.xml.temp"; private static final String TEMP_NEWS_FILE = "news.xml.temp";
private static final String PROP_BLOCKLIST_TIME = "router.blocklistVersion"; static final String PROP_BLOCKLIST_TIME = "router.blocklistVersion";
private static final String BLOCKLIST_DIR = "docs/feed/blocklist"; private static final String BLOCKLIST_DIR = "docs/feed/blocklist";
private static final String BLOCKLIST_FILE = "blocklist.txt"; private static final String BLOCKLIST_FILE = "blocklist.txt";
@ -711,7 +711,10 @@ class NewsFetcher extends UpdateRunner {
} }
if (!fail) { if (!fail) {
f.setLastModified(ble.updated); f.setLastModified(ble.updated);
_context.router().saveConfig(PROP_BLOCKLIST_TIME, Long.toString(ble.updated)); String upd = Long.toString(ble.updated);
_context.router().saveConfig(PROP_BLOCKLIST_TIME, upd);
_mgr.notifyVersionAvailable(this, _currentURI, BLOCKLIST, "", HTTP,
null, upd, "");
} }
if (_log.shouldWarn()) if (_log.shouldWarn())
_log.warn("Processed " + ble.entries.size() + " blocks and " + ble.removes.size() + " unblocks from news feed"); _log.warn("Processed " + ble.entries.size() + " blocks and " + ble.removes.size() + " unblocks from news feed");

View File

@ -14,7 +14,6 @@ public enum UpdateType {
PLUGIN, PLUGIN,
/** unused */ /** unused */
GEOIP, GEOIP,
/** unused */
BLOCKLIST, BLOCKLIST,
/** unused */ /** unused */
RESEED, RESEED,