@mathismeadows/roamer-device-auth 1.2.0 → 1.2.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/package.json +1 -1
- package/roamer-device-auth.mjs +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mathismeadows/roamer-device-auth",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "AUTH-14/AUTH-25: stdio<->HTTP MCP proxy for Roamer MCP with two auth mechanisms, chosen per-machine by default-browser detection. Safari-default machines use a server-mediated device authorization flow (AUTH-25) since Safari's HTTPS-Only Mode blocks a loopback redirect; every other machine uses a standard direct loopback redirect against Cloudflare Access Managed OAuth instead.",
|
package/roamer-device-auth.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
refreshAuthorization,
|
|
31
31
|
} from "@modelcontextprotocol/sdk/client/auth.js";
|
|
32
32
|
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
33
|
+
import { realpathSync } from "node:fs";
|
|
33
34
|
import { homedir } from "node:os";
|
|
34
35
|
import { join } from "node:path";
|
|
35
36
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
@@ -650,7 +651,10 @@ async function main() {
|
|
|
650
651
|
|
|
651
652
|
// Only auto-run when invoked directly (npx/CLI) — importing this module from a test file
|
|
652
653
|
// must not trigger a live device-auth flow and stdio takeover as a side effect.
|
|
653
|
-
|
|
654
|
+
// AUTH-29: npx always launches this via the node_modules/.bin symlink, so argv[1] must be
|
|
655
|
+
// realpath-resolved before comparing — import.meta.url is already realpath-resolved by Node.
|
|
656
|
+
const isMainModule =
|
|
657
|
+
process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href;
|
|
654
658
|
if (isMainModule) {
|
|
655
659
|
main().catch((err) => {
|
|
656
660
|
log(`Fatal error: ${err.stack ?? err.message}`);
|