share landing page bugfixes

This commit is contained in:
tim
2025-04-22 17:21:12 -04:00
parent 7b5421e6e7
commit fd7b9713ea
3 changed files with 6 additions and 9 deletions

View File

@@ -27,11 +27,8 @@ export async function getShareUrl() {
const json = JSON.stringify(data)
console.log('sharing data', json, data)
const compressed = compressToEncodedURIComponent(json);
let baseUrl = `${window.location.protocol}//${window.location.hostname}`;
if (window.location.port)
baseUrl += ':' + window.location.port
const imageFile = await takeSnapshot()
return `${baseUrl}/shared?i=${imageFile}&d=${compressed}`;
return import.meta.env.VITE_SERVER_URL+ `/share?i=${imageFile}&d=${compressed}`;
}
export function loadShareUrl() {
@@ -69,7 +66,7 @@ export function loadShareUrl() {
export async function takeSnapshot() {
const screenshotCanvas = await widget.takeClientScreenshot();
const image = await new Promise((resolve) => screenshotCanvas.toBlob(resolve));
const response = await fetch(import.meta.env.VITE_SNAPSHOT_URL, {
const response = await fetch(import.meta.env.VITE_SERVER_URL + '/snapshot', {
method: 'PUT',
body: image,
credentials: 'same-origin',