chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-08-13 23:06:38 +02:00
parent 9cd7ad597d
commit 69ab755f29
520 changed files with 16616 additions and 13483 deletions

View file

@ -1,4 +1,8 @@
import { SpecialVisualization, SpecialVisualizationState, SpecialVisualizationSvelte } from "../SpecialVisualization"
import {
SpecialVisualization,
SpecialVisualizationState,
SpecialVisualizationSvelte,
} from "../SpecialVisualization"
import Maproulette from "../../Logic/Maproulette"
import SvelteUIElement from "../Base/SvelteUIElement"
import { PointImportButtonViz } from "../Popup/ImportButtons/PointImportButtonViz"
@ -147,7 +151,7 @@ class LinkedDataFromWebsite extends SpecialVisualization {
feature: Feature,
layer: LayerConfig
): SvelteUIElement {
if(state.theme.enableMorePrivacy){
if (state.theme.enableMorePrivacy) {
return undefined
}
@ -165,51 +169,55 @@ class LinkedDataFromWebsite extends SpecialVisualization {
})
const externalData: Store<{ success: GeoJsonProperties } | { error }> = sourceUrl.bindD(
(url) => {
if(!downloadInformation.data){
if (!downloadInformation.data) {
return undefined
}
const country = countryStore.data
if (url.startsWith("https://data.velopark.be/")) {
return UIEventSource.fromPromiseWithErr((async () => {
try {
const loadAll = layer.id.toLowerCase().indexOf("maproulette") >= 0 // Dirty hack
const features = await LinkedDataLoader.fetchVeloparkEntry(
url,
loadAll
)
const feature =
features.find((f) => f.properties["ref:velopark"] === url) ??
features[0]
const properties = feature.properties
properties["ref:velopark"] = url
console.log("Got properties from velopark:", properties)
return properties
} catch (e) {
console.error(e)
throw e
}
})())
return UIEventSource.fromPromiseWithErr(
(async () => {
try {
const loadAll = layer.id.toLowerCase().indexOf("maproulette") >= 0 // Dirty hack
const features = await LinkedDataLoader.fetchVeloparkEntry(
url,
loadAll
)
const feature =
features.find((f) => f.properties["ref:velopark"] === url) ??
features[0]
const properties = feature.properties
properties["ref:velopark"] = url
console.log("Got properties from velopark:", properties)
return properties
} catch (e) {
console.error(e)
throw e
}
})()
)
}
if (country === undefined) {
return undefined
}
return UIEventSource.fromPromiseWithErr((async () => {
try {
return await LinkedDataLoader.fetchJsonLd(
url,
{ country },
useProxy ? "proxy" : "fetch-lod"
)
} catch (e) {
console.log(
"Could not get with proxy/download LOD, attempting to download directly. Error for ",
url,
"is",
e
)
return await LinkedDataLoader.fetchJsonLd(url, { country }, "fetch-raw")
}
})())
return UIEventSource.fromPromiseWithErr(
(async () => {
try {
return await LinkedDataLoader.fetchJsonLd(
url,
{ country },
useProxy ? "proxy" : "fetch-lod"
)
} catch (e) {
console.log(
"Could not get with proxy/download LOD, attempting to download directly. Error for ",
url,
"is",
e
)
return await LinkedDataLoader.fetchJsonLd(url, { country }, "fetch-raw")
}
})()
)
},
[countryStore, downloadInformation]
)
@ -218,18 +226,16 @@ class LinkedDataFromWebsite extends SpecialVisualization {
console.log("linked_data_from_website received the following data:", lod)
)
return new SvelteUIElement(ComparisonTool, {
feature,
state,
tags,
layer,
externalData,
sourceUrl,
readonly,
feature,
state,
tags,
layer,
externalData,
sourceUrl,
readonly,
downloadInformation,
collapsed: isClosed,
collapsed: isClosed,
})
}
}