Skip to content

Commit

Permalink
webId relative to pod
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgeoa committed May 21, 2024
1 parent 1034123 commit 99b3219
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/models/account-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const recursiveRead = require('recursive-readdir')
const fsUtils = require('../common/fs-utils')
const templateUtils = require('../common/template-utils')
const LDP = require('../ldp')
const { URL } = require('url')

const TEMPLATE_EXTENSIONS = ['.acl', '.meta', '.json', '.hbs', '.handlebars']
const TEMPLATE_FILES = ['card']
Expand Down Expand Up @@ -72,9 +73,12 @@ class AccountTemplate {
* @return {Object}
*/
static templateSubstitutionsFor (userAccount) {
const webUri = new URL(userAccount.webId)
const webIdOrigin = webUri.protocol + '//' + webUri.hostname
const podRelWebId = userAccount.webId.replace(webIdOrigin, '')
const substitutions = {
name: userAccount.displayName,
webId: userAccount.externalWebId ? userAccount.webId : '/profile/card#me',
webId: userAccount.externalWebId ? userAccount.webId : podRelWebId,
email: userAccount.email,
idp: userAccount.idp
}
Expand Down

0 comments on commit 99b3219

Please sign in to comment.