-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
46 lines (35 loc) · 1.06 KB
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* Hoodie plugin socialmedia
* Lightweight and easy socialmedia
*/
/**
* Dependencies
*/
var OauthIo = require('./lib'),
OAuth = require('oauthio');
/**
* OauthIo worker
*/
module.exports = function (hoodie, callback) {
var oauthIo = new OauthIo(hoodie);
var oauth_cofig = hoodie.config.get('oauthio_config');
if (!oauth_cofig) {
var default_oauthio_config = {
'enabled': false,
'settings': {
'url': 'https://oauth.io',
'publicKey': '',
'secretKey': ''
}
};
hoodie.config.set('oauthio_config', default_oauthio_config);
oauth_cofig = hoodie.config.get('oauthio_config');
OAuth.setOAuthdUrl(oauth_cofig.settings.url, '/');
OAuth.initialize(oauth_cofig.settings.publicKey, oauth_cofig.settings.secretKey);
}
hoodie.task.on('getoauthconfig:add', oauthIo.getOauthConfig);
hoodie.task.on('signupwith:add', oauthIo.signUpWith);
hoodie.task.on('updatesignupwith:add', oauthIo.updateSignUpWith);
hoodie.task.on('lookuphoodieid:add', oauthIo.lookupHoodieId);
callback();
};