1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-01-10 13:28:02 -05:00

Experiment with PGP signed messages

This commit is contained in:
Reinhard Pointner 2018-06-11 16:32:23 +07:00
parent cefd6dc6bb
commit 92495f0256
2 changed files with 10 additions and 20 deletions

View File

@ -10,11 +10,6 @@ public enum LicenseModel {
private final Resource<Boolean> CHECK = Resource.lazy(() -> !getAppUserModelID().equals("PointPlanck.FileBot")); private final Resource<Boolean> CHECK = Resource.lazy(() -> !getAppUserModelID().equals("PointPlanck.FileBot"));
@Override
public boolean isAppStore() {
return true;
}
@Override @Override
public void check() throws LicenseError { public void check() throws LicenseError {
try { try {
@ -31,11 +26,6 @@ public enum LicenseModel {
private final Resource<Boolean> CHECK = Resource.lazy(() -> !File.listRoots()[0].canRead()); private final Resource<Boolean> CHECK = Resource.lazy(() -> !File.listRoots()[0].canRead());
@Override
public boolean isAppStore() {
return true;
}
@Override @Override
public void check() throws LicenseError { public void check() throws LicenseError {
try { try {
@ -50,11 +40,6 @@ public enum LicenseModel {
PGPSignedMessage { PGPSignedMessage {
@Override
public boolean isAppStore() {
return false;
}
@Override @Override
public void check() throws LicenseError { public void check() throws LicenseError {
try { try {
@ -65,7 +50,9 @@ public enum LicenseModel {
} }
}; };
public abstract boolean isAppStore(); public boolean isFile() {
return this == PGPSignedMessage;
}
public abstract void check() throws LicenseError; public abstract void check() throws LicenseError;

View File

@ -114,7 +114,7 @@ public class Main {
// CLI mode => run command-line interface and then exit // CLI mode => run command-line interface and then exit
if (args.runCLI()) { if (args.runCLI()) {
// just import and print license when running with --license option // just import and print license when running with --license option
if (args.getLicenseFile() != null && !LICENSE.isAppStore()) { if (LICENSE.isFile() && args.getLicenseFile() != null) {
configureLicense(args); configureLicense(args);
System.exit(0); System.exit(0);
} }
@ -178,10 +178,13 @@ public class Main {
SwingEventBus.getInstance().post(new FileTransferable(files)); SwingEventBus.getInstance().post(new FileTransferable(files));
} }
// import license if launched with license file if (LICENSE.isFile()) {
if (args.getLicenseFile() != null && !LICENSE.isAppStore()) { // import license if launched with license file
configureLicense(args); if (args.getLicenseFile() != null) {
configureLicense(args);
}
// make sure license is validated and cached
try { try {
LICENSE.check(); LICENSE.check();
} catch (Throwable e) { } catch (Throwable e) {