claude-relay 2.1.2 → 2.1.3
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/lib/pages.js +3 -2
- package/lib/server.js +4 -1
- package/package.json +1 -1
package/lib/pages.js
CHANGED
|
@@ -444,8 +444,9 @@ function checkHttps() {
|
|
|
444
444
|
|
|
445
445
|
var ac = new AbortController();
|
|
446
446
|
setTimeout(function() { ac.abort(); }, 3000);
|
|
447
|
-
fetch(httpsUrl + "/info", { signal: ac.signal })
|
|
447
|
+
fetch(httpsUrl + "/info", { signal: ac.signal, mode: "no-cors" })
|
|
448
448
|
.then(function() {
|
|
449
|
+
// Any response (even opaque/401) means TLS handshake succeeded = cert is trusted
|
|
449
450
|
certStatus.className = "check-status ok";
|
|
450
451
|
certStatus.textContent = "HTTPS connection verified. Certificate is trusted.";
|
|
451
452
|
certNext.disabled = false;
|
|
@@ -614,7 +615,7 @@ if (!isHttps && !isLocal) {
|
|
|
614
615
|
if (!info.httpsUrl) { init(); return; }
|
|
615
616
|
var ac = new AbortController();
|
|
616
617
|
setTimeout(function() { ac.abort(); }, 3000);
|
|
617
|
-
fetch(info.httpsUrl + "/info", { signal: ac.signal })
|
|
618
|
+
fetch(info.httpsUrl + "/info", { signal: ac.signal, mode: "no-cors" })
|
|
618
619
|
.then(function() { location.replace(info.httpsUrl + "/setup"); })
|
|
619
620
|
.catch(function() { init(); });
|
|
620
621
|
}).catch(function() { init(); });
|
package/lib/server.js
CHANGED
|
@@ -262,7 +262,10 @@ function createServer(opts) {
|
|
|
262
262
|
// Global info endpoint (auth required)
|
|
263
263
|
if (req.method === "GET" && req.url === "/info") {
|
|
264
264
|
if (!isAuthed(req, authToken)) {
|
|
265
|
-
res.writeHead(401, {
|
|
265
|
+
res.writeHead(401, {
|
|
266
|
+
"Content-Type": "application/json",
|
|
267
|
+
"Access-Control-Allow-Origin": "*",
|
|
268
|
+
});
|
|
266
269
|
res.end('{"error":"unauthorized"}');
|
|
267
270
|
return;
|
|
268
271
|
}
|