backend-manager 2.2.0 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/src/manager/functions/core/actions/api/firebase/get-providers.js +1 -0
- package/src/manager/functions/core/actions/api/handler/create-post.js +1 -1
- package/src/manager/functions/core/actions/api/special/setup-electron-manager-client.js +30 -2
- package/src/manager/functions/core/actions/api.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-manager",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Quick tools for developing Firebase functions",
|
|
5
5
|
"main": "src/manager/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"homepage": "https://itwcreativeworks.com",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@firebase/rules-unit-testing": "^2.0.2",
|
|
31
|
-
"@google-cloud/storage": "^5.
|
|
32
|
-
"@sendgrid/mail": "^7.
|
|
31
|
+
"@google-cloud/storage": "^5.20.5",
|
|
32
|
+
"@sendgrid/mail": "^7.7.0",
|
|
33
33
|
"@sentry/node": "^6.19.7",
|
|
34
34
|
"backend-assistant": "^0.0.64",
|
|
35
35
|
"busboy": "^1.6.0",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"cors": "^2.8.5",
|
|
38
38
|
"dotenv": "^16.0.1",
|
|
39
39
|
"firebase-admin": "^9.12.0",
|
|
40
|
-
"firebase-functions": "^3.21.
|
|
40
|
+
"firebase-functions": "^3.21.2",
|
|
41
41
|
"fs-jetpack": "^4.3.1",
|
|
42
42
|
"hcaptcha": "^0.1.1",
|
|
43
43
|
"inquirer": "^8.2.4",
|
|
@@ -39,6 +39,7 @@ Module.prototype.main = function () {
|
|
|
39
39
|
prefix += `${item}=LOL&`
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
+
// https://firebase.google.com/docs/reference/rest/auth#section-sign-in-with-oauth-credential
|
|
42
43
|
fetch(`https://identitytoolkit.googleapis.com/v1/accounts:signInWithIdp?key=${payload.data.payload.firebaseApiKey}`, {
|
|
43
44
|
method: 'post',
|
|
44
45
|
json: true,
|
|
@@ -118,7 +118,7 @@ Module.prototype.main = function () {
|
|
|
118
118
|
title: payload.data.payload.title,
|
|
119
119
|
body: `"${payload.data.payload.title}" was just published on our blog. It's a great read and we think you'll enjoy the content!`,
|
|
120
120
|
// click_action: `${Manager.config.brand.url}/${postUrl}`,
|
|
121
|
-
click_action: Manager.config.brand.url
|
|
121
|
+
click_action: `${Manager.config.brand.url}/blog`,
|
|
122
122
|
icon: Manager.config.brand.brandmark,
|
|
123
123
|
}
|
|
124
124
|
}),
|
|
@@ -12,13 +12,37 @@ Module.prototype.main = function () {
|
|
|
12
12
|
return new Promise(async function(resolve, reject) {
|
|
13
13
|
|
|
14
14
|
const fetch = Manager.require('wonderful-fetch');
|
|
15
|
+
const _ = Manager.require('lodash');
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
let uid = payload.data.payload.uid;
|
|
17
18
|
const app = payload.data.payload.appId || payload.data.payload.app || Manager.config.app.id;
|
|
18
19
|
|
|
19
20
|
let uuid = null;
|
|
20
21
|
let error;
|
|
21
22
|
|
|
23
|
+
let customToken = null;
|
|
24
|
+
|
|
25
|
+
if (payload.data.authenticationToken || payload.data.backendManagerKey) {
|
|
26
|
+
await self.Api.resolveUser({adminRequired: true})
|
|
27
|
+
.then(async (user) => {
|
|
28
|
+
uid = _.get(user, 'auth.uid', null);
|
|
29
|
+
await self.libraries.admin.auth().createCustomToken(uid)
|
|
30
|
+
.then(token => {
|
|
31
|
+
customToken = token;
|
|
32
|
+
})
|
|
33
|
+
.catch(e => {
|
|
34
|
+
error = assistant.errorManager(`Failed to create custom token: ${e}`, {code: 500, sentry: false, send: false, log: false}).error
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
.catch(e => {
|
|
38
|
+
assistant.errorManager(`Failed to resolve user: ${e}`, {code: 500, sentry: false, send: false, log: true})
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
if (error) {
|
|
42
|
+
return reject(error)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
22
46
|
// Generate uuid
|
|
23
47
|
if (uid) {
|
|
24
48
|
await Api.import('general:generate-uuid', {version: 5, name: uid})
|
|
@@ -52,6 +76,7 @@ Module.prototype.main = function () {
|
|
|
52
76
|
return resolve({
|
|
53
77
|
data: {
|
|
54
78
|
uuid: uuid,
|
|
79
|
+
customToken: customToken,
|
|
55
80
|
timestamp: new Date().toISOString(),
|
|
56
81
|
ip: assistant.request.ip,
|
|
57
82
|
country: assistant.request.country,
|
|
@@ -60,9 +85,12 @@ Module.prototype.main = function () {
|
|
|
60
85
|
});
|
|
61
86
|
})
|
|
62
87
|
.catch(e => {
|
|
63
|
-
return reject(
|
|
88
|
+
return reject(assistant.errorManager(`Error fetching app details: ${e}`, {code: 500, sentry: false, send: false, log: false}).error)
|
|
64
89
|
})
|
|
65
90
|
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
66
94
|
});
|
|
67
95
|
|
|
68
96
|
};
|
|
@@ -78,6 +78,7 @@ Module.prototype.main = function() {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (self.payload.response.status === 200) {
|
|
81
|
+
self.assistant.log(`Finished: ${resolved.command}`, self.payload, JSON.stringify(self.payload), {environment: 'production'})
|
|
81
82
|
return res.status(self.payload.response.status).json(self.payload.response.data);
|
|
82
83
|
} else {
|
|
83
84
|
console.error(`Error executing ${resolved.command} @ ${resolved.path}`, self.payload.response.error)
|