@staff0rd/assist 0.831.0 → 0.832.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/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.831.0",
9
+ version: "0.832.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -12625,6 +12625,17 @@ async function readJsonBody(req) {
12625
12625
  return JSON.parse(Buffer.concat(chunks).toString("utf8"));
12626
12626
  }
12627
12627
 
12628
+ // src/commands/sessions/web/fromGithub/allowExtensionOrigin.ts
12629
+ var EXTENSION_ORIGIN = /^(moz|chrome)-extension:\/\/[^/]+$/;
12630
+ function allowExtensionOrigin(req, res) {
12631
+ const origin = req.headers.origin;
12632
+ if (!origin || !EXTENSION_ORIGIN.test(origin)) return;
12633
+ res.setHeader("Access-Control-Allow-Origin", origin);
12634
+ res.setHeader("Access-Control-Allow-Methods", "POST");
12635
+ res.setHeader("Access-Control-Allow-Headers", "Content-Type");
12636
+ res.setHeader("Vary", "Origin");
12637
+ }
12638
+
12628
12639
  // src/commands/sessions/web/fromGithub/parseGithubOrigin.ts
12629
12640
  function parseGithubOrigin(url) {
12630
12641
  let parsed;
@@ -12664,6 +12675,7 @@ ${extra}` : url.trim();
12664
12675
 
12665
12676
  // src/commands/sessions/web/fromGithub/sessionFromGithub.ts
12666
12677
  async function sessionFromGithub(req, res) {
12678
+ allowExtensionOrigin(req, res);
12667
12679
  let body;
12668
12680
  try {
12669
12681
  body = await readJsonBody(req);
@@ -12686,6 +12698,13 @@ async function sessionFromGithub(req, res) {
12686
12698
  }
12687
12699
  }
12688
12700
 
12701
+ // src/commands/sessions/web/fromGithub/sessionFromGithubPreflight.ts
12702
+ function sessionFromGithubPreflight(req, res) {
12703
+ allowExtensionOrigin(req, res);
12704
+ res.writeHead(204);
12705
+ res.end();
12706
+ }
12707
+
12689
12708
  // src/shared/db/listBackups.ts
12690
12709
  import { desc as desc2 } from "drizzle-orm";
12691
12710
  async function listBackups(db) {
@@ -18272,6 +18291,7 @@ var routes2 = {
18272
18291
  "GET /api/backlog/summary": getBacklogSummary,
18273
18292
  "GET /api/repo-location": getRepoLocation,
18274
18293
  "POST /api/sessions/from-github": sessionFromGithub,
18294
+ "OPTIONS /api/sessions/from-github": sessionFromGithubPreflight,
18275
18295
  "POST /api/open-in-code": openInCode,
18276
18296
  "POST /api/pr-preview/upload-image": uploadPrImage,
18277
18297
  "GET /api/pr-preview/image": previewImage,
@@ -25856,7 +25876,8 @@ function issuePreviewMetadata(resolved) {
25856
25876
  if (parent)
25857
25877
  items2.push({
25858
25878
  label: "Parent",
25859
- value: `${parent.owner}/${parent.repo}#${parent.number}`
25879
+ value: `${parent.owner}/${parent.repo}#${parent.number}`,
25880
+ url: `https://github.com/${parent.owner}/${parent.repo}/issues/${parent.number}`
25860
25881
  });
25861
25882
  if (project)
25862
25883
  items2.push({
@@ -44935,8 +44956,15 @@ function decidePrPreview(sessions, waiters, notify2, d) {
44935
44956
  function parsePreviewMetadata(value) {
44936
44957
  if (!Array.isArray(value)) return void 0;
44937
44958
  const items2 = value.flatMap((entry) => {
44938
- const { label: label2, value: text18 } = entry ?? {};
44939
- return typeof label2 === "string" && typeof text18 === "string" ? [{ label: label2, value: text18 }] : [];
44959
+ const {
44960
+ label: label2,
44961
+ value: text18,
44962
+ url
44963
+ } = entry ?? {};
44964
+ if (typeof label2 !== "string" || typeof text18 !== "string") return [];
44965
+ return [
44966
+ typeof url === "string" ? { label: label2, value: text18, url } : { label: label2, value: text18 }
44967
+ ];
44940
44968
  });
44941
44969
  return items2.length > 0 ? items2 : void 0;
44942
44970
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.831.0",
3
+ "version": "0.832.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {