
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
angular-google-picker
Advanced tools
Angular directive that interact with the Google Picker API :
Requirements: AngularJS 1.2+
File Size: 2.1Kb minified
bower install angular-google-picker --save
npm install angular-google-picker --save
Download https://github.com/softmonkeyjapan/angular-google-picker/archive/0.2.2.zip
<script src="http://apis.google.com/js/client.js"></script>
<script src="http://apis.google.com/js/api.js"></script>
angular.module('myApp', ['lk-google-picker'])
Configure the plugin (see below configuration section)
Create a scope to handle files that will be selected
angular.module('myApp', ['lk-google-picker'])
.controller('ExampleCtrl', ['$scope', function ($scope) {
$scope.files = [];
$scope.onLoaded = function () {
console.log('Google Picker loaded!');
}
$scope.onPicked = function (docs) {
angular.forEach(data.docs, function (file, index) {
$scope.files.push(file);
});
}
$scope.onCancel = function () {
console.log('Google picker close/cancel!');
}
}]);
<a href="javascript:;" lk-google-picker on-picked="onPicked(docs)" on-loaded="onLoaded()" on-cancel="onCancel()">Open my Google Drive</a>
Every file is a json object that looks like :
[
{
"id": "0B50DHrsuMky6UFlSQloxYGBxT2M",
"serviceId": "docs",
"mimeType": "image/jpeg",
"name": "DSC01845.JPG",
"type": "photo",
"lastEditedUtc": 1409023514905,
"iconUrl": "https://ssl.gstatic.com/docs/doclist/images/icon_11_image_list.png",
"description": "",
"url": "https://docs.google.com/file/d/0B50DHrsuMky6UFlSQloxYGBxT2M/edit?usp=drive_web",
"sizeBytes": 1570863,
"parentId": "0B50DHrsuMkx6cWhrSXpTR1cyYW8"
},
{
...
}
]
In order to work, Google Picker needs to connect to the Google API using an application credentials (Api Key and client ID). For more information on how to create an application/project, please refer to https://developers.google.com/drive/web/. To do so, you'll need to configure the service.
angular.module('myApp', ['lk-google-picker'])
.config(['lkGoogleSettingsProvider', function (lkGoogleSettingsProvider) {
lkGoogleSettingsProvider.configure({
apiKey : 'YOUR_API_KEY',
clientId : 'YOUR_CLIENT_ID',
scopes : ['https://www.googleapis.com/auth/drive', 'another_scope', 'and_another'],
locale : 'ja',
features : ['..', '..'],
views : ['..', '..']
});
}])
The Picker use the concept of views and features that allow you to customize it. The service provider allow you to enable some features to the Picker the same way you define your API Key or client ID (using either configure or setters).
angular.module('myApp', ['lk-google-picker'])
.config(['lkGoogleSettingsProvider', function (lkGoogleSettingsProvider) {
lkGoogleSettingsProvider.features(['MULTISELECT_ENABLED', 'ANOTHER_ONE']);
}])
Default : MULTISELECT_ENABLED
feature is use as default.
Please refer to https://developers.google.com/picker/docs/reference for more informations.
Views are objects that needs to be instanciate using the namespace google.picker.*
. That namespace is already defined in the core of the directive. In order to add views to your picker, all you need to do is to define the class that needs to be used :
angular.module('myApp', ['lk-google-picker'])
.config(['lkGoogleSettingsProvider', function (lkGoogleSettingsProvider) {
lkGoogleSettingsProvider.views([
'DocsUploadView()',
'DocsView()'
]);
}])
NOTE : Views classes have some useful methods such as setIncludeFolders
or setStarred
(or any other methods available). In order to use them, just chain them to the class :
angular.module('myApp', ['lk-google-picker'])
.config(['lkGoogleSettingsProvider', function (lkGoogleSettingsProvider) {
lkGoogleSettingsProvider.setViews([
'DocsUploadView().setIncludeFolders(true)',
'DocsView().setStarred(true)',
'DocsView(google.picker.ViewId.FOLDERS).setSelectFolderEnabled(true)'
]);
}])
Default : DocsUploadView
and DocsView
are use as default.
Please refer to https://developers.google.com/picker/docs/reference for more informations.
The directive provide you 3 callbacks that you can use in order to work with the Picker.
This callback is triggered after the picker has been initialized and shown on the page.
angular.module('myApp', ['lk-google-picker'])
.controller('ExampleCtrl', ['$scope', function ($scope) {
$scope.onLoaded = function () {
console.log('Google Picker loaded!');
}
}]);
<a href="javascript:;" lk-google-picker on-loaded="onLoaded()">Open my Google Drive</a>
This callback is triggered after you select files and click on the select
button from the Picker.
angular.module('myApp', ['lk-google-picker'])
.controller('ExampleCtrl', ['$scope', function ($scope) {
$scope.onPicked = function (docs) {
// docs contains the list of google documents object as shown above.
}
}]);
<a href="javascript:;" lk-google-picker on-picked="onPicked">Open my Google Drive</a>
This callback is triggered after the picker has been closed by clicking on the cancel button from the picker.
angular.module('myApp', ['lk-google-picker'])
.controller('ExampleCtrl', ['$scope', function ($scope) {
$scope.onCancel = function () {
console.log('Google picker close/cancel!');
}
}]);
<a href="javascript:;" lk-google-picker on-cancel="onCancel">Open my Google Drive</a>
The demo version available at http://softmonkeyjapan.github.io/angular-google-picker/ can be found in the example
folder.
You will need a server in order to try it on your local machine. Since the Google Picker demo application is setup to allow origin from localhost:8000, I encourage you to use the python SimpleHTTPServer
:
$ cd path/to/the/example/directory
$ python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
You should now be able to browse to localhost:8000
and see it in action from your localhost.
A demo version is available at http://softmonkeyjapan.github.io/angular-google-picker/.
Licensed under the MIT license
FAQs
An AngularJs directive that interact with the Google API Picker
The npm package angular-google-picker receives a total of 76 weekly downloads. As such, angular-google-picker popularity was classified as not popular.
We found that angular-google-picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.