Revert "Revert "Fix #125 Maintenance mode""

This reverts commit a68aa76b2f.
This commit is contained in:
ivan 2018-01-18 17:25:02 -03:00
parent 8f8c481d58
commit 8e750dbad5
4 changed files with 10 additions and 7 deletions

4
.gitignore vendored
View File

@ -1,4 +1,6 @@
server/composer.lock server/composer.lock
server/vendor server/vendor
.idea .idea
.jshintrc .jshintrc
server/files/
!server/files/.gitkeep

View File

@ -2,7 +2,7 @@
module.exports = { module.exports = {
'serverport': 3000, 'serverport': 3006,
'scripts': { 'scripts': {
'src': './src/*.js', 'src': './src/*.js',

View File

@ -64,12 +64,12 @@ class App extends React.Component {
loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff, loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff,
loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged
}; };
if(props.config['maintenance-mode'] === '1' && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) { if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) {
history.push('/maintenance'); history.push('/maintenance');
} }
if(props.config['maintenance-mode'] === '0' && _.includes(props.location.pathname, '/maintenance')) { if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) {
history.push('/'); history.push('/');
} }
@ -139,4 +139,4 @@ export default connect((store) => {
session: store.session, session: store.session,
routing: store.routing routing: store.routing
}; };
})(App); })(App);

View File

@ -60,6 +60,7 @@ class SessionStore {
this.setItem('registration', configs.registration); this.setItem('registration', configs.registration);
this.setItem('user-system-enabled', configs['user-system-enabled']); this.setItem('user-system-enabled', configs['user-system-enabled']);
this.setItem('allow-attachments', configs['allow-attachments']); this.setItem('allow-attachments', configs['allow-attachments']);
this.setItem('maintenance-mode', configs['maintenance-mode']);
} }
getConfigs() { getConfigs() {
@ -115,4 +116,4 @@ class SessionStore {
} }
} }
export default new SessionStore(); export default new SessionStore();