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. |
| `state` | `bool` | Show state / region. |
| `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:
+2 -1
View File
@@ -34,7 +34,8 @@
"city": true,
"state": true,
"country": true,
"gps": true
"gps": true,
"webLink": true
}
},
"customInvalidResponse": false,
+12 -10
View File
@@ -298,16 +298,18 @@ function renderLocation (exif: GalleryExif): HTMLElement {
coords.textContent = exif.latitude.toFixed(5) + ', ' + exif.longitude.toFixed(5)
body.appendChild(coords)
const link = document.createElement('a')
link.className = 'ipp-sidebar-osm'
link.href = 'https://www.openstreetmap.org/?mlat=' + exif.latitude +
'&mlon=' + exif.longitude +
'#map=15/' + exif.latitude + '/' + exif.longitude
link.target = '_blank'
// noreferrer suppresses the Referer header so the share URL doesn't end up in OSM's webserver logs
link.rel = 'noopener noreferrer'
link.textContent = 'Open in OpenStreetMap'
body.appendChild(link)
if (state.metadataConfig.locationWebLink) {
const link = document.createElement('a')
link.className = 'ipp-sidebar-osm'
link.href = 'https://www.openstreetmap.org/?mlat=' + exif.latitude +
'&mlon=' + exif.longitude +
'#map=15/' + exif.latitude + '/' + exif.longitude
link.target = '_blank'
// 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.textContent = 'Open in OpenStreetMap'
body.appendChild(link)
}
}
wrap.appendChild(body)
+2 -1
View File
@@ -82,7 +82,8 @@ export const state = {
metadataConfig: {
descriptionInCaption: false,
descriptionInSidebar: false,
sidebarHasContent: false
sidebarHasContent: false,
locationWebLink: false
} as MetadataConfig,
// True while our pushed history entry is live
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 exifGroupEnabled = !!getConfigOption('ipp.showMetadata.exif.enabled', false)
const locationGroupEnabled = !!getConfigOption('ipp.showMetadata.location.enabled', false)
const locationWebLink = locationGroupEnabled && !!getConfigOption('ipp.showMetadata.location.webLink', true)
const sidebarHasContent = descriptionInSidebar || exifGroupEnabled || locationGroupEnabled
// Build structured items in parallel
@@ -134,7 +135,8 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
metadataConfig: {
descriptionInCaption,
descriptionInSidebar,
sidebarHasContent
sidebarHasContent,
locationWebLink
},
groupByDate
}
+1
View File
@@ -73,6 +73,7 @@ export interface MetadataConfig {
descriptionInCaption: boolean
descriptionInSidebar: boolean
sidebarHasContent: boolean
locationWebLink: boolean
}
/**