mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
* Fixed a bug which didn't take sort direction when not changing sort field * Added foundation for Bookmark refactor * Code broken, need to take a break. Issue is Getting bookmark image needs authentication but UI doesn't send. * Implemented the ability to send bookmarked files to the web. Implemented ability to clear bookmarks on disk on a re-occuring basis. * Updated the bookmark design to have it's own card that is self contained. View bookmarks modal has been updated to better lay out the cards. * Refactored download bookmark codes to select files from bookmark directory directly rather than open underlying files. * Wrote the basic logic to kick start the bookmark migration. Added Installed Version into the DB to allow us to know more accurately when to run migrations * Implemented the ability to change the bookmarks directory * Updated all references to BookmarkDirectory to use setting from the DB. Updated Server Settings page to use 2 col for some rows. * Refactored some code to DirectoryService (hasWriteAccess) and fixed up some unit tests from a previous PR. * Treat folders that start with ._ as blacklisted. * Implemented Reset User preferences. Some extra code to prep for the migration. * Implemented a migration for existing bookmarks to using new filesystem based bookmarks
55 lines
2.1 KiB
C#
55 lines
2.1 KiB
C#
using System.Collections.Generic;
|
|
using API.DTOs.Settings;
|
|
using API.Entities;
|
|
using API.Entities.Enums;
|
|
using AutoMapper;
|
|
|
|
namespace API.Helpers.Converters
|
|
{
|
|
public class ServerSettingConverter : ITypeConverter<IEnumerable<ServerSetting>, ServerSettingDto>
|
|
{
|
|
public ServerSettingDto Convert(IEnumerable<ServerSetting> source, ServerSettingDto destination, ResolutionContext context)
|
|
{
|
|
destination ??= new ServerSettingDto();
|
|
foreach (var row in source)
|
|
{
|
|
switch (row.Key)
|
|
{
|
|
case ServerSettingKey.CacheDirectory:
|
|
destination.CacheDirectory = row.Value;
|
|
break;
|
|
case ServerSettingKey.TaskScan:
|
|
destination.TaskScan = row.Value;
|
|
break;
|
|
case ServerSettingKey.LoggingLevel:
|
|
destination.LoggingLevel = row.Value;
|
|
break;
|
|
case ServerSettingKey.TaskBackup:
|
|
destination.TaskBackup = row.Value;
|
|
break;
|
|
case ServerSettingKey.Port:
|
|
destination.Port = int.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.AllowStatCollection:
|
|
destination.AllowStatCollection = bool.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.EnableOpds:
|
|
destination.EnableOpds = bool.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.EnableAuthentication:
|
|
destination.EnableAuthentication = bool.Parse(row.Value);
|
|
break;
|
|
case ServerSettingKey.BaseUrl:
|
|
destination.BaseUrl = row.Value;
|
|
break;
|
|
case ServerSettingKey.BookmarkDirectory:
|
|
destination.BookmarksDirectory = row.Value;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return destination;
|
|
}
|
|
}
|
|
}
|