RynthServers/Plugins/RynthCore.Plugin.RynthDreamWeave/DreamWeave/DreamWeaveWeb.cs
Daniel Wallace d70f780e60 RynthDreamWeave: Task 6 re-review, close the source-scan gaps
- Calls: one CallPattern for the lock and Draw allow-lists, which also
  reads "?." member chains and a type-argument list before "(", so
  Reply?.Fail( and Notify<int>( count as non-launcher calls.
- Monitor is banned in WebButtons.cs and DreamWeaveWebTools.cs; the host
  takes the launcher's lock in exactly 9 places, and each lock body is
  pinned exactly (no host property read under it either).
- ServerChatText: everything before its first lock is pinned exactly
  (declarations only), so no gate, return or throw can come before the
  launcher reads the line.
- WebLauncher.cs holds no Action, Func or delegate; any scanned file
  with a raw string literal fails, since the scan does not model them.
- Usage: "Market, Suit Builder or Ability Planner". The shared two lines
  are unchanged.

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

49 lines
2.4 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 "/rserver" usage line for the destinations' verbs (ServerUsageLines).</summary>
public static string UsageLine()
{
var ids = new string[Destinations.Length];
var labels = new string[Destinations.Length];
for (int i = 0; i < Destinations.Length; i++) { ids[i] = Destinations[i].Id; labels[i] = Destinations[i].Label; }
string choices = labels.Length < 2 ? string.Join("", labels)
: string.Join(", ", labels, 0, labels.Length - 1) + " or " + labels[labels.Length - 1];
return "/rserver " + string.Join(" | ", ids) + " - open the website's " + choices + ", logged in as this account.";
}
/// <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);
}