Skip to content

Commit 1034123

Browse files
committed
check against externalWebId
1 parent 18b7cb3 commit 1034123

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

lib/create-app.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const corsProxy = require('./handlers/cors-proxy')
1111
const authProxy = require('./handlers/auth-proxy')
1212
const SolidHost = require('./models/solid-host')
1313
const AccountManager = require('./models/account-manager')
14-
const AccountTemplate = require('./models/account-template')
1514
const vhost = require('vhost')
1615
const EmailService = require('./services/email-service')
1716
const TokenService = require('./services/token-service')
@@ -53,8 +52,6 @@ function createApp (argv = {}) {
5352
defaultContentType: argv.defaultContentType
5453
})
5554

56-
AccountTemplate.registerHostname(argv.serverUri)
57-
5855
const configPath = config.initConfigDir(argv)
5956
argv.templates = config.initTemplateDirs(configPath)
6057

lib/models/account-template.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ class AccountTemplate {
3535
this.templateFiles = options.templateFiles || TEMPLATE_FILES
3636
}
3737

38-
/**
39-
* Registers the server hostname at compile time to check for webID stuff.
40-
* @param {string} hostname
41-
* @throws if hostname already registered
42-
*/
43-
static registerHostname (hostname) {
44-
this.hostname = hostname
45-
}
46-
4738
/**
4839
* Factory method, returns an AccountTemplate for a given user account.
4940
*
@@ -81,17 +72,9 @@ class AccountTemplate {
8172
* @return {Object}
8273
*/
8374
static templateSubstitutionsFor (userAccount) {
84-
let podRelativeWebId
85-
// this means the user's webId and server Uri are the same
86-
// therefore, we use a relative uri ref
87-
if (userAccount.webId.indexOf(this.hostname) > -1) {
88-
podRelativeWebId = path.join('/', userAccount.webId.substring(userAccount.webId.indexOf(this.hostname) + this.hostname.length))
89-
} else {
90-
podRelativeWebId = userAccount.webId
91-
}
9275
const substitutions = {
9376
name: userAccount.displayName,
94-
webId: podRelativeWebId,
77+
webId: userAccount.externalWebId ? userAccount.webId : '/profile/card#me',
9578
email: userAccount.email,
9679
idp: userAccount.idp
9780
}

0 commit comments

Comments
 (0)