DreamWeave: web links open the stage site on the stage world
A launch code is minted in the shard of the world that answered /weblogin, so a DreamWeave-Stage code opened on www.acdreamweave.com reports "expired or already used". The plugin now picks www-stage.acdreamweave.com and a stage-only allowlist when the engine reports world DreamWeave-Stage; any other or unknown world keeps the live site. The world is read once so the URL and allowlist always agree. Tests pin the helpers and the plugin wiring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
8547236e48
commit
ceb2c6a14b
3 changed files with 53 additions and 6 deletions
|
|
@ -403,6 +403,10 @@ internal static class DreamWeaveWebTests
|
|||
Check.Eq(uses, 3, "launchCode: declared, filled by OnChatLine, used once (DreamWeaveWeb.LaunchUrl)");
|
||||
Check.Eq(CountOf(host, "out launchCode"), 1, "launchCode is filled only by OnChatLine");
|
||||
Check.True(host.Contains("DreamWeaveWeb.LaunchUrl(launchCode, ", StringComparison.Ordinal), "the code's one use is the launch URL");
|
||||
// Stage routing: the URL and the allowlist both come from the one world read.
|
||||
Check.True(host.Contains("DreamWeaveWeb.LaunchUrl(launchCode, d, world)", StringComparison.Ordinal), "the launch URL is built for the connected world");
|
||||
Check.True(host.Contains("DreamWeaveWeb.AllowedHostsFor(world)", StringComparison.Ordinal), "the allowlist is the same world's");
|
||||
Check.False(System.Text.RegularExpressions.Regex.IsMatch(host, @"DreamWeaveWeb\.AllowedHosts\s*[,)]"), "the live-only allowlist is never passed directly");
|
||||
|
||||
// The chat hook reads every line through the launcher, whatever the world: no Active before OnChatLine.
|
||||
List<string> chatHook = StatementsAfter(host, "private void WebChatText(string text, int chatType, ref bool eat)");
|
||||
|
|
@ -587,6 +591,23 @@ internal static class DreamWeaveWebTests
|
|||
Check.Eq(DreamWeaveWeb.LaunchUrl(Code, DreamWeaveWeb.ById("abilities")!),
|
||||
DreamWeaveWeb.SiteBase + "/launch?code=" + Code + "&to=%2Fplay%2Fabilities", "abilities opens the live class ability page");
|
||||
|
||||
// The stage world's code only redeems on the stage site, and the stage panel may only go there.
|
||||
Check.Eq(DreamWeaveWeb.LaunchUrl(Code, DreamWeaveWeb.ById("abilities")!, "DreamWeave-Stage"),
|
||||
"https://www-stage.acdreamweave.com/launch?code=" + Code + "&to=%2Fplay%2Fabilities", "stage world -> stage site");
|
||||
Check.True(DreamWeaveWeb.IsStageWorld(" dreamweave-stage "), "stage match is trimmed and case-insensitive");
|
||||
foreach (string? live in new[] { "DreamWeave", "Dream Weave", "", null, "DreamWeave-Stage2" })
|
||||
{
|
||||
Check.Eq(DreamWeaveWeb.SiteBaseFor(live), DreamWeaveWeb.SiteBase, "'" + live + "' -> live site");
|
||||
Check.True(DreamWeaveWeb.AllowedHostsFor(live) == DreamWeaveWeb.AllowedHosts, "'" + live + "' -> live allowlist");
|
||||
}
|
||||
foreach (WebDestination d in DreamWeaveWeb.Destinations)
|
||||
{
|
||||
string su = DreamWeaveWeb.LaunchUrl(Code, d, DreamWeaveWeb.StageWorldName);
|
||||
Check.True(ServerWebOpen.IsAllowedUrl(su, DreamWeaveWeb.AllowedHostsFor(DreamWeaveWeb.StageWorldName)), d.Id + ": stage url passes the stage allowlist");
|
||||
Check.True(!ServerWebOpen.IsAllowedUrl(su, DreamWeaveWeb.AllowedHosts), d.Id + ": stage url refused by the live allowlist");
|
||||
Check.True(!ServerWebOpen.IsAllowedUrl(DreamWeaveWeb.LaunchUrl(Code, d), DreamWeaveWeb.StageAllowedHosts), d.Id + ": live url refused by the stage allowlist");
|
||||
}
|
||||
|
||||
foreach (WebDestination d in DreamWeaveWeb.Destinations)
|
||||
{
|
||||
string u = DreamWeaveWeb.LaunchUrl(Code, d);
|
||||
|
|
|
|||
Loading…
Reference in a new issue