forked from I2P_Developers/i2p.i2p
Update: Register blocklist version with update manager
This commit is contained in:
@ -142,6 +142,9 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
notifyInstalled(ROUTER_SIGNED, "", RouterVersion.VERSION);
|
||||
notifyInstalled(ROUTER_SIGNED_SU3, "", RouterVersion.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
|
||||
// This will not kick off any Updaters as none are yet registered
|
||||
(new NewsFetcher(_context, this, Collections.<URI> emptyList())).checkForUpdates();
|
||||
@ -789,7 +792,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
UpdateType type, String id,
|
||||
Map<UpdateMethod, List<URI>> sourceMap,
|
||||
String newVersion, String minVersion) {
|
||||
if (type == NEWS || type == NEWS_SU3) {
|
||||
if (type == NEWS || type == NEWS_SU3 || type == BLOCKLIST) {
|
||||
// shortcut
|
||||
notifyInstalled(type, "", newVersion);
|
||||
return true;
|
||||
|
@ -77,7 +77,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
private boolean _success;
|
||||
|
||||
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_FILE = "blocklist.txt";
|
||||
|
||||
@ -711,7 +711,10 @@ class NewsFetcher extends UpdateRunner {
|
||||
}
|
||||
if (!fail) {
|
||||
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())
|
||||
_log.warn("Processed " + ble.entries.size() + " blocks and " + ble.removes.size() + " unblocks from news feed");
|
||||
|
@ -14,7 +14,6 @@ public enum UpdateType {
|
||||
PLUGIN,
|
||||
/** unused */
|
||||
GEOIP,
|
||||
/** unused */
|
||||
BLOCKLIST,
|
||||
/** unused */
|
||||
RESEED,
|
||||
|
Reference in New Issue
Block a user