Kavita/API/Helpers/Converters/ServerSettingConverter.cs
Joseph Milazzo 242d8b106d
Bugfixes (#1177)
* Fixed an underline on hover of pagination link

* Ensure title of companion bar eats full width if there is no filter

* If a user doesn't have the Download role, they will not be able to download over OPDS.

* Fixed a bug where after going into webtoon reader mode then leaving, the bookmark effect would continue using the webtoon mode styling

* Fixed a bug where continuous reader wasn't being triggered due to moving scrollbar to body and a floating point percision error on scroll top

* Fixed how continuous trigger is shown so that we properly adjust scroll on the top (for prev chapter)

* Fixed a bad merge that broke saving any edits to series metadata

* When a epub key is not correct, even after we correct it, ignore the inlining of the style so the book is at least still readable.

* Disabled double rendering (this feature is being postponed to a later release)

* Disabled user setting and forced it to Single on any save

* Removed cache directory from UpdateSettings validation as we don't allow changing it.

* Fix security issue with url parse

* After all migrations run, update the installed version in the Database. Send that installed version on the stat service.

* Dependency bot to update some security stuff

* Some misc code cleanup and fixes on the typeahead (still broken)
2022-03-25 16:38:13 -07:00

58 lines
2.3 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.BaseUrl:
destination.BaseUrl = row.Value;
break;
case ServerSettingKey.BookmarkDirectory:
destination.BookmarksDirectory = row.Value;
break;
case ServerSettingKey.EmailServiceUrl:
destination.EmailServiceUrl = row.Value;
break;
case ServerSettingKey.InstallVersion:
destination.InstallVersion = row.Value;
break;
}
}
return destination;
}
}
}