@fudrouter/fsrouter 0.6.116 → 0.6.118

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.
@@ -740,7 +740,7 @@ const PROVIDERS = {
740
740
  // locally, the user lands on qoder.com/device/selectAccounts in the
741
741
  // browser, and we poll openapi.qoder.sh until a `dt-...` token appears.
742
742
  requestDeviceCode: async (config) => {
743
- const { QoderService } = await import("@/lib/oauth/services/qoder");
743
+ const { QoderService } = await import('../../lib/oauth/services/qoder.js');
744
744
  const flow = new QoderService().initiateDeviceFlow();
745
745
  // Match the device_code shape the rest of the OAuthModal expects
746
746
  // (device_code, user_code, verification_uri[_complete], interval).
@@ -761,7 +761,7 @@ const PROVIDERS = {
761
761
  };
762
762
  },
763
763
  pollToken: async (config, deviceCode, codeVerifier, extraData) => {
764
- const { QoderService } = await import("@/lib/oauth/services/qoder");
764
+ const { QoderService } = await import('../../lib/oauth/services/qoder.js');
765
765
  const svc = new QoderService();
766
766
  const nonce = deviceCode || extraData?._qoderNonce;
767
767
  const verifier = codeVerifier || extraData?._qoderVerifier;
@@ -1724,7 +1724,7 @@ export async function backfillCodexEmails() {
1724
1724
  if (codexBackfillDone) return;
1725
1725
  codexBackfillDone = true;
1726
1726
  try {
1727
- const { getProviderConnections, updateProviderConnection } = await import("@/lib/localDb");
1727
+ const { getProviderConnections, updateProviderConnection } = await import('../../lib/localDb.js');
1728
1728
  const connections = await getProviderConnections();
1729
1729
  const targets = connections.filter((c) => {
1730
1730
  if (c.provider !== "codex" || c.authType !== "oauth" || !c.idToken) return false;
@@ -26,7 +26,7 @@ export function getTtsAdapter(provider) {
26
26
 
27
27
  // Generic config-driven dispatcher (uses ttsConfig.format)
28
28
  export async function synthesizeViaConfig(provider, text, model, credentials) {
29
- const { AI_PROVIDERS } = await import("@/shared/constants/providers");
29
+ const { AI_PROVIDERS } = await import('../../../shared/constants/providers.js');
30
30
  const cfg = AI_PROVIDERS[provider]?.ttsConfig;
31
31
  if (!cfg) return null;
32
32
  const handler = FORMAT_HANDLERS[cfg.format];
@@ -400,13 +400,21 @@ export async function OPTIONS() {
400
400
  */
401
401
  export async function GET(req, res) {
402
402
  try {
403
+ // Require auth: do not publicly expose the model catalog.
404
+ const authHeader = (req.headers && (req.headers.authorization || req.headers.Authorization)) ||
405
+ (typeof req.get === "function" ? req.get("authorization") : undefined);
406
+ if (!authHeader || !/^Bearer\s+/i.test(String(authHeader))) {
407
+ return res.status(401).json({
408
+ error: { message: "Authentication required to list models", type: "authentication_error" },
409
+ });
410
+ }
403
411
  const data = await buildModelsList([LLM_KIND]);
404
- return Response.json({ object: "list", data }, {
405
- headers: { "Access-Control-Allow-Origin": "*" },
406
- });
412
+ return res.status(200).json({ object: "list", data });
407
413
  }
408
414
  catch (error) {
409
415
  console.log("Error fetching models:", error);
410
- return Response.json({ error: { message: error.message, type: "server_error" } }, { status: 500 });
416
+ return res.status(500).json({
417
+ error: { message: error.message, type: "server_error" },
418
+ });
411
419
  }
412
420
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fudrouter/fsrouter",
3
- "version": "0.6.116",
3
+ "version": "0.6.118",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "9Router v2 — Express Backend (API, SSE, DB, Auth, MITM)",