Additional variables for profile/template
This commit is contained in:
parent
ff219cbb06
commit
25e3630458
|
@ -13,6 +13,7 @@ const mimeTypes = require('mime-types');
|
||||||
|
|
||||||
const fs = require('graceful-fs');
|
const fs = require('graceful-fs');
|
||||||
const paths = require('path');
|
const paths = require('path');
|
||||||
|
const moment = require('moment');
|
||||||
|
|
||||||
exports.moduleInfo = {
|
exports.moduleInfo = {
|
||||||
name: 'WebFinger',
|
name: 'WebFinger',
|
||||||
|
@ -115,13 +116,31 @@ exports.getModule = class WebFingerServerModule extends WebHandlerModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
this._getProfileTemplate((template, mimeType) => {
|
this._getProfileTemplate((template, mimeType) => {
|
||||||
|
const up = (p, na = 'N/A') => {
|
||||||
|
return user.getProperty(p) || na;
|
||||||
|
};
|
||||||
|
|
||||||
|
let birthDate = up(UserProps.Birthdate);
|
||||||
|
if (moment.isDate(birthDate)) {
|
||||||
|
birthDate = moment(birthDate);
|
||||||
|
}
|
||||||
|
|
||||||
const varMap = {
|
const varMap = {
|
||||||
USERNAME: user.username,
|
USERNAME: user.username,
|
||||||
REAL_NAME: user.getSanitizedName('real'),
|
REAL_NAME: user.getSanitizedName('real'),
|
||||||
LOGIN_COUNT: user.getProperty(UserProps.LoginCount),
|
SEX: up(UserProps.Sex),
|
||||||
AFFILIATIONS: user.getProperty(UserProps.Affiliations) || 'N/A',
|
BIRTHDATE: birthDate,
|
||||||
ACHIEVEMENT_POINTS:
|
AGE: user.getAge(),
|
||||||
user.getProperty(UserProps.AchievementTotalPoints) || '0',
|
LOCATION: up(UserProps.Location),
|
||||||
|
AFFILIATIONS: up(UserProps.Affiliations),
|
||||||
|
EMAIL: up(UserProps.EmailAddress),
|
||||||
|
WEB_ADDRESS: up(UserProps.WebAddress),
|
||||||
|
ACCOUNT_CREATED: moment(user.getProperty(UserProps.AccountCreated)),
|
||||||
|
LAST_LOGIN: moment(user.getProperty(UserProps.LastLoginTs)),
|
||||||
|
LOGIN_COUNT: up(UserProps.LoginCount),
|
||||||
|
ACHIEVEMENT_COUNT: up(UserProps.AchievementTotalCount, '0'),
|
||||||
|
ACHIEVEMENT_POINTS: up(UserProps.AchievementTotalPoints, '0'),
|
||||||
|
BOARDNAME: Config().general.boardName,
|
||||||
};
|
};
|
||||||
|
|
||||||
let body = template;
|
let body = template;
|
||||||
|
|
|
@ -7,13 +7,13 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Profile information for %USERNAME%:</h1>
|
<h1>%USERNAME% of %BOARDNAME%:</h1>
|
||||||
<p>
|
<p>
|
||||||
<b>Real Name</b> %REAL_NAME%<br>
|
<b>Real Name</b>: %REAL_NAME%<br>
|
||||||
|
<b>Location</b>: %LOCATION%<br>
|
||||||
<b>Login Count</b> %LOGIN_COUNT%<br>
|
<b>Login Count</b> %LOGIN_COUNT%<br>
|
||||||
<b>Affils</b>: %AFFILIATIONS%<br>
|
<b>Affils</b>: %AFFILIATIONS%<br>
|
||||||
<b>Achievement Points</b>: %ACHIEVEMENT_POINTS%<br>
|
<b>Account Since</b>: %ACCOUNT_CREATED%<br>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue