Skip to content

Commit

Permalink
fix sharing link
Browse files Browse the repository at this point in the history
  • Loading branch information
haikoschol committed Jan 25, 2024
1 parent 6e3acea commit e849d1b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions photos/static/photos/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ class IconButton {

function shareCatto(photoId, zoomLevel) {
const protocol = window.location.hostname === 'localhost' ? 'http' : 'https';
const url = `${protocol}://${window.location.hostname}${window.location.pathname}?id=${photoId}&zoomLevel=${zoomLevel}`;
const maybePort = window.location.hostname === 'localhost' ? ':8000' : '';
const url = `${protocol}://${window.location.hostname}${maybePort}${window.location.pathname}?id=${photoId}&zoomLevel=${zoomLevel}`;

navigator.share({
title: `${document.title} #${photoId}`,
Expand Down Expand Up @@ -199,9 +200,8 @@ function setMapView(map, photos) {
let {latitude, longitude, zoomLevel} = getCurrentPosition(photos)

const urlParams = new URLSearchParams(window.location.search);
const photoId = Number(urlParams.get('id'));
const zoomParam = Number(urlParams.get('zoomLevel'));
const photosFromUrlParam = photos.filter(p => p.id === photoId);
const photosFromUrlParam = photos.filter(p => p.id === urlParams.get('id'));

if (photosFromUrlParam.length === 1) {
if (zoomParam <= maxZoomLevel && zoomParam >= 1) {
Expand Down

0 comments on commit e849d1b

Please sign in to comment.