Skip to content

Commit

Permalink
check against externalWebId
Browse files Browse the repository at this point in the history
  • Loading branch information
bourgeoa committed May 17, 2024
1 parent 18b7cb3 commit 1034123
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
3 changes: 0 additions & 3 deletions lib/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const corsProxy = require('./handlers/cors-proxy')
const authProxy = require('./handlers/auth-proxy')
const SolidHost = require('./models/solid-host')
const AccountManager = require('./models/account-manager')
const AccountTemplate = require('./models/account-template')
const vhost = require('vhost')
const EmailService = require('./services/email-service')
const TokenService = require('./services/token-service')
Expand Down Expand Up @@ -53,8 +52,6 @@ function createApp (argv = {}) {
defaultContentType: argv.defaultContentType
})

AccountTemplate.registerHostname(argv.serverUri)

const configPath = config.initConfigDir(argv)
argv.templates = config.initTemplateDirs(configPath)

Expand Down
19 changes: 1 addition & 18 deletions lib/models/account-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ class AccountTemplate {
this.templateFiles = options.templateFiles || TEMPLATE_FILES
}

/**
* Registers the server hostname at compile time to check for webID stuff.
* @param {string} hostname
* @throws if hostname already registered
*/
static registerHostname (hostname) {
this.hostname = hostname
}

/**
* Factory method, returns an AccountTemplate for a given user account.
*
Expand Down Expand Up @@ -81,17 +72,9 @@ class AccountTemplate {
* @return {Object}
*/
static templateSubstitutionsFor (userAccount) {
let podRelativeWebId
// this means the user's webId and server Uri are the same
// therefore, we use a relative uri ref
if (userAccount.webId.indexOf(this.hostname) > -1) {
podRelativeWebId = path.join('/', userAccount.webId.substring(userAccount.webId.indexOf(this.hostname) + this.hostname.length))
} else {
podRelativeWebId = userAccount.webId
}
const substitutions = {
name: userAccount.displayName,
webId: podRelativeWebId,
webId: userAccount.externalWebId ? userAccount.webId : '/profile/card#me',
email: userAccount.email,
idp: userAccount.idp
}
Expand Down

0 comments on commit 1034123

Please sign in to comment.