fix(rdesign): use relative path for API fetch to avoid mixed content

The bare-domain router redirects /demo/... paths to demo.rspace.online
with http:// protocol, causing mixed content errors. Use the current
page path as the base URL instead of constructing an absolute path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-24 10:41:13 -07:00
parent bfbf1d14cd
commit c2b5820f8a
1 changed files with 2 additions and 1 deletions

View File

@ -215,7 +215,8 @@ const RDESIGN_JS = `
var space = document.getElementById('rdesign-app').dataset.space || 'demo';
var fetchHeaders = { 'Content-Type': 'application/json' };
try { var sess = JSON.parse(localStorage.getItem('encryptid_session') || '{}'); if (sess.accessToken) fetchHeaders['Authorization'] = 'Bearer ' + sess.accessToken; } catch(e) {}
fetch('/' + space + '/rdesign/api/design-agent', {
var basePath = window.location.pathname.replace(/\\/$/, '');
fetch(basePath + '/api/design-agent', {
method: 'POST',
headers: fetchHeaders,
body: JSON.stringify({ brief: text, space: space }),