-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
montagereview.js contains hardcoded links to example.com/zm #2253
Comments
We have a PR that addresses this, not sure when it will be ready though. In the meantime, you can just add an alias in your apache config so that /zm works as well. The reason is that configuring everything everywhere to use something other than /zm is very confusing for most people, so if we just make the backend urls work with /zm and the front be whatever and have both work, then things are easier for new users to configure. |
OK, thanks for the reply! |
im getting this error in 1.32 as i changed my SSL port to 8443 in the default-ssl.conf can you be more specific? |
Sorry for the late reply. You've probably already figured out a solution on your own by now, but here's the explanation anyway (though I'm not really sure it applies to your case, since this is not about changing the port but about moving ZM's webroot from a subdir /zm to the (sub)domain's root). Supposing a webroot of /srv/zoneminder/www, the gist of it is something like this: ln -s /srv/zoneminder/www /srv/zoneminder/www/zm Now, if our domain example.com points to 'www', then when ZM's hardcoded links try to access example.com/zm they will descend into 'zm' and land right back to the parent dir 'www', because /zm is a link to it. So no more errors produced :) This could also be implemented as an alias in the http server's configuration file, as connortechnology said, but I find creating the link a simpler and cleaner solution (especially since it's supposed to be a stopgap measure until the PR connortechnology mentioned is merged). But they're essentially the exact same thing. |
That PR was merged and released in 1.32.3. |
Are you talking about #2335 (I saw it mentioned in #2336)? Yes, the issue has been partly fixed (e.g. no more malformed URL calls in live or montage view) but as you previously said, the backend still retains many instances of hardcoded /zm/whatever calls, mainly (but not solely) API and CSS calls as far as I can see, so I guess the 'zm' -> 'www' link or alias is still needed. By the way, I noticed this while skimming through skins/classic/includes/export_functions.php:
but
Shouldn't it be either 'zmEventImages.html' or 'zm/EventImages.html' in all three cases..? |
So I believe the fix for this is to create a new var in montagereview.js.php: Then replace the first part of the string It would be nice if someone could try this and report back. Otherwise, I'll get to it when I have time. |
fixed in #2377 |
OS: Arch Linux (not that it matters in this case)
ZoneMinder version: Confirmed as still present in master branch
In its default configuration ZM runs its Web UI from a 'zm' subdirectory, e.g. example.com/zm. That's fine, but I (and I'm sure many other people) prefer to run my servers with a domain- or port-based setup, i.e. zm.example.com or example.com:1234
The problem is that, when ZM is run this way (or even when it's run from a different subdir), Montage Review (and possibly other parts of ZM that I haven't yet stumbled upon) does not work properly because it's currently hardcoded to assume ZM is being run from the subdir 'zm'. The culprits are lines 127 and 135 in WEBDIR/skins/classic/views/js/montagereview.js (I have bolded the relevant parts):
Removing '/zm' from these two lines is an easy enough fix, but unfortunately it results in the same problem when trying to do the reverse: if ZM is run from a 'zm' subdir, as is the default, then the link fails once more because now it lacks that '/zm' part - not to mention, the issue with running from a differently named subdir is not addressed in either case.
One way to fix this would be to change the subdir part of the link from a hardcoded to a dynamic value and have some pre-install script fetch the WEBDIR path, extract the correct subdir (if any) and insert it to the relevant lines. So the above code block would become something like this:
It goes without saying that this is just me taking a quick look and trying to think of a quick fix, without having properly debugged, nor being properly familiar with, the codebase.
Edit: Some more potentially problematic files
skins/classic/css/base/views/zone.css, line 55:
background-image: url(/zm/skins/classic/graphics/point-g.png);
skins/classic/css/base/views/zone.css, line 59:
background-image: url(/zm/skins/classic/graphics/point-o.png);
includes/Event.php, line 577:
$url = $Server->Url() . '/zm/api/events/'.$this->{'Id'}.'.json';
includes/Event.php, line 621:
$url = $Server->Url() . '/zm/api/events/'.$this->{'Id'}.'.json';
includes/Monitor.php, line 388:
$url = $Server->Url() . '/zm/api/monitors/'.$this->{'Id'}.'.json';
skins/classic/includes/export_functions.php, line 628:
echo "< div >< a href="javascript:switchevent('$eids/zm/EventImages.html');" > $eids < /div >";
That's more or less it, along with a couple of comments in views/image.php and views/view_video.php but those can be fixed more than easily.
I think the issues in Event.php and Monitor.php are probably inconsequential, and I can't tell about the one in export_functions.php because I don't know where and how that function is used. The issue with Montage Review, along with maybe the two CSS ones, are the ones I would deem in need of some attention.
Edit 2: Hacky fix applied by creating a /zm/ link inside /www/ which points back to /www/. So I guess the problem can be considered as more or less "fixed" or at least of very low priority.
The text was updated successfully, but these errors were encountered: