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

@@ -1,2 +1,2 @@
VITE_WS_URL=wss://ws.dexorder.trade VITE_WS_URL=wss://ws.dexorder.trade
VITE_SNAPSHOT_URL=https://ws.dexorder.trade/snapshot VITE_SERVER_URL=https://ws.dexorder.trade

View File

@@ -381,11 +381,11 @@ export const DataFeed = {
onResolveErrorCallback, onResolveErrorCallback,
extension extension
) { ) {
log('[resolveSymbol]: Method call', symbolName); console.log('[resolveSymbol]: Method call', symbolName);
const symbols = getAllSymbols(); const symbols = getAllSymbols();
const symbolItem = symbolName === 'default' ? defaultSymbol : symbols[symbolName] const symbolItem = symbolName === 'default' ? defaultSymbol : symbols[symbolName]
if (!symbolItem) { if (!symbolItem) {
log('[resolveSymbol]: Cannot resolve symbol', symbolName); console.log('[resolveSymbol]: Cannot resolve symbol', symbolName);
onResolveErrorCallback('cannot resolve symbol'); onResolveErrorCallback('cannot resolve symbol');
return; return;
} }
@@ -451,7 +451,7 @@ export const DataFeed = {
// volume_precision: 2, // volume_precision: 2,
data_status: 'streaming', data_status: 'streaming',
}; };
log('[resolveSymbol]: Symbol resolved', symbolName); console.log('[resolveSymbol]: Symbol resolved', symbolName);
onSymbolResolvedCallback(symbolInfo) onSymbolResolvedCallback(symbolInfo)
}, },

View File

@@ -27,11 +27,8 @@ export async function getShareUrl() {
const json = JSON.stringify(data) const json = JSON.stringify(data)
console.log('sharing data', json, data) console.log('sharing data', json, data)
const compressed = compressToEncodedURIComponent(json); const compressed = compressToEncodedURIComponent(json);
let baseUrl = `${window.location.protocol}//${window.location.hostname}`;
if (window.location.port)
baseUrl += ':' + window.location.port
const imageFile = await takeSnapshot() 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() { export function loadShareUrl() {
@@ -69,7 +66,7 @@ export function loadShareUrl() {
export async function takeSnapshot() { export async function takeSnapshot() {
const screenshotCanvas = await widget.takeClientScreenshot(); const screenshotCanvas = await widget.takeClientScreenshot();
const image = await new Promise((resolve) => screenshotCanvas.toBlob(resolve)); 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', method: 'PUT',
body: image, body: image,
credentials: 'same-origin', credentials: 'same-origin',