forked from I2P_Developers/i2p.i2p
stubs for su3 news
This commit is contained in:
@ -158,6 +158,8 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
// right at instantiation if the news is already indicating a new version
|
||||
Checker c = new NewsHandler(_context, this);
|
||||
register(c, NEWS, HTTP, 0);
|
||||
// TODO
|
||||
//register(c, NEWS_SU3, HTTP, 0);
|
||||
register(c, ROUTER_SIGNED, HTTP, 0); // news is an update checker for the router
|
||||
Updater u = new UpdateHandler(_context, this);
|
||||
register(u, ROUTER_SIGNED, HTTP, 0);
|
||||
@ -734,9 +736,9 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
UpdateType type, String id,
|
||||
Map<UpdateMethod, List<URI>> sourceMap,
|
||||
String newVersion, String minVersion) {
|
||||
if (type == NEWS) {
|
||||
if (type == NEWS || type == NEWS_SU3) {
|
||||
// shortcut
|
||||
notifyInstalled(NEWS, "", newVersion);
|
||||
notifyInstalled(type, "", newVersion);
|
||||
return true;
|
||||
}
|
||||
UpdateItem ui = new UpdateItem(type, id);
|
||||
@ -806,6 +808,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
String msg = null;
|
||||
switch (type) {
|
||||
case NEWS:
|
||||
case NEWS_SU3:
|
||||
break;
|
||||
|
||||
case ROUTER_UNSIGNED:
|
||||
@ -900,6 +903,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
String msg = null;
|
||||
switch (task.getType()) {
|
||||
case NEWS:
|
||||
case NEWS_SU3:
|
||||
case ROUTER_SIGNED:
|
||||
case ROUTER_SIGNED_SU3:
|
||||
case ROUTER_UNSIGNED:
|
||||
@ -1009,6 +1013,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
switch (task.getType()) {
|
||||
case TYPE_DUMMY:
|
||||
case NEWS:
|
||||
case NEWS_SU3:
|
||||
rv = true;
|
||||
break;
|
||||
|
||||
@ -1132,6 +1137,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
|
||||
switch (type) {
|
||||
case NEWS:
|
||||
case NEWS_SU3:
|
||||
// handled in NewsHandler
|
||||
break;
|
||||
|
||||
|
@ -124,6 +124,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
* Parse the installed (not the temp) news file for the latest version.
|
||||
* TODO: Real XML parsing
|
||||
* TODO: Check minVersion, use backup URLs specified
|
||||
* TODO: SU3
|
||||
*/
|
||||
void checkForUpdates() {
|
||||
FileInputStream in = null;
|
||||
|
@ -29,6 +29,7 @@ class NewsHandler extends UpdateHandler implements Checker {
|
||||
* @since 0.7.14 not configurable
|
||||
*/
|
||||
private static final String BACKUP_NEWS_URL = "http://avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p/news.xml";
|
||||
private static final String BACKUP_NEWS_URL_SU3 = "http://avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a.b32.i2p/news.su3";
|
||||
|
||||
public NewsHandler(RouterContext ctx, ConsoleUpdateManager mgr) {
|
||||
super(ctx, mgr);
|
||||
@ -41,14 +42,17 @@ class NewsHandler extends UpdateHandler implements Checker {
|
||||
*/
|
||||
public UpdateTask check(UpdateType type, UpdateMethod method,
|
||||
String id, String currentVersion, long maxTime) {
|
||||
if ((type != ROUTER_SIGNED && type != NEWS) ||
|
||||
if ((type != ROUTER_SIGNED && type != NEWS && type != NEWS_SU3) ||
|
||||
method != HTTP)
|
||||
return null;
|
||||
List<URI> updateSources = new ArrayList<URI>(2);
|
||||
try {
|
||||
// TODO SU3
|
||||
updateSources.add(new URI(ConfigUpdateHelper.getNewsURL(_context)));
|
||||
} catch (URISyntaxException use) {}
|
||||
try {
|
||||
// TODO
|
||||
//updateSources.add(new URI(BACKUP_NEWS_URL_SU3));
|
||||
updateSources.add(new URI(BACKUP_NEWS_URL));
|
||||
} catch (URISyntaxException use) {}
|
||||
UpdateRunner update = new NewsFetcher(_context, _mgr, updateSources);
|
||||
|
@ -32,6 +32,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
// public static final String DEFAULT_NEWS_URL = "http://dev.i2p.net/cgi-bin/cvsweb.cgi/i2p/news.xml?rev=HEAD";
|
||||
public static final String OLD_DEFAULT_NEWS_URL = "http://complication.i2p/news.xml";
|
||||
public static final String DEFAULT_NEWS_URL = "http://echelon.i2p/i2p/news.xml";
|
||||
public static final String DEFAULT_NEWS_URL_SU3 = "http://echelon.i2p/i2p/news.su3";
|
||||
public static final String PROP_REFRESH_FREQUENCY = "router.newsRefreshFrequency";
|
||||
public static final long DEFAULT_REFRESH_FREQ = 36*60*60*1000l;
|
||||
public static final String DEFAULT_REFRESH_FREQUENCY = Long.toString(DEFAULT_REFRESH_FREQ);
|
||||
|
@ -32,6 +32,7 @@ public class ConfigUpdateHelper extends HelperBase {
|
||||
/** hack to replace the old news location with the new one, even if they have saved
|
||||
the update page at some point */
|
||||
public static String getNewsURL(I2PAppContext ctx) {
|
||||
// TODO SU3
|
||||
String url = ctx.getProperty(ConfigUpdateHandler.PROP_NEWS_URL);
|
||||
if (url != null && !url.equals(ConfigUpdateHandler.OLD_DEFAULT_NEWS_URL))
|
||||
return url;
|
||||
|
@ -67,12 +67,16 @@ public class SU3File {
|
||||
private static final int VERSION_OFFSET = 40; // Signature.SIGNATURE_BYTES; avoid early ctx init
|
||||
|
||||
public static final int TYPE_ZIP = 0;
|
||||
/** @since 0.9.15 */
|
||||
public static final int TYPE_XML = 1;
|
||||
/** @since 0.9.15 */
|
||||
public static final int TYPE_HTML = 2;
|
||||
|
||||
public static final int CONTENT_UNKNOWN = 0;
|
||||
public static final int CONTENT_ROUTER = 1;
|
||||
public static final int CONTENT_PLUGIN = 2;
|
||||
public static final int CONTENT_RESEED = 3;
|
||||
/** @since 0.9.15 */
|
||||
public static final int CONTENT_NEWS = 4;
|
||||
|
||||
private enum ContentType {
|
||||
|
@ -23,5 +23,7 @@ public enum UpdateType {
|
||||
/** unused */
|
||||
ADDRESSBOOK,
|
||||
/** @since 0.9.9 */
|
||||
ROUTER_SIGNED_SU3
|
||||
ROUTER_SIGNED_SU3,
|
||||
/** @since 0.9.15 */
|
||||
NEWS_SU3
|
||||
}
|
||||
|
Reference in New Issue
Block a user