Fix
This commit is contained in:
parent
7142d46849
commit
2f5d109aa8
2 changed files with 18 additions and 10 deletions
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.security.SignatureException;
|
import java.security.SignatureException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.CompletionException;
|
import java.util.concurrent.CompletionException;
|
||||||
|
|
||||||
|
@ -28,10 +29,17 @@ public class Updater {
|
||||||
public Environment getEnvironment() {
|
public Environment getEnvironment() {
|
||||||
return environment;
|
return environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all channels
|
||||||
|
* @return A future which returns the list of all channels
|
||||||
|
*/
|
||||||
|
public CompletableFuture<List<String>> getChannels() { return metadataProvider.getChannels(); }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the latest available version
|
* Get the latest available version
|
||||||
* @return a future which can throw ioexpception
|
* @return A future which returns latest version metadata
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Version> getLatestVersion() {
|
public CompletableFuture<Version> getLatestVersion() {
|
||||||
CompletableFuture<Version> currentVersionFuture = metadataProvider.getCurrentVersionMetadata();
|
CompletableFuture<Version> currentVersionFuture = metadataProvider.getCurrentVersionMetadata();
|
||||||
|
@ -49,16 +57,16 @@ public class Updater {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get information about this version
|
* Get information about this version
|
||||||
* @return a future which can throw ioexpception
|
* @return A future which returns current version metadata
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Version> getCurrentVersion() {
|
public CompletableFuture<Version> getCurrentVersion() {
|
||||||
return metadataProvider.getCurrentVersionMetadata();
|
return metadataProvider.getCurrentVersionMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* download the latest available version
|
* Download the latest available version
|
||||||
* @return a future which returns the downloaded file, it can also throw ioexpception or signatureexception
|
* @return a future which returns the downloaded file
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<File> downloadLatestVersion() {
|
public CompletableFuture<File> downloadLatestVersion() {
|
||||||
CompletableFuture<Version> latestVersionFuture = metadataProvider.getLatestVersionMetadata();
|
CompletableFuture<Version> latestVersionFuture = metadataProvider.getLatestVersionMetadata();
|
||||||
|
@ -75,9 +83,9 @@ public class Updater {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* installs the ALREADY DOWNLOADED latest version
|
* Installs the ALREADY DOWNLOADED latest version<br>
|
||||||
* you can call it immediately after {@link #downloadLatestVersion()}
|
* You can call it immediately after {@link #downloadLatestVersion()}
|
||||||
* @return a {@link CompletableFuture} that ends after move. it can throw
|
* @return a {@link CompletableFuture} that ends after move, it can throw some exceptions.
|
||||||
* @throws NoSuchFileException if you didn't download it first
|
* @throws NoSuchFileException if you didn't download it first
|
||||||
*/
|
*/
|
||||||
public CompletableFuture<Void> installLatestVersion() throws NoSuchFileException {
|
public CompletableFuture<Void> installLatestVersion() throws NoSuchFileException {
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class GiteaMetadataDAO implements MetadataDAO {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompletableFuture<Version> getMetadata(String channel, String versionLabel) {
|
public CompletableFuture<Version> getMetadata(String channel, String versionLabel) {
|
||||||
String url = getFileUrl(versionLabel, "meta-v1.json");
|
String url = getFileUrl(channel, versionLabel, "meta-v1.json");
|
||||||
|
|
||||||
CompletableFuture<Version> metadataFuture =
|
CompletableFuture<Version> metadataFuture =
|
||||||
makeRequest(url).thenApply(response -> {
|
makeRequest(url).thenApply(response -> {
|
||||||
|
|
Loading…
Reference in a new issue