Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for new versions #67

Merged
merged 1 commit into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.lehmannet.om.ui.extension.IExtension;
import de.lehmannet.om.ui.navigation.ObservationManager;

public class UpdateChecker implements Runnable {
Expand All @@ -25,14 +23,15 @@ public class UpdateChecker implements Runnable {
public static URL UPDATE_URL = null;
static {
try {
UPDATE_URL = new URL("http://observation.sourceforge.net/update");
UPDATE_URL = new URL(
"https://raw.githubusercontent.com/capape/observation-manager/master/observation-manager/observation-manager-app/src/main/resources/version.properties");
} catch (MalformedURLException url) {
LOGGER.error("Malformed update check URL: {} ", UPDATE_URL);
}
}

private static final String UPDATEFILE_LATESTVERSION = "latestVersion";
private static final String UPDATEFILE_DOWNLOADURL = "downloadURL";
private static final String UPDATEFILE_LATESTVERSION = "latest.version";
private static final String UPDATEFILE_DOWNLOADURL = "download.url";

private ObservationManager om = null;
private List<UpdateEntry> result = new ArrayList<>();
Expand All @@ -56,27 +55,10 @@ public boolean isUpdateAvailable() {
@Override
public void run() {

// Check extensions
List<IExtension> extensions = this.om.getExtensionLoader().getExtensions();
ListIterator<IExtension> iterator = extensions.listIterator();
IExtension currentExtension = null;
URL currentExtensionURL = null;
UpdateEntry currentResult = null;
try {
while (iterator.hasNext()) {
currentExtension = iterator.next();
currentExtensionURL = currentExtension.getUpdateInformationURL();
if (currentExtensionURL != null) {
currentResult = this.checkForUpdates(currentExtension.getName(),
String.valueOf(currentExtension.getVersion()), currentExtensionURL);
if (currentResult != null) { // New version found
result.add(currentResult);
}
}
}

// Check OM itself
currentResult = this.checkForUpdates("Observation Manager", om.getVersion(), UPDATE_URL);
UpdateEntry currentResult = this.checkForUpdates("Observation Manager", om.getVersion(), UPDATE_URL);
if (currentResult != null) { // New version found
result.add(currentResult);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
observation.manager.version=${project.version}
observation.manager.version=${project.version}
latest.version=1.6.0-RC11
download.url=https://github.com/capape/observation-manager/releases/download/v1.6.0-RC11/observation-manager-distribution-1.6.0-RC11-distribution.zip