remove requirement to hold ctrl, remove puzzle
This commit is contained in:
@@ -60,8 +60,6 @@ public class Configuration : IPluginConfiguration
|
||||
private string _apiUri = string.Empty;
|
||||
[NonSerialized]
|
||||
private DalamudPluginInterface? _pluginInterface;
|
||||
|
||||
public bool DarkSoulsAgreement { get; set; } = false;
|
||||
public bool AcceptedAgreement { get; set; } = false;
|
||||
public string ApiUri
|
||||
{
|
||||
|
||||
@@ -36,9 +36,12 @@ public class FileCacheManager : IDisposable
|
||||
_configuration = configuration;
|
||||
CsvPath = Path.Combine(configDirectoryName, "FileCache.csv");
|
||||
|
||||
if (File.Exists(CsvBakPath))
|
||||
lock (_fileWriteLock)
|
||||
{
|
||||
File.Move(CsvBakPath, CsvPath, true);
|
||||
if (File.Exists(CsvBakPath))
|
||||
{
|
||||
File.Move(CsvBakPath, CsvPath, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (File.Exists(CsvPath))
|
||||
|
||||
@@ -34,33 +34,11 @@ public static class Strings
|
||||
"The service holds no information about which mod files belong to which mod.");
|
||||
|
||||
public readonly string Paragraph6 = Loc.Localize("Paragraph6",
|
||||
"This service is provided as-is. In case of abuse, contact darkarchon#4313 on Discord or join the Mare Synchronos Discord. " +
|
||||
"To accept those conditions hold CTRL while clicking 'I agree'");
|
||||
"This service is provided as-is. In case of abuse join the Mare Synchronos Discord.");
|
||||
|
||||
public readonly string AgreeLabel = Loc.Localize("AgreeLabel", "I agree");
|
||||
|
||||
public readonly string RemainingLabel = Loc.Localize("RemainingLabel", "remaining");
|
||||
|
||||
public readonly string FailedLabel = Loc.Localize("FailedLabel",
|
||||
"Congratulations. You have failed to read the agreements.");
|
||||
|
||||
public readonly string TimeoutLabel = Loc.Localize("TimeoutLabel",
|
||||
"I'm going to give you 1 minute to read the agreements carefully again. If you fail once more you will have to solve an annoying puzzle.");
|
||||
|
||||
public readonly string FailedAgainLabel = Loc.Localize("FailedAgainLabel",
|
||||
"Congratulations. You have failed to read the agreements. Again.");
|
||||
|
||||
public readonly string PuzzleLabel = Loc.Localize("PuzzleLabel",
|
||||
"I did warn you. Here's your annoying puzzle:");
|
||||
|
||||
public readonly string PuzzleDescLabel = Loc.Localize("PuzzleDescLabel",
|
||||
"Enter the following 3 words from the agreement exactly as described without punctuation to make the \"I agree\" button visible again.");
|
||||
|
||||
public readonly string ParagraphLabel = Loc.Localize("ParagraphLabel", "Paragraph");
|
||||
|
||||
public readonly string SentenceLabel = Loc.Localize("SentenceLabel", "Sentence");
|
||||
|
||||
public readonly string WordLabel = Loc.Localize("WordLabel", "Word");
|
||||
public readonly string ButtonWillBeAvailableIn = Loc.Localize("ButtonWillBeAvailableIn", "'I agree' button will be available in");
|
||||
}
|
||||
|
||||
public static ToSStrings ToS { get; set; } = new();
|
||||
|
||||
@@ -32,47 +32,15 @@
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"Paragraph6": {
|
||||
"message": "Dieser Dienst wird ohne Gewähr angeboten. Im Falle eines Missbrauchs kontaktiert darkarchon#4313 auf Discord oder tretet dem Mare Synchronos Discord bei. Um diese Konditionen zu akzeptieren, halte STRG gedrückt während du \"Ich Stimme zu\" klickst.",
|
||||
"message": "Dieser Dienst wird ohne Gewähr angeboten. Im Falle eines Missbrauchs tretet dem Mare Synchronos Discord bei.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"AgreeLabel": {
|
||||
"message": "Ich Stimme zu",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"RemainingLabel": {
|
||||
"message": "übrig",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"FailedLabel": {
|
||||
"message": "Gratulation. Du bist daran gescheitert die Nutzungsbedingungen zu lesen.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"TimeoutLabel": {
|
||||
"message": "Ich gebe dir nun 1 Minute um die Nutzungsbedingungen nochmals sorgfälig zu lesen. Falls du wieder daran scheiterst, musst du ein nerviges Puzzle lösen.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"FailedAgainLabel": {
|
||||
"message": "Gratulation. Du bist daran gescheitert die Nutzungsbedingungen zu lesen. Schon wieder.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"PuzzleLabel": {
|
||||
"message": "Ich habe dich gewarnt. Hier ist dein nerviges Puzzle:",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"PuzzleDescLabel": {
|
||||
"message": "Gib die 3 folgenden Wörter der Nutzungsbedingungen ohne Zeichensetzung exakt wie im Text ein um den \"Ich Stimme zu\" Knopf wieder sichtbar zu machen.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"ParagraphLabel": {
|
||||
"message": "Paragraph",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"SentenceLabel": {
|
||||
"message": "Satz",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"WordLabel": {
|
||||
"message": "Wort",
|
||||
"ButtonWillBeAvailableIn": {
|
||||
"message": "\"Ich stimme zu\" Knopf verfügbar in",
|
||||
"description": "ToSStrings..ctor"
|
||||
}
|
||||
}
|
||||
@@ -32,47 +32,15 @@
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"Paragraph6": {
|
||||
"message": "Ce service et ses composants vous sont fournis en l'état. En cas d'abus, veuillez contacter darkarchon#4313 sur Discord ou rejoindre le serveur Discord Mare Synchronos. Pour accepters ces conditions d'utilisation, veuillez tenir la touche CTRL enfoncée en cliquant sur le bouton 'J'accepte'.",
|
||||
"message": "Ce service et ses composants vous sont fournis en l'état. En cas d'abus rejoindre le serveur Discord Mare Synchronos.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"AgreeLabel": {
|
||||
"message": "J'accept",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"RemainingLabel": {
|
||||
"message": "restants",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"FailedLabel": {
|
||||
"message": "Bravo! Vous n'avez donc pas lu les conditions d'utilisation suffisament en détail.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"TimeoutLabel": {
|
||||
"message": "C'est pas bien grave, vous avez droit à 1 minute de répit pour vous relire et tenter une seconde fois. Si vous ignorez à nouveau les conditions d'utilisation, un petit puzzle agaçant vous sera proposé.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"FailedAgainLabel": {
|
||||
"message": "Bravo, vous avez encore ignoré les consignes écrites dans les conditions d'utilisation.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"PuzzleLabel": {
|
||||
"message": "Chose promise, chose dûe. Voici votre puzzle casse-pied:",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"PuzzleDescLabel": {
|
||||
"message": "Entrez les 3 mots suivants tirés des conditions d'utilisation, sans ponctuation, pour rendre le bouton 'J'accepte' de nouveau visible.",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"ParagraphLabel": {
|
||||
"message": "Paragraphe",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"SentenceLabel": {
|
||||
"message": "Phrase",
|
||||
"description": "ToSStrings..ctor"
|
||||
},
|
||||
"WordLabel": {
|
||||
"message": "Mot",
|
||||
"ButtonWillBeAvailableIn": {
|
||||
"message": "Bouton \"J'accept\" disposible dans",
|
||||
"description": "ToSStrings..ctor"
|
||||
}
|
||||
}
|
||||
@@ -164,6 +164,8 @@ public class CachedPlayer
|
||||
//Logger.Verbose(JsonConvert.SerializeObject(_cachedData, Formatting.Indented));
|
||||
while ((toDownloadReplacements = TryCalculateModdedDictionary(out moddedPaths)).Count > 0 && attempts++ <= 10)
|
||||
{
|
||||
downloadId = _apiController.GetDownloadId();
|
||||
|
||||
Logger.Debug("Downloading missing files for player " + PlayerName + ", kind: " + objectKind);
|
||||
if (toDownloadReplacements.Any())
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>0.5.9</Version>
|
||||
<Version>0.5.11</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Penumbra-Sync/client</PackageProjectUrl>
|
||||
|
||||
@@ -26,25 +26,12 @@ internal class IntroUi : Window, IDisposable
|
||||
|
||||
private string[] TosParagraphs;
|
||||
|
||||
private Tuple<string, string> _darkSoulsCaptcha1 = new(string.Empty, string.Empty);
|
||||
private Tuple<string, string> _darkSoulsCaptcha2 = new(string.Empty, string.Empty);
|
||||
private Tuple<string, string> _darkSoulsCaptcha3 = new(string.Empty, string.Empty);
|
||||
private string _enteredDarkSoulsCaptcha1 = string.Empty;
|
||||
private string _enteredDarkSoulsCaptcha2 = string.Empty;
|
||||
private string _enteredDarkSoulsCaptcha3 = string.Empty;
|
||||
|
||||
private bool _failedOnce = false;
|
||||
private Task _timeoutTask;
|
||||
private string _timeoutTime;
|
||||
private string _timeoutLabel;
|
||||
|
||||
private Dictionary<string, string> _languages = new(StringComparer.Ordinal) { { "English", "en" }, { "Deutsch", "de" }, { "Français", "fr" } };
|
||||
private int _currentLanguage;
|
||||
|
||||
private bool DarkSoulsCaptchaValid => string.Equals(_darkSoulsCaptcha1.Item2, _enteredDarkSoulsCaptcha1.Trim()
|
||||
, StringComparison.Ordinal) && string.Equals(_darkSoulsCaptcha2.Item2, _enteredDarkSoulsCaptcha2.Trim()
|
||||
, StringComparison.Ordinal) && string.Equals(_darkSoulsCaptcha3.Item2, _enteredDarkSoulsCaptcha3.Trim(), StringComparison.Ordinal);
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Logger.Verbose("Disposing " + nameof(IntroUi));
|
||||
@@ -93,6 +80,15 @@ internal class IntroUi : Window, IDisposable
|
||||
if (ImGui.Button("Next##toAgreement"))
|
||||
{
|
||||
_readFirstPage = true;
|
||||
_timeoutTask = Task.Run(async () =>
|
||||
{
|
||||
for (int i = 60; i > 0; i--)
|
||||
{
|
||||
_timeoutLabel = $"{Strings.ToS.ButtonWillBeAvailableIn} {i}s";
|
||||
Logger.Debug(_timeoutLabel);
|
||||
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (!_pluginConfiguration.AcceptedAgreement && _readFirstPage)
|
||||
@@ -134,63 +130,17 @@ internal class IntroUi : Window, IDisposable
|
||||
UiShared.TextWrapped(TosParagraphs[5]);
|
||||
|
||||
ImGui.Separator();
|
||||
if ((!_pluginConfiguration.DarkSoulsAgreement || DarkSoulsCaptchaValid) && (_timeoutTask?.IsCompleted ?? true))
|
||||
if (_timeoutTask?.IsCompleted ?? true)
|
||||
{
|
||||
if (ImGui.Button(Strings.ToS.AgreeLabel + "##toSetup"))
|
||||
{
|
||||
_enteredDarkSoulsCaptcha1 = string.Empty;
|
||||
_enteredDarkSoulsCaptcha2 = string.Empty;
|
||||
_enteredDarkSoulsCaptcha3 = string.Empty;
|
||||
|
||||
if (UiShared.CtrlPressed())
|
||||
{
|
||||
_pluginConfiguration.AcceptedAgreement = true;
|
||||
_pluginConfiguration.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_failedOnce)
|
||||
{
|
||||
_failedOnce = true;
|
||||
_timeoutTask = Task.Run(async () =>
|
||||
{
|
||||
for (int i = 60; i > 0; i--)
|
||||
{
|
||||
_timeoutTime = $"{i}s " + Strings.ToS.RemainingLabel;
|
||||
Logger.Debug(_timeoutTime);
|
||||
await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
_pluginConfiguration.DarkSoulsAgreement = true;
|
||||
_pluginConfiguration.Save();
|
||||
GenerateDarkSoulsAgreementCaptcha();
|
||||
}
|
||||
}
|
||||
_pluginConfiguration.AcceptedAgreement = true;
|
||||
_pluginConfiguration.Save();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_failedOnce && (!_timeoutTask?.IsCompleted ?? true))
|
||||
{
|
||||
UiShared.ColorTextWrapped(Strings.ToS.FailedLabel, ImGuiColors.DalamudYellow);
|
||||
UiShared.TextWrapped(Strings.ToS.TimeoutLabel);
|
||||
UiShared.TextWrapped(_timeoutTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
UiShared.ColorTextWrapped(Strings.ToS.FailedAgainLabel, ImGuiColors.DalamudYellow);
|
||||
UiShared.TextWrapped(Strings.ToS.PuzzleLabel);
|
||||
UiShared.TextWrapped(Strings.ToS.PuzzleDescLabel);
|
||||
ImGui.SetNextItemWidth(100);
|
||||
ImGui.InputText(_darkSoulsCaptcha1.Item1, ref _enteredDarkSoulsCaptcha1, 255);
|
||||
ImGui.SetNextItemWidth(100);
|
||||
ImGui.InputText(_darkSoulsCaptcha2.Item1, ref _enteredDarkSoulsCaptcha2, 255);
|
||||
ImGui.SetNextItemWidth(100);
|
||||
ImGui.InputText(_darkSoulsCaptcha3.Item1, ref _enteredDarkSoulsCaptcha3, 255);
|
||||
}
|
||||
UiShared.TextWrapped(_timeoutLabel);
|
||||
}
|
||||
}
|
||||
else if (_pluginConfiguration.AcceptedAgreement
|
||||
@@ -270,28 +220,5 @@ internal class IntroUi : Window, IDisposable
|
||||
}
|
||||
|
||||
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();
|
||||
_darkSoulsCaptcha2 = GetCaptchaTuple();
|
||||
_darkSoulsCaptcha3 = GetCaptchaTuple();
|
||||
}
|
||||
|
||||
private Tuple<string, string> GetCaptchaTuple()
|
||||
{
|
||||
Random random = new();
|
||||
var paragraphIdx = random.Next(TosParagraphs.Length);
|
||||
var splitParagraph = TosParagraphs[paragraphIdx].Split(".", StringSplitOptions.RemoveEmptyEntries).Select(c => c.Trim()).ToArray();
|
||||
var sentenceIdx = random.Next(splitParagraph.Length);
|
||||
var splitSentence = splitParagraph[sentenceIdx].Split(" ").Select(c => c.Trim()).Select(c => c.Replace(".", "", StringComparison.Ordinal).Replace(",", "", StringComparison.Ordinal).Replace("'", "", StringComparison.Ordinal)).ToArray();
|
||||
var wordIdx = random.Next(splitSentence.Length);
|
||||
return new($"{Strings.ToS.ParagraphLabel} {paragraphIdx + 1}, {Strings.ToS.SentenceLabel} {sentenceIdx + 1}, {Strings.ToS.WordLabel} {wordIdx + 1}", splitSentence[wordIdx]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public partial class ApiController
|
||||
Logger.Warn("Could not set download progress for " + hash);
|
||||
Logger.Warn(ex.Message);
|
||||
Logger.Warn(ex.StackTrace ?? string.Empty);
|
||||
wc.CancelAsync();
|
||||
}
|
||||
};
|
||||
wc.DownloadProgressChanged += progChanged;
|
||||
@@ -131,7 +132,6 @@ public partial class ApiController
|
||||
{
|
||||
File.Delete(tempFile);
|
||||
Logger.Debug("Detected cancellation, removing " + currentDownloadId);
|
||||
DownloadFinished?.Invoke();
|
||||
CancelDownload(currentDownloadId);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user