Add config option to control the map provider link

This commit is contained in:
Alan Grainger
2026-06-04 10:03:08 +12:00
parent 70153c3137
commit 6d77075e21
6 changed files with 22 additions and 14 deletions
+2 -1
View File
@@ -290,7 +290,8 @@ Under `ipp.showMetadata.location`:
| `city` | `bool` | Show city. | | `city` | `bool` | Show city. |
| `state` | `bool` | Show state / region. | | `state` | `bool` | Show state / region. |
| `country` | `bool` | Show country. | | `country` | `bool` | Show country. |
| `gps` | `bool` | Show GPS coordinates and an "Open in OpenStreetMap" link. | | `gps` | `bool` | Show GPS coordinates. |
| `webLink` | `bool` | Show an "Open in OpenStreetMap" link below the coordinates. The link is rendered with `rel="noreferrer"` so the share URL is not leaked to the map provider when a viewer clicks it. Has no effect unless `gps` is also true. Default `true`. |
Example: show description in the sidebar only (not as a caption), show full EXIF, and hide GPS coordinates while keeping city / state / country: Example: show description in the sidebar only (not as a caption), show full EXIF, and hide GPS coordinates while keeping city / state / country:
+2 -1
View File
@@ -34,7 +34,8 @@
"city": true, "city": true,
"state": true, "state": true,
"country": true, "country": true,
"gps": true "gps": true,
"webLink": true
} }
}, },
"customInvalidResponse": false, "customInvalidResponse": false,
+3 -1
View File
@@ -298,17 +298,19 @@ function renderLocation (exif: GalleryExif): HTMLElement {
coords.textContent = exif.latitude.toFixed(5) + ', ' + exif.longitude.toFixed(5) coords.textContent = exif.latitude.toFixed(5) + ', ' + exif.longitude.toFixed(5)
body.appendChild(coords) body.appendChild(coords)
if (state.metadataConfig.locationWebLink) {
const link = document.createElement('a') const link = document.createElement('a')
link.className = 'ipp-sidebar-osm' link.className = 'ipp-sidebar-osm'
link.href = 'https://www.openstreetmap.org/?mlat=' + exif.latitude + link.href = 'https://www.openstreetmap.org/?mlat=' + exif.latitude +
'&mlon=' + exif.longitude + '&mlon=' + exif.longitude +
'#map=15/' + exif.latitude + '/' + exif.longitude '#map=15/' + exif.latitude + '/' + exif.longitude
link.target = '_blank' link.target = '_blank'
// noreferrer suppresses the Referer header so the share URL doesn't end up in OSM's webserver logs // noreferrer suppresses the Referer header so the share URL doesn't end up in the map provider's webserver logs
link.rel = 'noopener noreferrer' link.rel = 'noopener noreferrer'
link.textContent = 'Open in OpenStreetMap' link.textContent = 'Open in OpenStreetMap'
body.appendChild(link) body.appendChild(link)
} }
}
wrap.appendChild(body) wrap.appendChild(body)
return wrap return wrap
+2 -1
View File
@@ -82,7 +82,8 @@ export const state = {
metadataConfig: { metadataConfig: {
descriptionInCaption: false, descriptionInCaption: false,
descriptionInSidebar: false, descriptionInSidebar: false,
sidebarHasContent: false sidebarHasContent: false,
locationWebLink: false
} as MetadataConfig, } as MetadataConfig,
// True while our pushed history entry is live // True while our pushed history entry is live
lightboxPushedHistory: false, lightboxPushedHistory: false,
+3 -1
View File
@@ -41,6 +41,7 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
const descriptionInSidebar = !!getConfigOption('ipp.showMetadata.description.sidebar', false) const descriptionInSidebar = !!getConfigOption('ipp.showMetadata.description.sidebar', false)
const exifGroupEnabled = !!getConfigOption('ipp.showMetadata.exif.enabled', false) const exifGroupEnabled = !!getConfigOption('ipp.showMetadata.exif.enabled', false)
const locationGroupEnabled = !!getConfigOption('ipp.showMetadata.location.enabled', false) const locationGroupEnabled = !!getConfigOption('ipp.showMetadata.location.enabled', false)
const locationWebLink = locationGroupEnabled && !!getConfigOption('ipp.showMetadata.location.webLink', true)
const sidebarHasContent = descriptionInSidebar || exifGroupEnabled || locationGroupEnabled const sidebarHasContent = descriptionInSidebar || exifGroupEnabled || locationGroupEnabled
// Build structured items in parallel // Build structured items in parallel
@@ -134,7 +135,8 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
metadataConfig: { metadataConfig: {
descriptionInCaption, descriptionInCaption,
descriptionInSidebar, descriptionInSidebar,
sidebarHasContent sidebarHasContent,
locationWebLink
}, },
groupByDate groupByDate
} }
+1
View File
@@ -73,6 +73,7 @@ export interface MetadataConfig {
descriptionInCaption: boolean descriptionInCaption: boolean
descriptionInSidebar: boolean descriptionInSidebar: boolean
sidebarHasContent: boolean sidebarHasContent: boolean
locationWebLink: boolean
} }
/** /**