From db777eeb3c87f8d857720be37dd31780de3c5b6f Mon Sep 17 00:00:00 2001 From: JT Date: Mon, 15 Apr 2024 23:33:02 -0700 Subject: [PATCH 1/7] fix comment parsing & metadata parsing --- CHANGELOG.md | 5 +++++ StabilityMatrix.Core/Python/PipInstallArgs.cs | 2 +- .../Services/MetadataImportService.cs | 14 +++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a14178d4..baffe87a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to Stability Matrix will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). +## v2.something +### Fixed +- Fixed more crashes when loading invalid connected model info files +- Fixed pip installs not parsing comments properly + ## v2.10.1 ### Added - Added SVD Shared Model & Output Folders for Forge (fixes [#580](https://github.com/LykosAI/StabilityMatrix/issues/580)) diff --git a/StabilityMatrix.Core/Python/PipInstallArgs.cs b/StabilityMatrix.Core/Python/PipInstallArgs.cs index 68e371f7..8c33f194 100644 --- a/StabilityMatrix.Core/Python/PipInstallArgs.cs +++ b/StabilityMatrix.Core/Python/PipInstallArgs.cs @@ -30,7 +30,7 @@ public record PipInstallArgs : ProcessArgsBuilder { var requirementsEntries = requirements .SplitLines(StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) - .AsEnumerable(); + .Where(s => !s.StartsWith('#')); if (excludePattern is not null) { diff --git a/StabilityMatrix.Core/Services/MetadataImportService.cs b/StabilityMatrix.Core/Services/MetadataImportService.cs index 21ce5a2c..3830fa70 100644 --- a/StabilityMatrix.Core/Services/MetadataImportService.cs +++ b/StabilityMatrix.Core/Services/MetadataImportService.cs @@ -155,9 +155,17 @@ public class MetadataImportService( var cmInfoList = new Dictionary(); foreach (var cmInfoPath in directory.EnumerateFiles("*.cm-info.json", SearchOption.AllDirectories)) { - var cmInfo = JsonSerializer.Deserialize( - await cmInfoPath.ReadAllTextAsync().ConfigureAwait(false) - ); + ConnectedModelInfo? cmInfo; + try + { + cmInfo = JsonSerializer.Deserialize( + await cmInfoPath.ReadAllTextAsync().ConfigureAwait(false) + ); + } + catch (JsonException) + { + cmInfo = null; + } if (cmInfo == null) continue; From 2de9fdcdf65ec4f597968ec3e04bc9c0e81e3cf1 Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 16 Apr 2024 18:16:33 -0700 Subject: [PATCH 2/7] more better comment parsing --- CHANGELOG.md | 2 +- StabilityMatrix.Core/Python/PipInstallArgs.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baffe87a..1d49d7d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to Stability Matrix will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). -## v2.something +## v2.10.2 ### Fixed - Fixed more crashes when loading invalid connected model info files - Fixed pip installs not parsing comments properly diff --git a/StabilityMatrix.Core/Python/PipInstallArgs.cs b/StabilityMatrix.Core/Python/PipInstallArgs.cs index 8c33f194..9359f4ec 100644 --- a/StabilityMatrix.Core/Python/PipInstallArgs.cs +++ b/StabilityMatrix.Core/Python/PipInstallArgs.cs @@ -30,7 +30,8 @@ public record PipInstallArgs : ProcessArgsBuilder { var requirementsEntries = requirements .SplitLines(StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) - .Where(s => !s.StartsWith('#')); + .Where(s => !s.StartsWith('#')) + .Select(s => s.Contains('#') ? s.Substring(0, s.IndexOf('#')) : s); if (excludePattern is not null) { From c66c4972b8474d705403f0cf13a6be761406a19b Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 16 Apr 2024 18:21:41 -0700 Subject: [PATCH 3/7] no empty strings --- StabilityMatrix.Core/Python/PipInstallArgs.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/StabilityMatrix.Core/Python/PipInstallArgs.cs b/StabilityMatrix.Core/Python/PipInstallArgs.cs index 9359f4ec..558a7db8 100644 --- a/StabilityMatrix.Core/Python/PipInstallArgs.cs +++ b/StabilityMatrix.Core/Python/PipInstallArgs.cs @@ -31,7 +31,8 @@ public record PipInstallArgs : ProcessArgsBuilder var requirementsEntries = requirements .SplitLines(StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) .Where(s => !s.StartsWith('#')) - .Select(s => s.Contains('#') ? s.Substring(0, s.IndexOf('#')) : s); + .Select(s => s.Contains('#') ? s.Substring(0, s.IndexOf('#')) : s) + .Where(s => !string.IsNullOrWhiteSpace(s)); if (excludePattern is not null) { From d543b1a36e5a5fd5909df2ced3c4ee0a93aa5d49 Mon Sep 17 00:00:00 2001 From: jt Date: Tue, 16 Apr 2024 19:55:17 -0700 Subject: [PATCH 4/7] Fix some crashes on macOS & linux --- Avalonia.Gif/Avalonia.Gif.csproj | 2 +- CHANGELOG.md | 4 ++ ...tabilityMatrix.Avalonia.Diagnostics.csproj | 4 +- .../Extensions/DataObjectExtensions.cs | 14 +++++-- .../StabilityMatrix.Avalonia.csproj | 38 +++++++++---------- .../ControlThemes/BetterComboBoxStyles.axaml | 13 ++++--- .../Base/InferenceTabViewModelBase.cs | 5 ++- .../CheckpointManager/CheckpointFolder.cs | 3 +- .../Views/CheckpointsPage.axaml.cs | 9 +++-- .../Views/ConsoleOutputPage.axaml | 1 + .../StabilityMatrix.Core.csproj | 6 +-- .../StabilityMatrix.UITests.csproj | 2 +- 12 files changed, 60 insertions(+), 41 deletions(-) diff --git a/Avalonia.Gif/Avalonia.Gif.csproj b/Avalonia.Gif/Avalonia.Gif.csproj index dbf0defd..6a363589 100644 --- a/Avalonia.Gif/Avalonia.Gif.csproj +++ b/Avalonia.Gif/Avalonia.Gif.csproj @@ -10,7 +10,7 @@ true - + diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d49d7d5..455efd4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2 ### Fixed - Fixed more crashes when loading invalid connected model info files - Fixed pip installs not parsing comments properly +- Fixed crash when sending input to a process that isn't running +- Fixed [#576](https://github.com/LykosAI/StabilityMatrix/issues/576) - drag & drop crashes on macOS & Linux +- Fixed [#594](https://github.com/LykosAI/StabilityMatrix/issues/594) - missing thumbnails in Inference model selector +- Downgraded Avalonia back to 11.0.9 to fix [#589](https://github.com/LykosAI/StabilityMatrix/issues/589) and possibly other rendering issues ## v2.10.1 ### Added diff --git a/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj b/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj index 2fbf2fd4..72a57f69 100644 --- a/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj +++ b/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs b/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs index ef6a47f0..25993dd6 100644 --- a/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs +++ b/StabilityMatrix.Avalonia/Extensions/DataObjectExtensions.cs @@ -1,4 +1,5 @@ -using Avalonia.Input; +using System.Runtime.InteropServices; +using Avalonia.Input; namespace StabilityMatrix.Avalonia.Extensions; @@ -9,9 +10,16 @@ public static class DataObjectExtensions /// public static T? GetContext(this IDataObject dataObject) { - if (dataObject.Get("Context") is T context) + try { - return context; + if (dataObject.Get("Context") is T context) + { + return context; + } + } + catch (COMException) + { + return default; } return default; diff --git a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj index b3fba009..cda7adcd 100644 --- a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj +++ b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj @@ -39,17 +39,17 @@ - - - - - - + + + + + + - + - - + + @@ -58,10 +58,10 @@ - - - - + + + + @@ -78,25 +78,25 @@ - + - + - + - - + + - + diff --git a/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml b/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml index c1274ef4..c5105328 100644 --- a/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml +++ b/StabilityMatrix.Avalonia/Styles/ControlThemes/BetterComboBoxStyles.axaml @@ -8,7 +8,8 @@ xmlns:sg="clr-namespace:SpacedGridControl.Avalonia;assembly=SpacedGridControl.Avalonia" xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:labs="clr-namespace:Avalonia.Labs.Controls;assembly=Avalonia.Labs.Controls" - xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs"> + xmlns:vendorLabs="clr-namespace:StabilityMatrix.Avalonia.Controls.VendorLabs" + xmlns:converters="clr-namespace:StabilityMatrix.Avalonia.Converters"> @@ -29,7 +30,9 @@ - + + + @@ -220,7 +223,7 @@ Height="36" CornerRadius="60" RenderOptions.BitmapInterpolationMode="HighQuality" - Source="{Binding Local.PreviewImageFullPathGlobal}" + Source="{Binding Local.PreviewImageFullPathGlobal, Converter={StaticResource FileUriConverter}}" Stretch="UniformToFill"> diff --git a/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs b/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs index 57e6bf47..30fd84ff 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs @@ -18,6 +18,7 @@ using FluentAvalonia.UI.Media.Animation; using Microsoft.Extensions.DependencyInjection; using NLog; using StabilityMatrix.Avalonia.Animations; +using StabilityMatrix.Avalonia.Extensions; using StabilityMatrix.Avalonia.Models; using StabilityMatrix.Avalonia.Models.Inference; using StabilityMatrix.Avalonia.Services; @@ -249,7 +250,7 @@ public abstract partial class InferenceTabViewModelBase // 1. Context drop for LocalImageFile if (e.Data.GetDataFormats().Contains("Context")) { - if (e.Data.Get("Context") is LocalImageFile imageFile) + if (e.Data.GetContext() is { } imageFile) { e.Handled = true; return; @@ -274,7 +275,7 @@ public abstract partial class InferenceTabViewModelBase // 1. Context drop for LocalImageFile if (e.Data.GetDataFormats().Contains("Context")) { - if (e.Data.Get("Context") is LocalImageFile imageFile) + if (e.Data.GetContext() is { } imageFile) { e.Handled = true; diff --git a/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs b/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs index 5f23e3fc..51ad4025 100644 --- a/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs +++ b/StabilityMatrix.Avalonia/ViewModels/CheckpointManager/CheckpointFolder.cs @@ -15,6 +15,7 @@ using CommunityToolkit.Mvvm.Input; using DynamicData; using DynamicData.Binding; using FluentAvalonia.UI.Controls; +using StabilityMatrix.Avalonia.Extensions; using StabilityMatrix.Avalonia.Services; using StabilityMatrix.Avalonia.ViewModels.Base; using StabilityMatrix.Core.Attributes; @@ -279,7 +280,7 @@ public partial class CheckpointFolder : ViewModelBase var paths = files.Select(f => f.Path.LocalPath).ToArray(); await ImportFilesAsync(paths, settingsManager.Settings.IsImportAsConnected); } - else if (e.Data.Get("Context") is CheckpointFile file) + else if (e.Data.GetContext() is { } file) { await MoveBetweenFolders(file); } diff --git a/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs b/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs index e95b45f4..dda5cd9c 100644 --- a/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs +++ b/StabilityMatrix.Avalonia/Views/CheckpointsPage.axaml.cs @@ -6,6 +6,7 @@ using Avalonia.Markup.Xaml; using Avalonia.VisualTree; using DynamicData.Binding; using StabilityMatrix.Avalonia.Controls; +using StabilityMatrix.Avalonia.Extensions; using StabilityMatrix.Avalonia.ViewModels; using StabilityMatrix.Avalonia.ViewModels.CheckpointManager; using StabilityMatrix.Core.Attributes; @@ -68,7 +69,7 @@ public partial class CheckpointsPage : UserControlBase { case CheckpointFolder folder: { - if (e.Data.Get("Context") is not CheckpointFile file) + if (e.Data.GetContext() is not { } file) { await folder.OnDrop(e); break; @@ -83,7 +84,7 @@ public partial class CheckpointsPage : UserControlBase } case CheckpointFile file: { - if (e.Data.Get("Context") is not CheckpointFile dragFile) + if (e.Data.GetContext() is not { } dragFile) { await file.ParentFolder.OnDrop(e); break; @@ -132,7 +133,7 @@ public partial class CheckpointsPage : UserControlBase case CheckpointFolder folder: { folder.IsExpanded = true; - if (e.Data.Get("Context") is not CheckpointFile file) + if (e.Data.GetContext() is not { } file) { folder.IsCurrentDragTarget = true; break; @@ -144,7 +145,7 @@ public partial class CheckpointsPage : UserControlBase } case CheckpointFile file: { - if (e.Data.Get("Context") is not CheckpointFile dragFile) + if (e.Data.GetContext() is not { } dragFile) { file.ParentFolder.IsCurrentDragTarget = true; break; diff --git a/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml b/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml index d44b44e6..7fa19f89 100644 --- a/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml +++ b/StabilityMatrix.Avalonia/Views/ConsoleOutputPage.axaml @@ -89,6 +89,7 @@ Classes="accent" IsDefault="True" Content="{x:Static lang:Resources.Action_Send}" + IsEnabled="{Binding IsRunning}" Command="{Binding SendToConsoleCommand}"/> diff --git a/StabilityMatrix.Core/StabilityMatrix.Core.csproj b/StabilityMatrix.Core/StabilityMatrix.Core.csproj index 5005b1bd..76fa5624 100644 --- a/StabilityMatrix.Core/StabilityMatrix.Core.csproj +++ b/StabilityMatrix.Core/StabilityMatrix.Core.csproj @@ -27,7 +27,7 @@ - + @@ -45,7 +45,7 @@ - + @@ -53,7 +53,7 @@ - + diff --git a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj index eb592e08..66d3a9ee 100644 --- a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj +++ b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj @@ -15,7 +15,7 @@ - + From 047d973b11bbbd3798ea647d8a851f08d40232d7 Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 16 Apr 2024 20:34:41 -0700 Subject: [PATCH 5/7] use AvaloniaVersion variable --- Avalonia.Gif/Avalonia.Gif.csproj | 2 +- Directory.Build.props | 5 +++++ .../StabilityMatrix.Avalonia.Diagnostics.csproj | 4 ++-- .../StabilityMatrix.Avalonia.csproj | 12 ++++++------ .../StabilityMatrix.UITests.csproj | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 Directory.Build.props diff --git a/Avalonia.Gif/Avalonia.Gif.csproj b/Avalonia.Gif/Avalonia.Gif.csproj index 6a363589..48a8f949 100644 --- a/Avalonia.Gif/Avalonia.Gif.csproj +++ b/Avalonia.Gif/Avalonia.Gif.csproj @@ -10,7 +10,7 @@ true - + diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..e059bd8f --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + 11.0.9 + + diff --git a/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj b/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj index 72a57f69..7d0762ac 100644 --- a/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj +++ b/StabilityMatrix.Avalonia.Diagnostics/StabilityMatrix.Avalonia.Diagnostics.csproj @@ -19,8 +19,8 @@ - - + + diff --git a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj index cda7adcd..096e08c9 100644 --- a/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj +++ b/StabilityMatrix.Avalonia/StabilityMatrix.Avalonia.csproj @@ -39,14 +39,14 @@ - - + + - - - + + + - + diff --git a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj index 66d3a9ee..2ebeb2e8 100644 --- a/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj +++ b/StabilityMatrix.UITests/StabilityMatrix.UITests.csproj @@ -15,7 +15,7 @@ - + From 14b3bd191ea1911ff57583cfc92f7e82b1931a3e Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 16 Apr 2024 22:46:42 -0700 Subject: [PATCH 6/7] Updated spanish and turkish translations from poeditor --- CHANGELOG.md | 2 + .../Languages/Resources.es.resx | 54 +++++++++++++++++++ .../Languages/Resources.tr-TR.resx | 54 +++++++++++++++++++ 3 files changed, 110 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 455efd4a..96304457 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html). ## v2.10.2 +### Changed +- Updated translations for Spanish and Turkish ### Fixed - Fixed more crashes when loading invalid connected model info files - Fixed pip installs not parsing comments properly diff --git a/StabilityMatrix.Avalonia/Languages/Resources.es.resx b/StabilityMatrix.Avalonia/Languages/Resources.es.resx index 28b0dae1..0bc23e71 100644 --- a/StabilityMatrix.Avalonia/Languages/Resources.es.resx +++ b/StabilityMatrix.Avalonia/Languages/Resources.es.resx @@ -1025,4 +1025,58 @@ Navegador de Modelos + + Workflows + + + Scroll Infinito + + + Navegador de Workflows + + + Abrir en OpenArt + + + Detalles del Nodo + + + Descripción del Workflow + + + Navegador OpenArt + + + Vista previa del Preprocesador + + + El botón 'Abrir interfaz de usuario web' se ha movido a la barra de comandos + + + Ya se está ejecutando otra instancia de Stability Matrix. Ciérrelo antes de comenzar uno nuevo. + + + Stability Matrix ya se está ejecutando + + + {0} eliminados correctamente + + + Workflow Eliminado + + + Error al recuperar workflows + + + Workflows Instalados + + + Workflow Importado + + + Terminada la importación del workflow y los nodos personalizados + + + Se han importado el workflow y los nodos personalizados. + \ No newline at end of file diff --git a/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx b/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx index 5b6064d2..e9329a1a 100644 --- a/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx +++ b/StabilityMatrix.Avalonia/Languages/Resources.tr-TR.resx @@ -1021,4 +1021,58 @@ Model Tarayıcı + + İş akışları + + + Sonsuz Kaydırma + + + İş Akışı Tarayıcısı + + + OpenArt'ta aç + + + Düğüm Ayrıntıları + + + İş Akışı Açıklaması + + + OpenArt Tarayıcı + + + Ön İşlemciyi Önizle + + + 'Web Kullanıcı Arayüzünü Aç' düğmesi komut çubuğuna taşındı + + + Stability Matrixin başka bir örneği zaten çalışıyor. Yenisini başlatmadan önce lütfen kapatın. + + + Stability Matrix zaten çalışıyor + + + {0} başarıyla silindi + + + İş Akışı Silindi + + + İş akışları alınırken hata oluştu + + + Yüklü İş Akışları + + + İş Akışı İçeri Aktarıldı + + + İş akışının ve özel düğümlerin içe aktarılması tamamlandı + + + İş akışı ve özel düğümler içe aktarıldı. + \ No newline at end of file From 7e436ba1320b34940566f525c214ffd91f61f5d3 Mon Sep 17 00:00:00 2001 From: JT Date: Thu, 18 Apr 2024 18:18:47 -0700 Subject: [PATCH 7/7] new roles --- .../Models/Api/Lykos/GetUserResponse.cs | 7 +++---- StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs b/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs index 4d5ce09a..8d2c1ca7 100644 --- a/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs +++ b/StabilityMatrix.Core/Models/Api/Lykos/GetUserResponse.cs @@ -7,9 +7,8 @@ public record GetUserResponse public required HashSet UserRoles { get; init; } public string? PatreonId { get; init; } public bool IsEmailVerified { get; init; } + public bool CanHasDevBuild { get; init; } + public bool CanHasPreviewBuild { get; init; } - public bool IsActiveSupporter => - UserRoles.Contains(LykosRole.PatreonSupporter) - || UserRoles.Contains(LykosRole.Insider) - || (UserRoles.Contains(LykosRole.Developer) && PatreonId is not null); + public bool IsActiveSupporter => CanHasDevBuild || CanHasPreviewBuild; } diff --git a/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs b/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs index d3bdca64..556852e7 100644 --- a/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs +++ b/StabilityMatrix.Core/Models/Api/Lykos/LykosRole.cs @@ -7,6 +7,16 @@ public enum LykosRole Supporter = 1, PatreonSupporter = 2, Insider = 3, - BetaTester = 4, - Developer = 5 + + // 4 and 5 have been retired 🫡 + [Obsolete("Roles restructured, use the new BetaTester role")] + OLD_BetaTester = 4, + + [Obsolete("Roles restructured, use the new Developer role")] + OLD_Developer = 5, + Pioneer = 6, + Visionary = 7, + BetaTester = 100, + Translator = 101, + Developer = 900, }