Complete the webinterface config panel

This commit is contained in:
Infi
2024-08-28 14:43:49 +02:00
parent 8d6f59f9fa
commit c77a1f9d2d
3 changed files with 149 additions and 40 deletions
+82 -1
View File
@@ -3407,6 +3407,51 @@ namespace ChatTwo.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to - Expect multi-boxing to work with this (only first client works).
/// </summary>
internal static string Options_Webinterface_DoNot_Multibox {
get {
return ResourceManager.GetString("Options_Webinterface_DoNot_Multibox", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to - Forward the port used (9000).
/// </summary>
internal static string Options_Webinterface_DoNot_Port {
get {
return ResourceManager.GetString("Options_Webinterface_DoNot_Port", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to - Share your authentication code with anyone else.
/// </summary>
internal static string Options_Webinterface_DoNot_Share {
get {
return ResourceManager.GetString("Options_Webinterface_DoNot_Share", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unable to resolve hostname..
/// </summary>
internal static string Options_Webinterface_Hostname_Fail {
get {
return ResourceManager.GetString("Options_Webinterface_Hostname_Fail", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Note: This will require at least a semi-modern browser in order to function correctly..
/// </summary>
internal static string Options_Webinterface_Note {
get {
return ResourceManager.GetString("Options_Webinterface_Note", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Webinterface.
/// </summary>
@@ -3417,7 +3462,43 @@ namespace ChatTwo.Resources {
}
/// <summary>
/// Looks up a localized string similar to The Webinterface is going to be started when the plugins loads..
/// Looks up a localized string similar to Do Not:.
/// </summary>
internal static string Options_Webinterface_Warning_DoNot {
get {
return ResourceManager.GetString("Options_Webinterface_Warning_DoNot", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to After checking &apos;Enabled&apos; and clicking &apos;Start&apos; this will load up Chat2&apos;s built-in web interface, which will allow devices on your network to access in-game chat. This feature may be used to allow a phone or another computer to see Chat2 activity, switch channels, and send messages as though you were typing in FFXIV itself..
/// </summary>
internal static string Options_Webinterface_Warning_Header {
get {
return ResourceManager.GetString("Options_Webinterface_Warning_Header", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to For reasons of account security, this feature is not intended for use outside of your local network, you have been warned!.
/// </summary>
internal static string Options_Webinterface_Warning_Reason {
get {
return ResourceManager.GetString("Options_Webinterface_Warning_Reason", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to No support will be provided if any of the &apos;Do Not&apos; clauses aren&apos;t respected and adhered to appropriately..
/// </summary>
internal static string Options_Webinterface_Warning_Support {
get {
return ResourceManager.GetString("Options_Webinterface_Warning_Support", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Webinterface will start alongside the plugin automatically.
/// </summary>
internal static string Options_WebinterfaceAutoStart_Description {
get {
+28 -1
View File
@@ -560,7 +560,7 @@
<value>Start automatically</value>
</data>
<data name="Options_WebinterfaceAutoStart_Description">
<value>The Webinterface is going to be started when the plugins loads.</value>
<value>Webinterface will start alongside the plugin automatically</value>
</data>
<data name="Options_OverrideStyle_Name">
<value>Override Style</value>
@@ -1336,4 +1336,31 @@
<data name="Webinterface_Option_Port_Description" xml:space="preserve">
<value>The port this webinterface will be running on.</value>
</data>
<data name="Options_Webinterface_Warning_Header" xml:space="preserve">
<value>After checking 'Enabled' and clicking 'Start' this will load up Chat2's built-in web interface, which will allow devices on your network to access in-game chat. This feature may be used to allow a phone or another computer to see Chat2 activity, switch channels, and send messages as though you were typing in FFXIV itself.</value>
</data>
<data name="Options_Webinterface_Warning_Reason" xml:space="preserve">
<value>For reasons of account security, this feature is not intended for use outside of your local network, you have been warned!</value>
</data>
<data name="Options_Webinterface_Warning_DoNot" xml:space="preserve">
<value>Do Not:</value>
</data>
<data name="Options_Webinterface_DoNot_Port" xml:space="preserve">
<value>- Forward the port used (9000)</value>
</data>
<data name="Options_Webinterface_DoNot_Share" xml:space="preserve">
<value>- Share your authentication code with anyone else</value>
</data>
<data name="Options_Webinterface_DoNot_Multibox" xml:space="preserve">
<value>- Expect multi-boxing to work with this (only first client works)</value>
</data>
<data name="Options_Webinterface_Warning_Support" xml:space="preserve">
<value>No support will be provided if any of the 'Do Not' clauses aren't respected and adhered to appropriately.</value>
</data>
<data name="Options_Webinterface_Hostname_Fail" xml:space="preserve">
<value>Unable to resolve hostname.</value>
</data>
<data name="Options_Webinterface_Note" xml:space="preserve">
<value>Note: This will require at least a semi-modern browser in order to function correctly.</value>
</data>
</root>
+39 -38
View File
@@ -16,21 +16,21 @@ internal sealed class Webinterface(Plugin plugin, Configuration mutable) : ISett
public void Draw(bool changed)
{
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudWhite, "After checking 'Enabled' and clicking 'Start' this will load up Chat2's built-in web interface, which will allow devices on your network to access in-game chat. This feature may be used to allow a phone or another computer to see Chat2 activity, switch channels, and send messages as though you were typing in FFXIV itself.");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudWhite, Language.Options_Webinterface_Warning_Header);
ImGui.Spacing();
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, "For reasons of account security, this feature is not intended for use outside of your local network, you have been warned!");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, Language.Options_Webinterface_Warning_Reason);
ImGui.Spacing();
ImGui.Spacing();
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, "Do Not:");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_Warning_DoNot);
using (ImRaii.PushIndent(15.0f))
{
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, "- Forward the port used (9000)");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, "- Share your authentication code with anyone else");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, "- Expect multi-boxing to work with this (only first client works)");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_DoNot_Port);
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_DoNot_Share);
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_DoNot_Multibox);
}
ImGui.Spacing();
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, "No support will be provided if any of the 'Do Not' clauses aren't respected and adhered to appropriately.");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, Language.Options_Webinterface_Warning_Support);
ImGui.Spacing();
ImGui.Separator();
@@ -51,6 +51,7 @@ internal sealed class Webinterface(Plugin plugin, Configuration mutable) : ISett
ImGui.Spacing();
ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, Language.Webinterface_CurrentPassword);
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(Mutable.WebinterfacePassword);
ImGui.SameLine();
if (ImGuiUtil.IconButton(FontAwesomeIcon.Recycle, tooltip: Language.Webinterface_PasswordReset_Tooltip))
@@ -62,37 +63,7 @@ internal sealed class Webinterface(Plugin plugin, Configuration mutable) : ISett
ImGui.TextUnformatted(Language.Webinterface_Controls);
using (ImRaii.PushIndent(10.0f))
{
ImGui.TextUnformatted(Language.Webinterface_Controls_Active);
ImGui.SameLine();
var isActive = Plugin.ServerCore.IsActive();
using (Plugin.FontManager.FontAwesome.Push())
using (ImRaii.PushColor(ImGuiCol.Text, isActive ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed))
{
ImGui.TextUnformatted(isActive ? FontAwesomeIcon.Check.ToIconString() : FontAwesomeIcon.Times.ToIconString());
}
Uri? uri;
try {
uri = new Uri($"http://{System.Net.Dns.GetHostName()}:{Mutable.WebinterfacePort}/");
}
catch(Exception)
{
uri = null;
}
ImGui.TextUnformatted(Language.Webinterface_Controls_Url);
ImGui.SameLine();
if (uri is not null)
{
if (ImGui.Selectable(uri.AbsoluteUri))
WrapperUtil.TryOpenURI(uri);
}
else
{
ImGui.TextUnformatted("Unable to resolve hostname.");
}
using (ImRaii.Disabled(isActive || Plugin.ServerCore.IsStopping()))
{
if (ImGui.Button(Language.Webinterface_Button_Start))
@@ -129,10 +100,40 @@ internal sealed class Webinterface(Plugin plugin, Configuration mutable) : ISett
});
}
}
ImGui.AlignTextToFramePadding();
ImGui.TextUnformatted(Language.Webinterface_Controls_Active);
ImGui.SameLine();
using (Plugin.FontManager.FontAwesome.Push())
using (ImRaii.PushColor(ImGuiCol.Text, isActive ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed))
{
ImGui.TextUnformatted(isActive ? FontAwesomeIcon.Check.ToIconString() : FontAwesomeIcon.Times.ToIconString());
}
Uri? uri;
try {
uri = new Uri($"http://{System.Net.Dns.GetHostName()}:{Mutable.WebinterfacePort}/");
}
catch(Exception)
{
uri = null;
}
ImGui.TextUnformatted(Language.Webinterface_Controls_Url);
ImGui.SameLine();
if (uri is not null)
{
if (ImGui.Selectable(uri.AbsoluteUri))
WrapperUtil.TryOpenURI(uri);
}
else
{
ImGui.TextUnformatted(Language.Options_Webinterface_Hostname_Fail);
}
}
ImGui.Spacing();
ImGui.Spacing();
ImGuiUtil.WrappedTextWithColor(ImGuiColors.HealerGreen, "Note: This will require at least a semi-modern browser in order to function correctly.");
ImGuiUtil.WrappedTextWithColor(ImGuiColors.HealerGreen, Language.Options_Webinterface_Note);
}
}