PackageViewer (iOS) & GoogleMap HTTP referrer ?

Q&A about the latest versions
Post Reply
Peres
Posts: 4
Joined: Mon Apr 26, 2021 8:42 pm

May I ask -
What would be a correct HTTP referrer in the GoogleMap API Credentials section, for showing map content in projects uploaded to the PackageViewer (iOS) ?
A HTTP referrer of localhost:1234/* (or similar) works in Safari but not in iOS.

Thanks & best regards,
Rainer
User avatar
Hopki
Gnome
Posts: 13005
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Rainer,
Only do this if the tour is going to be loaded in the APP and no one can download the package.
So basically only you using it on your device, otherwise use OpenStreetMap as it's free.
If you leave the HTTP blank and it will then be open.

Screenshot 2021-05-03 at 20.16.22.png
Screenshot 2021-05-03 at 20.16.22.png (27.33 KiB) Viewed 3872 times

Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

The files in the package viewer are opened with the "file:" protocol. In the Google API key restrictions you need to use the macro __file_url__ to make the work. So with

Code: Select all

__file_url__/*   
you can allow Google Maps in the package, and also prevent others from using your key on their website.
Screen Shot 2021-05-25 at 12.01.26.png
Screen Shot 2021-05-25 at 12.01.26.png (57.67 KiB) Viewed 3581 times
MfG, Thomas
Peres
Posts: 4
Joined: Mon Apr 26, 2021 8:42 pm

Thanks a lot Hopi and Thomas, for your advice and the warning about the referrer.
Much appreciated.

Best regards,
Rainer
Peres
Posts: 4
Joined: Mon Apr 26, 2021 8:42 pm

Hello Thomas,
Hello Hopki,

my apologies but I haven't managed to follow your kind advice.
The key question is how to set the __file_url__ macro correctly.
Below is what I've tried.
All file/path names given are symbolic.

1.
Project Example-Test.p2vr on macOS, connected to Google Map APIs
Saved on local drive.
API: Maps JavaScript with application restriction HTTP referrer *localhost:12345/abcdefg/*
### Works including GoogleMaps access

2.
Saved Example-Test.p2vr as package, Example-Test.ggpkg, on local drive
Uploaded to iCloud Drive
### Opens in Package Viewer, without GoogleMaps connection

3.
URL of Example-Test.p2vr as indicated on iCloud Drive (Web):
https://www.icloud.com/iclouddrive/uvwx ... ple%5FTest

4.
Google Cloud Platform, Project selected, Credentials, Restrictions for API "Maps JavaScript API"
Application restrictions (type) : HTTP referrers (websites)
Website restrictions (for Pano2VR, macOS): *localhost:12345/abcdefg/*
Website restrictions (for Package Viewer, ipadOS): *www.icloud.com/iclouddrive/uvwxyz987654#Example%5FTest*
Saved in Google Cloud Platform.
See screenshot below, please.
Re-started Package Viewer on ipadOS
### Opens in Package Viewer, but still without GoogleMaps connection
### Error Message "page didn't load GoogleMaps correctly. See the JavaScript console ..."

Question:
Which is the correct way of entering file and url correctly ?
With the data above in your example __file_url__* ?


Thank you so much for your help & best regards,
Rainer
Attachments
Test.jpg
Test.jpg (76.21 KiB) Viewed 3649 times
Peres
Posts: 4
Joined: Mon Apr 26, 2021 8:42 pm

Might I ask you to have another look at the issue ?

Correct __file_url__ macro setup
PackageViewer (iOS) & GoogleMap HTTP referrer

Thanks a lot for your help & best regards,
Rainer

Peres wrote: Mon May 17, 2021 7:04 pm Hello Thomas,
Hello Hopki,

my apologies but I haven't managed to follow your kind advice.
The key question is how to set the __file_url__ macro correctly.
Below is what I've tried.
All file/path names given are symbolic.

1.
Project Example-Test.p2vr on macOS, connected to Google Map APIs
Saved on local drive.
API: Maps JavaScript with application restriction HTTP referrer *localhost:12345/abcdefg/*
### Works including GoogleMaps access

2.
Saved Example-Test.p2vr as package, Example-Test.ggpkg, on local drive
Uploaded to iCloud Drive
### Opens in Package Viewer, without GoogleMaps connection

3.
URL of Example-Test.p2vr as indicated on iCloud Drive (Web):
https://www.icloud.com/iclouddrive/uvwx ... ple%5FTest

4.
Google Cloud Platform, Project selected, Credentials, Restrictions for API "Maps JavaScript API"
Application restrictions (type) : HTTP referrers (websites)
Website restrictions (for Pano2VR, macOS): *localhost:12345/abcdefg/*
Website restrictions (for Package Viewer, ipadOS): *www.icloud.com/iclouddrive/uvwxyz987654#Example%5FTest*
Saved in Google Cloud Platform.
See screenshot below, please.
Re-started Package Viewer on ipadOS
### Opens in Package Viewer, but still without GoogleMaps connection
### Error Message "page didn't load GoogleMaps correctly. See the JavaScript console ..."

Question:
Which is the correct way of entering file and url correctly ?
With the data above in your example __file_url__* ?


Thank you so much for your help & best regards,
Rainer
User avatar
thomas
Chief Gnome
Posts: 2611
Joined: Fri Sep 01, 2006 3:56 pm
Location: Vienna, Austria
Contact:

Sorry, I made a small mistake. The URL should be __file_url__/* (the original post had a missing "/"). I fixed the original post, to make it easier for people to find the solution. You literally put __file_url__/* into the URL field as shown in the screenshot, as the actual path on your device is unknown, for security reasons. Also, iOS/Android may change those paths with newer OS versions.
MfG, Thomas
Post Reply