Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Webreaper committed Dec 29, 2024
2 parents a6dfc2f + 6004b42 commit 300cd54
Show file tree
Hide file tree
Showing 260 changed files with 5,757 additions and 6,417 deletions.
Binary file modified .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Setup Dotnet Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100'
dotnet-version: '9.0.101'

- name: Install WASM-Tools
run: dotnet workload install wasm-tools
Expand Down
29 changes: 14 additions & 15 deletions .github/workflows/damselfly-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,24 @@ jobs:
run: sh scripts/makedesktop.sh ${{ matrix.target }}

- name: Upload desktop builds for Docker build
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Desktop-Dist
name: Desktop-Dist-${{ matrix.target }}
path: Damselfly.Web.Client/wwwroot/desktop/*.*
retention-days: 5

build-server:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# FIX Package restore for MacOS
target: [windows, linux]
target: [windows, linux, mac]
include:
- target: windows
os: ubuntu-latest
- target: linux
os: ubuntu-latest
# - target: mac
# os: macos-latest
- target: mac
os: macos-latest

steps:
- name: Clone Repository (latest)
Expand All @@ -75,7 +74,7 @@ jobs:
- name: Setup Dotnet Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100'
dotnet-version: '9.0.101'

- name: Install WASM-Tools
run: dotnet workload install wasm-tools
Expand All @@ -84,9 +83,9 @@ jobs:
run: sh scripts/makeserver.sh ${{ matrix.target }}

- name: Upload server builds to artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Server-Dist
name: Server-Dist-${{ matrix.target }}
path: server/*.zip
retention-days: 5

Expand Down Expand Up @@ -116,9 +115,9 @@ jobs:
run: echo "::set-output name=version::$(cat VERSION)"

- name: Download Server Build
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: Server-Dist
name: Server-Dist-${{ matrix.target }}
path: server

- name: Unzip server into publish folder
Expand All @@ -132,9 +131,9 @@ jobs:
echo "Server artifacts:"
ls server
- name: Download Desktop Builds into wwwroot folder
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: Desktop-Dist
name: Desktop-Dist-${{ matrix.target }}
path: publish/wwwroot/desktop

- name: Validate Desktop artifacts
Expand Down Expand Up @@ -177,14 +176,14 @@ jobs:

- name: Download Desktop Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: Desktop-Dist
path: Damselfly.Web.Client/wwwroot/desktop

- name: Download Server Artifacts
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: Server-Dist
path: server
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core.Constants/ConfigSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class ConfigSettings
{
public const bool DefaultEnableRolesAndAuth = true;

public const string ThumbSize = "ThumbSize";
public const string GridImageSize = "GridImageSize";
public const string RecentTags = "RecentTags";
public const string LoadedImages = "LoadedImages";
public const string Theme = "Theme";
Expand Down
9 changes: 9 additions & 0 deletions Damselfly.Core.Constants/GridImageSizes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Damselfly.Core.Constants;

public enum GridImageSize
{
Large = 1,
Medium = 2,
Small = 3,
Mini = 4
}
6 changes: 2 additions & 4 deletions Damselfly.Core.Constants/SearchTypes.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

namespace Damselfly.Core.Constants;
namespace Damselfly.Core.Constants;

public enum SortOrderType
{
Expand Down Expand Up @@ -28,5 +27,4 @@ public enum OrientationType
Portrait,
Panorama,
Square
}

}
1 change: 1 addition & 0 deletions Damselfly.Core.Constants/TaskTypes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;

namespace Damselfly.Core.Constants;

public enum TaskType
Expand Down
8 changes: 4 additions & 4 deletions Damselfly.Core.Constants/ZoomRange.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;

namespace Damselfly.Core.Constants;


public static class ZoomRange
{
public static int Minimum { get; } = 1;
public static int Maximum { get; } = 8;
public static double ZoomStep { get;} = 0.2;
}

public static double ZoomStep { get; } = 0.2;
}
15 changes: 8 additions & 7 deletions Damselfly.Core.DbModels/AuthorisationRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ namespace Damselfly.Core.DbModels;

public static class AuthorisationRegistration
{
private static bool IsAdminOrNoUsers( AuthorizationHandlerContext context, UserManager<AppIdentityUser> userManager )
private static bool IsAdminOrNoUsers( AuthorizationHandlerContext context,
UserManager<AppIdentityUser> userManager )
{
if (context.User != null && context.User.IsInRole(RoleDefinitions.s_AdminRole) )
if ( context.User != null && context.User.IsInRole(RoleDefinitions.s_AdminRole) )
return true;

// No logged in users. See if there are any users. If not, we allow it
if (userManager != null && !userManager.Users.Any())
if ( userManager != null && !userManager.Users.Any() )
return true;

return false;
Expand All @@ -36,7 +37,7 @@ public static void SetupPolicies(this AuthorizationOptions config, IServiceColle
var userManager = serviceProvider.GetService<UserManager<AppIdentityUser>>();
var logger = serviceProvider.GetService<ILogger<AuthorizationOptions>>();
var enablePolicies = configService!.GetBool(ConfigSettings.EnablePoliciesAndRoles,
ConfigSettings.DefaultEnableRolesAndAuth);
ConfigSettings.DefaultEnableRolesAndAuth);


if ( enablePolicies )
Expand All @@ -52,13 +53,13 @@ public static void SetupPolicies(this AuthorizationOptions config, IServiceColle

// Users and Admins can edit content (keywords)
config.AddPolicy(PolicyDefinitions.s_IsEditor, policy => policy.RequireRole(
RoleDefinitions.s_AdminRole,
RoleDefinitions.s_UserRole));
RoleDefinitions.s_AdminRole,
RoleDefinitions.s_UserRole));

// Special role for the user Admin page - only accessible if the current user
// is an admin or there are no users defined at all.
config.AddPolicy(PolicyDefinitions.s_IsAdminOrNoUsers, policy => policy.RequireAssertion(
context => IsAdminOrNoUsers( context, userManager )));
context => IsAdminOrNoUsers( context, userManager )));

// Admins, Users and ReadOnly users can download
config.AddPolicy(PolicyDefinitions.s_IsDownloader, policy => policy.RequireRole(
Expand Down
52 changes: 26 additions & 26 deletions Damselfly.Core.DbModels/Damselfly.Core.DbModels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" />
<PackageReference Include="Microsoft.EntityFrameworkCore"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -16,35 +16,35 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="FluentValidation" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" />
<PackageReference Include="Microsoft.Extensions.Logging.Console"/>
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore"/>
<PackageReference Include="FluentValidation"/>
<PackageReference Include="Microsoft.AspNetCore.Authorization"/>
</ItemGroup>

<ItemGroup>
<Folder Include="Authentication\" />
<Folder Include="Utils\" />
<Folder Include="Models\" />
<Folder Include="Models\SideCars\" />
<Folder Include="Images\" />
<Folder Include="Models\ConfigSettings\" />
<Folder Include="Models\TransformationModels\" />
<Folder Include="Authentication\"/>
<Folder Include="Utils\"/>
<Folder Include="Models\"/>
<Folder Include="Models\SideCars\"/>
<Folder Include="Images\"/>
<Folder Include="Models\ConfigSettings\"/>
<Folder Include="Models\TransformationModels\"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Damselfly.Core.Utils\Damselfly.Core.Utils.csproj" />
<ProjectReference Include="..\Damselfly.Core.Interfaces\Damselfly.Core.Interfaces.csproj" />
<ProjectReference Include="..\Damselfly.Shared.Utils\Damselfly.Shared.Utils.csproj" />
<ProjectReference Include="..\Damselfly.Core.Utils\Damselfly.Core.Utils.csproj"/>
<ProjectReference Include="..\Damselfly.Core.Interfaces\Damselfly.Core.Interfaces.csproj"/>
<ProjectReference Include="..\Damselfly.Shared.Utils\Damselfly.Shared.Utils.csproj"/>
</ItemGroup>
<ItemGroup>
<None Remove="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<None Remove="Models\" />
<None Remove="Models\SideCars\" />
<None Remove="FluentValidation" />
<None Remove="Images\" />
<None Remove="Microsoft.AspNetCore.Authorization" />
<None Remove="Models\API Models\" />
<None Remove="Models\ConfigSettings\" />
<None Remove="Models\TransformationModels\" />
<None Remove="Microsoft.AspNetCore.Identity.EntityFrameworkCore"/>
<None Remove="Models\"/>
<None Remove="Models\SideCars\"/>
<None Remove="FluentValidation"/>
<None Remove="Images\"/>
<None Remove="Microsoft.AspNetCore.Authorization"/>
<None Remove="Models\API Models\"/>
<None Remove="Models\ConfigSettings\"/>
<None Remove="Models\TransformationModels\"/>
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions Damselfly.Core.DbModels/Interfaces/ICachedDataService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Damselfly.Core.DbModels.Models;
using Damselfly.Core.DbModels.Models.APIModels;
using Damselfly.Core.Models;

namespace Damselfly.Core.ScopedServices.Interfaces;
Expand All @@ -14,4 +15,5 @@ public interface ICachedDataService
Task InitialiseData();
Task<Statistics> GetStatistics();
Task ClearCache();
Task<NewVersionResponse> CheckForNewVersion();
}
3 changes: 2 additions & 1 deletion Damselfly.Core.DbModels/Interfaces/IConfigService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Damselfly.Core.Models;

namespace Damselfly.Core.ScopedServices.Interfaces;
Expand All @@ -15,6 +16,6 @@ public interface IConfigService

public interface IUserConfigService : IConfigService
{
void SetForUser(string name, string value);
Task SetForUser(string name, string value);
event Action<ICollection<ConfigSetting>> OnSettingsLoaded;
}
5 changes: 2 additions & 3 deletions Damselfly.Core.DbModels/Interfaces/IFileService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Damselfly.Core.DbModels.Models.APIModels;

namespace Damselfly.Core.ScopedServices.Interfaces;
Expand All @@ -7,5 +7,4 @@ public interface IFileService
{
public Task<bool> MoveImages( ImageMoveRequest req );
public Task<bool> DeleteImages( MultiImageRequest req );
}

}
4 changes: 4 additions & 0 deletions Damselfly.Core.DbModels/Interfaces/IFolderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ public interface IFolderService
{
Task<ICollection<Folder>> GetFolders();

Task<Dictionary<int, UserFolderState>> GetUserFolderStates(int? userId);

Task SaveFolderStates(IEnumerable<UserFolderState> newStates);

event Action OnChange;
}
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Interfaces/IPeopleService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Damselfly.Core.DbModels.Models.API_Models;
using Damselfly.Core.DbModels.Models.APIModels;
using Damselfly.Core.Models;

Expand All @@ -10,6 +9,7 @@ public interface IPeopleService
{
Task<Person> GetPerson(int personId);
Task<List<Person>> GetAllPeople();
Task<List<Person>> GetPeople(PeopleRequest req);
Task<List<string>> GetPeopleNames(string searchText);
Task UpdatePersonName(NameChangeRequest req);
Task<bool> NeedsAIMigration();
Expand Down
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Interfaces/ISearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface ISearchService
int? CameraId { get; set; }
int? SimilarToId { get; set; }
int? LensId { get; set; }
int? Month { get; set; }
IEnumerable<int>? Months { get; set; }
int? MinRating { get; set; }
int? MaxSizeKB { get; set; }
int? MinSizeKB { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion Damselfly.Core.DbModels/Interfaces/ITagService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Damselfly.Core.Models;

Expand Down Expand Up @@ -27,7 +28,7 @@ public interface IRecentTagService

public interface ITagSearchService
{
Task<ICollection<Tag>> SearchTags(string filterText);
Task<ICollection<Tag>> SearchTags(string filterText, CancellationToken token = default);
Task<ICollection<Tag>> GetAllTags();
Task<Tag> GetTag( int tagId );
}
2 changes: 1 addition & 1 deletion Damselfly.Core.DbModels/Interfaces/IUserFolderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public interface IUserFolderService
Task<List<Folder>> GetFilteredFolders(string filterTerm);
Task<Folder?> GetFolder(int folderId);
void ToggleExpand(Folder item);
bool IsExpanded(Folder item);
bool IsExpanded(Folder? item);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Damselfly.Core.DbModels.Models.API_Models;
namespace Damselfly.Core.DbModels.Models.APIModels;

public class AIMigrationRequest
{
Expand Down
Loading

0 comments on commit 300cd54

Please sign in to comment.