add intermediate version to allow usage for now

This commit is contained in:
Stanley Dimant
2022-08-01 11:20:22 +02:00
parent 4c2d5e2001
commit 42f598b9d5
6 changed files with 40 additions and 37 deletions

Submodule MareAPI updated: 714d990c0b...50a447c4d0

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Authors></Authors>
<Company></Company>
<Version>0.2.13.0</Version>
<Version>0.2.14.0</Version>
<Description></Description>
<Copyright></Copyright>
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>

View File

@@ -10,6 +10,7 @@ using ImGuiNET;
using MareSynchronos.Managers;
using MareSynchronos.Utils;
using MareSynchronos.Localization;
using Dalamud.Utility;
namespace MareSynchronos.UI
{
@@ -99,12 +100,12 @@ namespace MareSynchronos.UI
var textSize = ImGui.CalcTextSize(Strings.ToS.LanguageLabel);
ImGui.TextUnformatted(Strings.ToS.AgreementLabel);
if (_uiShared.UidFontBuilt) ImGui.PopFont();
ImGui.SameLine();
var languageSize = ImGui.CalcTextSize(Strings.ToS.LanguageLabel);
ImGui.SetCursorPosX(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X - languageSize.X - 80);
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + textSize.Y / 2 - languageSize.Y / 2);
ImGui.TextUnformatted(Strings.ToS.LanguageLabel);
ImGui.SameLine();
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + textSize.Y / 2 - (languageSize.Y + ImGui.GetStyle().FramePadding.Y) / 2);
@@ -113,7 +114,7 @@ namespace MareSynchronos.UI
{
GetToSLocalization(_currentLanguage);
}
ImGui.Separator();
ImGui.SetWindowFontScale(1.5f);
string readThis = Strings.ToS.ReadLabel;
@@ -262,32 +263,46 @@ namespace MareSynchronos.UI
}
else
{
UiShared.TextWrapped("You will now have to register at a service. You can use the provided central service or pick a custom one. " +
"There is no support for custom services from the plugin creator. Use at your own risk.");
UiShared.ColorTextWrapped("On registration on a service the plugin will create and save a secret key to your plugin configuration. " +
"Make a backup of your secret key. In case of loss, it cannot be restored. The secret key is your identification to the service " +
"to verify who you are. It is directly tied to the UID you will be receiving. In case of loss, you will have to re-register an account.", ImGuiColors.DalamudYellow);
UiShared.ColorTextWrapped("Do not ever, under any circumstances, share your secret key to anyone! Likewise do not share your Mare Synchronos plugin configuration to anyone!", ImGuiColors.DalamudYellow);
_uiShared.DrawServiceSelection(new Action(() => { }), true);
UiShared.TextWrapped("Registrations are currently closed. Join the Mare Synchronos server Discord for further information.");
if (ImGui.Button("Mare Synchronos Discord"))
{
Util.OpenLink("https://discord.gg/mpNdkrTRjW");
}
UiShared.TextWrapped("I'm sorry for the inconvenience caused, however the main service suffered from a DDoS-like attack a short time ago. I am currently working hard on implementing measures to avoid such issues in the future.");
UiShared.TextWrapped("You can close this window for now.");
ImGui.Separator();
UiShared.TextWrapped("If you made an account before (AND ONLY THEN) you can connect to the service using the tools provided below.");
_uiShared.DrawServiceSelection(() =>
{
SwitchToMainUi?.Invoke();
IsOpen = false;
}, true);
}
}
}
private string _secretKey = string.Empty;
private void GetToSLocalization(int changeLanguageTo = -1)
{
if (changeLanguageTo != -1)
{
_uiShared.LoadLocalization(_languages.ElementAt(changeLanguageTo).Value);
}
TosParagraphs = new[] { Strings.ToS.Paragraph1, Strings.ToS.Paragraph2, Strings.ToS.Paragraph3, Strings.ToS.Paragraph4, Strings.ToS.Paragraph5, Strings.ToS.Paragraph6 };
if (_pluginConfiguration.DarkSoulsAgreement)
{
GenerateDarkSoulsAgreementCaptcha();
}
}
private void GenerateDarkSoulsAgreementCaptcha()
{
_darkSoulsCaptcha1 = GetCaptchaTuple();

View File

@@ -41,6 +41,9 @@ namespace MareSynchronos.UI
public static bool CtrlPressed() => (GetKeyState(0xA2) & 0x8000) != 0 || (GetKeyState(0xA3) & 0x8000) != 0;
// todo remove after rework
public ApiController ApiController => _apiController;
public UiShared(IpcManager ipcManager, ApiController apiController, FileCacheManager fileCacheManager, FileDialogManager fileDialogManager, Configuration pluginConfiguration, DalamudUtil dalamudUtil, DalamudPluginInterface pluginInterface, Dalamud.Localization localization)
{
_ipcManager = ipcManager;
@@ -321,23 +324,7 @@ namespace MareSynchronos.UI
PrintServerState(isIntroUi);
if (_apiController.ServerAlive && (!_pluginConfiguration.ClientSecret.ContainsKey(_pluginConfiguration.ApiUri) || _pluginConfiguration.ClientSecret[_pluginConfiguration.ApiUri].IsNullOrEmpty()))
{
if (!_enterSecretKey)
{
if (ImGui.Button("Register"))
{
_pluginConfiguration.FullPause = false;
_pluginConfiguration.Save();
Task.Run(() => _apiController.Register(isIntroUi));
ShowClientSecret = true;
callBackOnExit?.Invoke();
}
ImGui.SameLine();
}
}
else
if (!_apiController.ServerAlive && (_pluginConfiguration.ClientSecret.ContainsKey(_pluginConfiguration.ApiUri) && !_pluginConfiguration.ClientSecret[_pluginConfiguration.ApiUri].IsNullOrEmpty()))
{
ColorTextWrapped("You already have an account on this server.", ImGuiColors.DalamudYellow);
ImGui.SameLine();
@@ -380,10 +367,10 @@ namespace MareSynchronos.UI
ImGui.SameLine();
if (_secretKey.Length > 0 && _secretKey.Length != 64)
{
ColorTextWrapped("Your secret key must be exactly 64 characters long. If try to enter your UID here, this is incorrect." +
" If you have lost your secret key, you will need to create a new account.", ImGuiColors.DalamudRed);
UiShared.ColorTextWrapped("Your secret key must be exactly 64 characters long. If try to enter your UID here, this is incorrect." +
" Don't enter anything but a prior acquired secret key here.", ImGuiColors.DalamudRed);
}
else
else if (_secretKey.Length == 64)
{
if (ImGui.Button("Save"))
{

View File

@@ -38,6 +38,7 @@ namespace MareSynchronos.WebAPI
private async Task<string> DownloadFile(int downloadId, string hash, CancellationToken ct)
{
using WebClient wc = new();
wc.Headers.Add("Authorization", SecretKey);
DownloadProgressChangedEventHandler progChanged = (s, e) =>
{
try

View File

@@ -21,8 +21,8 @@ namespace MareSynchronos.WebAPI
{
if (!ServerAlive) return;
Logger.Debug("Registering at service " + ApiUri);
var response = await _mareHub!.InvokeAsync<string>(Api.InvokeUserRegister);
_pluginConfiguration.ClientSecret[ApiUri] = response;
//var response = await _mareHub!.InvokeAsync<string>(Api.InvokeUserRegister);
//_pluginConfiguration.ClientSecret[ApiUri] = response;
_pluginConfiguration.Save();
if (!isIntroUi)
{