How can I find location of resource file loaded in TWebBrowser when running GMLib? - gmlib

I am running GMLib in XE7 and we are using a Google API Client ID (as opposed to an API Key). I have successfully modified the map.html to include the Client ID. I recompiled the resource files and GMLib and that is all working. However, because of the use of the Client ID, I need to give Google all possible locations that will be using our Client ID. If it were a web app, it would be the URL, but in this case I can give them the file location.
I assume the GMMap control generates a local html file based on the resource file and this file is loaded in the TWebBrowser. How can I find the file location because that is what Google is verifying against our Client ID? I tried looking for it a different events, but it always seems to show about:blank.

GMLib don't create a local file with HTML page. You need to change TCustomGMMap.GetAPIUrl method. This methid returns a string with the HTML code

Related

Can download files (without file name or extension), but unable to see them?

I'm using the Google Drive API to generate a downloadable link for a file that looks like this:
https://www.googleapis.com/drive/v3/files/{file_id}?access_token={access_token}&alt=media
The problem is files are being downloaded without name and without extension.
If I add the extension manually after the file downloads it still works, but it's bad to tell my users they have to do that every time, and the user would have to know which extension the file actually has.
If I call https://www.googleapis.com/drive/v3/files/?access_token={access_token}
I can't see the files I've uploaded... I think it could be a problem related to having access to the files' metadata, but I did authorize the auth.files.metadata scope.
I generate the access token using the refresh token and obtained the refresh token from the Oauth Playground... I'm confident I used the proper credentials for my application, but I could triple-check if someone suggests this could be the problem.
What can I do to debug this?

Downloading files from Drive using alt=media with correct filename

I'm having trouble allowing files (non-shared) to be downloaded from a Google Drive account. I've created a listing using the php drive sdk and would like to provide authorised links to download the files using a generated access token. I've got downloads working with links like this:
https://www.googleapis.com/drive/v3/files/[fileid]?alt=media&access_token=[access_token]
The problem is that whenever a file is downloaded, it is named [fileid].[extension], rather than the real file name that appears in Drive.
I've tried adding the download="[real filename]" into the a link to suggest the correct filename, but it's being ignored in all the browsers I've tried.
I've got an alternative working that gets the file piece by piece server side and echoes it out as a file via php, but I'd prefer for downloads to be straight from Drive to the user.

Chrome App: Getting a list of files in a designated folder

I am building a chrome app for Digital Signage where I need the user to select some files from a particular folder (preferably in the app's directory) i.e audio, videos, photos which should be created by the app on install.
The sample code provided by Google requires that the user navigates to a folder like this
chrome.fileSystem.chooseEntry({type: 'openDirectory'}, function(theEntry) {
if (!theEntry) {
output.textContent = 'No Directory selected.';
return;
}
// use local storage to retain access to this file
chrome.storage.local.set({'chosenFile': chrome.fileSystem.retainEntry(theEntry)});
loadDirEntry(theEntry);
});
However, my app simply needs the name of files in that (say Video) known directory for the user to build a playlist, rather than actually selecting a video file.
Is this supported in chrome.fileSystem API? Any pointers to how I cold get this done?
It sounds like you should be using either the app's sandboxed file systems, or the app's install folder itself.
The sandboxed file systems allow the app to store whatever data it wants, in whatever structure it wants. There are two to choose from: persistent or temporary. Temporary may be cleared at any point in time. To use these check out this article. Some of its code may be out of date with the spec. Note also apps need to request the unlimitedStorage to use these.
The install folder itself can be used in a read only way. To do this you use chrome.runtime.getPackageDirectoryEntry.

google drive hosting changes in URL

I've developed a web app that uses google drive as hosting platform as explained here:
https://support.google.com/drive/answer/2881970?hl=en
The application has been working OK when users accessed:
https://googledrive.com/host/0B0YWdwxH6K5XdVpaNjhWUl9vZkE/?scriptid=AKfycbx66sZMaqLK8byhV7wY_DoQ8ouqF1acWRcc0JIHyDu5CVWZupAK&id=people
But yesterday it started redirecting that address to:
b216bdb4cf56e8d9d85cf1123921ca125a010325.googledrive.com/host/0B0YWdwxH6K5XdVpaNjhWUl9vZkE/
any idea why? is this a permanent change? does the subdomain key follow any logic?
Browser: occurs on chrome & IE
Operating System: windows8
Drive on the Web / Drive for desktop: when accessing googledrive.com/host
I found the right thread at google.com to answer this. Here it is: https://productforums.google.com/forum/#!category-topic/drive/mTyJXruRhBg
In short, the redirect and prefix is here to stay. It's for some security thing. All files within the same googledrive folder will be prefixed with the same guid-looking string. That is, provided we use this googledrive url form: googledrive.com/host/{folderID}/FriendlyFilename. Then, any support files you want to access or link from that folder, just access them as FriendlyFilename with relative url form.
My problem was, I was using the obscure form googledrive.com/host/{userID+fileID}. (no FolderID or FriendlyFilename). That now gets a different domain prefix for every file within the same folder.
Here's a different variation of that test file I showed above (which was getting Security exception for webworker). It works now by using the {FolderID}/FriendlyFilename form. Tada. https://googledrive.com/host/0B8BLd2qPPV7XME1rNU9iWnYtbTg/ded-worker-F12throw.html

Google Drive API without Ouath and receive files

We are building a web application that should get all files from a specific folder in our Drive (read only). The problem is that I can't find a way to access our files without using OAuth. Basically I would want to request our files using AJAX and present the contents of them on a page (without the user having to do anything). Is this at all possible and have I missed something?
Whenever I try something without using OAuth I get a global internalError (being related to authorization according to the current documentation).
The experience I'm trying to achieve:
User enters http://domain.com/posts > Get all public files from folder Y > Sort them by date > Show the titles in HTML > User clicks title > User is presented with full contents of the file as HTML.
Is this possible?
Thanks in advance! :)
UPDATE:
To clarify: I would want to depend on our API key only.
You can do it this way, without using Google Drive API:
Make the folder public
Copy the folder ID from the URL
Append it to https://googledrive.com/host/ e.g. https://googledrive.com/host/0BzEbtMoF6IXbaVN2Qmx1em9qS0k/
You will get a directory index with all files listed and if the (sub)folder contains an index.html file, it will be rendered instead.
To get the JSON or XML file list, use YQL.