myapikey 0.41.0 → 0.42.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "myapikey",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Personal LLM API gateway & proxy — one address + one API key for all your models. Forwards OpenAI & Anthropic calls to your backends with failover and a circuit breaker. Pure passthrough, no format translation. Self-hosted (CLI + web UI).",
|
|
6
6
|
"keywords": [
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"packages/*"
|
|
53
53
|
],
|
|
54
54
|
"scripts": {
|
|
55
|
-
"dev": "tsx watch packages/core/src/cli/index.ts serve",
|
|
55
|
+
"dev": "NODE_ENV=development tsx watch packages/core/src/cli/index.ts serve",
|
|
56
56
|
"dev:web": "npm run dev -w @myapikey/web",
|
|
57
57
|
"start": "npm run build:web && npm run serve",
|
|
58
58
|
"serve": "tsx packages/core/src/cli/index.ts serve",
|
|
@@ -38,6 +38,10 @@ export function extractSecret(c: Context): { password: string; username?: string
|
|
|
38
38
|
/** Hono middleware: require the single account/password. */
|
|
39
39
|
export function authMiddleware(getUser: () => string, getPass: () => string, logger?: Logger): MiddlewareHandler {
|
|
40
40
|
return async (c, next) => {
|
|
41
|
+
// Dev convenience: `npm run dev` sets NODE_ENV=development, and iterating on
|
|
42
|
+
// the UI/CLI against scratch data dirs shouldn't fight a fresh random
|
|
43
|
+
// password on every run. Production (`serve`) never sees this.
|
|
44
|
+
if (process.env.NODE_ENV === "development") return next();
|
|
41
45
|
const cred = extractSecret(c);
|
|
42
46
|
const ok =
|
|
43
47
|
!!cred &&
|