Base URL for hotlink
Opened this issue · 4 comments
Would it be possible to add two configuration directives to the link component which would be base_url and link_target?
I've framed the dynmap view so that I can display our navigation at the top.
That works perfectly except for the hotlinking feature which I don't want to miss. For the time being I've hacked something together to get it working (for me) but a configuration option would be pretty cool.
I needed to edit the map.js because the base path isn't the same.
This is what I've changed to get it working
EDIT: This is the nginx config I've used, maybe it's useful to someone: NGINX config
It's impossible to apply your patch directly to the source 😊
But it's possible to add some code to detect framed page and do something different.
However, I think you can add navigation without framing it. 😃
Sure, my patch is more like the hack to get it working not the solution to the problem :)
And I think framing the whole thing is more clean than manually extracting everything needed for the navigation into a static version which couldn't reflect logged in users, etc. just to fiddle it into the map template.
I'm not sure what the best solution might be but I'm not really into JS either. I usually use lambdas to build certain things such as URLs so that I can provide "custom builders" by just providing a lambda as option.
From what I've seen is that most sites follow the pattern of framing a small version into their page and link to the "fullscreen version" which is the stock template with no site navigation at all. I tried to provide a fullscreen version with a smaller navigation at the top (normally the header is bigger and the page isn't full width).
I think a seamless integration of dynmap into a site isn't trivial at all. I can't remember anymore but I had to change a bit more to get it working.
Cheers!
I use nginx in front of dynmap to proxy it with some caching to speed up load times and also to not expose the dynmap web server itself. There's an nginx proxying module that basically lets your hack the html while in transit that may meet your needs, but it may also count as even more of a hack than you've proposed. Might be worth looking into though, as I've had success with getting nginx to proxy to dynmap.
Basically dynmap would need 3 settings to allow my hack out of the box:
Link plugin
- link target (_top, _parent, _blank)
- Fix for _follow (could be smart code to determine this from the link target but I didn't understand why this method exists at all)
Main map
- Base URL (I would use a callback here)
As I said, the fix wouldn't be for me as I already solved it for my personal use but I thought that adding these 2-3 options or otherwise making it possible to change the linking behaviour would enable other users (or webmasters) to easily frame the page in a designed webpage and not breaking the hotlinking feature of dynmap.
I also added a link to my nginx config in the first post. Maybe it can help someone trying to get the same thing working.
Cheers!