@webqit/webflo 0.8.56-0 → 0.8.57-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
@@ -12,7 +12,7 @@
12
12
  "vanila-javascript"
13
13
  ],
14
14
  "homepage": "https://webqit.io/tooling/webflo",
15
- "version": "0.8.56-0",
15
+ "version": "0.8.57-0",
16
16
  "license": "MIT",
17
17
  "repository": {
18
18
  "type": "git",
@@ -143,25 +143,25 @@ export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
143
143
  console.log('-------------------------event.request.headers', event.request.headers)
144
144
  if (event.request.headers.has('user-agent') && event.request.headers.get('user-agent').startsWith('GitHub-Hookshot/')) {
145
145
  console.log('-------------------------111111111111111111')
146
- const submits = await event.request.parse();
147
- console.log('-------------------------submits', submits)
148
- const matches = (await origins.match(submits.payload.repository.full_name, flags, layout)).filter(o => o.autodeploy);
146
+ const payload = await event.request.json();
147
+ console.log('-------------------------payload', payload)
148
+ const matches = (await origins.match(payload.repository.full_name, flags, layout)).filter(o => o.autodeploy);
149
149
  console.log('-------------------------matches', matches)
150
150
  var deployParams;
151
151
  if (!(deployParams = matches[0])) {
152
152
  return;
153
153
  }
154
154
  if (matches.length > 1) {
155
- throw new Error(`Failed deploy attempt (${submits.payload.repository.full_name}): Multiple deploy settings found.`);
155
+ throw new Error(`Failed deploy attempt (${payload.repository.full_name}): Multiple deploy settings found.`);
156
156
  }
157
157
  if (!deployParams.autodeploy_secret) {
158
- throw new Error(`Failed deploy attempt (${submits.payload.repository.full_name}): The deploy settings do not contain a secret.`);
158
+ throw new Error(`Failed deploy attempt (${payload.repository.full_name}): The deploy settings do not contain a secret.`);
159
159
  }
160
- if (!Webhooks.verify(deployParams.autodeploy_secret, submits.payload, event.request.headers['x-hub-signature'])) {
161
- throw new Error(`Failed deploy attempt (${submits.payload.repository.full_name}): Signature mismatch.`);
160
+ if (!Webhooks.verify(deployParams.autodeploy_secret, payload, event.request.headers['x-hub-signature'])) {
161
+ throw new Error(`Failed deploy attempt (${payload.repository.full_name}): Signature mismatch.`);
162
162
  }
163
- if (submits.payload.repository.disabled || submits.payload.repository.archived) {
164
- throw new Error(`Failed deploy attempt (${submits.payload.repository.full_name}): Repository disabled or archived.`);
163
+ if (payload.repository.disabled || payload.repository.archived) {
164
+ throw new Error(`Failed deploy attempt (${payload.repository.full_name}): Repository disabled or archived.`);
165
165
  }
166
166
  eventHandler.on('push', async ({ name, payload }) => {
167
167
  Ui.log('---------------------------');
@@ -184,7 +184,7 @@ export async function hook(Ui, event, deployCallback, flags = {}, layout = {}) {
184
184
  return eventHandler.receive({
185
185
  id: event.request.headers['x-github-delivery'],
186
186
  name: event.request.headers['x-github-event'],
187
- payload: submits.payload /* JSON object */,
187
+ payload: payload /* JSON object */,
188
188
  });
189
189
  }
190
190
  }