openfused 0.3.15 → 0.3.16
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/dist/sync.js +12 -4
- package/package.json +1 -1
package/dist/sync.js
CHANGED
|
@@ -140,17 +140,25 @@ async function syncHttp(store, peer, baseUrl, peerDir) {
|
|
|
140
140
|
const errors = [];
|
|
141
141
|
// SSRF check: block requests to private/reserved IPs
|
|
142
142
|
await checkSsrf(baseUrl);
|
|
143
|
+
// Try /read/{file} (full mode) then /profile (public mode) for PROFILE.md.
|
|
144
|
+
// CONTEXT.md 404s are silently skipped — peers in public mode don't serve it.
|
|
143
145
|
for (const file of ["CONTEXT.md", "PROFILE.md"]) {
|
|
144
146
|
try {
|
|
145
|
-
const
|
|
147
|
+
const url = file === "PROFILE.md"
|
|
148
|
+
? `${baseUrl}/profile` // public mode serves /profile not /read/PROFILE.md
|
|
149
|
+
: `${baseUrl}/read/${file}`;
|
|
150
|
+
let resp = await fetch(url);
|
|
151
|
+
// Fallback: try /read/ path if /profile didn't work (full mode daemon)
|
|
152
|
+
if (!resp.ok && file === "PROFILE.md") {
|
|
153
|
+
resp = await fetch(`${baseUrl}/read/${file}`);
|
|
154
|
+
}
|
|
146
155
|
if (resp.ok) {
|
|
147
156
|
await writeFile(join(peerDir, file), await resp.text());
|
|
148
157
|
pulled.push(file);
|
|
149
158
|
}
|
|
159
|
+
// Don't report 404s as errors — peer may be in public mode
|
|
150
160
|
}
|
|
151
|
-
catch
|
|
152
|
-
errors.push(`${file}: ${e.message}`);
|
|
153
|
-
}
|
|
161
|
+
catch { }
|
|
154
162
|
}
|
|
155
163
|
for (const dir of ["shared", "knowledge"]) {
|
|
156
164
|
try {
|