Performance: cache panoramax requests more aggressively; reuse license information that comes from the search-api; lower picture limit; should relieve #2384 greatly

This commit is contained in:
Pieter Vander Vennet 2025-04-22 02:53:31 +02:00
parent bd287fd8b0
commit 549129671a
7 changed files with 53 additions and 45 deletions

View file

@ -1,7 +1,7 @@
<script lang="ts">
import { LicenseInfo } from "../../Logic/ImageProviders/LicenseInfo"
import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
import { Store, UIEventSource } from "../../Logic/UIEventSource"
import { ImmutableStore, Store, UIEventSource } from "../../Logic/UIEventSource"
import ToSvelte from "../Base/ToSvelte.svelte"
import { EyeIcon } from "@rgossiaux/svelte-heroicons/solid"
import Tr from "../Base/Tr.svelte"
@ -13,7 +13,7 @@
export let image: Partial<ProvidedImage> & { id: string; url: string }
export let attributionFormat: "minimal" | "medium" | "large" = "medium"
let license: Store<LicenseInfo> = UIEventSource.FromPromise(
let license: Store<LicenseInfo> = image.license ? new ImmutableStore(image.license) : UIEventSource.FromPromise(
image.provider?.DownloadAttribution(image)
)
let icon = image.provider?.SourceIcon(image)

View file

@ -18,6 +18,7 @@
import { Utils } from "../../Utils"
import ThemeViewState from "../../Models/ThemeViewState"
import { MenuState } from "../../Models/MenuState"
import { LicenseInfo } from "../../Logic/ImageProviders/LicenseInfo"
export let tags: UIEventSource<OsmTags>
export let state: ThemeViewState
@ -36,7 +37,13 @@
}
})
const t = Translations.t.image.nearby
const providedImage: ProvidedImage = {
let license: LicenseInfo = {
artist: image.author,
license: image.license,
date: new Date(image.date),
informationLocation: image.detailsUrl
}
let providedImage: ProvidedImage = {
url: image.thumbUrl ?? image.pictureUrl,
url_hd: image.pictureUrl,
key: undefined,
@ -44,6 +51,7 @@
date: new Date(image.date),
id: Object.values(image.osmTags)[0],
isSpherical: image.details.isSpherical,
license
}
async function applyLink(isLinked: boolean) {