Lots of cleanup

This commit is contained in:
Joseph Milazzo 2021-02-07 12:02:47 -06:00
parent bd5a1338c4
commit 077e5f798a
28 changed files with 80 additions and 55 deletions

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using API.Constants;
using API.Data.Migrations;
using API.DTOs;
using API.Entities;
using API.Extensions;

View file

@ -1,6 +1,5 @@
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace API.Controllers
{

View file

@ -18,7 +18,7 @@ namespace API.Controllers
_logger = logger;
}
[HttpPost]
[HttpPost("restart")]
public ActionResult RestartServer()
{
_logger.LogInformation($"{User.GetUsername()} is restarting server from admin dashboard.");

View file

@ -1,8 +1,9 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using API.DTOs;
using API.Entities;
using API.Entities.Enums;
using API.Extensions;
using API.Helpers.Converters;
using API.Interfaces;
@ -62,6 +63,13 @@ namespace API.Controllers
setting.Value = updateSettingsDto.TaskScan;
_unitOfWork.SettingsRepository.Update(setting);
}
if (setting.Key == ServerSettingKey.Port && updateSettingsDto.Port + "" != setting.Value)
{
setting.Value = updateSettingsDto.Port + "";
Environment.SetEnvironmentVariable("KAVITA_PORT", setting.Value);
_unitOfWork.SettingsRepository.Update(setting);
}
}
if (_unitOfWork.HasChanges() && await _unitOfWork.Complete())