diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml
index 56d1b219..3f3a8fd0 100644
--- a/.github/workflows/build-linux.yml
+++ b/.github/workflows/build-linux.yml
@@ -23,10 +23,10 @@ env:
jobs:
build:
- runs-on: ubuntu-latest
+ runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [Linux, MacOS]
+ os: [ubuntu-latest, macos-latest]
arch: [x64, arm64]
steps:
- uses: actions/checkout@v3
@@ -45,62 +45,63 @@ jobs:
then
version="${inputVersion}"
else
- version="$(grep -oP '(?<=).*(?=.*' ./Source/AppScaffolding/AppScaffolding.csproj | sed -r 's/<\/?Version>//g')"
fi
echo "version=${version}" >> "${GITHUB_OUTPUT}"
-
- name: Unit test
if: ${{ inputs.run_unit_tests }}
working-directory: ./Source
run: dotnet test
- name: Publish
+ id: publish
working-directory: ./Source
run: |
os=${{ matrix.os }}
- RUNTIME_IDENTIFIER="$(echo ${os,} | sed 's/macOS/osx/')-${{ matrix.arch }}"
+ target_os="$(echo ${os/-latest/} | sed 's/ubuntu/linux/')"
+ display_os="$(echo ${target_os/macos/macOS} | sed 's/linux/Linux/')"
+ echo "display_os=${display_os}" >> $GITHUB_OUTPUT
+ RUNTIME_IDENTIFIER="$(echo ${target_os/macos/osx})-${{ matrix.arch }}"
echo "$RUNTIME_IDENTIFIER"
dotnet publish \
LibationAvalonia/LibationAvalonia.csproj \
--runtime "$RUNTIME_IDENTIFIER" \
--configuration ${{ env.DOTNET_CONFIGURATION }} \
- --output bin/Publish/${{ matrix.os }}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
- -p:PublishProfile=LibationAvalonia/Properties/PublishProfiles/${{ matrix.os }}Profile.pubxml
+ --output bin/Publish/${display_os}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
+ -p:PublishProfile=LibationAvalonia/Properties/PublishProfiles/${display_os}Profile.pubxml
dotnet publish \
- LoadByOS/${{ matrix.os }}ConfigApp/${{ matrix.os }}ConfigApp.csproj \
+ LoadByOS/${display_os}ConfigApp/${display_os}ConfigApp.csproj \
--runtime "$RUNTIME_IDENTIFIER" \
--configuration ${{ env.DOTNET_CONFIGURATION }} \
- --output bin/Publish/${{ matrix.os }}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
- -p:PublishProfile=LoadByOS/Properties/${{ matrix.os }}ConfigApp/PublishProfiles/${{ matrix.os }}Profile.pubxml
+ --output bin/Publish/${display_os}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
+ -p:PublishProfile=LoadByOS/Properties/${display_os}ConfigApp/PublishProfiles/${display_os}Profile.pubxml
dotnet publish \
LibationCli/LibationCli.csproj \
--runtime "$RUNTIME_IDENTIFIER" \
--configuration ${{ env.DOTNET_CONFIGURATION }} \
- --output bin/Publish/${{ matrix.os }}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
- -p:PublishProfile=LibationCli/Properties/PublishProfiles/${{ matrix.os }}Profile.pubxml
+ --output bin/Publish/${display_os}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
+ -p:PublishProfile=LibationCli/Properties/PublishProfiles/${display_os}Profile.pubxml
dotnet publish \
HangoverAvalonia/HangoverAvalonia.csproj \
--runtime "$RUNTIME_IDENTIFIER" \
--configuration ${{ env.DOTNET_CONFIGURATION }} \
- --output bin/Publish/${{ matrix.os }}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
- -p:PublishProfile=HangoverAvalonia/Properties/PublishProfiles/${{ matrix.os }}Profile.pubxml
-
+ --output bin/Publish/${display_os}-${{ matrix.arch }}-${{ env.RELEASE_NAME }} \
+ -p:PublishProfile=HangoverAvalonia/Properties/PublishProfiles/${display_os}Profile.pubxml
- name: Build bundle
id: bundle
- working-directory: ./Source/bin/Publish/${{ matrix.os }}-${{ matrix.arch }}-${{ env.RELEASE_NAME }}
+ working-directory: ./Source/bin/Publish/${{ steps.publish.outputs.display_os }}-${{ matrix.arch }}-${{ env.RELEASE_NAME }}
run: |
BUNDLE_DIR=$(pwd)
echo "Bundle dir: ${BUNDLE_DIR}"
cd ..
- SCRIPT=../../../Scripts/Bundle_${{ matrix.os }}.sh
+ SCRIPT=../../../Scripts/Bundle_${{ steps.publish.outputs.display_os }}.sh
chmod +rx ${SCRIPT}
${SCRIPT} "${BUNDLE_DIR}" "${{ steps.get_version.outputs.version }}" "${{ matrix.arch }}"
artifact=$(ls ./bundle)
echo "artifact=${artifact}" >> "${GITHUB_OUTPUT}"
-
- name: Publish bundle
uses: actions/upload-artifact@v3
with:
name: ${{ steps.bundle.outputs.artifact }}
path: ./Source/bin/Publish/bundle/${{ steps.bundle.outputs.artifact }}
- if-no-files-found: error
+ if-no-files-found: error
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
index 25d4bb59..2ba35f87 100644
--- a/.vscode/tasks.json
+++ b/.vscode/tasks.json
@@ -5,19 +5,37 @@
"tasks": [
{
"label": "build",
+ "dependsOn": [
+ "build_libation",
+ "build_linuxconfigapp"
+ ]
+ },
+ {
+ "label": "build_libation",
"type": "shell",
"command": "dotnet",
"args": [
"build",
- // Ask msbuild to generate full paths for file names.
"${workspaceFolder}/Source/LibationAvalonia/LibationAvalonia.csproj"
],
"group": "build",
"presentation": {
- // Reveal the output only if unrecognized errors occur.
- "reveal": "silent"
+ //"reveal": "silent"
+ },
+ "problemMatcher": "$msCompile"
+ },
+ {
+ "label": "build_linuxconfigapp",
+ "type": "shell",
+ "command": "dotnet",
+ "args": [
+ "build",
+ "${workspaceFolder}/Source/LoadByOS/LinuxConfigApp/LinuxConfigApp.csproj"
+ ],
+ "group": "build",
+ "presentation": {
+ //"reveal": "silent"
},
- // Use the standard MS compiler pattern to detect errors, warnings and infos
"problemMatcher": "$msCompile"
}
]
diff --git a/Documentation/InstallOnMac.md b/Documentation/InstallOnMac.md
index 7d4a9af3..45e0be78 100644
--- a/Documentation/InstallOnMac.md
+++ b/Documentation/InstallOnMac.md
@@ -13,14 +13,10 @@ This walkthrough should get you up and running with Libation on your Mac.
- Move the extracted Libation app bundle to your applications folder.
- Open a terminal (Go > Utilities > Terminal)
- Copy/paste/run the following command (you'll be prompted to enter your password)
- - macOS x64
- ```Console
- sudo spctl --master-disable && sudo spctl --add --label "Libation" /Applications/Libation.app && open /Applications/Libation.app && sudo spctl --master-enable
- ```
- - macOS arm64
- ```Console
- codesign --force --deep -s - /Applications/Libation.app && sudo spctl --master-disable && sudo spctl --add --label "Libation" /Applications/Libation.app && open /Applications/Libation.app && sudo spctl --master-enable
- ```
+
+ ```Console
+ sudo spctl --master-disable && sudo spctl --add --label "Libation" /Applications/Libation.app && open /Applications/Libation.app && sudo spctl --master-enable
+ ```
- Close the terminal and use Libation!
## Running Hangover
diff --git a/Scripts/Bundle_Linux.sh b/Scripts/Bundle_Linux.sh
index a5f842ef..9fcb1437 100644
--- a/Scripts/Bundle_Linux.sh
+++ b/Scripts/Bundle_Linux.sh
@@ -88,38 +88,27 @@ cp $FOLDER_EXEC/Libation.desktop $FOLDER_DESKTOP/Libation.desktop
echo "Creating pre-install file..."
echo "#!/bin/bash
-
# Pre-install script, removes previous installation program files and sym links
-
echo \"Removing previously created symlinks...\"
-
rm /usr/bin/libation
rm /usr/bin/hangover
rm /usr/bin/libationcli
-
echo \"Removing previously installed Libation files...\"
-
rm -r /usr/lib/libation
-
# making sure it won't stop installation
exit 0
" >> $FOLDER_DEBIAN/preinst
echo "Creating post-install file..."
echo "#!/bin/bash
-
gtk-update-icon-cache -f /usr/share/icons/hicolor/
-
ln -s /usr/lib/libation/Libation /usr/bin/libation
ln -s /usr/lib/libation/Hangover /usr/bin/hangover
ln -s /usr/lib/libation/LibationCli /usr/bin/libationcli
-
# Increase the maximum number of inotify instances
-
-if ! grep -q 'fs.inotify.max_user_instances=524288' /etc/sysctl.conf; then
+if ! grep -q 'fs.inotify.max_user_instances=524288' /etc/sysctl.conf; then
echo fs.inotify.max_user_instances=524288 | tee -a /etc/sysctl.conf && sysctl -p
fi
-
# workaround until this file is moved to the user's home directory
touch /usr/lib/libation/appsettings.json
chmod 666 /usr/lib/libation/appsettings.json
@@ -139,6 +128,11 @@ echo "Changing permissions for pre- and post-install files..."
chmod +x "$FOLDER_DEBIAN/preinst"
chmod +x "$FOLDER_DEBIAN/postinst"
+if [ "$(uname -s)" == "Darwin" ]; then
+ echo "macOS detected, installing dpkg"
+ brew install dpkg
+fi
+
DEB_FILE=Libation.${VERSION}-linux-chardonnay-${ARCH}.deb
echo "Creating $DEB_FILE"
dpkg-deb -Zxz --build $DEB_DIR ./$DEB_FILE
@@ -149,4 +143,4 @@ mv $DEB_FILE ./bundle/$DEB_FILE
rm -r "$BIN_DIR"
-echo "Done!"
+echo "Done!"
\ No newline at end of file
diff --git a/Scripts/Bundle_MacOS.sh b/Scripts/Bundle_MacOS.sh
index d9bd31b9..57bc60e1 100644
--- a/Scripts/Bundle_MacOS.sh
+++ b/Scripts/Bundle_MacOS.sh
@@ -96,6 +96,9 @@ done
APP_FILE=Libation.${VERSION}-macOS-chardonnay-${ARCH}.tgz
+echo "Signing executables in: $BUNDLE"
+codesign --force --deep -s - $BUNDLE
+
echo "Creating app bundle: $APP_FILE"
tar -czvf $APP_FILE $BUNDLE
@@ -105,4 +108,4 @@ mv $APP_FILE ./bundle/$APP_FILE
rm -r $BUNDLE
-echo "Done!"
+echo "Done!"
\ No newline at end of file
diff --git a/Source/AppScaffolding/AppScaffolding.csproj b/Source/AppScaffolding/AppScaffolding.csproj
index 87605ccd..1bc9573c 100644
--- a/Source/AppScaffolding/AppScaffolding.csproj
+++ b/Source/AppScaffolding/AppScaffolding.csproj
@@ -2,7 +2,7 @@
net7.0
- 9.3.0.1
+ 9.4.0.1
diff --git a/Source/LibationAvalonia/App.axaml.cs b/Source/LibationAvalonia/App.axaml.cs
index 8ae51baf..b1d0fed2 100644
--- a/Source/LibationAvalonia/App.axaml.cs
+++ b/Source/LibationAvalonia/App.axaml.cs
@@ -11,11 +11,13 @@ using System.Threading.Tasks;
using System.Collections.Generic;
using System.IO;
using ApplicationServices;
+using Avalonia.Controls;
namespace LibationAvalonia
{
public class App : Application
{
+ public static Window MainWindow { get;private set; }
public static IBrush ProcessQueueBookFailedBrush { get; private set; }
public static IBrush ProcessQueueBookCompletedBrush { get; private set; }
public static IBrush ProcessQueueBookCancelledBrush { get; private set; }
@@ -213,7 +215,7 @@ namespace LibationAvalonia
private static void ShowMainWindow(IClassicDesktopStyleApplicationLifetime desktop)
{
var mainWindow = new MainWindow();
- desktop.MainWindow = mainWindow;
+ desktop.MainWindow = MainWindow = mainWindow;
mainWindow.RestoreSizeAndLocation(Configuration.Instance);
mainWindow.OnLoad();
mainWindow.OnLibraryLoaded(LibraryTask.GetAwaiter().GetResult());
diff --git a/Source/LibationAvalonia/AvaloniaUtils.cs b/Source/LibationAvalonia/AvaloniaUtils.cs
index 8d9fd607..9a9d669d 100644
--- a/Source/LibationAvalonia/AvaloniaUtils.cs
+++ b/Source/LibationAvalonia/AvaloniaUtils.cs
@@ -1,8 +1,6 @@
using Avalonia.Controls;
using Avalonia.Media;
-using Avalonia.Threading;
-using System;
-using System.Threading;
+using LibationAvalonia.Dialogs;
using System.Threading.Tasks;
namespace LibationAvalonia
@@ -18,6 +16,9 @@ namespace LibationAvalonia
return defaultBrush;
}
+ public static Task ShowDialogAsync(this DialogWindow dialogWindow, Window owner = null)
+ => dialogWindow.ShowDialog(owner ?? App.MainWindow);
+
public static Window GetParentWindow(this IControl control) => control.VisualRoot as Window;
}
}
diff --git a/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginBase.cs b/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginBase.cs
deleted file mode 100644
index 276ee9b8..00000000
--- a/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginBase.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using Avalonia;
-using Avalonia.Controls.ApplicationLifetimes;
-using System;
-using System.Threading.Tasks;
-
-namespace LibationAvalonia.Dialogs.Login
-{
- public abstract class AvaloniaLoginBase
- {
-
- /// True if ShowDialog's DialogResult == OK
- protected static async Task ShowDialog(DialogWindow dialog)
- {
- if (Application.Current.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
- return false;
-
- var result = await dialog.ShowDialog(desktop.MainWindow);
- Serilog.Log.Logger.Debug("{@DebugInfo}", new { DialogResult = result });
- return result == DialogResult.OK;
- }
- }
-}
diff --git a/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginCallback.cs b/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginCallback.cs
index 606af6ac..b7c1f682 100644
--- a/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginCallback.cs
+++ b/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginCallback.cs
@@ -5,7 +5,7 @@ using AudibleUtilities;
namespace LibationAvalonia.Dialogs.Login
{
- public class AvaloniaLoginCallback : AvaloniaLoginBase, ILoginCallback
+ public class AvaloniaLoginCallback : ILoginCallback
{
private Account _account { get; }
@@ -19,7 +19,7 @@ namespace LibationAvalonia.Dialogs.Login
public async Task Get2faCodeAsync(string prompt)
{
var dialog = new _2faCodeDialog(prompt);
- if (await ShowDialog(dialog))
+ if (await dialog.ShowDialogAsync() is DialogResult.OK)
return dialog.Code;
return null;
@@ -28,15 +28,15 @@ namespace LibationAvalonia.Dialogs.Login
public async Task<(string password, string guess)> GetCaptchaAnswerAsync(string password, byte[] captchaImage)
{
var dialog = new CaptchaDialog(password, captchaImage);
- if (await ShowDialog(dialog))
+ if (await dialog.ShowDialogAsync() is DialogResult.OK)
return (dialog.Password, dialog.Answer);
- return (null,null);
+ return (null, null);
}
public async Task<(string name, string value)> GetMfaChoiceAsync(MfaConfig mfaConfig)
{
var dialog = new MfaDialog(mfaConfig);
- if (await ShowDialog(dialog))
+ if (await dialog.ShowDialogAsync() is DialogResult.OK)
return (dialog.SelectedName, dialog.SelectedValue);
return (null, null);
}
@@ -44,7 +44,7 @@ namespace LibationAvalonia.Dialogs.Login
public async Task<(string email, string password)> GetLoginAsync()
{
var dialog = new LoginCallbackDialog(_account);
- if (await ShowDialog(dialog))
+ if (await dialog.ShowDialogAsync() is DialogResult.OK)
return (_account.AccountId, dialog.Password);
return (null, null);
}
@@ -52,7 +52,7 @@ namespace LibationAvalonia.Dialogs.Login
public async Task ShowApprovalNeededAsync()
{
var dialog = new ApprovalNeededDialog();
- await ShowDialog(dialog);
+ await dialog.ShowDialogAsync();
}
}
}
\ No newline at end of file
diff --git a/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginChoiceEager.cs b/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginChoiceEager.cs
index 4203e36f..a812c18c 100644
--- a/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginChoiceEager.cs
+++ b/Source/LibationAvalonia/Dialogs/Login/AvaloniaLoginChoiceEager.cs
@@ -5,14 +5,15 @@ using AudibleUtilities;
namespace LibationAvalonia.Dialogs.Login
{
- public class AvaloniaLoginChoiceEager : AvaloniaLoginBase, ILoginChoiceEager
+ public class AvaloniaLoginChoiceEager : ILoginChoiceEager
{
/// Convenience method. Recommended when wiring up Winforms to
- public static async Task ApiExtendedFunc(Account account) => await ApiExtended.CreateAsync(account, new AvaloniaLoginChoiceEager(account));
+ public static async Task ApiExtendedFunc(Account account)
+ => await ApiExtended.CreateAsync(account, new AvaloniaLoginChoiceEager(account));
- public ILoginCallback LoginCallback { get; private set; }
+ public ILoginCallback LoginCallback { get; }
- private Account _account { get; }
+ private readonly Account _account;
public AvaloniaLoginChoiceEager(Account account)
{
@@ -24,10 +25,9 @@ namespace LibationAvalonia.Dialogs.Login
{
var dialog = new LoginChoiceEagerDialog(_account);
- if (!await ShowDialog(dialog))
+ if (await dialog.ShowDialogAsync() is not DialogResult.OK)
return null;
-
switch (dialog.LoginMethod)
{
case LoginMethod.Api:
@@ -35,7 +35,7 @@ namespace LibationAvalonia.Dialogs.Login
case LoginMethod.External:
{
var externalDialog = new LoginExternalDialog(_account, choiceIn.LoginUrl);
- return await ShowDialog(externalDialog)
+ return await externalDialog.ShowDialogAsync() is DialogResult.OK
? ChoiceOut.External(externalDialog.ResponseUrl)
: null;
}
diff --git a/Source/LibationAvalonia/Dialogs/Login/CaptchaDialog.axaml.cs b/Source/LibationAvalonia/Dialogs/Login/CaptchaDialog.axaml.cs
index e500218a..fc520dcf 100644
--- a/Source/LibationAvalonia/Dialogs/Login/CaptchaDialog.axaml.cs
+++ b/Source/LibationAvalonia/Dialogs/Login/CaptchaDialog.axaml.cs
@@ -91,7 +91,15 @@ namespace LibationAvalonia.Dialogs.Login
public CaptchaDialogViewModel(string password, Bitmap[] gifFrames, int[] frameDelayMs)
{
Password = password;
- FrameSwitch = SwitchFramesAsync(gifFrames, frameDelayMs);
+ if (gifFrames.Length == 1)
+ {
+ FrameSwitch = Task.CompletedTask;
+ CaptchaImage = gifFrames[0];
+ }
+ else
+ {
+ FrameSwitch = SwitchFramesAsync(gifFrames, frameDelayMs);
+ }
}
public async Task StopAsync()
diff --git a/Source/LibationAvalonia/Views/MainWindow.Upgrade.cs b/Source/LibationAvalonia/Views/MainWindow.Upgrade.cs
index c7402ba8..a4cb95b4 100644
--- a/Source/LibationAvalonia/Views/MainWindow.Upgrade.cs
+++ b/Source/LibationAvalonia/Views/MainWindow.Upgrade.cs
@@ -7,27 +7,28 @@ namespace LibationAvalonia.Views
{
public partial class MainWindow
{
- private void Configure_Update()
+ private void Configure_Upgrade()
{
setProgressVisible(false);
#if !DEBUG
+ async Task upgradeAvailable(UpgradeEventArgs e)
+ {
+ var notificationResult = await new UpgradeNotificationDialog(e.UpgradeProperties, e.CapUpgrade).ShowDialogAsync(this);
+
+ e.Ignore = notificationResult == DialogResult.Ignore;
+ e.InstallUpgrade = notificationResult == DialogResult.OK;
+ }
+
var upgrader = new Upgrader();
upgrader.DownloadProgress += async (_, e) => await Dispatcher.UIThread.InvokeAsync(() => _viewModel.DownloadProgress = e.ProgressPercentage);
- upgrader.DownloadBegin += async (_, _) => await Dispatcher.UIThread.InvokeAsync(() => setProgressVisible(false));
- upgrader.DownloadCompleted += async (_, _) => await Dispatcher.UIThread.InvokeAsync(() => setProgressVisible(true));
+ upgrader.DownloadBegin += async (_, _) => await Dispatcher.UIThread.InvokeAsync(() => setProgressVisible(true));
+ upgrader.DownloadCompleted += async (_, _) => await Dispatcher.UIThread.InvokeAsync(() => setProgressVisible(false));
- Opened += async (_, _) => await upgrader.CheForUpgradeAsync(UpgradeAvailable);
+ Opened += async (_, _) => await upgrader.CheForUpgradeAsync(upgradeAvailable);
#endif
}
private void setProgressVisible(bool visible) => _viewModel.DownloadProgress = visible ? 0 : null;
- private async Task UpgradeAvailable(UpgradeEventArgs e)
- {
- var notificationResult = await new UpgradeNotificationDialog(e.UpgradeProperties, e.CapUpgrade).ShowDialog(this);
-
- e.Ignore = notificationResult == DialogResult.Ignore;
- e.InstallUpdate = notificationResult == DialogResult.OK;
- }
}
}
diff --git a/Source/LibationAvalonia/Views/MainWindow.axaml.cs b/Source/LibationAvalonia/Views/MainWindow.axaml.cs
index 95353f0b..88f8a705 100644
--- a/Source/LibationAvalonia/Views/MainWindow.axaml.cs
+++ b/Source/LibationAvalonia/Views/MainWindow.axaml.cs
@@ -40,7 +40,7 @@ namespace LibationAvalonia.Views
Configure_Export();
Configure_Settings();
Configure_ProcessQueue();
- Configure_Update();
+ Configure_Upgrade();
Configure_Filter();
// misc which belongs in winforms app but doesn't have a UI element
Configure_NonUI();
diff --git a/Source/LibationFileManager/IInteropFunctions.cs b/Source/LibationFileManager/IInteropFunctions.cs
index fd1cca37..a4d12f7c 100644
--- a/Source/LibationFileManager/IInteropFunctions.cs
+++ b/Source/LibationFileManager/IInteropFunctions.cs
@@ -8,7 +8,7 @@ namespace LibationFileManager
void SetFolderIcon(string image, string directory);
void DeleteFolderIcon(string directory);
Process RunAsRoot(string exe, string args);
- void InstallUpdate(string updateBundle);
- bool CanUpdate { get; }
+ void InstallUpgrade(string upgradeBundle);
+ bool CanUpgrade { get; }
}
}
diff --git a/Source/LibationFileManager/NullInteropFunctions.cs b/Source/LibationFileManager/NullInteropFunctions.cs
index bf995d11..eebac514 100644
--- a/Source/LibationFileManager/NullInteropFunctions.cs
+++ b/Source/LibationFileManager/NullInteropFunctions.cs
@@ -11,8 +11,8 @@ namespace LibationFileManager
public void SetFolderIcon(string image, string directory) => throw new PlatformNotSupportedException();
public void DeleteFolderIcon(string directory) => throw new PlatformNotSupportedException();
- public bool CanUpdate => throw new PlatformNotSupportedException();
+ public bool CanUpgrade => throw new PlatformNotSupportedException();
public Process RunAsRoot(string exe, string args) => throw new PlatformNotSupportedException();
- public void InstallUpdate(string updateBundle) => throw new PlatformNotSupportedException();
+ public void InstallUpgrade(string updateBundle) => throw new PlatformNotSupportedException();
}
}
diff --git a/Source/LibationUiBase/Upgrader.cs b/Source/LibationUiBase/Upgrader.cs
index 33117b30..5bf94216 100644
--- a/Source/LibationUiBase/Upgrader.cs
+++ b/Source/LibationUiBase/Upgrader.cs
@@ -13,23 +13,23 @@ namespace LibationUiBase
public UpgradeProperties UpgradeProperties { get; internal init; }
public bool CapUpgrade { get; internal init; }
private bool _ignore = false;
- private bool _installUpdate = true;
+ private bool _installUpgrade = true;
public bool Ignore
{
get => _ignore;
set
{
_ignore = value;
- _installUpdate &= !Ignore;
+ _installUpgrade &= !Ignore;
}
}
- public bool InstallUpdate
+ public bool InstallUpgrade
{
- get => _installUpdate;
+ get => _installUpgrade;
set
{
- _installUpdate = value;
- _ignore &= !InstallUpdate;
+ _installUpgrade = value;
+ _ignore &= !InstallUpgrade;
}
}
}
@@ -47,35 +47,35 @@ namespace LibationUiBase
var upgradeProperties = await Task.Run(LibationScaffolding.GetLatestRelease);
if (upgradeProperties is null) return;
- const string ignoreUpdate = "IgnoreUpdate";
+ const string ignoreUpgrade = "IgnoreUpgrade";
var config = Configuration.Instance;
- if (config.GetString(propertyName: ignoreUpdate) == upgradeProperties.LatestRelease.ToString())
+ if (config.GetString(propertyName: ignoreUpgrade) == upgradeProperties.LatestRelease.ToString())
return;
var interop = InteropFactory.Create();
- if (!interop.CanUpdate)
- Serilog.Log.Logger.Information("Can't perform update automatically");
+ if (!interop.CanUpgrade)
+ Serilog.Log.Logger.Information("Can't perform upgrade automatically");
var upgradeEventArgs = new UpgradeEventArgs
{
UpgradeProperties = upgradeProperties,
- CapUpgrade = interop.CanUpdate
+ CapUpgrade = interop.CanUpgrade
};
await upgradeAvailableHandler(upgradeEventArgs);
if (upgradeEventArgs.Ignore)
- config.SetString(upgradeProperties.LatestRelease.ToString(), ignoreUpdate);
+ config.SetString(upgradeProperties.LatestRelease.ToString(), ignoreUpgrade);
- if (!upgradeEventArgs.InstallUpdate) return;
+ if (!upgradeEventArgs.InstallUpgrade) return;
- //Download the update file in the background,
+ //Download the upgrade file in the background,
DownloadBegin?.Invoke(this, EventArgs.Empty);
- string updateBundle = await DownloadUpgradeAsync(upgradeProperties);
+ string upgradeBundle = await DownloadUpgradeAsync(upgradeProperties);
- if (string.IsNullOrEmpty(updateBundle) || !File.Exists(updateBundle))
+ if (string.IsNullOrEmpty(upgradeBundle) || !File.Exists(upgradeBundle))
{
DownloadCompleted?.Invoke(this, false);
}
@@ -83,15 +83,15 @@ namespace LibationUiBase
{
DownloadCompleted?.Invoke(this, true);
- //Install the update
- Serilog.Log.Logger.Information($"Begin running auto-updater");
- interop.InstallUpdate(updateBundle);
- Serilog.Log.Logger.Information($"Completed running auto-updater");
+ //Install the upgrade
+ Serilog.Log.Logger.Information($"Begin running auto-upgrader");
+ interop.InstallUpgrade(upgradeBundle);
+ Serilog.Log.Logger.Information($"Completed running auto-upgrader");
}
}
catch (Exception ex)
{
- Serilog.Log.Logger.Error(ex, "An error occured while checking for app updates.");
+ Serilog.Log.Logger.Error(ex, "An error occured while checking for app upgrades.");
}
}
@@ -103,7 +103,7 @@ namespace LibationUiBase
return null;
}
- //Silently download the update in the background, save it to a temp file.
+ //Silently download the upgrade in the background, save it to a temp file.
var zipFile = Path.Combine(Path.GetTempPath(), Path.GetFileName(upgradeProperties.ZipUrl));
@@ -140,7 +140,7 @@ namespace LibationUiBase
}
catch (Exception ex)
{
- Serilog.Log.Logger.Error(ex, "Failed to download the update: {pdate}", upgradeProperties.ZipUrl);
+ Serilog.Log.Logger.Error(ex, "Failed to download the upgrade: {bundle}", upgradeProperties.ZipUrl);
return null;
}
}
diff --git a/Source/LibationWinForms/Dialogs/Login/_2faCodeDialog.resx b/Source/LibationWinForms/Dialogs/Login/_2faCodeDialog.resx
index f298a7be..e8ae276d 100644
--- a/Source/LibationWinForms/Dialogs/Login/_2faCodeDialog.resx
+++ b/Source/LibationWinForms/Dialogs/Login/_2faCodeDialog.resx
@@ -1,4 +1,5 @@
-
+
+
diff --git a/Source/LibationWinForms/Form1.Upgrade.cs b/Source/LibationWinForms/Form1.Upgrade.cs
index 0edc380d..e1b9466d 100644
--- a/Source/LibationWinForms/Form1.Upgrade.cs
+++ b/Source/LibationWinForms/Form1.Upgrade.cs
@@ -6,29 +6,30 @@ namespace LibationWinForms
{
public partial class Form1
{
- private void Configure_Update()
+ private void Configure_Upgrade()
{
setProgressVisible(false);
#if !DEBUG
+ Task upgradeAvailable(UpgradeEventArgs e)
+ {
+ var notificationResult = new UpgradeNotificationDialog(e.UpgradeProperties).ShowDialog(this);
+
+ e.Ignore = notificationResult == System.Windows.Forms.DialogResult.Ignore;
+ e.InstallUpgrade = notificationResult == System.Windows.Forms.DialogResult.Yes;
+
+ return Task.CompletedTask;
+ }
+
var upgrader = new Upgrader();
upgrader.DownloadProgress += (_, e) => Invoke(() => upgradePb.Value = int.Max(0, int.Min(100, (int)(e.ProgressPercentage ?? 0))));
upgrader.DownloadBegin += (_, _) => Invoke(() => setProgressVisible(true));
upgrader.DownloadCompleted += (_, _) => Invoke(() => setProgressVisible(false));
- Shown += async (_, _) => await upgrader.CheForUpgradeAsync(UpgradeAvailable);
+ Shown += async (_, _) => await upgrader.CheForUpgradeAsync(upgradeAvailable);
#endif
}
private void setProgressVisible(bool visible) => upgradeLbl.Visible = upgradePb.Visible = visible;
- private Task UpgradeAvailable(UpgradeEventArgs e)
- {
- var notificationResult = new UpgradeNotificationDialog(e.UpgradeProperties).ShowDialog(this);
-
- e.Ignore = notificationResult == System.Windows.Forms.DialogResult.Ignore;
- e.InstallUpdate = notificationResult == System.Windows.Forms.DialogResult.Yes;
-
- return Task.CompletedTask;
- }
}
}
diff --git a/Source/LibationWinForms/Form1.cs b/Source/LibationWinForms/Form1.cs
index 1b8641e7..cb5743fc 100644
--- a/Source/LibationWinForms/Form1.cs
+++ b/Source/LibationWinForms/Form1.cs
@@ -51,7 +51,7 @@ namespace LibationWinForms
Configure_Settings();
Configure_ProcessQueue();
Configure_Filter();
- Configure_Update();
+ Configure_Upgrade();
// misc which belongs in winforms app but doesn't have a UI element
Configure_NonUI();
diff --git a/Source/LibationWinForms/FormSaveExtension.cs b/Source/LibationWinForms/FormSaveExtension.cs
index 227ee451..3ab11630 100644
--- a/Source/LibationWinForms/FormSaveExtension.cs
+++ b/Source/LibationWinForms/FormSaveExtension.cs
@@ -1,7 +1,6 @@
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
-using Dinah.Core.WindowsDesktop;
using LibationFileManager;
namespace LibationWinForms
diff --git a/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs b/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs
index bd6458b0..b9dd02e5 100644
--- a/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs
+++ b/Source/LoadByOS/LinuxConfigApp/LinuxInterop.cs
@@ -23,12 +23,12 @@ namespace LinuxConfigApp
public void SetFolderIcon(string image, string directory) => throw new PlatformNotSupportedException();
public void DeleteFolderIcon(string directory) => throw new PlatformNotSupportedException();
- //only run the auto updater if the current app was installed from the
+ //only run the auto upgrader if the current app was installed from the
//.deb package. Try to detect this by checking if the symlink exists.
- public bool CanUpdate => Directory.Exists("/usr/lib/libation");
- public void InstallUpdate(string updateBundle)
+ public bool CanUpgrade => Directory.Exists("/usr/lib/libation");
+ public void InstallUpgrade(string upgradeBundle)
{
- RunAsRoot("apt", $"install '{updateBundle}'");
+ RunAsRoot("apt", $"install '{upgradeBundle}'");
}
public Process RunAsRoot(string exe, string args)
diff --git a/Source/LoadByOS/MacOSConfigApp/MacOSInterop.cs b/Source/LoadByOS/MacOSConfigApp/MacOSInterop.cs
index a8993345..23f26a7c 100644
--- a/Source/LoadByOS/MacOSConfigApp/MacOSInterop.cs
+++ b/Source/LoadByOS/MacOSConfigApp/MacOSInterop.cs
@@ -13,15 +13,15 @@ namespace MacOSConfigApp
public void DeleteFolderIcon(string directory) => throw new PlatformNotSupportedException();
//I haven't figured out how to find the app bundle's directory from within
- //the running process, so don't update unless it's "installed" in /Applications
- public bool CanUpdate => Directory.Exists(AppPath);
+ //the running process, so don't upgrade unless it's "installed" in /Applications
+ public bool CanUpgrade => Directory.Exists(AppPath);
- public void InstallUpdate(string updateBundle)
+ public void InstallUpgrade(string upgradeBundle)
{
- Serilog.Log.Information($"Extracting update bundle to {AppPath}");
+ Serilog.Log.Information($"Extracting upgrade bundle to {AppPath}");
//tar wil overwrite existing without elevated privileges
- Process.Start("tar", $"-xf \"{updateBundle}\" -C \"/Applications\"").WaitForExit();
+ Process.Start("tar", $"-xf \"{upgradeBundle}\" -C \"/Applications\"").WaitForExit();
//For now, it seems like this step is unnecessary. We can overwrite and
//run Libation without needing to re-add the exception. This is insurance.
diff --git a/Source/LoadByOS/WindowsConfigApp/FolderIcon.cs b/Source/LoadByOS/WindowsConfigApp/FolderIcon.cs
index e588bd2c..e35eb57c 100644
--- a/Source/LoadByOS/WindowsConfigApp/FolderIcon.cs
+++ b/Source/LoadByOS/WindowsConfigApp/FolderIcon.cs
@@ -97,10 +97,10 @@ namespace WindowsConfigApp
refresh();
}
- private static void refresh() => SHChangeNotify(0x08000000, 0x0000, IntPtr.Zero, IntPtr.Zero); //SHCNE_ASSOCCHANGED SHCNF_IDLIST
+ private static void refresh() => SHChangeNotify(0x08000000, 0x0000, 0, 0); //SHCNE_ASSOCCHANGED SHCNF_IDLIST
[DllImport("shell32.dll", SetLastError = true)]
- private static extern void SHChangeNotify(int wEventId, int uFlags, IntPtr dwItem1, IntPtr dwItem2);
+ private static extern void SHChangeNotify(int wEventId, int uFlags, nint dwItem1, nint dwItem2);
}
}
diff --git a/Source/LoadByOS/WindowsConfigApp/Properties/PublishProfiles/WindowsProfile.pubxml b/Source/LoadByOS/WindowsConfigApp/Properties/PublishProfiles/WindowsProfile.pubxml
index 75e91e8b..03ef4015 100644
--- a/Source/LoadByOS/WindowsConfigApp/Properties/PublishProfiles/WindowsProfile.pubxml
+++ b/Source/LoadByOS/WindowsConfigApp/Properties/PublishProfiles/WindowsProfile.pubxml
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
Release
Any CPU
- C:\Users\mbuca\OneDrive\Projects\Libation\Source\bin\Publish\Windows-chardonnay
+ ..\..\bin\Publish\classic
FileSystem
net7.0-windows
win-x64
diff --git a/Source/LoadByOS/WindowsConfigApp/WinInterop.cs b/Source/LoadByOS/WindowsConfigApp/WinInterop.cs
index 76972c06..ced9929f 100644
--- a/Source/LoadByOS/WindowsConfigApp/WinInterop.cs
+++ b/Source/LoadByOS/WindowsConfigApp/WinInterop.cs
@@ -33,8 +33,8 @@ namespace WindowsConfigApp
public void DeleteFolderIcon(string directory)
=> new DirectoryInfo(directory)?.DeleteIcon();
- public bool CanUpdate => true;
- public void InstallUpdate(string updateBundle)
+ public bool CanUpgrade => true;
+ public void InstallUpgrade(string upgradeBundle)
{
var thisExe = Environment.ProcessPath;
var thisDir = Path.GetDirectoryName(thisExe);
@@ -42,7 +42,7 @@ namespace WindowsConfigApp
File.Copy("ZipExtractor.exe", zipExtractor, overwrite: true);
- RunAsRoot(zipExtractor, $"--input \"{updateBundle}\" --output \"{thisDir}\" --executable \"{thisExe}\"");
+ RunAsRoot(zipExtractor, $"--input \"{upgradeBundle}\" --output \"{thisDir}\" --executable \"{thisExe}\"");
}
public Process RunAsRoot(string exe, string args)
diff --git a/Source/LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj b/Source/LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj
index a34a143b..2057f3a8 100644
--- a/Source/LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj
+++ b/Source/LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj
@@ -14,7 +14,7 @@
- ..\..\bin\Avalonia\Debug
+ ..\..\bin\Debug
embedded