Skip to content

Commit 5756beb

Browse files
feat(webid): use standard /profile/card#me WebID structure
Change WebID from pod root (/#me) to standard Solid convention (/profile/card#me). This fixes mashlib profile editing which expects the profile document at /profile/card. - Create /profile/ directory in pod structure - Write profile to /profile/card instead of index.html - Update WebID construction in pod creation and registration Fixes JavaScriptSolidServer#15
1 parent 1122e2a commit 5756beb

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/handlers/container.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@ export async function createPodStructure(name, webId, baseUrl) {
138138
await storage.createContainer(`${podPath}public/`);
139139
await storage.createContainer(`${podPath}private/`);
140140
await storage.createContainer(`${podPath}settings/`);
141+
await storage.createContainer(`${podPath}profile/`);
141142

142-
// Generate and write WebID profile as index.html at pod root
143+
// Generate and write WebID profile at /profile/card (standard Solid location)
143144
const profileHtml = generateProfile({ webId, name, podUri, issuer });
144-
await storage.write(`${podPath}index.html`, profileHtml);
145+
await storage.write(`${podPath}profile/card`, profileHtml);
145146

146147
// Generate and write preferences
147148
const prefs = generatePreferences({ webId, podUri });
@@ -175,6 +176,11 @@ export async function createPodStructure(name, webId, baseUrl) {
175176
const publicAcl = generatePublicFolderAcl(`${podUri}public/`, webId);
176177
await storage.write(`${podPath}public/.acl`, serializeAcl(publicAcl));
177178

179+
// Profile folder: owner full, public read (with inheritance)
180+
// Profile documents must be publicly readable for WebID verification
181+
const profileAcl = generatePublicFolderAcl(`${podUri}profile/`, webId);
182+
await storage.write(`${podPath}profile/.acl`, serializeAcl(profileAcl));
183+
178184
return { podPath, podUri };
179185
}
180186

@@ -224,22 +230,22 @@ export async function handleCreatePod(request, reply) {
224230
}
225231

226232
// Build URIs
227-
// WebID is at pod root: /alice/#me (path mode) or alice.example.com/#me (subdomain mode)
233+
// WebID follows standard Solid convention: /alice/profile/card#me
228234
const subdomainsEnabled = request.subdomainsEnabled;
229235
const baseDomain = request.baseDomain;
230236

231237
let baseUri, podUri, webId;
232238
if (subdomainsEnabled && baseDomain) {
233-
// Subdomain mode: alice.example.com/
239+
// Subdomain mode: alice.example.com/profile/card#me
234240
const podHost = `${name}.${baseDomain}`;
235241
baseUri = `${request.protocol}://${baseDomain}`;
236242
podUri = `${request.protocol}://${podHost}/`;
237-
webId = `${podUri}#me`;
243+
webId = `${podUri}profile/card#me`;
238244
} else {
239-
// Path mode: example.com/alice/
245+
// Path mode: example.com/alice/profile/card#me
240246
baseUri = `${request.protocol}://${request.hostname}`;
241247
podUri = `${baseUri}${podPath}`;
242-
webId = `${podUri}#me`;
248+
webId = `${podUri}profile/card#me`;
243249
}
244250

245251
// Issuer needs trailing slash for CTH compatibility

src/idp/interactions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ export async function handleRegisterPost(request, reply, issuer) {
354354
}
355355

356356
try {
357-
// Build URLs
357+
// Build URLs - WebID follows standard Solid convention: /profile/card#me
358358
const baseUrl = issuer.endsWith('/') ? issuer.slice(0, -1) : issuer;
359359
const podUri = `${baseUrl}/${username}/`;
360-
const webId = `${podUri}#me`;
360+
const webId = `${podUri}profile/card#me`;
361361

362362
// Check if pod already exists
363363
const podPath = `${username}/`;

0 commit comments

Comments
 (0)