refactor: GeneralConfig
This commit is contained in:
@ -55,7 +55,7 @@ public partial class SetupController(
|
||||
if (!notConfigureService.IsMaintenanceMode)
|
||||
throw new ControllerArgumentException(
|
||||
"The token cannot be generated because the server has been configured. " +
|
||||
$"If you need to restart the configuration, then delete the \"{PathBuilder.Combine(GeneralConfig.FilePath)}\" file and restart the application.");
|
||||
$"If you need to restart the configuration, then delete the \"{GeneralConfig.FilePath}\" file and restart the application.");
|
||||
|
||||
var token = new byte[32];
|
||||
RandomNumberGenerator.Create().GetBytes(token);
|
||||
@ -333,18 +333,9 @@ public partial class SetupController(
|
||||
if (!cache.TryGetValue(CacheAdminKey, out Admin? admin) || admin == null)
|
||||
throw new ControllerArgumentException("The administrator's data was not set.");
|
||||
|
||||
if (System.IO.File.Exists(PathBuilder.Combine(GeneralConfig.FilePath)))
|
||||
System.IO.File.Delete(PathBuilder.Combine(GeneralConfig.FilePath));
|
||||
|
||||
System.IO.File.WriteAllText(PathBuilder.Combine(Admin.PathToSave), JsonSerializer.Serialize(admin));
|
||||
|
||||
System.IO.File.WriteAllText(
|
||||
PathBuilder.Combine(GeneralConfig.FilePath),
|
||||
JsonSerializer.Serialize(GeneralConfig, new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true
|
||||
})
|
||||
);
|
||||
GeneralConfig.SaveSetting();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user