fix: setup https support + various fixes

This commit is contained in:
Nick
2019-03-16 22:41:48 -04:00
parent 7bbf683902
commit 358e79d7f5
7 changed files with 64 additions and 58 deletions

View File

@@ -130,7 +130,7 @@ module.exports = {
// JWT is NOT valid, set as guest
if (!user) {
if (true || WIKI.auth.guest.cacheExpiration.isSameOrBefore(moment.utc())) {
if (WIKI.auth.guest.cacheExpiration.isSameOrBefore(moment.utc())) {
WIKI.auth.guest = await WIKI.models.users.getGuestUser()
WIKI.auth.guest.cacheExpiration = moment.utc().add(1, 'm')
}
@@ -176,9 +176,7 @@ module.exports = {
user.groups.forEach(grp => {
const grpId = _.isObject(grp) ? _.get(grp, 'id', 0) : grp
_.get(WIKI.auth.groups, `${grpId}.pageRules`, []).forEach(rule => {
console.info(page.path)
console.info(rule)
switch(rule.match) {
switch (rule.match) {
case 'START':
if (_.startsWith(`/${page.path}`, `/${rule.path}`)) {
checkState = this._applyPageRuleSpecificity({ rule, checkState, higherPriority: ['END', 'REGEX', 'EXACT'] })
@@ -194,6 +192,7 @@ module.exports = {
if (reg.test(page.path)) {
checkState = this._applyPageRuleSpecificity({ rule, checkState, higherPriority: ['EXACT'] })
}
break
case 'EXACT':
if (`/${page.path}` === `/${rule.path}`) {
checkState = this._applyPageRuleSpecificity({ rule, checkState, higherPriority: [] })