From 989d22be22d2cd0e695cf25d60319cd894233158 Mon Sep 17 00:00:00 2001 From: DavidSM100 Date: Fri, 7 Nov 2025 19:32:25 -0500 Subject: [PATCH 1/3] feature: try apps in the browser --- website/apps/main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/apps/main.js b/website/apps/main.js index a6b0c23..0bec288 100644 --- a/website/apps/main.js +++ b/website/apps/main.js @@ -18,6 +18,7 @@ dayjs.extend(dayjs_plugin_localizedFormat); // without a trailing slash const xdcget_export = "https://apps.testrun.org"; +const tryItBaseUrl = "https://webxdc-try-it.xyz"; /* Each is implemented as a button that, when clicked, would show @@ -67,6 +68,19 @@ const Dialog = ({app, modal, toggleModal}) => { size = `${(app.size/1000000).toLocaleString(undefined, {maximumFractionDigits: 1})} mb`; } + let tryItUrl = new URL(tryItBaseUrl); + tryItUrl.hostname = + "webapp-" + + app.app_id + + "-" + + app.tag_name.replaceAll(".", "-") + + "." + + tryItUrl.hostname; + const params = new URLSearchParams({ + url: xdcget_export + "/" + app.cache_relname, + }); + tryItUrl.hash = params.toString(); + return html` toggleModal(false)} closedby="any" aria-labelledby="${app.app_id}_label" aria-describedby="${app.app_id}_desc">
@@ -97,6 +111,7 @@ const Dialog = ({app, modal, toggleModal}) => { Add to Chat + Try it
From a5ee27f6eaf8eaf383bc25d03ffc5b6c62e39a8e Mon Sep 17 00:00:00 2001 From: WofWca Date: Sun, 15 Feb 2026 20:42:07 +0400 Subject: [PATCH 2/3] refactor: `useMemo` for `tryItUrl` --- website/apps/main.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/website/apps/main.js b/website/apps/main.js index 0bec288..7ce3fc2 100644 --- a/website/apps/main.js +++ b/website/apps/main.js @@ -68,18 +68,22 @@ const Dialog = ({app, modal, toggleModal}) => { size = `${(app.size/1000000).toLocaleString(undefined, {maximumFractionDigits: 1})} mb`; } - let tryItUrl = new URL(tryItBaseUrl); - tryItUrl.hostname = - "webapp-" + - app.app_id + - "-" + - app.tag_name.replaceAll(".", "-") + - "." + - tryItUrl.hostname; - const params = new URLSearchParams({ - url: xdcget_export + "/" + app.cache_relname, - }); - tryItUrl.hash = params.toString(); + const tryItUrl = useMemo(() => { + const url = new URL(tryItBaseUrl); + url.hostname = + "webapp-" + + app.app_id + + "-" + + app.tag_name.replaceAll(".", "-") + + "." + + url.hostname; + const params = new URLSearchParams({ + url: xdcget_export + "/" + app.cache_relname, + }); + url.hash = params.toString(); + + return url.toString(); + }, [app.app_id, app.cache_relname, app.tag_name]); return html` toggleModal(false)} closedby="any" aria-labelledby="${app.app_id}_label" aria-describedby="${app.app_id}_desc"> @@ -111,7 +115,7 @@ const Dialog = ({app, modal, toggleModal}) => { Add to Chat - Try it + Try it From ff7c8942887ba1216ee08729ab667879a450c7ae Mon Sep 17 00:00:00 2001 From: WofWca Date: Sun, 15 Feb 2026 20:45:52 +0400 Subject: [PATCH 3/3] improvement: hide Try It unless explicitly enabled --- website/apps/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/website/apps/main.js b/website/apps/main.js index 7ce3fc2..87c64b3 100644 --- a/website/apps/main.js +++ b/website/apps/main.js @@ -69,6 +69,10 @@ const Dialog = ({app, modal, toggleModal}) => { } const tryItUrl = useMemo(() => { + if (!location.search.includes('tryIt')) { + return null; + } + const url = new URL(tryItBaseUrl); url.hostname = "webapp-" + @@ -115,7 +119,7 @@ const Dialog = ({app, modal, toggleModal}) => { Add to Chat - Try it + ${tryItUrl && html`Try it`}