mirror of
				https://github.com/Kareadita/Kavita.git
				synced 2025-11-04 03:27:05 -05:00 
			
		
		
		
	* Added base url config * UI side is not working * Working base url more * Attempt to get UI to work with base url * Implemented the ability to set the Base URL for the app * Hooked in Base URL as a managed setting * Ensure we always start with / for base url * Removed default base href from debug builds. Cleaned up an issue with base url migration. * Fixed an issue with our BaseURL migration
		
			
				
	
	
		
			52 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			2.0 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;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            return destination;
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |