Fixes for binary.html

This commit is contained in:
Alexey Milovidov 2024-02-01 20:36:38 +01:00
parent 81fe2f330c
commit 667256a67d

View File

@ -70,6 +70,19 @@
if (params.has('password')) { password = params.get('password'); } if (params.has('password')) { password = params.get('password'); }
} }
let url = `${host}?allow_introspection_functions=1`;
if (add_http_cors_header) {
url += '&add_http_cors_header=1';
}
if (user) {
url += `&user=${encodeURIComponent(user)}`;
}
if (password) {
url += `&password=${encodeURIComponent(password)}`;
}
let map = L.map('space', { let map = L.map('space', {
crs: L.CRS.Simple, crs: L.CRS.Simple,
center: [-512, 512], center: [-512, 512],
@ -103,24 +116,11 @@
const key = `${coords.z}-${coords.x}-${coords.y}`; const key = `${coords.z}-${coords.x}-${coords.y}`;
let buf = cached_tiles[key]; let buf = cached_tiles[key];
if (!buf) { if (!buf) {
let url = `${host}?default_format=RowBinary&allow_introspection_functions=1`; let request_url = `${url}&default_format=RowBinary` +
`&param_z=${coords.z}&param_x=${coords.x}&param_y=${coords.y}` +
`&enable_http_compression=1&network_compression_method=zstd&network_zstd_compression_level=6`;
if (add_http_cors_header) { const response = await fetch(request_url, { method: 'POST', body: sql });
// For debug purposes, you may set add_http_cors_header from a browser console
url += '&add_http_cors_header=1';
}
if (user) {
url += `&user=${encodeURIComponent(user)}`;
}
if (password) {
url += `&password=${encodeURIComponent(password)}`;
}
url += `&param_z=${coords.z}&param_x=${coords.x}&param_y=${coords.y}`;
url += `&enable_http_compression=1&network_compression_method=zstd&network_zstd_compression_level=6`;
const response = await fetch(url, { method: 'POST', body: sql });
if (!response.ok) { if (!response.ok) {
const text = await response.text(); const text = await response.text();
@ -238,7 +238,7 @@
const addr_hex = '0x' + addr_int.toString(16); const addr_hex = '0x' + addr_int.toString(16);
const response = fetch( const response = fetch(
`http://localhost:8123/?default_format=JSON`, `${url}&default_format=JSON`,
{ {
method: 'POST', method: 'POST',
body: `SELECT encodeXMLComponent(demangle(addressToSymbol(${addr_int}::UInt64))) AS name, body: `SELECT encodeXMLComponent(demangle(addressToSymbol(${addr_int}::UInt64))) AS name,