Skip to content

Commit

Permalink
Merge branch 'public/9.0' into public/9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelherger committed Dec 11, 2024
2 parents 0602e66 + a37c8ed commit 261f97d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions buildme.pl
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ sub buildMacOS {
if (`which npx`) {
print "INFO: Building $pkgName.dmg using $realName.app...\n";
# system("cd $destDir; npx --yes create-dmg --overwrite '$realName.app'; mv -f L*.dmg '$pkgName.dmg'");
system("cd $buildDir/platforms/osx/MenuBarItem && cp *png $destDir/ && cp icon.icns $destDir/ && cp app.json $destDir/");
system("cd $buildDir/platforms/osx/MenuBarItem && cp *png *webloc icon.icns app.json $destDir/");

# add signing information if available
if ($hasCerts) {
Expand All @@ -718,7 +718,7 @@ sub buildMacOS {
}

system("cd $destDir; npx --yes appdmg\@0.6.6 app.json LMS.dmg; mv -f LMS.dmg '$pkgName.dmg'");
system("cd $destDir; rm -rf *.png icon.icns app.json L*.app");
system("cd $destDir; rm -rf *.png icon.icns app.json *webloc L*.app");

if ($hasCerts) {
print "INFO: Notarizing $pkgName.dmg...";
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions osx/MenuBarItem/Getting Started.webloc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ URL = "https://lyrion.org/getting-started/mac-install"; }
21 changes: 10 additions & 11 deletions osx/MenuBarItem/LMSMenu.pl
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ sub getPort {
}

sub getUpdate {
my $updatesFile = catfile(getPref('cachedir'), 'updates', 'server.version');
my $updatesFile = getVersionFile();
my $update;

if (-r $updatesFile) {
open(UPDATE, '<', $updatesFile) or return;
chomp $_;

while (<UPDATE>) {
chomp;
if ($_ && -r $_) {
$update = $_;
last;
Expand All @@ -59,6 +59,10 @@ sub getUpdate {
return $update;
}

sub getVersionFile {
return catfile(main::getPref('cachedir'), 'updates', 'server.version')
}

sub getPref {
my $pref = shift;
my $ret;
Expand Down Expand Up @@ -98,19 +102,15 @@ sub getPrefPane {
-e '/Library/PreferencePanes/Squeezebox.prefPane' || -e catfile($ENV{HOME}, 'Library/PreferencePanes/Squeezebox.prefPane');
}

my $httpPort = getPort();
my $update = getUpdate();
my $hasPrefPane = getPrefPane();

if (scalar @ARGV > 0) {
LMSMenuAction::handleAction($httpPort, $update);
LMSMenuAction::handleAction();
}
else {
my $autoStartItem = -f catfile($ENV{HOME}, 'Library', 'LaunchAgents', 'org.lyrion.lyrionmusicserver.plist')
? 'AUTOSTART_ON'
: 'AUTOSTART_OFF';

if ($httpPort) {
if (getPort()) {
printMenuItem('OPEN_GUI');
printMenuItem('OPEN_SETTINGS');
print("----\n");
Expand All @@ -122,13 +122,12 @@ sub getPrefPane {
printMenuItem($autoStartItem);
}

if ($update) {
if (getUpdate()) {
print("----\n");
printMenuItem('UPDATE_AVAILABLE');
# print("STATUSTITLE|✨\n");
}

if ($hasPrefPane) {
if (getPrefPane()) {
print("----\n");
printMenuItem('UNINSTALL_PREFPANE');
}
Expand Down
20 changes: 13 additions & 7 deletions osx/MenuBarItem/LMSMenuAction.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use File::Spec::Functions qw(catfile);
use Text::Unidecode;

sub handleAction {
my ($httpPort, $update) = @_;
my $httpPort = main::getPort();

my $item = getMenuItem();

Expand All @@ -32,12 +32,18 @@ sub handleAction {
runScript('create-launchitem.sh');
}
elsif ($item eq 'UPDATE_AVAILABLE') {
system("open \"$update\"");
my $title = main::getString('UPDATE_TITLE');
my $message = main::getString('INSTALL_UPDATE');
print("ALERT:$title|$message\n");
# TODO - we don't quit yet, as the user will have to stop the service first... needs more work!
# print("QUITAPP\n");
if (my $update = main::getUpdate()) {
runScript('stop-server.sh');
unlink main::getVersionFile();
system("open \"$update\"");
print("QUITAPP\n");
}
# if we can't find the installer, fall back to showing instructions
else {
my $title = main::getString('UPDATE_TITLE');
my $message = main::getString('INSTALL_UPDATE');
print("ALERT:$title|$message\n");
}
}
elsif ($item eq 'UNINSTALL_PREFPANE') {
system("open https://lyrion.org/reference/uninstall-legacy-mac/");
Expand Down
4 changes: 2 additions & 2 deletions osx/MenuBarItem/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"code-sign": { "signing-identity": "_SIGNING_IDENTITY_" },
"contents": [
{
"x": 312,
"x": 317,
"y": 100,
"type": "file",
"path": "Getting Started - Lyrion Menubar Item.png"
"path": "Getting Started.webloc"
},
{
"x": 192,
Expand Down

0 comments on commit 261f97d

Please sign in to comment.