ludicord 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/compiler/build.js +5 -0
- package/dist/compiler/client-entry.js +7 -1
- package/dist/docs/README.md +1 -1
- package/dist/docs/activity-rooms.md +1 -1
- package/dist/docs/ai-agents.md +28 -7
- package/dist/docs/api-reference.md +2 -2
- package/dist/docs/api-routes.md +1 -1
- package/dist/docs/build.md +1 -1
- package/dist/docs/cli.md +2 -2
- package/dist/docs/configuration.md +1 -1
- package/dist/docs/deployment.md +4 -2
- package/dist/docs/development.md +2 -2
- package/dist/docs/discord-developer-portal.md +1 -1
- package/dist/docs/discord-sdk.md +1 -1
- package/dist/docs/distribution.md +1 -1
- package/dist/docs/embeds.md +1 -1
- package/dist/docs/environment-variables.md +4 -2
- package/dist/docs/getting-started.md +1 -1
- package/dist/docs/installation.md +2 -2
- package/dist/docs/login.md +1 -1
- package/dist/docs/migration.md +5 -5
- package/dist/docs/mobile-layout.md +1 -1
- package/dist/docs/navigation.md +1 -1
- package/dist/docs/pages.md +1 -1
- package/dist/docs/participants.md +1 -1
- package/dist/docs/prefix-router.md +1 -1
- package/dist/docs/project-structure.md +1 -1
- package/dist/docs/recipes.md +1 -1
- package/dist/docs/security.md +4 -2
- package/dist/docs/start.md +1 -1
- package/dist/docs/state-and-effects.md +1 -1
- package/dist/docs/troubleshooting.md +2 -1
- package/dist/docs/voice-events.md +1 -1
- package/dist/docs/websockets.md +1 -1
- package/dist/lint/index.js +1 -1
- package/dist/runtime/server/production-server.js +34 -5
- package/dist/server/request-security.js +2 -1
- package/dist/skills/ludicord/SKILL.md +5 -5
- package/dist/skills/ludicord/manifest.yaml +1 -1
- package/dist/skills/ludicord/references/auth-security.md +5 -3
- package/dist/skills/ludicord/references/config-deploy.md +5 -1
- package/dist/skills/ludicord/references/intelligence/skill-router.md +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Discord helpers include complete raw user/channel/guild/member/role/participant/
|
|
|
34
34
|
|
|
35
35
|
Activity hooks add application-, instance-, user-, guild-, and channel-scoped persistence, cached queries, lifecycle readiness, raw Discord-event callbacks, presence summaries, animation frames, and revision-safe shared instance state. Use normal React state for local UI and these helpers where Discord Activity behavior needs a framework-owned lifecycle.
|
|
36
36
|
|
|
37
|
-
V4 adds independently mounted pathname scopes, prefix-aware generated types, `PrefixLink`, `prefixHref()`, `useActivityPrefix()`, `usePageParams()`, project-root `@/` imports, listener-first compiler recovery, a PAGE/HTTP/SOCKET/EMBED route table, and a redesigned development diagnostics surface. Read the [V4 Prefix Router guide](https://github.com/mrcholer/ludicord/blob/main/docs/prefix-router.md), [migration guide](https://github.com/mrcholer/ludicord/blob/main/docs/migration-v4.md), and [4.0.
|
|
37
|
+
V4 adds independently mounted pathname scopes, prefix-aware generated types, `PrefixLink`, `prefixHref()`, `useActivityPrefix()`, `usePageParams()`, project-root `@/` imports, listener-first compiler recovery, a PAGE/HTTP/SOCKET/EMBED route table, and a redesigned development diagnostics surface. Ludicord 4.0.1 fixes Discord iframe navigation and keeps the runtime Discord application ID consistent across the client, HTTP, authentication, and WebSockets. Read the [V4 Prefix Router guide](https://github.com/mrcholer/ludicord/blob/main/docs/prefix-router.md), [migration guide](https://github.com/mrcholer/ludicord/blob/main/docs/migration-v4.md), and [4.0.1 release notes](https://github.com/mrcholer/ludicord/blob/main/releases/v4/4.0.1.md).
|
|
38
38
|
|
|
39
39
|
V4 includes the production authentication, Activity-launch isolation, realtime reliability, and multi-process adapters introduced in 3.1.
|
|
40
40
|
|
package/dist/compiler/build.js
CHANGED
|
@@ -22,6 +22,11 @@ const STALE_BUILD_DIRECTORY = /^\.ludicord-(?:build|previous)-\d+-[0-9a-f-]+$/i;
|
|
|
22
22
|
const STALE_BUILD_AGE_MS = 24 * 60 * 60 * 1_000;
|
|
23
23
|
function frameworkWarnings(config, manifests) {
|
|
24
24
|
const warnings = [];
|
|
25
|
+
const usesDiscordActivityOrigins = config.server.allowedOrigins === "discord-activity" ||
|
|
26
|
+
(Array.isArray(config.server.allowedOrigins) && config.server.allowedOrigins.includes("discord-activity"));
|
|
27
|
+
if (usesDiscordActivityOrigins && config.discord.clientId === undefined) {
|
|
28
|
+
warnings.push("LUDICORD_DISCORD_CLIENT_ID is missing. Provide it at build time or production start so Discord Activity HTTP, auth, and WebSocket connections use the same application origin.");
|
|
29
|
+
}
|
|
25
30
|
if (config.discord.auth.required) {
|
|
26
31
|
if (config.discord.auth.activityInstanceVerification === false) {
|
|
27
32
|
warnings.push("Discord Activity instance verification is disabled. Browser-provided guild, channel, and instance identity is not authoritative.");
|
|
@@ -94,7 +94,13 @@ const normalizePrefix = (value) => {
|
|
|
94
94
|
};
|
|
95
95
|
const activePrefix = normalizePrefix(window.location.pathname);
|
|
96
96
|
const selectedPage = matchPageRoute(Object.keys(prefixScopes).map((prefix) => ({ prefix })), activePrefix);
|
|
97
|
-
|
|
97
|
+
let runtimePublicConfig = {};
|
|
98
|
+
const runtimePublicConfigElement = document.getElementById("ludicord-runtime-config");
|
|
99
|
+
if (runtimePublicConfigElement?.textContent) {
|
|
100
|
+
try { runtimePublicConfig = JSON.parse(runtimePublicConfigElement.textContent); }
|
|
101
|
+
catch { runtimePublicConfig = {}; }
|
|
102
|
+
}
|
|
103
|
+
globalThis.__LUDICORD_PUBLIC_CONFIG__ = { ...${JSON.stringify(publicConfig)}, ...runtimePublicConfig };
|
|
98
104
|
globalThis.__LUDICORD_ACTIVE_PREFIX__ = activePrefix;
|
|
99
105
|
globalThis.__LUDICORD_PAGE_PARAMS__ = selectedPage?.match.params ?? {};
|
|
100
106
|
installLudicordLaunchIsolation();
|
package/dist/docs/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Ludicord documentation
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
## Learn Ludicord
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Activity Rooms
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Every authenticated WebSocket client can join the Activity Instance room:
|
package/dist/docs/ai-agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI coding agents
|
|
2
2
|
|
|
3
|
-
Ludicord 4.0.
|
|
3
|
+
Ludicord 4.0.1 ships documentation and agent skills with the npm package. They
|
|
4
4
|
are available offline and change together with the installed framework:
|
|
5
5
|
|
|
6
6
|
```text
|
|
@@ -21,6 +21,18 @@ reusable skill stay under `dist/`. Upgrading Ludicord upgrades all of these
|
|
|
21
21
|
resources. The generated application receives no extra agent file, and no
|
|
22
22
|
postinstall hook or external docs download is required.
|
|
23
23
|
|
|
24
|
+
## Install from skills.sh
|
|
25
|
+
|
|
26
|
+
Install the public skill from the canonical repository:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx skills add mrcholer/ludicord --skill ludicord
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The searchable listing is [Ludicord on skills.sh](https://skills.sh/mrcholer/ludicord/ludicord).
|
|
33
|
+
The public copy helps discovery, while the skill under
|
|
34
|
+
`node_modules/ludicord/dist/skills/` stays version-matched to the project.
|
|
35
|
+
|
|
24
36
|
For an existing project, add this instruction to its existing `AGENTS.md`,
|
|
25
37
|
preserving the project's own rules:
|
|
26
38
|
|
|
@@ -36,15 +48,24 @@ package manager uses a different layout, locate `ludicord/package.json` with
|
|
|
36
48
|
the project's resolver and read `dist` beside it. Read only task-relevant
|
|
37
49
|
references; do not load the entire documentation tree on every request.
|
|
38
50
|
|
|
39
|
-
##
|
|
51
|
+
## Additional pathname pages are optional
|
|
40
52
|
|
|
41
53
|
Agents should keep ordinary applications on `app/page.tsx` and `app/`.
|
|
42
|
-
|
|
43
|
-
or an important requirement needs distinct pathname entry points,
|
|
44
|
-
provider lifetimes. Explain that requirement before creating
|
|
45
|
-
upgrade, additional screens, realtime, or a deep directory tree
|
|
46
|
-
justify one.
|
|
54
|
+
Add another pathname page only when project scale calls for independent product
|
|
55
|
+
surfaces, or an important requirement needs distinct pathname entry points,
|
|
56
|
+
shells, or provider lifetimes. Explain that requirement before creating the
|
|
57
|
+
page. A v4 upgrade, additional screens, realtime, or a deep directory tree
|
|
58
|
+
alone does not justify one. There is no structural `prefix/` folder in unified
|
|
59
|
+
mode. See [Page scopes and unified routing](prefix-router.md) when it applies.
|
|
47
60
|
|
|
48
61
|
Installed declarations and generated route types take precedence over older
|
|
49
62
|
online guidance or a globally installed skill. For v3 applications, use the
|
|
50
63
|
matching v3 docs instead of adding v4-only imports.
|
|
64
|
+
|
|
65
|
+
Use this authority order when sources disagree:
|
|
66
|
+
|
|
67
|
+
1. installed declarations and `ludicord.generated.d.ts`;
|
|
68
|
+
2. matching files in `node_modules/ludicord/dist/docs/`;
|
|
69
|
+
3. the bundled skill;
|
|
70
|
+
4. public docs and the skills.sh copy;
|
|
71
|
+
5. remembered examples from another Ludicord release.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Public API reference
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
This page describes supported import paths and their purpose. The package includes TypeScript declarations for exact signatures and data shapes; use editor completion against the version you actually installed.
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ This page describes supported import paths and their purpose. The package includ
|
|
|
15
15
|
|
|
16
16
|
The compiler supplies the minimize provider for automatic files; do not manually wrap it just to use `app/minimize.tsx`. See [automatic files](pages.md) and [navigation](navigation.md).
|
|
17
17
|
|
|
18
|
-
`PrefixLink` and `prefixHref()` navigate between pathname-owned Activity
|
|
18
|
+
`PrefixLink` and `prefixHref()` navigate between pathname-owned Activity pages. `Link` and `useEmbedRouter()` navigate among local embeds without remounting the active page. Read [Page scopes and unified routing](prefix-router.md) before constructing cross-page URLs.
|
|
19
19
|
|
|
20
20
|
## Authentication
|
|
21
21
|
|
package/dist/docs/api-routes.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# API Routes
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Create a `route.ts` anywhere under `app/`. For example, `app/api/hello/route.ts` serves `/api/hello`; `app/health/route.ts` serves `/health`. The `api/` directory is optional. Do not place another route file in the same directory.
|
package/dist/docs/build.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Build
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
```bash
|
package/dist/docs/cli.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CLI reference
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
Run commands through your generated package scripts or the locally installed `ludicord` executable.
|
|
6
6
|
|
|
@@ -27,7 +27,7 @@ npx ludicord start --port 3000
|
|
|
27
27
|
|
|
28
28
|
Use `npx ludicord` inside an application where the package is already installed. Review diagnostics before sharing them publicly.
|
|
29
29
|
|
|
30
|
-
Generated V4 projects intentionally keep only `dev`, `build`, and `start` in `package.json`. Run advanced commands through the project's package runner, for example `pnpm exec ludicord routes` or `npx ludicord lint`. In V4, `routes` prints the
|
|
30
|
+
Generated V4 projects intentionally keep only `dev`, `build`, and `start` in `package.json`. Run advanced commands through the project's package runner, for example `pnpm exec ludicord routes` or `npx ludicord lint`. In V4, `routes` prints the page and embed ownership tree, and `info` reports the page-scope count and total owned embeds. Use `ludicord --help` as the authority for flags supported by the installed version.
|
|
31
31
|
|
|
32
32
|
## Project generator
|
|
33
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Configuration reference
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
Create `ludicord.config.mjs` in the application root:
|
|
6
6
|
|
package/dist/docs/deployment.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Deployment
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Deploy Ludicord to a Node.js 20.19+ environment that supports long-lived HTTP upgrades for WebSockets.
|
|
7
7
|
|
|
8
8
|
1. Install with a locked dependency file.
|
|
9
|
-
2. Set server-only environment variables in the hosting platform.
|
|
9
|
+
2. Set server-only environment variables and `LUDICORD_DISCORD_CLIENT_ID` in the hosting platform.
|
|
10
10
|
3. Run `ludicord build` during the build stage.
|
|
11
11
|
4. Persist the generated `.ludicord` directory into the runtime image.
|
|
12
12
|
5. Run `ludicord start` and route both HTTP and WebSocket traffic to the same port.
|
|
@@ -14,6 +14,8 @@ Deploy Ludicord to a Node.js 20.19+ environment that supports long-lived HTTP up
|
|
|
14
14
|
|
|
15
15
|
Do not place a CDN cache in front of `/_ludicord/auth`, authenticated `/api/*`, or `/ws/*`. If a reverse proxy terminates TLS, preserve the host/protocol headers and WebSocket upgrade headers. Sessions use secure partitioned cookies in production, so test the final iframe origin rather than only a direct server URL.
|
|
16
16
|
|
|
17
|
+
The Client ID can be present during the build or supplied to `ludicord start`. A runtime value takes precedence and is injected into the Activity document, allowing one promoted build to run against the intended Discord application. The same effective ID protects HTTP, authentication, and WebSocket requests. With the default origin policy, the exact Activity proxy origin is `https://<clientId>.discordsays.com`; do not add a wildcard for all Discord applications.
|
|
18
|
+
|
|
17
19
|
The built-in session, OAuth-token, WebSocket, and shared-state implementations are process-local. Multiple replicas should use a custom launcher:
|
|
18
20
|
|
|
19
21
|
```ts
|
package/dist/docs/development.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Development runtime
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
`ludicord dev` owns the HTTP server, API routes, WebSockets, React hot updates, and diagnostics. It binds and announces the local URL before the initial compilation, then reports a clear `listening` → `compiling` → `ready` lifecycle. Requests wait for that first compilation instead of racing an incomplete server:
|
|
@@ -24,4 +24,4 @@ Ludicord's development panel handles syntax, TypeScript, render, event-handler,
|
|
|
24
24
|
|
|
25
25
|
Successful server graph rebuilds remove obsolete temporary bundles; failed rebuilds keep the last working graph. The current run directory is removed on shutdown. Vite remains an internal compiler, not a separate developer-facing server. `vite.config.ts` is unnecessary and ignored. Tailwind is detected when `@tailwindcss/vite` is installed in the app.
|
|
26
26
|
|
|
27
|
-
Run `ludicord routes` to inspect recursive
|
|
27
|
+
Run `ludicord routes` to inspect recursive page and embed ownership, `ludicord info` for environment and project details, `ludicord lint` for React Hooks rules, and `ludicord build` for the complete production validation and client-secret scan.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Discord Developer Portal Setup
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
1. Create a Discord application and enable Activities.
|
package/dist/docs/discord-sdk.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Discord SDK
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Ludicord uses the official `@discord/embedded-app-sdk` package and initializes one SDK instance per Activity. `LudicordActivity` waits for SDK readiness before authentication and reuses shared subscriptions rather than registering one listener per component.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Package distribution and automated releases
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
Ludicord uses a two-stage release pipeline so its public package links and npm provenance are correct without publishing the original TypeScript implementation.
|
|
6
6
|
|
package/dist/docs/embeds.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Embeds
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
An embed is an internal Activity screen owned by its nearest ancestor page. Create `app/home/embed.tsx` for the root page:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Environment Variables
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
```env
|
|
@@ -20,7 +20,7 @@ LUDICORD_DISCORD_PUBLIC_KEY=
|
|
|
20
20
|
# LUDICORD_DEV_SCOPES=identify
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
- `LUDICORD_DISCORD_CLIENT_ID` is the public Discord application/client ID and may reach the client
|
|
23
|
+
- `LUDICORD_DISCORD_CLIENT_ID` is the public Discord application/client ID and may reach the client. Set it during the build or when `ludicord start` launches. A runtime value takes precedence over build metadata and is used consistently by the browser SDK, HTTP security, authentication, and WebSocket upgrades.
|
|
24
24
|
- `LUDICORD_DISCORD_CLIENT_SECRET` is the OAuth2 Client Secret. It is server-only.
|
|
25
25
|
- `LUDICORD_SESSION_SECRET` encrypts and authenticates session state. Use at least 32 random characters and keep it server-only.
|
|
26
26
|
- `LUDICORD_DISCORD_PUBLIC_KEY` enables optional Ed25519 proxy-request verification.
|
|
@@ -28,3 +28,5 @@ LUDICORD_DISCORD_PUBLIC_KEY=
|
|
|
28
28
|
- `LUDICORD_DEV_*` values customize the fake identity created by `ludicord dev`. Production never accepts a development session.
|
|
29
29
|
|
|
30
30
|
Use `.env.local` for local secrets and keep it out of source control. Commit only `.env.example` with empty values. `ludicord build` scans client output for actual server secret values and fails if one leaked.
|
|
31
|
+
|
|
32
|
+
When `server.allowedOrigins` uses the default `"discord-activity"` policy, the production server needs a Client ID from build metadata or its runtime environment. Ludicord warns when neither source provides one because it cannot derive the exact `https://<clientId>.discordsays.com` origin.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Getting Started
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Create an Activity and start the development server:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Installation
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Node.js 20.19 or newer is required. A new project is the simplest installation:
|
|
7
7
|
|
|
8
|
-
The commands below install the latest **published** release.
|
|
8
|
+
The commands below install the latest **published** release. Confirm the registry reports 4.0.1 before upgrading a production deployment.
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
11
|
npx create-ludicord-app my-activity
|
package/dist/docs/login.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Login and sessions
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Ludicord authentication follows the Embedded App SDK authorization-code flow:
|
package/dist/docs/migration.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
# Upgrading to Ludicord 4.0.
|
|
1
|
+
# Upgrading to Ludicord 4.0.1
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
|
-
Check that both 4.0.
|
|
5
|
+
Check that both 4.0.1 packages are available before upgrading:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm view ludicord version
|
|
9
9
|
npm view create-ludicord-app version
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Update an existing application's framework dependency with `npm install ludicord@4.0.
|
|
12
|
+
Update an existing application's framework dependency with `npm install ludicord@4.0.1` (or your package-manager equivalent), update its lockfile, and create a fresh production build. The generator is for new projects; do not run it over an existing non-empty application. Existing V3 trees remain supported through legacy compatibility mode; follow [the routing migration](migration-v4.md) before switching file conventions.
|
|
13
13
|
|
|
14
14
|
## Review your application
|
|
15
15
|
|
|
@@ -42,4 +42,4 @@ Update an existing application's framework dependency with `npm install ludicord
|
|
|
42
42
|
- Every expected prefix pathname and default embed URL returns the correct shell.
|
|
43
43
|
- Unknown production prefixes return 404 instead of falling through to an unrelated scope.
|
|
44
44
|
|
|
45
|
-
Back up your current lockfile and keep the last deployable build for rollback. Review the detailed [V4 migration guide](migration-v4.md), [
|
|
45
|
+
Back up your current lockfile and keep the last deployable build for rollback. Review the detailed [V4 migration guide](migration-v4.md), [page scopes and unified routing](prefix-router.md), [4.0.1 release notes](https://github.com/mrcholer/ludicord/blob/main/releases/v4/4.0.1.md), [security](security.md), and [deployment](deployment.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Mobile and Layout
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Ludicord installs four CSS custom properties:
|
package/dist/docs/navigation.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Navigation and generated route types
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Inside one prefix scope, use the Ludicord embed router. The current local embed is synchronized through the hash (`#/profile/user-one`) for deep links and browser back/forward, and hashes are validated against that prefix's generated registry:
|
package/dist/docs/pages.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pages: page.tsx
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
A default-exported React component in `app/page.tsx` renders at `/`. Nested `page.tsx` files render at their directory paths. A page can render plain UI without any embed:
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Participants
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
```tsx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Page scopes and optional prefix navigation
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
## Choose the simplest structure
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Project structure
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
The `app/` tree is the router. These four files define routes:
|
|
6
6
|
|
package/dist/docs/recipes.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Usage recipes
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
These small application examples illustrate the public API. They are not framework implementation or complete production applications.
|
|
6
6
|
|
package/dist/docs/security.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# Security
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Ludicord encrypts and authenticates session cookies with AES-256-GCM, validates OAuth state, keeps server secrets out of React stores, requires sessions for API and WebSocket routes by default, and scans production client output for actual secret values.
|
|
7
7
|
|
|
8
|
-
HTTP requests and WebSocket upgrades share the same boundary checks. `server.allowedOrigins` defaults to `"discord-activity"`, which accepts same-origin requests and the configured application's exact `https://<clientId>.discordsays.com` proxy origin. Ludicord derives the hostname from `discord.clientId` or `LUDICORD_DISCORD_CLIENT_ID` and never trusts a wildcard for other applications. Use `"same-origin"` for a host-only policy. An origin array must include `"same-origin"` and `"discord-activity"` explicitly when both built-in policies should remain active alongside additional trusted HTTPS origins. `server.allowedHosts` can restrict the `Host` header to production and tunnel hostnames; `true` accepts every host and produces a production warning.
|
|
8
|
+
HTTP requests and WebSocket upgrades share the same boundary checks. `server.allowedOrigins` defaults to `"discord-activity"`, which accepts same-origin requests and the configured application's exact `https://<clientId>.discordsays.com` proxy origin. Ludicord derives the hostname from `discord.clientId` or `LUDICORD_DISCORD_CLIENT_ID` and never trusts a wildcard for other applications. The initial Discord iframe navigation is a safe `GET` request and browsers may omit its `Origin` header, so Ludicord permits origin-less `GET` and `HEAD` navigation. Cross-site mutation requests without an allowed `Origin` remain blocked. Use `"same-origin"` for a host-only policy. An origin array must include `"same-origin"` and `"discord-activity"` explicitly when both built-in policies should remain active alongside additional trusted HTTPS origins. `server.allowedHosts` can restrict the `Host` header to production and tunnel hostnames; `true` accepts every host and produces a production warning.
|
|
9
|
+
|
|
10
|
+
In production, `LUDICORD_DISCORD_CLIENT_ID` may be supplied when the server starts. That effective runtime ID is injected into the served Activity document and reused by HTTP, authentication, and WebSocket origin checks. This keeps promoted build artifacts consistent with the Discord application that runs them.
|
|
9
11
|
|
|
10
12
|
Large Discord payloads are not copied into the browser cookie. Compact trusted claims plus an opaque data key remain in the encrypted cookie, while complete `.raw` objects use a bounded server-side `LudicordSessionDataStore`. Losing that enrichment never converts untrusted browser data into an authenticated claim.
|
|
11
13
|
|
package/dist/docs/start.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Start
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Build once, then run the existing output:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# React state and effects
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
Ludicord is React, so ordinary React state is the first choice for ordinary interface state. Framework hooks add Activity-aware lifecycles; they do not replace `useState`, `useReducer`, or correct effect cleanup.
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Run the checks relevant to the failure:
|
|
@@ -27,6 +27,7 @@ Start with the first mapped compile diagnostic rather than restarting repeatedly
|
|
|
27
27
|
- WebSocket closes immediately: the browser needs a valid Ludicord session cookie and an instance context.
|
|
28
28
|
- Voice hooks are empty: request `rpc.voice.read` and inspect `useDiscordDiagnostics()`.
|
|
29
29
|
- Activity works in a browser but not Discord: verify HTTPS tunnel reachability and the `/` URL Mapping target.
|
|
30
|
+
- `LUDICORD_ORIGIN_NOT_ALLOWED`: upgrade to Ludicord 4.0.1 or newer, verify that `LUDICORD_DISCORD_CLIENT_ID` exactly matches the Discord application, and restart the production server. Initial iframe `GET` navigation may omit `Origin`; API mutations and WebSocket upgrades must still match the configured application's `https://<clientId>.discordsays.com` origin.
|
|
30
31
|
- `LUDICORD3001`: run `ludicord build` before `ludicord start`.
|
|
31
32
|
- Signature verification fails: preserve the exact raw request body and Discord signature/timestamp headers through any reverse proxy.
|
|
32
33
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Voice Events
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Request the `rpc.voice.read` scope, then use:
|
package/dist/docs/websockets.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# WebSockets
|
|
2
2
|
|
|
3
|
-
> Documentation for Ludicord 4.0.
|
|
3
|
+
> Documentation for Ludicord 4.0.1. See [release status](https://github.com/mrcholer/ludicord/blob/main/releases/README.md).
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
Create `app/ws/presence/socket.ts` for `/ws/presence`, or `app/live/socket.ts` for `/live`. The `ws/` folder is optional. A directory may contain only one route file. Use the full discovered URL in `useWS()`; no `/ws` prefix is added automatically.
|
package/dist/lint/index.js
CHANGED
|
@@ -45,7 +45,7 @@ export async function lintLudicordProject(projectRoot) {
|
|
|
45
45
|
ludicord: {
|
|
46
46
|
processors: {
|
|
47
47
|
conventions: {
|
|
48
|
-
meta: { name: "ludicord-conventions", version: "4.0.
|
|
48
|
+
meta: { name: "ludicord-conventions", version: "4.0.1" },
|
|
49
49
|
preprocess: (source, filename) => [normalizeConventionComponent(source, filename)],
|
|
50
50
|
postprocess: (messages) => messages[0] ?? [],
|
|
51
51
|
supportsAutofix: false,
|
|
@@ -16,6 +16,28 @@ import { formatPrefixTable, formatRouteTable, matchPageRoute, normalizeActivityP
|
|
|
16
16
|
function readJson(file) {
|
|
17
17
|
return JSON.parse(readFileSync(file, "utf8"));
|
|
18
18
|
}
|
|
19
|
+
function runtimeDiscordClientId(buildClientId) {
|
|
20
|
+
const runtimeClientId = process.env.LUDICORD_DISCORD_CLIENT_ID?.trim();
|
|
21
|
+
if (runtimeClientId !== undefined && runtimeClientId !== "")
|
|
22
|
+
return runtimeClientId;
|
|
23
|
+
const normalizedBuildClientId = buildClientId?.trim();
|
|
24
|
+
return normalizedBuildClientId === "" ? undefined : normalizedBuildClientId;
|
|
25
|
+
}
|
|
26
|
+
function injectRuntimePublicConfig(indexHtml, discordClientId) {
|
|
27
|
+
if (discordClientId === undefined)
|
|
28
|
+
return indexHtml;
|
|
29
|
+
const serialized = JSON.stringify({ discordClientId })
|
|
30
|
+
.replaceAll("<", "\\u003c")
|
|
31
|
+
.replaceAll(">", "\\u003e")
|
|
32
|
+
.replaceAll("&", "\\u0026");
|
|
33
|
+
const runtimeConfig = `<script id="ludicord-runtime-config" type="application/json">${serialized}</script>`;
|
|
34
|
+
return indexHtml.includes("</head>")
|
|
35
|
+
? indexHtml.replace("</head>", ` ${runtimeConfig}\n </head>`)
|
|
36
|
+
: `${runtimeConfig}\n${indexHtml}`;
|
|
37
|
+
}
|
|
38
|
+
function usesDiscordActivityOrigins(allowedOrigins) {
|
|
39
|
+
return allowedOrigins === "discord-activity" || (Array.isArray(allowedOrigins) && allowedOrigins.includes("discord-activity"));
|
|
40
|
+
}
|
|
19
41
|
function loadProductionBuild(projectRoot) {
|
|
20
42
|
const output = path.join(projectRoot, ".ludicord");
|
|
21
43
|
const buildFile = path.join(output, "build.json");
|
|
@@ -56,9 +78,10 @@ export async function createLudicordProductionServer(options) {
|
|
|
56
78
|
const projectRoot = path.resolve(options.projectRoot);
|
|
57
79
|
loadProjectEnvironment(projectRoot, "production");
|
|
58
80
|
const { output, metadata, manifests } = loadProductionBuild(projectRoot);
|
|
81
|
+
const discordClientId = runtimeDiscordClientId(metadata.config.discord.clientId);
|
|
59
82
|
const app = express();
|
|
60
83
|
app.set("env", "production");
|
|
61
|
-
app.use(createLudicordRequestSecurity(metadata.config.server.allowedHosts, metadata.config.server.allowedOrigins,
|
|
84
|
+
app.use(createLudicordRequestSecurity(metadata.config.server.allowedHosts, metadata.config.server.allowedOrigins, discordClientId));
|
|
62
85
|
const httpServer = createServer(app);
|
|
63
86
|
const sockets = new Set();
|
|
64
87
|
let draining = false;
|
|
@@ -115,9 +138,9 @@ export async function createLudicordProductionServer(options) {
|
|
|
115
138
|
}
|
|
116
139
|
};
|
|
117
140
|
app.use("/_ludicord/auth", createLudicordAuthRouter({
|
|
118
|
-
...(
|
|
141
|
+
...(discordClientId === undefined
|
|
119
142
|
? {}
|
|
120
|
-
: { clientId:
|
|
143
|
+
: { clientId: discordClientId }),
|
|
121
144
|
production: true,
|
|
122
145
|
activityInstanceVerification: metadata.config.discord.activityInstanceVerification,
|
|
123
146
|
activityInstanceCacheTtlMs: metadata.config.discord.activityInstanceCacheTtlMs,
|
|
@@ -176,14 +199,17 @@ export async function createLudicordProductionServer(options) {
|
|
|
176
199
|
allowDevelopmentSessions: false,
|
|
177
200
|
allowedHosts: metadata.config.server.allowedHosts,
|
|
178
201
|
allowedOrigins: metadata.config.server.allowedOrigins,
|
|
179
|
-
...(
|
|
202
|
+
...(discordClientId === undefined ? {} : { discordClientId }),
|
|
180
203
|
...(options.websocketAdapter === undefined ? {} : { adapter: options.websocketAdapter }),
|
|
181
204
|
requireVerifiedActivitySessions: metadata.config.discord.activityInstanceVerification === true ||
|
|
182
205
|
(metadata.config.discord.activityInstanceVerification === "auto" && Boolean(process.env.LUDICORD_DISCORD_BOT_TOKEN)),
|
|
183
206
|
onError: (error, file) => { void reportRequestError(error, "websocket", file); },
|
|
184
207
|
});
|
|
185
208
|
const clientDirectory = path.join(output, "client");
|
|
186
|
-
const indexHtml = readFileSync(path.join(clientDirectory, "index.html"), "utf8");
|
|
209
|
+
const indexHtml = injectRuntimePublicConfig(readFileSync(path.join(clientDirectory, "index.html"), "utf8"), discordClientId);
|
|
210
|
+
app.get("/index.html", (_request, response) => {
|
|
211
|
+
response.status(200).type("html").send(indexHtml);
|
|
212
|
+
});
|
|
187
213
|
app.use(express.static(clientDirectory, { index: false }));
|
|
188
214
|
app.use((request, response, next) => {
|
|
189
215
|
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
@@ -249,6 +275,9 @@ export async function createLudicordProductionServer(options) {
|
|
|
249
275
|
}
|
|
250
276
|
if (metadata.config.server.allowedHosts === true)
|
|
251
277
|
warnings.push("server.allowedHosts accepts every Host header.");
|
|
278
|
+
if (usesDiscordActivityOrigins(metadata.config.server.allowedOrigins) && discordClientId === undefined) {
|
|
279
|
+
warnings.push("server.allowedOrigins expects a Discord Activity origin, but LUDICORD_DISCORD_CLIENT_ID is missing.");
|
|
280
|
+
}
|
|
252
281
|
if (manifests.activity.proxy !== undefined && !metadata.config.discord.proxyVerification)
|
|
253
282
|
warnings.push("app/proxy.ts is running without Discord request-signature verification.");
|
|
254
283
|
return {
|
|
@@ -85,7 +85,8 @@ export function createLudicordRequestSecurity(allowedHosts, allowedOrigins, disc
|
|
|
85
85
|
const origin = Array.isArray(request.headers.origin) ? request.headers.origin[0] : request.headers.origin;
|
|
86
86
|
const fetchSite = request.headers["sec-fetch-site"];
|
|
87
87
|
const originAllowed = isLudicordOriginAllowed(origin, request.headers.host, allowedOrigins, discordClientId);
|
|
88
|
-
const
|
|
88
|
+
const safeNavigation = request.method === "GET" || request.method === "HEAD";
|
|
89
|
+
const missingCrossSiteOrigin = !safeNavigation && fetchSite === "cross-site" && origin === undefined && allowedOrigins !== true;
|
|
89
90
|
if (!originAllowed || missingCrossSiteOrigin) {
|
|
90
91
|
response.status(403).json({ error: "LUDICORD_ORIGIN_NOT_ALLOWED", message: "The request Origin is not allowed by server.allowedOrigins." });
|
|
91
92
|
return;
|
|
@@ -3,7 +3,7 @@ name: ludicord
|
|
|
3
3
|
description: "Build, modify, debug, review, or document Ludicord Discord Activities. Use for Activity roots, embeds, typed navigation, React state and effects, API or WebSocket routes, shared Activity state, Discord SDK data, participants, voice, authentication, security, configuration, development diagnostics, deployment, migration, and release compatibility."
|
|
4
4
|
metadata:
|
|
5
5
|
author: ludicord
|
|
6
|
-
version: "4.0.
|
|
6
|
+
version: "4.0.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Ludicord
|
|
@@ -98,11 +98,11 @@ correct/incorrect pairs and the public guide behind it.
|
|
|
98
98
|
generated route types. Ludicord synchronizes embeds with hash history so
|
|
99
99
|
back/forward and deep links work while the Activity pathname stays stable.
|
|
100
100
|
|
|
101
|
-
### V4
|
|
101
|
+
### V4 Unified Page Router → [prefix-router.md](references/prefix-router.md)
|
|
102
102
|
|
|
103
|
-
- **
|
|
103
|
+
- **Additional pathname pages are optional.** Start with one Activity root and ordinary embeds. Add another page only when a large project needs independent product surfaces, or an important requirement needs distinct pathname entry points, persistent shells, or provider lifetimes. Explain the concrete need before creating it. More screens, realtime, deep folders, or a v4 upgrade alone do not justify another page. Preserve existing page scopes when editing a project that already uses them.
|
|
104
104
|
- **A page scope lives at `app/<path>/page.tsx`.** Nested directories and `[id]` parameters form its pathname. Its nearest descendant embeds belong to that page. Do not add literal `prefix/` scaffolding in unified mode.
|
|
105
|
-
- **At most one route file per directory:** `page.tsx`, `route.ts`, `socket.ts`, or `embed.tsx`. Use `PrefixLink`/`prefixHref()` across justified page paths and the embed router within one page.
|
|
105
|
+
- **At most one route file per directory:** `page.tsx`, `route.ts`, `socket.ts`, or `embed.tsx`. Use the established `PrefixLink`/`prefixHref()` APIs across justified page paths and the embed router within one page.
|
|
106
106
|
- **Use configured project aliases for deep imports.** Read
|
|
107
107
|
`imports.aliases` from `ludicord.config.mjs` and keep `tsconfig.json` paths
|
|
108
108
|
synchronized; never assume `@/` if the project changed the map.
|
|
@@ -282,7 +282,7 @@ npx create-ludicord-app@latest my-activity --tailwind # scripted styling choice
|
|
|
282
282
|
npx create-ludicord-app@latest my-activity --no-tailwind
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
-
Generated 4.0.
|
|
285
|
+
Generated 4.0.1 projects intentionally include only `dev`, `build`, and
|
|
286
286
|
`start` scripts. Run advanced commands with the project's package runner.
|
|
287
287
|
|
|
288
288
|
## Routed Intelligence References
|
|
@@ -85,9 +85,11 @@ LUDICORD_DISCORD_PUBLIC_KEY=
|
|
|
85
85
|
responses never leak stack traces or filesystem paths.
|
|
86
86
|
- `server.allowedOrigins` defaults to `"discord-activity"`: same-origin plus
|
|
87
87
|
this application's exact `https://<clientId>.discordsays.com` proxy origin.
|
|
88
|
-
The Client ID comes from config or the supported environment variable;
|
|
89
|
-
|
|
90
|
-
points
|
|
88
|
+
The Client ID comes from config or the supported environment variable; a
|
|
89
|
+
runtime value takes precedence and is shared by the client, HTTP, auth, and
|
|
90
|
+
WebSocket entry points. The policy never trusts a wildcard for every
|
|
91
|
+
Activity. Browsers may omit `Origin` from the initial safe iframe `GET`, so
|
|
92
|
+
it is allowed; cross-site mutation requests without an allowed origin fail.
|
|
91
93
|
|
|
92
94
|
Optional verifications (both fail closed):
|
|
93
95
|
|
|
@@ -54,7 +54,10 @@ Invalid configuration values produce diagnostics. Restart development after
|
|
|
54
54
|
configuration changes; renew authorization after OAuth scope changes.
|
|
55
55
|
|
|
56
56
|
The default derives `https://<clientId>.discordsays.com` from the configured
|
|
57
|
-
Discord Application ID and never allows a wildcard for other Activities.
|
|
57
|
+
Discord Application ID and never allows a wildcard for other Activities. A
|
|
58
|
+
runtime `LUDICORD_DISCORD_CLIENT_ID` takes precedence over build metadata and
|
|
59
|
+
is shared by the client, HTTP, auth, and WebSocket entry points. Safe iframe
|
|
60
|
+
`GET`/`HEAD` navigation may omit `Origin`; cross-site mutations may not. Use
|
|
58
61
|
`"same-origin"` for a host-only policy. In an array, include both
|
|
59
62
|
`"same-origin"` and `"discord-activity"` explicitly when retaining both
|
|
60
63
|
built-in policies alongside another trusted browser origin.
|
|
@@ -140,6 +143,7 @@ npx ludicord build
|
|
|
140
143
|
| WebSocket closes immediately | Browser needs a valid session cookie and instance context |
|
|
141
144
|
| Voice hooks empty | Request `rpc.voice.read`; inspect `useDiscordDiagnostics()` |
|
|
142
145
|
| Works in browser, not Discord | Verify HTTPS tunnel reachability and the `/` URL Mapping target |
|
|
146
|
+
| `LUDICORD_ORIGIN_NOT_ALLOWED` | Use Ludicord 4.0.1+, set the exact Discord Application ID, then restart the production server |
|
|
143
147
|
| `LUDICORD3001` | Run `ludicord build` before `ludicord start` |
|
|
144
148
|
| Signature verification fails | Preserve the raw body and signature/timestamp headers through proxies |
|
|
145
149
|
|
|
@@ -168,9 +168,9 @@ load_game_details:
|
|
|
168
168
|
- testing
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
## Optional v4
|
|
171
|
+
## Optional v4 pathname pages
|
|
172
172
|
|
|
173
|
-
Start with one Activity root and ordinary embeds.
|
|
173
|
+
Start with one Activity root and ordinary embeds. Add another pathname page only when a large project needs independent product surfaces, or an important requirement needs distinct pathname entry points, persistent shells, or provider lifetimes. Explain the concrete need before creating it. More screens, realtime, deep folders, or a v4 upgrade alone do not justify another page. Preserve existing page scopes when editing a project that already uses them.
|
|
174
174
|
|
|
175
175
|
When justified, load [prefix-router.md](../prefix-router.md). Import aliases
|
|
176
176
|
work without prefixes and are not a reason to add them.
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LUDICORD_VERSION = "4.0.
|
|
1
|
+
export const LUDICORD_VERSION = "4.0.1";
|