Skip to content

Commit 2becfe0

Browse files
committed
fix: resolve extension connection error by using 127.0.0.1 and updating permissions
1 parent 540b66f commit 2becfe0

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

extension/background.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
// IntellectSafe Companion - Background Worker
22

3-
let API_Base = "http://localhost:8001/api/v1/scan"; // Default Localhost
3+
let API_Base = "http://127.0.0.1:8001/api/v1/scan"; // Default Localhost (using IP for Windows reliability)
44

55
function updateApiBase(rootUrl) {
66
if (!rootUrl) return;
7-
const cleanRoot = rootUrl.replace(/\/$/, "");
7+
let cleanRoot = rootUrl.replace(/\/$/, "");
8+
// Normalize localhost to 127.0.0.1 for consistency
9+
cleanRoot = cleanRoot.replace("localhost", "127.0.0.1");
10+
811
if (cleanRoot.endsWith('/api/v1/scan')) {
912
API_Base = cleanRoot;
1013
} else if (cleanRoot.endsWith('/api/v1')) {
@@ -106,7 +109,7 @@ async function scanText(text, platform, endpoint) {
106109
return { action: "allow", score: riskScore };
107110

108111
} catch (error) {
109-
console.error("[IntellectSafe] Fetch error:", error);
110-
return { action: "allow", error: "Connection failed" };
112+
console.error(`[IntellectSafe] Fetch error at ${url}:`, error);
113+
return { action: "allow", error: `Connection failed: ${error.message}` };
111114
}
112115
}

extension/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"https://claude.ai/*",
1414
"https://gemini.google.com/*",
1515
"https://grok.com/*",
16-
"http://localhost:8001/*"
16+
"http://localhost:8001/*",
17+
"http://127.0.0.1:8001/*"
1718
],
1819
"content_scripts": [
1920
{

0 commit comments

Comments
 (0)