1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-09 22:09:47 -04:00

Experiment with user prompts

This commit is contained in:
Reinhard Pointner 2018-06-15 01:13:44 +07:00
parent f32d29560e
commit 803fb7b083
2 changed files with 7 additions and 4 deletions

View File

@ -13,7 +13,6 @@ import java.net.URL;
import java.nio.file.Files; import java.nio.file.Files;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Map; import java.util.Map;
@ -63,6 +62,10 @@ public class License implements Serializable {
} }
} }
private String getExpirationDate() {
return expires == null ? null : expires.atZone(ZoneOffset.UTC).format(DateTimeFormatter.ISO_LOCAL_DATE);
}
private Map<String, String> getProperties(byte[] bytes) throws Exception { private Map<String, String> getProperties(byte[] bytes) throws Exception {
return NEWLINE.splitAsStream(verifyClearSignMessage(bytes)).map(s -> s.split(": ", 2)).collect(toMap(a -> a[0], a -> a[1])); return NEWLINE.splitAsStream(verifyClearSignMessage(bytes)).map(s -> s.split(": ", 2)).collect(toMap(a -> a[0], a -> a[1]));
} }
@ -115,7 +118,7 @@ public class License implements Serializable {
} }
if (Instant.now().isAfter(expires)) { if (Instant.now().isAfter(expires)) {
throw new IllegalStateException("EXPIRED since " + expires.atZone(ZoneId.systemDefault()).format(DateTimeFormatter.RFC_1123_DATE_TIME)); throw new IllegalStateException("EXPIRED since " + getExpirationDate());
} }
return this; return this;
@ -123,7 +126,7 @@ public class License implements Serializable {
@Override @Override
public String toString() { public String toString() {
return String.format("%s License %s (Valid-Until: %s)", product, id, expires == null ? null : expires.atZone(ZoneOffset.UTC).format(DateTimeFormatter.ISO_LOCAL_DATE)); return String.format("%s License %s (Valid-Until: %s)", product, id, getExpirationDate());
} }
public static final SystemProperty<File> FILE = SystemProperty.of("net.filebot.license", File::new, ApplicationFolder.AppData.resolve("license.txt")); public static final SystemProperty<File> FILE = SystemProperty.of("net.filebot.license", File::new, ApplicationFolder.AppData.resolve("license.txt"));

View File

@ -193,7 +193,7 @@ public final class Settings {
} }
public static String getPurchaseURL() { public static String getPurchaseURL() {
return getApplicationProperty("link.app.purchase") + "?src=" + getApplicationDeployment(); return getApplicationProperty("link.app.purchase");
} }
public static String getEmbeddedHelpURL() { public static String getEmbeddedHelpURL() {