@ganglion/xacpx-relay 0.2.3 → 0.4.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/dist/cli.js CHANGED
@@ -331,6 +331,12 @@ class InstanceStore {
331
331
  this.db.run("DELETE FROM instances WHERE id = ?", [instanceId]);
332
332
  return true;
333
333
  }
334
+ rename(instanceId, accountId, name) {
335
+ if (!this.getOwned(instanceId, accountId))
336
+ return false;
337
+ this.db.run("UPDATE instances SET name = ? WHERE id = ?", [name, instanceId]);
338
+ return true;
339
+ }
334
340
  prunePairingTokens(now) {
335
341
  const iso = now.toISOString();
336
342
  const row = this.db.get("SELECT COUNT(*) AS n FROM pairing_tokens WHERE expires_at <= ? OR used_at IS NOT NULL", [iso]);
@@ -732,6 +738,17 @@ function createApp(deps) {
732
738
  const issued = deps.instances.issuePairingToken(account.id, body.name, pairingTtlMs);
733
739
  return c.json({ token: issued.token, expiresAt: issued.expiresAt });
734
740
  });
741
+ app.patch("/api/instances/:id", async (c) => {
742
+ if (!requireJson(c.req.header("content-type")))
743
+ return c.json({ error: "unsupported-media-type" }, 415);
744
+ const account = c.get("account");
745
+ const body = await c.req.json().catch(() => ({}));
746
+ const name = (body.name ?? "").trim();
747
+ if (!name)
748
+ return c.json({ error: "invalid-name" }, 400);
749
+ const ok = deps.instances.rename(c.req.param("id"), account.id, name);
750
+ return ok ? c.json({ ok: true }) : c.json({ error: "not-found" }, 404);
751
+ });
735
752
  app.delete("/api/instances/:id", (c) => {
736
753
  const account = c.get("account");
737
754
  const removed = deps.instances.remove(c.req.param("id"), account.id);
@@ -1 +1 @@
1
- import{d as e,o as s,c as a,O as n}from"./index-BHLOc9dP.js";const o={class:"flex items-center gap-2 select-none"},d=e({__name:"BrandLogo",setup(r){return(p,t)=>(s(),a("div",o,[...t[0]||(t[0]=[n('<svg data-test="brand-x" width="22" height="22" viewBox="0 0 24 24" fill="none" aria-hidden="true"><defs><linearGradient id="xacpxBrand" x1="3" y1="3" x2="21" y2="21" gradientUnits="userSpaceOnUse"><stop stop-color="#4F9BF5"></stop><stop offset="1" stop-color="#69D689"></stop></linearGradient></defs><path d="M5 5 L19 19 M19 5 L5 19" stroke="url(#xacpxBrand)" stroke-width="3.2" stroke-linecap="round"></path></svg><span class="text-[15px] font-semibold tracking-tight text-fg">xacpx</span><span class="text-fg-muted text-xs">· relay</span>',3)])]))}});export{d as _};
1
+ import{d as e,c as s,Q as a,o as n}from"./index-CyMgv7-t.js";const o={class:"flex items-center gap-2 select-none"},d=e({__name:"BrandLogo",setup(r){return(p,t)=>(n(),s("div",o,[...t[0]||(t[0]=[a('<svg data-test="brand-x" width="22" height="22" viewBox="0 0 24 24" fill="none" aria-hidden="true"><defs><linearGradient id="xacpxBrand" x1="3" y1="3" x2="21" y2="21" gradientUnits="userSpaceOnUse"><stop stop-color="#4F9BF5"></stop><stop offset="1" stop-color="#69D689"></stop></linearGradient></defs><path d="M5 5 L19 19 M19 5 L5 19" stroke="url(#xacpxBrand)" stroke-width="3.2" stroke-linecap="round"></path></svg><span class="text-[15px] font-semibold tracking-tight text-fg">xacpx</span><span class="text-fg-muted text-xs">· relay</span>',3)])]))}});export{d as _};