3 support issues
- All
- Questions
- Suggestions
- Problems
Keif 888
Sep 3, 2024
Issues with url matching when PhotoPrism is proxied so that the extension activates
Hi,
Thanks for writing this extension.
I've had a couple of issues using it since I put my PhotoPrism instance into a Kubernetes container and that changed the URL.
When the URL that PhotoPrism is hosted on is proxied the match in the manifest fails.
eg: the following isn't matched.
https://mylocalnas.local:8443/photoprism/library/browse
I've got an adjusted manifest match as follows which handles this, and should handle a non proxied scenario:
"matches": ["*://*/library/browse", "*://*/*/library/browse"],
Please note, that so long as the 1st page landed on within PhotoPrism ends with /library/browse (which is does by default) the extension will be activated. That caused me some pain when testing as I didn't realise it.
There are issues when the updatePhoto function runs, as it is unable to resolve the correct URL to the api, if on a proxied setup.
I addressed this as follows (which should handle both proxied and non). It assumes that the PhotoPrism URL will always have /library, which all the screens that I have tested on do:
// Get the current host URL
var hostUrl = window.location.origin;
var UrlPath = window.location.pathname.match("(\/.*)\/library");
if (UrlPath != null)
{
hostUrl += UrlPath[1];
}
There are also a bunch of situations where variables in the setTimeout function are some times undefined or null. The following checks for these cases, and prevents console error messages.
// Receive message with new coordinates
top.window.addEventListener("message", function(message) {
console.log(message.data);
setTimeout(function(){
// This is necessary because Vue.js responds by default to the input event rather than change event
var event = new Event('input');
if (message.data.coordinates !== undefined)
{
if (message.data.coordinates.lat !== undefined)
{
var leftBox = document.getElementsByClassName('input-latitude')[0];
if (leftBox !== undefined)
{
leftBox.firstChild.firstChild.firstChild.childNodes[1].value = message.data.coordinates.lat;
leftBox.firstChild.firstChild.firstChild.childNodes[1].dispatchEvent(event);
}
}
if (message.data.coordinates.lon !== undefined)
{
var rightBox = document.getElementsByClassName('input-longitude')[0];
if (rightBox !== undefined)
{
rightBox.firstChild.firstChild.firstChild.childNodes[1].value = message.data.coordinates.lon;
rightBox.firstChild.firstChild.firstChild.childNodes[1].dispatchEvent(event);
}
}
}
}, 10);
// Save the coordinates to local storage in case it is a bulk update (to be used when the user triggers the bulk update)
if (message.data.coordinates !== undefined)
{
if (message.data.coordinates.lat !== undefined)
{
localStorage.setItem('latitude', message.data.coordinates.lat);
}
if (message.data.coordinates.lon !== undefined)
{
localStorage.setItem('longitude', message.data.coordinates.lon);
}
}
});
- Report illegal content
- Copy link
Mike Harper
Jul 20, 2023
Not working
Hi, The plugin does not seem to work as others have outlined. I have had it work for small periods of time then it stops. Do you have a plan to update it or should I look at alternatives. Thanks for any feedback.
- Report illegal content
- Copy link
M T
Dec 7, 2022
Geolocation plugin doesn't work with the latest PhotoPrism
Hi,
Your map plugin does not seem to trigger/display on the Library > Originals > Details page running the latest PhotoPrism version. This is the first time I've tried the plugin so I can't comment on earlier versions.
PhotoPrism® CE Build 221118-e58fee0fb
Google Chrome Version 108.0.5359.94 (Official Build) unknown (64-bit)
Pop-OS Linux 22.04 LTS
- Report illegal content
- Copy link