ework-web 0.10.7 → 0.10.9

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.7",
3
+ "version": "0.10.9",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
@@ -112,10 +112,16 @@ function buildSetupScript(envBlock: string, daemonPort: number, mysqlHostRaw: st
112
112
  `EWORK_DAEMON_ENV_EOF`,
113
113
  `echo "$DAEMON_ENDPOINT_LINE"; } > ~/.local/share/ework-aio/ework-daemon/.env`,
114
114
  `echo "[4/5] starting daemon..."`,
115
- `ework-aio stop daemon 2>/dev/null; sleep 1; ework-aio start daemon`,
116
- `echo "[5/5] verifying daemon is alive..."`,
115
+ `ework-aio stop daemon 2>/dev/null || true`,
116
+ `kill $(lsof -ti:${String(daemonPort)} 2>/dev/null) 2>/dev/null || true`,
117
+ `pkill -f ework-daemon-server 2>/dev/null || true`,
118
+ `sleep 2`,
119
+ `ework-aio start daemon`,
120
+ `echo "[5/5] verifying daemon is alive + on MySQL..."`,
117
121
  `sleep 3`,
118
- `curl -sf --max-time 5 http://127.0.0.1:${String(daemonPort)}/api/status 2>/dev/null && echo "DAEMON_ALIVE" || { echo "DAEMON_FAILED: status check failed"; echo "=== daemon log (last 20 lines) ==="; tail -20 ~/.local/share/ework-aio/run/daemon.log 2>/dev/null || echo "(no log)"; exit 1; }`,
122
+ `STATUS=$(curl -sf --max-time 5 http://127.0.0.1:${String(daemonPort)}/api/status 2>/dev/null) || { echo "DAEMON_FAILED: status check failed"; echo "=== daemon log (last 20 lines) ==="; tail -20 ~/.local/share/ework-aio/run/daemon.log 2>/dev/null || echo "(no log)"; exit 1; }`,
123
+ `echo "$STATUS"`,
124
+ `echo "$STATUS" | grep -q '"driver":"mysql"' || { echo "DAEMON_FAILED: daemon is NOT on MySQL (still SQLite?)"; tail -20 ~/.local/share/ework-aio/run/daemon.log 2>/dev/null; exit 1; }`,
119
125
  `echo "=== hostname: $(hostname) ==="`,
120
126
  `echo DAEMON_STARTED`,
121
127
  ].join("\n");
package/src/webhooks.ts CHANGED
@@ -541,25 +541,6 @@ async function recordDelivery(
541
541
  }
542
542
  }
543
543
 
544
- async function resolveDeliveryUrl(storedUrl: string): Promise<string> {
545
- try {
546
- const { getActiveDaemons } = await import("./coordination");
547
- const daemons = await getActiveDaemons();
548
- if (daemons.length === 0) return storedUrl;
549
- const storedHost = storedUrl.replace(/^https?:\/\//, "").split("/")[0] ?? "";
550
- const storedMatchesDaemon = daemons.some((d) => {
551
- const daemonHost = d.endpoint.replace(/^https?:\/\//, "");
552
- return daemonHost === storedHost;
553
- });
554
- if (storedMatchesDaemon) return storedUrl;
555
- const best = daemons.sort((a, b) => a.id - b.id)[0]!;
556
- const ep = /^https?:\/\//.test(best.endpoint) ? best.endpoint : `http://${best.endpoint}`;
557
- return ep.replace(/\/$/, "") + "/webhook/gitea";
558
- } catch {
559
- return storedUrl;
560
- }
561
- }
562
-
563
544
  async function deliver(
564
545
  webhook: WebhookRow,
565
546
  event: WebhookEventName,
@@ -567,12 +548,11 @@ async function deliver(
567
548
  ): Promise<void> {
568
549
  await acquireDeliverySlot();
569
550
  try {
570
- const targetUrl = await resolveDeliveryUrl(webhook.url);
571
551
  for (const attempt of RETRY_DELAYS_MS) {
572
552
  if (attempt > 0) await Bun.sleep(attempt);
573
553
  const deliveryUuid = randomUUID();
574
554
  const headers = buildHeaders(event, deliveryUuid, rawBody, webhook.secret);
575
- const result = await postWithTimeout(targetUrl, rawBody, headers);
555
+ const result = await postWithTimeout(webhook.url, rawBody, headers);
576
556
  const success = result.status !== null && result.status >= 200 && result.status < 300;
577
557
  await recordDelivery(webhook.id, event, deliveryUuid, rawBody, result);
578
558
  if (success) return;