Update server url

This commit is contained in:
Liza 2023-07-30 22:32:04 +02:00
parent bbec57c3ad
commit 5f506bda8a
2 changed files with 18 additions and 3 deletions

View File

@ -87,7 +87,9 @@ internal sealed class ConfigurationManager
dbContext.Imports.Add(new ImportHistory dbContext.Imports.Add(new ImportHistory
{ {
Id = importHistory.Id, Id = importHistory.Id,
RemoteUrl = importHistory.RemoteUrl?.Replace(".μ.tv", ".liza.sh"), RemoteUrl = importHistory.RemoteUrl
?.Replace(".μ.tv", ".liza.sh")
.Replace("pal.liza.sh", "connect.palacepal.com"),
ExportedAt = importHistory.ExportedAt, ExportedAt = importHistory.ExportedAt,
ImportedAt = importHistory.ImportedAt ImportedAt = importHistory.ImportedAt
}); });
@ -98,6 +100,17 @@ internal sealed class ConfigurationManager
File.Move(_pluginInterface.ConfigFile.FullName, _pluginInterface.ConfigFile.FullName + ".old", true); File.Move(_pluginInterface.ConfigFile.FullName, _pluginInterface.ConfigFile.FullName + ".old", true);
} }
IPalacePalConfiguration? currentConfig = Load();
IAccountConfiguration? legacyAccount = currentConfig?.FindAccount("https://pal.liza.sh");
if (currentConfig != null && legacyAccount != null)
{
IAccountConfiguration newAccount = currentConfig.CreateAccount("https://connect.palacepal.com", legacyAccount.AccountId);
newAccount.CachedRoles = legacyAccount.CachedRoles;
currentConfig.RemoveAccount(legacyAccount.Server);
Save(currentConfig, false);
}
} }
private ConfigurationV7 MigrateToV7(ConfigurationV1 v1) private ConfigurationV7 MigrateToV7(ConfigurationV1 v1)
@ -141,7 +154,9 @@ internal sealed class ConfigurationManager
if (string.IsNullOrEmpty(accountId)) if (string.IsNullOrEmpty(accountId))
continue; continue;
string serverName = server.Replace(".μ.tv", ".liza.sh"); string serverName = server
.Replace(".μ.tv", ".liza.sh")
.Replace("pal.liza.sh", "connect.palacepal.com");
IAccountConfiguration newAccount = v7.CreateAccount(serverName, accountId); IAccountConfiguration newAccount = v7.CreateAccount(serverName, accountId);
newAccount.CachedRoles = oldAccount.CachedRoles.ToList(); newAccount.CachedRoles = oldAccount.CachedRoles.ToList();
} }

View File

@ -13,7 +13,7 @@ internal sealed partial class RemoteApi : IDisposable
#if DEBUG #if DEBUG
public const string RemoteUrl = "http://localhost:5415"; public const string RemoteUrl = "http://localhost:5415";
#else #else
public const string RemoteUrl = "https://pal.liza.sh"; public const string RemoteUrl = "https://connect.palacepal.com";
#endif #endif
private readonly string _userAgent = private readonly string _userAgent =
$"{typeof(RemoteApi).Assembly.GetName().Name?.Replace(" ", "")}/{typeof(RemoteApi).Assembly.GetName().Version?.ToString(2)}"; $"{typeof(RemoteApi).Assembly.GetName().Name?.Replace(" ", "")}/{typeof(RemoteApi).Assembly.GetName().Version?.ToString(2)}";