RynthServers/Plugins/RynthCore.Plugin.RynthDreamWeave/DreamWeave/DreamWeaveWeb.cs
Daniel Wallace fbd6458a0f RynthDreamWeave: web destinations and the launch reply's wire text
DreamWeaveWeb (constants-only destinations and launch URL) and LaunchWire
(/weblogin request, [WEB] reply parser that refuses player-authored copies).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:20:38 -08:00

38 lines
1.7 KiB
C#

// DreamWeave's website destinations: where each button goes. The host and the paths are constants
// (the site's registry: dreamweave-market Source/ACE.Market/Site/SiteTools.cs and HostRouting.cs);
// nothing here is ever read from chat. Pure, so RynthServerPack.Tests compiles it directly.
using System;
namespace RynthCore.Plugin.RynthDreamWeave;
/// <summary>One website page a DreamWeave button opens.</summary>
internal sealed record WebDestination(string Id, string Label, string Path, string Tooltip);
internal static class DreamWeaveWeb
{
public const string SiteBase = "https://www.acdreamweave.com";
/// <summary>The only host the panel or the browser may be sent to.</summary>
public static readonly string[] AllowedHosts = { "www.acdreamweave.com" };
public const string PanelTitle = "DreamWeave";
public static readonly WebDestination[] Destinations =
{
new("market", "Market", "/market", "The player market, logged in as this account."),
new("suit", "Suit Builder", "/tools/suit", "Plan a suit from this account's characters."),
new("abilities", "Ability Planner", "/tools/abilities", "Plan a class ability build."),
};
public static WebDestination? ById(string? id)
{
if (string.IsNullOrEmpty(id)) return null;
foreach (WebDestination d in Destinations)
if (string.Equals(d.Id, id, StringComparison.OrdinalIgnoreCase)) return d;
return null;
}
/// <summary>The sign-in URL for a destination. The caller has already checked the code with LaunchWire.</summary>
public static string LaunchUrl(string code, WebDestination d)
=> SiteBase + "/launch?code=" + code + "&to=" + Uri.EscapeDataString(d.Path);
}