@webqit/webflo 0.8.57-0 → 0.8.58-0
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
|
@@ -140,13 +140,9 @@ export async function deploy(Ui, origin, flags = {}, layout = {}) {
|
|
|
140
140
|
*/
|
|
141
141
|
export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
|
|
142
142
|
const eventHandler = Webhooks.createEventHandler();
|
|
143
|
-
console.log('-------------------------event.request.headers', event.request.headers)
|
|
144
143
|
if (event.request.headers.has('user-agent') && event.request.headers.get('user-agent').startsWith('GitHub-Hookshot/')) {
|
|
145
|
-
console.log('-------------------------111111111111111111')
|
|
146
144
|
const payload = await event.request.json();
|
|
147
|
-
console.log('-------------------------payload', payload)
|
|
148
145
|
const matches = (await origins.match(payload.repository.full_name, flags, layout)).filter(o => o.autodeploy);
|
|
149
|
-
console.log('-------------------------matches', matches)
|
|
150
146
|
var deployParams;
|
|
151
147
|
if (!(deployParams = matches[0])) {
|
|
152
148
|
return;
|
|
@@ -157,7 +153,7 @@ export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
|
|
|
157
153
|
if (!deployParams.autodeploy_secret) {
|
|
158
154
|
throw new Error(`Failed deploy attempt (${payload.repository.full_name}): The deploy settings do not contain a secret.`);
|
|
159
155
|
}
|
|
160
|
-
if (!Webhooks.verify(deployParams.autodeploy_secret, payload, event.request.headers
|
|
156
|
+
if (!Webhooks.verify(deployParams.autodeploy_secret, payload, event.request.headers.get('x-hub-signature'))) {
|
|
161
157
|
throw new Error(`Failed deploy attempt (${payload.repository.full_name}): Signature mismatch.`);
|
|
162
158
|
}
|
|
163
159
|
if (payload.repository.disabled || payload.repository.archived) {
|
|
@@ -182,8 +178,8 @@ export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
|
|
|
182
178
|
}
|
|
183
179
|
});
|
|
184
180
|
return eventHandler.receive({
|
|
185
|
-
id: event.request.headers
|
|
186
|
-
name: event.request.headers
|
|
181
|
+
id: event.request.headers.get('x-github-delivery'),
|
|
182
|
+
name: event.request.headers.get('x-github-event'),
|
|
187
183
|
payload: payload /* JSON object */,
|
|
188
184
|
});
|
|
189
185
|
}
|