From 68bfed8aa3cf9352f4c40e0516554f8b47963d97 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 10 Jun 2018 14:47:00 +0700 Subject: [PATCH] Experiment with PGP signed messages --- app.properties | 5 ++-- source/net/filebot/Settings.java | 6 +++-- source/net/filebot/Settings.properties | 4 ++-- source/net/filebot/ui/SupportDialog.java | 29 +++++++++++------------- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/app.properties b/app.properties index 772f49ea..8c95e1c5 100644 --- a/app.properties +++ b/app.properties @@ -3,21 +3,20 @@ application.name: FileBot application.version: 4.8.2 - # Script Base URL github.stable: https://app.filebot.net/scripts/m1.jar.xz github.master: https://raw.githubusercontent.com/filebot/scripts/master/ # Update Descriptor update.url: https://app.filebot.net/update.xml -donate.url: https://www.filebot.net/donate.php # Store link.mas: macappstore://itunes.apple.com/app/id905384638 link.mws: ms-windows-store://review/?ProductId=9NBLGGH52T9X -# Tutorials +# Links link.app.help: https://www.filebot.net/getting-started/embed.html +link.app.purchase: https://www.filebot.net/purchase.html # Help link.intro: https://www.filebot.net/getting-started/index.html diff --git a/source/net/filebot/Settings.java b/source/net/filebot/Settings.java index d2c06fde..7734460b 100644 --- a/source/net/filebot/Settings.java +++ b/source/net/filebot/Settings.java @@ -25,6 +25,8 @@ import net.filebot.util.PreferencesMap.StringAdapter; public final class Settings { + public static final LicenseModel LICENSE = LicenseModel.get(); + public static String getApplicationName() { return getApplicationProperty("application.name"); } @@ -157,8 +159,8 @@ public final class Settings { return null; } - public static String getDonateURL() { - return getApplicationProperty("donate.url") + "?src=" + getApplicationDeployment(); + public static String getPurchaseURL() { + return getApplicationProperty("link.app.purchase") + "?src=" + getApplicationDeployment(); } public static String getEmbeddedHelpURL() { diff --git a/source/net/filebot/Settings.properties b/source/net/filebot/Settings.properties index add70c5b..c017f242 100644 --- a/source/net/filebot/Settings.properties +++ b/source/net/filebot/Settings.properties @@ -3,7 +3,6 @@ application.version: @{application.version} application.revision: @{revision} update.url: @{update.url} -donate.url: @{donate.url} github.stable: @{github.stable} github.master: @{github.master} @@ -12,6 +11,7 @@ link.mas: @{link.mas} link.mws: @{link.mws} link.app.help: @{link.app.help} +link.app.purchase: @{link.app.purchase} link.intro: @{link.intro} link.forums: @{link.forums} @@ -29,4 +29,4 @@ apikey.themoviedb: @{apikey.themoviedb} apikey.omdb: @{apikey.omdb} apikey.acoustid: @{apikey.acoustid} apikey.anidb: @{apikey.anidb} -apikey.opensubtitles: @{apikey.opensubtitles} \ No newline at end of file +apikey.opensubtitles: @{apikey.opensubtitles} diff --git a/source/net/filebot/ui/SupportDialog.java b/source/net/filebot/ui/SupportDialog.java index c4109f13..b80630d1 100644 --- a/source/net/filebot/ui/SupportDialog.java +++ b/source/net/filebot/ui/SupportDialog.java @@ -8,7 +8,6 @@ import static net.filebot.util.StringUtilities.*; import static net.filebot.util.ui.SwingUI.*; import java.util.List; -import java.util.function.Predicate; import java.util.logging.Level; import java.util.stream.Stream; @@ -22,44 +21,42 @@ import net.filebot.util.PreferencesMap.PreferencesEntry; public enum SupportDialog { - Donation { + Purchase { @Override String getMessage(int renameCount) { - return String.format("

Thank you for using FileBot!


It has taken thousands of hours to develop this application. If you enjoy using it,
please consider making a donation. It'll help make FileBot even better!

You've renamed %,d files.


", renameCount); + return String.format("

Thank you for using FileBot!


It has taken thousands of hours to develop this application. If it works well for you,
please purchase a license. It'll help make FileBot even better!

You've renamed %,d files.


", renameCount); } @Override String[] getActions(boolean first) { - if (first) - return new String[] { "Donate! :)", "Nope! Maybe next time." }; - else - return new String[] { "Donate again! :)", "Nope! Not this time." }; + return new String[] { "Purchase! :)", "Nope! Maybe another time." }; } @Override Icon getIcon() { - return ResourceManager.getIcon("message.donate"); + return ResourceManager.getIcon("window.icon.large"); } @Override String getTitle() { - return "Please Donate"; + return "Purchase FileBot"; } @Override public boolean feelingLucky(int sessionRenameCount, int totalRenameCount, int currentRevision, int lastSupportRevision, int supportRevisionCount) { - // annoy users that chose not to purchase FileBot on the Store - if (sessionRenameCount > 0 && Stream.of("Mac OS X", "Windows 10").anyMatch(Predicate.isEqual(System.getProperty("os.name")))) { - return true; + try { + LICENSE.check(); + return false; + } catch (Throwable e) { + log.log(Level.WARNING, e::toString); + return false; } - - return super.feelingLucky(sessionRenameCount, totalRenameCount, currentRevision, lastSupportRevision, supportRevisionCount); } @Override String getURI() { - return getDonateURL(); + return getPurchaseURL(); } }, @@ -167,7 +164,7 @@ public enum SupportDialog { int totalRenameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); // show donation / review reminders to power users - SupportDialog dialog = isAppStore() ? AppStoreReview : Donation; + SupportDialog dialog = isAppStore() ? AppStoreReview : Purchase; if (dialog.feelingLucky(sessionRenameCount, totalRenameCount, currentRevision, lastSupportRevision, supportRevision.size())) { if (dialog.show(totalRenameCount, supportRevision.isEmpty())) {