Connect my computer: works from Docker and on Windows
- Docker passes BROKE_HOSTED through (setting it in .env did nothing before) - the helper finds claude.exe / claude.cmd on Windows (PATH uses ';' there), runs a .cmd through cmd.exe with the question on stdin only, and keeps the Windows variables Claude needs to find its login; opencode on Windows only as .exe - the page gives Windows a PowerShell command (curl.exe, file then node) - Copy works on a plain http LAN address Tested on Windows end to end with a stand-in claude.cmd: pairing, a question with quotes, & and %, and every lockdown flag arriving intact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ea53718e5d
commit
0232766260
4 files changed
+54
-12
No files matched your search
@@ -42,7 +42,20 @@ export function ConnectAI({ initial, choice: saved, hosted, connected, failed }:
|
||||
if (!res.ok) return setHelperCmd("");
|
||||
const { code } = (await res.json()) as { code: string };
|
||||
const site = window.location.origin;
|
||||
setHelperCmd(`curl -fsSL ${site}/broke-connect.cjs | node - ${site} ${code}`);
|
||||
// Windows PowerShell's own "curl" is a different command, and piping a script into node can mangle it there:
|
||||
// download the file with Windows' curl.exe, then run it.
|
||||
setHelperCmd(/Windows/.test(navigator.userAgent)
|
||||
? `curl.exe -fsSL -o broke-connect.cjs ${site}/broke-connect.cjs; node broke-connect.cjs ${site} ${code}`
|
||||
: `curl -fsSL ${site}/broke-connect.cjs | node - ${site} ${code}`);
|
||||
}
|
||||
// navigator.clipboard only exists on https or localhost; a server on the LAN (http://192.168.x.x) needs the old way.
|
||||
function copy(text: string) {
|
||||
if (navigator.clipboard) return void navigator.clipboard.writeText(text);
|
||||
const t = Object.assign(document.createElement("textarea"), { value: text });
|
||||
document.body.append(t);
|
||||
t.select();
|
||||
document.execCommand("copy");
|
||||
t.remove();
|
||||
}
|
||||
|
||||
const row = (p: Provider) => (
|
||||
@@ -101,10 +114,10 @@ export function ConnectAI({ initial, choice: saved, hosted, connected, failed }:
|
||||
{helperCmd === "" && <p className="text-sm text-bad" role="alert">That didn't work. Try again.</p>}
|
||||
{helperCmd && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm">Paste this in Terminal, then press Check again. The code in it works once, for 10 minutes.</p>
|
||||
<p className="text-sm">Paste this in Terminal (PowerShell on Windows), then press Check again. The code in it works once, for 10 minutes.</p>
|
||||
<code className="block text-xs break-all rounded-lg border border-line p-3">{helperCmd}</code>
|
||||
<div className="flex gap-2">
|
||||
<button className="btn" onClick={() => navigator.clipboard.writeText(helperCmd)}>Copy</button>
|
||||
<button className="btn" onClick={() => copy(helperCmd)}>Copy</button>
|
||||
<button className="btn" onClick={recheck}>Check again</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user