fix: resolve mixed-content error in thread builder API calls

The bare-domain rewrite (rspace.online/rsocials/thread → /demo/rsocials/thread)
injected /demo/ into __BASE_PATH__, causing fetches to /demo/rsocials/api/threads
which triggered a 301 redirect to http://demo.rspace.online (mixed content blocked).
Now derives the base path from the actual browser URL. Also fixed layout so compose
input is on the left and thread preview is on the right.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-04 10:03:38 -08:00
parent 495baa5935
commit 7a11936483
1 changed files with 4 additions and 1 deletions

View File

@ -702,6 +702,7 @@ const THREAD_CSS = `
.thread-image-preview { border-radius: 8px; overflow: hidden; border: 1px solid #334155; } .thread-image-preview { border-radius: 8px; overflow: hidden; border: 1px solid #334155; }
.thread-image-preview[hidden] { display: none; } .thread-image-preview[hidden] { display: none; }
.thread-image-preview img { display: block; max-width: 200px; height: auto; } .thread-image-preview img { display: block; max-width: 200px; height: auto; }
#share-link-area { grid-column: 1 / -1; }
.thread-share-link { .thread-share-link {
display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.75rem; display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.75rem;
background: rgba(99,102,241,0.1); border: 1px solid #6366f1; border-radius: 8px; background: rgba(99,102,241,0.1); border: 1px solid #6366f1; border-radius: 8px;
@ -818,7 +819,9 @@ function renderThreadBuilderPage(space: string, threadData?: ThreadData | null):
</div> </div>
</div> </div>
<script type="module"> <script type="module">
const base = window.__BASE_PATH__ || './'; // Derive base from actual URL — bare-domain rewrites inject /demo/ which isn't in the browser path
const declared = window.__BASE_PATH__ || './';
const base = window.location.pathname.startsWith(declared) ? declared : declared.replace(/^\\/[^\\/]+/, '');
let currentThreadId = null; let currentThreadId = null;
let autoSaveTimer = null; let autoSaveTimer = null;