backend-manager 4.0.21 → 4.0.23
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
CHANGED
|
@@ -40,8 +40,8 @@ Module.prototype.main = function () {
|
|
|
40
40
|
// Check for required values
|
|
41
41
|
if (!payload.data.payload.path) {
|
|
42
42
|
return reject(assistant.errorify(`Missing required parameter: path`, {code: 400}));
|
|
43
|
-
} else if (!payload.data.payload.
|
|
44
|
-
return reject(assistant.errorify(`Missing required parameter:
|
|
43
|
+
} else if (!payload.data.payload.content) {
|
|
44
|
+
return reject(assistant.errorify(`Missing required parameter: content`, {code: 400}));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
// Fix other values
|
|
@@ -68,7 +68,7 @@ Module.prototype.main = function () {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// Upload post to GitHub
|
|
71
|
-
Module.prototype.uploadContent = function (
|
|
71
|
+
Module.prototype.uploadContent = function () {
|
|
72
72
|
const self = this;
|
|
73
73
|
const Manager = self.Manager;
|
|
74
74
|
const Api = self.Api;
|
|
@@ -77,9 +77,10 @@ Module.prototype.uploadContent = function (content) {
|
|
|
77
77
|
|
|
78
78
|
return new Promise(async function(resolve, reject) {
|
|
79
79
|
// Save variables
|
|
80
|
-
const filename = payload.data.payload.pathl
|
|
81
80
|
const owner = payload.data.payload.githubUser;
|
|
82
81
|
const repo = payload.data.payload.githubRepo;
|
|
82
|
+
const filename = payload.data.payload.path;
|
|
83
|
+
const content = payload.data.payload.content;
|
|
83
84
|
|
|
84
85
|
// Log
|
|
85
86
|
assistant.log(`uploadContent(): filename`, filename);
|
|
@@ -90,7 +91,7 @@ Module.prototype.uploadContent = function (content) {
|
|
|
90
91
|
repo: repo,
|
|
91
92
|
path: filename,
|
|
92
93
|
})
|
|
93
|
-
.catch(e => e);
|
|
94
|
+
.catch((e) => e);
|
|
94
95
|
|
|
95
96
|
// Log
|
|
96
97
|
assistant.log(`uploadContent(): Existing`, existing);
|
|
@@ -116,8 +116,8 @@ BackendAssistant.prototype.init = function (ref, options) {
|
|
|
116
116
|
|
|
117
117
|
// Set stuff about request
|
|
118
118
|
self.request = {};
|
|
119
|
-
self.request.referrer =
|
|
120
|
-
self.request.method =
|
|
119
|
+
self.request.referrer = self.ref.req.headers?.referrer || self.ref.req.headers?.referer || '';
|
|
120
|
+
self.request.method = self.ref.req.method || undefined;
|
|
121
121
|
|
|
122
122
|
// Set geolocation data
|
|
123
123
|
self.request.geolocation = {
|
|
@@ -178,6 +178,7 @@ BackendAssistant.prototype.init = function (ref, options) {
|
|
|
178
178
|
} else {
|
|
179
179
|
self.request.type = 'form';
|
|
180
180
|
}
|
|
181
|
+
self.request.url = self.ref.req.url || '';
|
|
181
182
|
self.request.path = self.ref.req.path || '';
|
|
182
183
|
self.request.user = self.resolveAccount({authenticated: false});
|
|
183
184
|
|
|
@@ -55,6 +55,7 @@ Settings.prototype.resolve = function (assistant, schema, settings, options) {
|
|
|
55
55
|
throw assistant.errorify(`Invalid schema provided`, {code: 400});
|
|
56
56
|
}
|
|
57
57
|
// console.log('---schema', schema);
|
|
58
|
+
// console.log('---options', options);
|
|
58
59
|
// console.log('---self.settings', self.settings);
|
|
59
60
|
|
|
60
61
|
// Iterate each key and check for some things
|
|
@@ -63,9 +64,9 @@ Settings.prototype.resolve = function (assistant, schema, settings, options) {
|
|
|
63
64
|
const resolvedValue = _.get(self.settings, path);
|
|
64
65
|
let replaceValue = undefined;
|
|
65
66
|
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
//
|
|
67
|
+
// console.log('Found:', path, schemaNode);
|
|
68
|
+
// console.log('originalValue:', originalValue);
|
|
69
|
+
// console.log('resolvedValue:', resolvedValue);
|
|
69
70
|
|
|
70
71
|
// Check if this node is marked as required
|
|
71
72
|
let isRequired = false;
|
|
@@ -75,7 +76,7 @@ Settings.prototype.resolve = function (assistant, schema, settings, options) {
|
|
|
75
76
|
isRequired = schemaNode.required;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
//
|
|
79
|
+
// console.log('isRequired:', isRequired);
|
|
79
80
|
|
|
80
81
|
// If the key is required and the original value is undefined, throw an error
|
|
81
82
|
if (options.checkRequired && isRequired && typeof originalValue === 'undefined') {
|