viewing a local pdf file in google chrome packaged apps - google-chrome

In my packaged app I would like to open pdf's stored in local filesystem. I've managed to open them if I select them using chrome.fileSystem.chooseEntry, but I can't find a way to do the same if the filesnames are hard coded.
The idea behind is an app that manages book information and allows to open them if they are stored in the local filesystem. Thanks a lot!

This can't be done, for good reason. Packaged apps have a security model based on the open web. Web pages can't access your local files without your permission (i.e., without a "user gesture" or a specific user action such as going through a file chooser), and packaged apps have the same restriction.
You could import local files (again using a user gesture) into the HTML5 file system, or into chrome.syncFileSystem. Then you'd have gestureless access to the imported copies. Likewise, you could export from either of those file systems to the local file system, again with a user gesture. But the boundary between local files and your app's access to them is meant to be loud and explicit.

Related

Building cloud service using python google drive API

Hi i'm trying to make my own cloud web service that uses python google drive API.
what i'm trying to make is basically cloud service but can also interact with Google Drive.
To do that, my web service users have to have their own 'storage.json' file in their server's virtual directory (which really stores in server).
when I somehow get my own 'storage.json' file, (I followd: https://developers.google.com/drive/api/v3/manage-uploads)
and upload 'storage.json' file to my directory like User1, upload and download with Google drive works just fine.
but my final goal is when my user doesn't have 'storage.json' file in their directory like User2, I want browser to pops up in User2's computer and User2 can follow the google's authentication flow and finally download 'storage.json' file into server's ~/User2/ directory.
Do you think this is possible? or if there are better ways, can you notice me? thank you

Open folder vs create new project from existing files, located under shared network drive in PhpStorm

It's not clear to my why I should use the option in PhpStorm to create a new project from existing files instead of just opening a folder and declaring the project directory.
I have a web server installed and I can access it's root by a shared network drive. Now I can just open the a folder in PhpStorm and declare it's root. It will generate a PhpStorm project at the given directory.
But there is also an option to open a new project from existing files (located under shared network drive). My best guess is that this option is the way to go. Is this true and if so, why? Or if it doesn't matter, why doesn't it?
There will be several people using the same shared drive to work in different projects in the webroot.
You can, of course, create a project on mounted network drive via File/Open, but note that this is not officially supported. All IDE functionality is based on the index of the project files which PHPStorm builds when the project is loaded and updates on the fly as you edit your code. To provide efficient coding assistance, PHPStorm needs to re-index code fast, which requires fast access to project files and caches storage. The latter can be ensured only for local files, that is, files that are stored on you hard disk and are accessible through the file system. Sure, mounts are typically in the fast network, but one day some hiccup happen and a user sends a stacktrace and all we see in it is blocking I/O call.
So, the suggested approach is downloading files to your local drive and use deployment configuiration to synchronize local files with remote. See https://confluence.jetbrains.com/display/PhpStorm/Sync+changes+and+automatic+upload+to+a+deployment+server+in+PhpStorm

Access website localstorage data from a Chrome Packaged App

I'm building a packaged app that's meant to interact with a website I wrote to get its localStorage data and send it to other devices using bluetooth. This seems like it would be easy with an extension, however with an extension I would not have access to chrome's bluetooth API. I'm not sure this is even possible, but if it is, how would I go about accessing and communicating with the website using the packaged app?
The answer is that you can't. The two local storage repositories are distinct ("sandboxed"), and one can't access the other.
If this website wants to make data available to any other website, or to a Chrome App, it should put it someplace on the server, accessible via a URL, and then the Chrome App can easily access it. But, there's no way to effect such sharing with the data on the client.
Two Chrome Apps can share data locally, because they can access the local file system. However, web apps (HTML/JavaScript loaded from a server) can't access the local file system, only a sandboxed file system.

sharing files from app and pc

I created an app which records audio and adds some effect to it (Voice Instagram!).
Currently, I save an mp3 versions of these files in Local Storage folder.
For my debug purposes I need to access this files from my PC. And this is the problem!
WP8 does not allow me to write in any public folder (Documents, Music, ...) and I cannot access internal app files from my PC.
What are my options here?
I ended up using SkyDrive and uploading files there.

How to restrict user access the file on the HTTP Server?

I'm writing a web application that allow user upload their files on the app. The file will be uploaded on the HTTP Server, after the user click the "upload" button. The user can receive the file by getting the file from the path.... ...for example: http://www.demo.com/user/abc/download/the_file.jpg
but I found that all the people can access this file using the path. How can I do, or is there a better way to manage the file that only registered user or the file owner can download the file?
Serving a file directly within a script is not an option because of performance issues and it's not really possible to serve BIG files because of memory limits.
The best option is to use the Apache module mod_xsendfile. The idea is to redirect all requests to a
PHP/Perl/Python script which will just set a HTTP header saying "Hey Apache, serve this file instead" and mod_xsendfile will take care of it.
And the client will never be able to download the file without this authentication.
If using something like apache httpd, you can use .htaccess files and have directories that are provisioned to users or groups if you want the user to continue accessing files at a path on the filesystem.
If you lock down the directory and have a script to manage file delivery, you can check permissions in the script and give the user the file requested or a 403.
I tend to use the script approach as it gives me more control over how the permissions are managed and more complex access scenarios.