mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
New client edit avatar (#8955)
* Fixed some purchasing issues with backgrounds * Added more background styles * Fixed some menu styles * Initial old client removal * Added cross-env * removed bower and fixed lint * Made interceptor errors use notify * Removed old client tests and fixed lint
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import locals from '../../middlewares/locals';
|
||||
import _ from 'lodash';
|
||||
import md from 'habitica-markdown';
|
||||
import nconf from 'nconf';
|
||||
// import _ from 'lodash';
|
||||
// import md from 'habitica-markdown';
|
||||
// import nconf from 'nconf';
|
||||
|
||||
let api = {};
|
||||
|
||||
const IS_PROD = nconf.get('IS_PROD');
|
||||
const TOTAL_USER_COUNT = '2,000,000';
|
||||
// const IS_PROD = nconf.get('IS_PROD');
|
||||
// const TOTAL_USER_COUNT = '2,000,000';
|
||||
const LOADING_SCREEN_TIPS = 33;
|
||||
const IS_NEW_CLIENT_ENABLED = nconf.get('NEW_CLIENT_ENABLED') === 'true';
|
||||
// const IS_NEW_CLIENT_ENABLED = nconf.get('NEW_CLIENT_ENABLED') === 'true';
|
||||
|
||||
api.getFrontPage = {
|
||||
method: 'GET',
|
||||
url: '/',
|
||||
url: '/old-client',
|
||||
middlewares: [locals],
|
||||
runCron: false,
|
||||
async handler (req, res) {
|
||||
@@ -28,76 +28,75 @@ api.getFrontPage = {
|
||||
},
|
||||
};
|
||||
|
||||
let staticPages = ['front', 'privacy', 'terms', 'features', 'login',
|
||||
'videos', 'contact', 'plans', 'new-stuff', 'community-guidelines',
|
||||
'old-news', 'press-kit', 'faq', 'overview', 'apps',
|
||||
'clear-browser-data', 'merch', 'maintenance-info'];
|
||||
// let staticPages = ['front', 'privacy', 'terms', 'features', 'login',
|
||||
// 'videos', 'contact', 'plans', 'new-stuff', 'community-guidelines',
|
||||
// 'old-news', 'press-kit', 'faq', 'overview', 'apps',
|
||||
// 'clear-browser-data', 'merch', 'maintenance-info'];
|
||||
|
||||
_.each(staticPages, (name) => {
|
||||
api[`get${name}Page`] = {
|
||||
method: 'GET',
|
||||
url: `/static/${name}`,
|
||||
middlewares: [locals],
|
||||
runCron: false,
|
||||
async handler (req, res) {
|
||||
return res.render(`static/${name}.jade`, {
|
||||
env: res.locals.habitrpg,
|
||||
md,
|
||||
userCount: TOTAL_USER_COUNT,
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
// _.each(staticPages, (name) => {
|
||||
// api[`get${name}Page`] = {
|
||||
// method: 'GET',
|
||||
// url: `/static/${name}`,
|
||||
// middlewares: [locals],
|
||||
// runCron: false,
|
||||
// async handler (req, res) {
|
||||
// return res.render(`static/${name}.jade`, {
|
||||
// env: res.locals.habitrpg,
|
||||
// md,
|
||||
// userCount: TOTAL_USER_COUNT,
|
||||
// });
|
||||
// },
|
||||
// };
|
||||
// });
|
||||
|
||||
api.redirectApi = {
|
||||
method: 'GET',
|
||||
url: '/static/api',
|
||||
runCron: false,
|
||||
async handler (req, res) {
|
||||
res.redirect(301, '/apidoc');
|
||||
},
|
||||
};
|
||||
// api.redirectApi = {
|
||||
// method: 'GET',
|
||||
// url: '/static/api',
|
||||
// runCron: false,
|
||||
// async handler (req, res) {
|
||||
// res.redirect(301, '/apidoc');
|
||||
// },
|
||||
// };
|
||||
|
||||
let shareables = ['level-up', 'hatch-pet', 'raise-pet', 'unlock-quest', 'won-challenge', 'achievement'];
|
||||
// let shareables = ['level-up', 'hatch-pet', 'raise-pet', 'unlock-quest', 'won-challenge', 'achievement'];
|
||||
|
||||
_.each(shareables, (name) => {
|
||||
api[`get${name}ShareablePage`] = {
|
||||
method: 'GET',
|
||||
url: `/social/${name}`,
|
||||
middlewares: [locals],
|
||||
runCron: false,
|
||||
async handler (req, res) {
|
||||
return res.render(`social/${name}`, {
|
||||
env: res.locals.habitrpg,
|
||||
md,
|
||||
userCount: TOTAL_USER_COUNT,
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
// _.each(shareables, (name) => {
|
||||
// api[`get${name}ShareablePage`] = {
|
||||
// method: 'GET',
|
||||
// url: `/social/${name}`,
|
||||
// middlewares: [locals],
|
||||
// runCron: false,
|
||||
// async handler (req, res) {
|
||||
// return res.render(`social/${name}`, {
|
||||
// env: res.locals.habitrpg,
|
||||
// md,
|
||||
// userCount: TOTAL_USER_COUNT,
|
||||
// });
|
||||
// },
|
||||
// };
|
||||
// });
|
||||
|
||||
api.redirectExtensionsPage = {
|
||||
method: 'GET',
|
||||
url: '/static/extensions',
|
||||
runCron: false,
|
||||
async handler (req, res) {
|
||||
return res.redirect('http://habitica.wikia.com/wiki/Extensions,_Add-Ons,_and_Customizations');
|
||||
},
|
||||
};
|
||||
// api.redirectExtensionsPage = {
|
||||
// method: 'GET',
|
||||
// url: '/static/extensions',
|
||||
// runCron: false,
|
||||
// async handler (req, res) {
|
||||
// return res.redirect('http://habitica.wikia.com/wiki/Extensions,_Add-Ons,_and_Customizations');
|
||||
// },
|
||||
// };
|
||||
|
||||
// All requests to /new_app (except /new_app/static) should serve the new client in development
|
||||
if (IS_PROD && IS_NEW_CLIENT_ENABLED) {
|
||||
api.getNewClient = {
|
||||
method: 'GET',
|
||||
url: /^\/new-app($|\/(?!(static\/.?|static$)))/,
|
||||
async handler (req, res) {
|
||||
if (!(req.session && req.session.userId)) {
|
||||
return res.redirect('/static/front');
|
||||
}
|
||||
|
||||
return res.sendFile('./dist-client/index.html', {root: `${__dirname}/../../../../`});
|
||||
},
|
||||
};
|
||||
}
|
||||
// if (IS_PROD && IS_NEW_CLIENT_ENABLED) {
|
||||
api.getNewClient = {
|
||||
method: 'GET',
|
||||
url: '/',
|
||||
async handler (req, res) {
|
||||
if (!(req.session && req.session.userId)) {
|
||||
return res.redirect('/');
|
||||
}
|
||||
return res.sendFile('./dist-client/index.html', {root: `${__dirname}/../../../../`});
|
||||
},
|
||||
};
|
||||
// }
|
||||
|
||||
module.exports = api;
|
||||
|
||||
Reference in New Issue
Block a user