-
Notifications
You must be signed in to change notification settings - Fork 124
feat(website): host A2UI playground at /a2ui #2533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,7 +92,7 @@ export function DemosPage(props: { protocol: ProtocolVersion }) { | |
| const [lynxDevQrError, setLynxDevQrError] = useState(''); | ||
| const [lynxDevCopied, setLynxDevCopied] = useState(false); | ||
|
|
||
| const origin = window.location.origin; | ||
| const baseUrl = window.location.href.replace(/#.*$/, ''); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
GitHub Pages typically redirects directory paths to the slash form, so this is low-probability — but it's a silent failure that produces a wrong QR code/iframe URL with no error. Pairing the fix with 🛡️ Proposed fix — normalize trailing slash + memoize- const baseUrl = window.location.href.replace(/#.*$/, '');
+ const baseUrl = useMemo(() => {
+ // Strip hash, then ensure the path ends with a slash so that
+ // new URL('render.html', baseUrl) always resolves into the same
+ // directory rather than replacing the last path segment.
+ const stripped = window.location.href.replace(/#.*$/, '');
+ const url = new URL(stripped);
+ if (!url.pathname.endsWith('/')) {
+ url.pathname = url.pathname.replace(/\/[^/]*$/, '/');
+ }
+ return url.toString();
+ }, []);🤖 Prompt for AI Agents |
||
| const rspeedyDevUrl = useRspeedyDevUrl(); | ||
| const lynxUrlSeqRef = useRef(0); | ||
|
|
||
|
|
@@ -115,7 +115,7 @@ export function DemosPage(props: { protocol: ProtocolVersion }) { | |
| const actionMocks = scenario?.actionMocks; | ||
| const url = buildRenderUrl( | ||
| { protocol, demoUrl: DEFAULT_DEMO_URL, messages: parsed, actionMocks }, | ||
| origin, | ||
| baseUrl, | ||
| ); | ||
| setRenderUrl(url); | ||
|
|
||
|
|
@@ -174,7 +174,7 @@ export function DemosPage(props: { protocol: ProtocolVersion }) { | |
| // "View on Device" QR is scannable. render.html already supports | ||
| // messagesUrl / actionMocksUrl query params. | ||
| if (messagesUrlAbs) { | ||
| const r = new URL('/render.html', origin); | ||
| const r = new URL('render.html', baseUrl); | ||
| r.searchParams.set('protocol', protocol); | ||
| r.searchParams.set('demoUrl', DEFAULT_DEMO_URL); | ||
| r.searchParams.set('messagesUrl', messagesUrlAbs); | ||
|
|
@@ -189,7 +189,7 @@ export function DemosPage(props: { protocol: ProtocolVersion }) { | |
| } | ||
| })(); | ||
| }, | ||
| [origin, protocol, rspeedyDevUrl], | ||
| [baseUrl, protocol, rspeedyDevUrl], | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Copyright 2026 The Lynx Authors. All rights reserved. | ||
| // Licensed under the Apache License Version 2.0 that can be found in the | ||
| // LICENSE file in the root directory of this source tree. | ||
| export const DEFAULT_DEMO_URL = '/main.web.js'; | ||
| export const DEFAULT_DEMO_URL = './main.web.js'; |
Uh oh!
There was an error while loading. Please reload this page.