Chrome extension and accessing Google Drive - google-chrome-extension

I want to access google drive from a chrome extension and it appears that Google provides 2 ways to do it.
One is via the google-api-javascript-client:
https://github.com/google/google-api-javascript-client
I cannot find the npm entry for this library. Can it be installed via npm?
The other seems to be via the google-api-nodejs-client
https://github.com/googleapis/google-api-nodejs-client
This can be installed via this npm entry: https://www.npmjs.com/package/googleapis
Can google-api-nodejs-client be used in a Chrome extension?

Related

Is there a way to locate Google Chrome automatically - NodeJS

Problem
I have an electron + puppeteer application which uses the chrome on users computer (Windows and MacOS).
However the problems arises some users have chrome on different locations than set in my program, this leads to program not working completely.
Objective
Is there any NodeJs module to detect chrome location on a PC automatically like registry or something? Or is there a way for puppeteer to detect chrome?

Whats the lowest NodeJs version is required to use Google Drive API V3?

I have been told to use NodeJs V4.9.1/NPM 2.5.11 to develop the server side API's and should use google drive/sheet API's for file upload and validating the user's file. Does NodeJs V4.9.1 should support the Google Drive V3 and Google Sheets API V4 ?
The Google drive and google sheets apis are rest apis that means that they are accessed using HTTP calls.
Any programming language or version of a programming language that can make a HTTP Post, HTTP Get, and possibly patch. will be able to use these apis.
I suspect that who ever told you that was refering to the version of node required for running the Google apis nodejs clinet library I have been unable to find any information on what the minimum version of node required to run that library is.
I have added an issue asking them to clarify that issues 1348
If you use the http/REST API directly, then it's your code so you can write to any version of node. If you intend to use Google's JavaScript client library, that requires node >= 6, so will not run on node 4.9.

Hide Chrome Packaged App from App Launcher

I am creating Chrome Packaged App and need it to be hidden in Chrome App Laucher (list of apps appear when you creating the new tab, URL: chrome://apps/).
I have found "display_in_launcher" and "display_in_new_tab_page" attributes in manifest overview but they seems to be not working for some reason:
When I install App from Chrome Web Store, it just ignores fields and app is still in the App Launcher
When App is installed from developer mode, I see warnings:
Is it possible to hide App from App Launcher for latest version of Chrome?
http://git.chromium.org/gitweb/?p=chromium/chromium.git;a=commitdiff;h=430aa48d0be9a1ae9ba404e8c3dc76d1148f97eb
this will help you find if your app is allowed to hide itself.
Why do you want to do that?

CRUD files on local (sandboxed) filesystem with chrome-extensions

I've been trying to do some CRUD operations to a local drive using chrome extensions.
I understand i won't be able to access the local file system directly, a sandboxed environment will do.
LocalStorage worked for data upto 5 mb. I'll be needing more.
I've found that setting "unlimitedStorage" won't grant more to the LocalStorage.
"unlimitedStorage"
Provides an unlimited quota for storing HTML5 client-side data, such as databases and local storage files. Without this permission, the extension or app is limited to 5 MB of local storage.
Note: This permission applies only to Web SQL Database and application cache (see issue 58985). Also, it doesn't currently work with wildcard subdomains such as http://*.example.com.
see chrome extension docs
I've then tried to use the FileSystemApi.
But it turned out that only chrome apps can use this api.
As far as i know I'm left with 4 other options:
WebSQL, which is deprecated.
IndexedDB, which looks promising
Application cache, referenced in the notes of the unlimitedStorage description.
Storage api, Which seems to be available for both extensions and apps
I've got a hunch that indexedDb will allow some form of CRUD. I'm reluctant to use WebSQL as it's deprecated and i've yet to find information about the Application cache, although i doubt that storing data for extensions is within the boundaries of its intended purpose.
Is it possible for chrome extensions to save, load and delete files on the local file system?
Am i misinformed about the LocalStorage Limitations or the use of the fileSystem Api in chrome extensions?
Will IndexedDB fulfill my needs?
Try with Cordova, Capacitor or similars.
In the browser, run the code in your test area, if you want to use your sandbox you need to run the application on the device (iOS, Android, Windows, Linux, etc.) and use native resources inside the sandbox, dont forget request permission.
If you work with ionic v4 you can use capacitor and mostest important is you can build for native app from web components to have your sandbox into native device!
Capacitor:
https://capacitor.ionicframework.com/docs/apis/filesystem/
Cordova:
https://cordova.apache.org/docs/en/latest/cordova/storage/storage.html

How to package Firefox and Chrome extensions

I am new to Firefox and Chrome extension development.
I have downloaded and tested helloworld sample extension in both FF and Chrome in development mode.
Followed the following steps to work properly in FF and chrome,
In FF
Extracted the sample extension, and added one file in /mozilla/firefox/dev_user/helloworld#mozilla.doslash.org and given extracted folder path.
My FF version is 12.0 and I changed the<em:maxVersion> to 12.0.* in install.rdf file.
Restarted FF and tested, it worked fine.
In Chrome:
Extracted the sample extension
Choose Tools > Extensions
Checked Developer mode
Click the Load unpacked extension button
Dialog appears and selected extracted sample extension folder path
Extension is added and works perfectly.
Now I would like to know how to package these extensions? I mean on clicking the package that extension should install directly in the browser instead of following the above steps.
It's generally not a good idea to ask four questions at once. Let's try to answer all your questions:
How do I package a Firefox extension?
You follow the official documentation (a Firefox XPI package is simply a ZIP archive).
How do I package a Chrome extension?
You follow the official documentation.
How do I make sure a Firefox extension can be installed from a website?
That question is already answered elsewhere.
How do I make sure a Chrome extension can be installed from a website?
You cannot. Current Chrome versions make it very complicated to install extensions from third-party sites. Your best bet is to upload your extension to the Chrome Web Store (as a ZIP archive of extension files, not a proper package - Chrome Web Store creates the package for you). Once the extension is in the Chrome Web Store you can use inline installation to simplify installation from the website associated with your extension.

Resources