godprotocol 2.2.84 → 2.2.85
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
|
@@ -174,7 +174,13 @@ class Headers extends Services {
|
|
|
174
174
|
headers["authorization"] = `Bearer ${authorization}`;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
let third_party =
|
|
177
|
+
let third_party =
|
|
178
|
+
xplatform !== this.platform_uri &&
|
|
179
|
+
!gp_services.profile.endsWith(request.headers.host);
|
|
180
|
+
if (gp_services.profile.endsWith(request.headers.host)) {
|
|
181
|
+
headers["x-platform"] = xplatform;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
let res = await fetch(
|
|
179
185
|
`${gp_services.profile}/${third_party ? "third_party_me" : "me"}`,
|
|
180
186
|
{
|
|
@@ -234,13 +240,13 @@ class Headers extends Services {
|
|
|
234
240
|
if (authorisation) authorisation = authorisation.replace("Bearer ", "");
|
|
235
241
|
|
|
236
242
|
let val;
|
|
237
|
-
if (
|
|
238
|
-
val = await this.validate_api_key(api_key, authorisation);
|
|
239
|
-
} else if (authorisation) {
|
|
243
|
+
if (route.config.security?.includes("auth_token")) {
|
|
240
244
|
val = await this.validate_third_party(
|
|
241
245
|
xplatform || this.platform_uri,
|
|
242
246
|
authorisation,
|
|
243
247
|
);
|
|
248
|
+
} else if (route.config.security?.includes("api_key")) {
|
|
249
|
+
val = await this.validate_api_key(api_key, authorisation);
|
|
244
250
|
}
|
|
245
251
|
|
|
246
252
|
// debug(val);
|
|
@@ -119,7 +119,11 @@ class Services {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
platform_db = async () => {
|
|
122
|
-
|
|
122
|
+
if (this.db) return this.db;
|
|
123
|
+
|
|
124
|
+
this.db = new DB(this.db_config, this);
|
|
125
|
+
|
|
126
|
+
return this.db;
|
|
123
127
|
};
|
|
124
128
|
|
|
125
129
|
handle_webhook_prior = async (req) => {
|