@staff0rd/assist 0.830.0 → 0.831.1

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.830.0",
9
+ version: "0.831.1",
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.830.0",
3
+ "version": "0.831.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {