Skip to content

Use display version in update process #3050

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ jobs:
working-directory: Quicksilver
run: |
./Tools/qsrelease
cp ./SharedSupport/ChangesBare.html /tmp
- name: Prepare DMG_INGREDIENTS artifact
working-directory: /tmp/QS/build/Release/
run: |
cp \
/tmp/qs_build_settings \
/tmp/Quicksilver.entitlements \
/tmp/ChangesBare.html \
./dmg/
tar -czvf ./dmg_ingredients.tar.gz ./dmg
- name: Upload components for sign action
Expand Down Expand Up @@ -78,7 +76,6 @@ jobs:
mv \
./dmg/qs_build_settings \
./dmg/Quicksilver.entitlements \
./dmg/ChangesBare.html \
/tmp/
QS_INFO_VERSION=$(awk '/QS_INFO_VERSION/ { print $NF }' \
/tmp/qs_build_settings)
Expand Down
2 changes: 1 addition & 1 deletion Quicksilver/Code-App/QSController.m
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ - (void)activateInterface:(id)sender {
NSBeep();
[NSApp activateIgnoringOtherApps:YES];
[modal makeKeyAndOrderFront:self];
} else {
} else if (![sender isEqualTo:[NSApplication sharedApplication]]) {
QSInterfaceController *iController = [self interfaceController];
if (!iController)
NSBeep();
Expand Down
43 changes: 35 additions & 8 deletions Quicksilver/Code-App/QSUpdateController.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
@interface QSUpdateController () <QSURLDownloadDelegate> {
NSTimer *updateTimer;
NSString *availableVersion;
NSString *availableVersionDisplay;
}
@property (retain) QSURLDownload *appDownload;
@property (retain) QSTask *downloadTask;
Expand Down Expand Up @@ -104,6 +105,14 @@ - (void)setUpdateTimer {
#endif
}

- (NSString *)currentVersionString {
return [NSString stringWithFormat:NSLocalizedString(@"%@, build %@", @"no update version number string"), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]];
}

- (NSString *)newVersionString {
return [NSString stringWithFormat:NSLocalizedString(@"%@, build %@", @"no update version number string"), self->availableVersionDisplay, self->availableVersion];
}

- (NSURL *)buildUpdateCheckURL {
NSString *checkURL = [[[NSProcessInfo processInfo] environment] objectForKey:@"QSCheckUpdateURL"];
if (!checkURL)
Expand All @@ -123,7 +132,7 @@ - (NSURL *)buildUpdateCheckURL {
break;
}

checkURL = [checkURL stringByAppendingFormat:@"?type=%@&current=%@", versionType, thisVersionString];
checkURL = [checkURL stringByAppendingFormat:@"?type=%@&current=%@&json=1", versionType, thisVersionString];
#ifdef DEBUG
if (VERBOSE) NSLog(@"Update Check URL: %@", checkURL);
#endif
Expand All @@ -146,9 +155,25 @@ - (void)checkForUpdateStatus:(BOOL)userInitiated completionHandler:(void (^)(QSU
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:theRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
QSGCDMainAsync(^{
[task stop];

NSString *checkVersionString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];


// convert the response data from json to a dict.
if (error || !data) {
NSLog(@"Error: %@", error);
block(kQSUpdateCheckError);
return;
}
NSError *jsonError = nil;
// format, see https://github.com/quicksilver/QSApp.com/blob/main/qs0/plugins/check.php#L70
// latestDisplay -> displayVersion (STRING)
// latest -> latestVersion (HEX)
// current -> currentVersion (HEX)
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
if (jsonError) {
NSLog(@"JSON Error: %@", jsonError);
block(kQSUpdateCheckError);
return;
}
NSString *checkVersionString = json[@"latest"];
[[NSUserDefaults standardUserDefaults] setObject:[NSDate date] forKey:kLastUpdateCheck];
if (![checkVersionString length] || [checkVersionString length] > 10) {
NSString *preview = [checkVersionString substringToIndex:([checkVersionString length] < 10 ? [checkVersionString length] : 9)];
Expand All @@ -162,6 +187,7 @@ - (void)checkForUpdateStatus:(BOOL)userInitiated completionHandler:(void (^)(QSU
* so force happens only if there's a valid response from the server
*/
self->availableVersion = checkVersionString;
self->availableVersionDisplay = json[@"latestDisplay"];
#ifdef DEBUG
if (VERBOSE)
NSLog(@"Installed Version: %@, Available Version: %@, Valid: %@, User-initiated: %@", thisVersionString, checkVersionString, (newVersionAvailable ? @"YES" : @"NO"), (userInitiated ? @"YES" : @"NO"));
Expand Down Expand Up @@ -224,7 +250,7 @@ - (void)checkForUpdates:(BOOL)userInitiated {
/* Disable automatically checking for updates in the background for DEBUG builds
* You can still check for updates by clicking the "Check Now" button */
if (!userInitiated) {
NSLog(@"Update availableself-> (%@) but disabled in DEBUG", self->availableVersion);
NSLog(@"Update available (%@ build %@) but disabled in DEBUG", [self currentVersionString], [self newVersionString]);
[self setIsCheckingForUpdates:NO];
return;
}
Expand All @@ -236,7 +262,7 @@ - (void)checkForUpdates:(BOOL)userInitiated {
NSAlert *alert = [[NSAlert alloc] init];
alert.alertStyle = NSAlertStyleInformational;
alert.messageText = NSLocalizedString(@"New Version of Quicksilver Available", @"QSUpdateController - update available alert title");
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"A new version of Quicksilver is available, would you like to update now?\n\n(Update from %@ → %@)", @"QSUpdateController - update available alert message"), [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey], self->availableVersion];
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"A new version of Quicksilver is available, would you like to update now?\n\n(Update from %@ → %@)", @"QSUpdateController - update available alert message"), [self currentVersionString], [self newVersionString]];
[alert addButtonWithTitle:NSLocalizedString(@"Install Update", @"QSUpdateController - update available alert default button")];
[alert addButtonWithTitle:NSLocalizedString(@"Later", @"QSUpdateController - update available alert cancel button")];
[alert addButtonWithTitle:NSLocalizedString(@"More Info", @"QSUpdateController - update available alert other button")];
Expand Down Expand Up @@ -266,9 +292,10 @@ - (void)checkForUpdates:(BOOL)userInitiated {
QSGCDMainAsync(^{
NSAlert *alert = [[NSAlert alloc] init];

NSString *versionNumber = [NSString stringWithFormat:NSLocalizedString(@"%@, build %@", @"no update version number string"), [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"], [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]];
alert.alertStyle = NSAlertStyleInformational;
alert.messageText = NSLocalizedString(@"You're up-to-date!", @"QSUpdateController - no update alert title");
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"You already have the latest version of Quicksilver (%@) and all installed plugins", @"no update alert message"), [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]];
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"You already have the latest version of Quicksilver (%@) and all installed plugins", @"no update alert message"), versionNumber];
[alert addButtonWithTitle:NSLocalizedString(@"OK", nil)];

[alert runModal];
Expand Down Expand Up @@ -385,7 +412,7 @@ - (void)finishAppInstall {
NSAlert *alert = [[NSAlert alloc] init];
alert.alertStyle = NSAlertStyleInformational;
alert.messageText = NSLocalizedString(@"Download Successful", @"QSUpdateController - update downloaded alert title");
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"A new version of Quicksilver has been dowloaded, would you like to install and relaunch now?\n\n(Update from %@ → %@)", @"QSUpdateController - update available alert message"), [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey], self->availableVersion];
alert.informativeText = [NSString stringWithFormat:NSLocalizedString(@"A new version of Quicksilver has been dowloaded, would you like to install and relaunch now?\n\n(Update from %@ → %@)", @"QSUpdateController - update available alert message"), [self currentVersionString], [self newVersionString]];
[alert addButtonWithTitle:NSLocalizedString(@"Install and Relaunch", @"QSUpdateController - update available alert default button")];
[alert addButtonWithTitle:NSLocalizedString(@"Cancel Update", @"QSUpdateController - cancel update button")];
[alert addButtonWithTitle:NSLocalizedString(@"More Info", @"QSUpdateController - update available alert other button")];
Expand Down
2 changes: 1 addition & 1 deletion Quicksilver/Code-QuickStepCore/QSPaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define kBugsURL @"https://github.com/quicksilver/Quicksilver/issues"
#define kWebSiteURL @"https://qsapp.com/"
#define kDonatePageURL @"https://qsapp.com/donate.php"
#define kChangelogURL @"https://qsapp.com/changelog.php"
#define kChangelogURL @"https://github.com/quicksilver/Quicksilver/releases/"
#define kHelpURL @"https://qsapp.com/manual/"
#define kHelpSearchURL @"https://qsapp.com/w/index.php?title=Special:Search&search=%@&go=Go"
// URL to crash reporter server/script
Expand Down
Binary file modified Quicksilver/Localized/en.lproj/Localizable.strings
Binary file not shown.
21 changes: 0 additions & 21 deletions Quicksilver/Quicksilver.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
4D8A0B3410AB23B6006AF163 /* CopyFiles */,
600950E82ABB938B00F67DEB /* ShellScript */,
D4DCF31114D059DB006672AB /* Copy Markdown Python module and bltrversion */,
7FA4EF1E0913AE44007DB407 /* Release Notes */,
);
dependencies = (
);
Expand Down Expand Up @@ -259,7 +258,6 @@
7F9BDB3009F86D25004F6E7A /* QSHandledSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F9BDB2E09F86D25004F6E7A /* QSHandledSplitView.m */; };
7F9BDBD609F9C40D004F6E7A /* QSSplitHandleView.h in Headers */ = {isa = PBXBuildFile; fileRef = 7F9BDBD409F9C40D004F6E7A /* QSSplitHandleView.h */; settings = {ATTRIBUTES = (Public, ); }; };
7F9BDBD709F9C40D004F6E7A /* QSSplitHandleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F9BDBD509F9C40D004F6E7A /* QSSplitHandleView.m */; };
7FA4EF270913AF3B007DB407 /* Changes.html in Copy SharedSupport */ = {isa = PBXBuildFile; fileRef = 7FA4EF240913AF27007DB407 /* Changes.html */; };
7FADDCE208B4D805004559C1 /* QSHistoryObjectSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FADDCE008B4D805004559C1 /* QSHistoryObjectSource.m */; };
7FB37EB4080997EF00A2B2B4 /* QSURLDownloadWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 7FB37EB2080997EF00A2B2B4 /* QSURLDownloadWrapper.h */; settings = {ATTRIBUTES = (Public, ); }; };
7FB37EB5080997EF00A2B2B4 /* QSURLDownloadWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7FB37EB3080997EF00A2B2B4 /* QSURLDownloadWrapper.m */; };
Expand Down Expand Up @@ -1083,7 +1081,6 @@
dstPath = "";
dstSubfolderSpec = 12;
files = (
7FA4EF270913AF3B007DB407 /* Changes.html in Copy SharedSupport */,
7F8C65A50811728E0051113C /* Credits.html in Copy SharedSupport */,
);
name = "Copy SharedSupport";
Expand Down Expand Up @@ -1386,7 +1383,6 @@
7F9BDB2E09F86D25004F6E7A /* QSHandledSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QSHandledSplitView.m; sourceTree = "<group>"; usesTabs = 1; };
7F9BDBD409F9C40D004F6E7A /* QSSplitHandleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QSSplitHandleView.h; sourceTree = "<group>"; usesTabs = 1; };
7F9BDBD509F9C40D004F6E7A /* QSSplitHandleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QSSplitHandleView.m; sourceTree = "<group>"; usesTabs = 1; };
7FA4EF240913AF27007DB407 /* Changes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = Changes.html; sourceTree = "<group>"; };
7FADDCDF08B4D805004559C1 /* QSHistoryObjectSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QSHistoryObjectSource.h; sourceTree = "<group>"; };
7FADDCE008B4D805004559C1 /* QSHistoryObjectSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QSHistoryObjectSource.m; sourceTree = "<group>"; };
7FB37EB2080997EF00A2B2B4 /* QSURLDownloadWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QSURLDownloadWrapper.h; sourceTree = "<group>"; usesTabs = 1; };
Expand Down Expand Up @@ -2113,7 +2109,6 @@
D4BDCC1A19E7F78F0080710C /* SUStandardVersionComparator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUStandardVersionComparator.h; path = Sparkle/SUStandardVersionComparator.h; sourceTree = "<group>"; };
D4BDCC1D19E7F8F50080710C /* SUExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUExport.h; path = Sparkle/SUExport.h; sourceTree = "<group>"; };
D4BDCC1E19E7F8F50080710C /* SUVersionComparisonProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUVersionComparisonProtocol.h; path = Sparkle/SUVersionComparisonProtocol.h; sourceTree = "<group>"; };
D4DCF31F14D07F47006672AB /* ChangesBare.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = ChangesBare.html; sourceTree = "<group>"; };
D4E0060D1523951500FDF185 /* NSMetadataQuery+Synchronous.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMetadataQuery+Synchronous.h"; sourceTree = "<group>"; usesTabs = 1; };
D4E0060E1523951500FDF185 /* NSMetadataQuery+Synchronous.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMetadataQuery+Synchronous.m"; sourceTree = "<group>"; usesTabs = 1; };
D4FED80D1683B82400593628 /* QSUserDefinedProxyTargetPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QSUserDefinedProxyTargetPicker.h; sourceTree = "<group>"; usesTabs = 1; };
Expand Down Expand Up @@ -3477,8 +3472,6 @@
isa = PBXGroup;
children = (
7F8C659E081171DB0051113C /* Credits.html */,
7FA4EF240913AF27007DB407 /* Changes.html */,
D4DCF31F14D07F47006672AB /* ChangesBare.html */,
);
path = SharedSupport;
sourceTree = "<group>";
Expand Down Expand Up @@ -4884,20 +4877,6 @@
shellPath = /bin/sh;
shellScript = "# Script to append development information to the QS version string\n\n# Created by Henning Jungkurth on Apr 18 2012\n# Modifications by Nathan Henrie on 20220405\n\nset -euf\n\nCURRENT_TAG=$(git describe --exact-match --tags 2> /dev/null || true)\nCURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)\nHEAD=$(git rev-parse --short HEAD)\n\n# Default: `2.0.2:main-a83756f6:Debug`\nNEW_VERSION_STRING=${QS_INFO_VERSION}:${CURRENT_BRANCH:-\"detached HEAD\"}-${HEAD}:${CONFIGURATION}\n\n# If on a tag, make pretty: `v2.0.2:Debug` or `v2.0.2`\nif [ -n \"${CURRENT_TAG}\" ]; then\n if [ \"${CONFIGURATION}\" = \"Release\" ]; then\n NEW_VERSION_STRING=${QS_INFO_VERSION}\n else\n NEW_VERSION_STRING=${QS_INFO_VERSION}:${CONFIGURATION}\n fi\nfi\n\nif [ -n \"${NEW_VERSION_STRING}\" ]; then\n defaults write \"$QS_APP_CONTENTS_FOLDER/Info\" CFBundleShortVersionString \"\\\"${NEW_VERSION_STRING}\\\"\"\nfi\n";
};
7FA4EF1E0913AE44007DB407 /* Release Notes */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 12;
files = (
);
inputPaths = (
);
name = "Release Notes";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = "/usr/bin/env python3";
shellScript = "#!/usr/bin/env python3\n\nimport os\nimport sys\nimport re\nimport platform\nfrom pathlib import Path\n\nsrcroot = Path(os.getenv('SRCROOT'))\nif srcroot is None:\n sys.exit(78) # configuration error\n\n## location for input and output files\nsupp_dir = srcroot / \"SharedSupport\"\n\n## fake the deployment target to make distutils happy\nos.environ['MACOSX_DEPLOYMENT_TARGET'] = '.'.join(platform.mac_ver()[0].split('.')[0:2])\n\n## import Markdown support\nsys.path.append(str(srcroot / \"Tools\" / \"python-support\"))\nimport markdown\n\n## get the original text\ntext = (supp_dir / \"CHANGELOG\").read_text()\n\n## make issue numbers link to GitHub\ntext = re.sub(r'#(\\d+)', r'[#\\g<1>](https://github.com/quicksilver/Quicksilver/issues/\\g<1>)', text)\n\n## convert to HTML\n## https://stackoverflow.com/a/59055691/1588795\nmd = markdown.Markdown(extensions = [\n \"markdown.extensions.abbr\",\n \"markdown.extensions.attr_list\",\n \"markdown.extensions.def_list\",\n \"markdown.extensions.fenced_code\",\n \"markdown.extensions.footnotes\",\n \"markdown.extensions.tables\",\n \"markdown.extensions.md_in_html\",\n], output_format = 'html')\nhtml = md.convert(text)\n\n## read in Quicksilver's stylesheet\nstyle = (srcroot / \"Resources\" / \"QSStyle.css\").read_text()\n\n## write the result\n(supp_dir / \"Changes.html\").write_text(\n f\"\"\"\n<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n <link rel=\"stylesheet\" href=\"../Resources/QSStyle.css\" type=\"text/css\" charset=\"utf-8\">\n </head>\n <body id=\"qsrn\">\n <div id=\"content\">\n {html}\n </div>\n </body>\n</html>\n \"\"\".strip()\n)\n(supp_dir / \"ChangesBare.html\").write_text(html)\n";
};
D4DCF31114D059DB006672AB /* Copy Markdown Python module and bltrversion */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
3 changes: 2 additions & 1 deletion Quicksilver/SharedSupport/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

**See [Github](https://github.com/quicksilver/Quicksilver/releases/) for latest release notes**
**See [Github](https://github.com/quicksilver/Quicksilver/releases/) for latest release notes.**
**This file is no longer updated.**

## Changes - 2.4.3 (4042) ##

Expand Down