Files
Simon James b54a3139c7 Initial commit: Qortal Web Builder monorepo.
Includes QWB, Qortal Web, and Q-Shops Q-Apps with shared packages and build scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 12:17:29 +00:00

104 lines
4.3 KiB
HTML

<!doctype html>
<html lang="en" data-qw-theme="dark">
<head>
<meta charset="UTF-8" />
<script>
(function () {
try {
var p = location.pathname;
if (/\.html?$/i.test(p)) p = p.replace(/\/[^/]+$/, '/');
else if (p !== '/' && !p.endsWith('/')) p += '/';
if (p.length < 1 || p.charAt(0) !== '/') return;
var b = document.createElement('base');
b.href = p;
document.head.insertBefore(b, document.head.firstChild);
} catch (_e) {}
})();
</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>Qortal Web · Qortal Web Engine</title>
<link rel="icon" href="./qortal-web-logo.png" type="image/png" />
</head>
<body>
<script>
(function () {
if (typeof window.qortalRequest === 'function') return;
function qwbStubForwardTimeoutMs(action) {
if (!action) return 60000;
switch (action) {
case 'SEARCH_QDN_RESOURCES':
return 30000;
case 'FETCH_QDN_RESOURCE':
return 60000;
case 'PUBLISH_QDN_RESOURCE':
case 'PUBLISH_MULTIPLE_QDN_RESOURCES':
return 3600000;
default:
return 300000;
}
}
function forwardToParent(request, timeoutMs) {
return new Promise(function (resolve, reject) {
var channel = new MessageChannel();
var done = false;
var waitMs = timeoutMs != null && timeoutMs > 0 ? timeoutMs : qwbStubForwardTimeoutMs(request && request.action);
channel.port1.onmessage = function (ev) {
if (done) return;
done = true;
try { channel.port1.close(); } catch (e) {}
var d = ev && ev.data;
if (d && typeof d === 'object' && !Array.isArray(d) && ('result' in d || 'error' in d)) {
if (d.error) {
reject(new Error(typeof d.error === 'string' ? d.error : JSON.stringify(d.error)));
return;
}
d = d.result;
} else if (d && typeof d === 'object' && !Array.isArray(d)) {
if ('data' in d && d.data !== undefined && !('address' in d && 'publicKey' in d)) d = d.data;
else if ('response' in d && d.response !== undefined) d = d.response;
}
resolve(d);
};
channel.port1.onmessageerror = function () {
if (done) return;
done = true;
reject(new Error('qortalRequest MessageChannel error'));
};
try {
var payload = Object.assign({}, request || {}, { requestedHandler: 'UI' });
if (window.parent && window.parent !== window) {
window.parent.postMessage(payload, '*', [channel.port2]);
} else {
window.postMessage(payload, '*', [channel.port2]);
}
} catch (e) {
if (!done) { done = true; reject(e); }
return;
}
setTimeout(function () {
if (done) return;
done = true;
try { channel.port1.close(); } catch (e) {}
reject(new Error('qortalRequest timed out'));
}, waitMs);
});
}
try { window.__QWB_QORTAL_BRIDGE_STUB__ = true; } catch (e) {}
function install(name, wrapper) {
try { if (typeof window[name] !== 'function') window[name] = wrapper; } catch (e) {}
}
install('qortalRequest', function (request) { return forwardToParent(request, null); });
install('qortalRequestWithNoTimeout', function (request, ms) {
return forwardToParent(request, ms != null && ms > 0 ? ms : qwbStubForwardTimeoutMs(request && request.action));
});
install('qortalRequestWithTimeout', function (req, ms) {
return forwardToParent(req, ms != null && ms > 0 ? ms : qwbStubForwardTimeoutMs(req && req.action));
});
})();
</script>
<script src="./embed-bridge-relay.js"></script>
<div id="root"><p style="padding:2rem;font:14px system-ui;color:#8a9a8e;margin:0">Loading Qortal Web…</p></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>