3 const asyncHandler = require('express-async-handler');
4 var contextGenerator = require('../../web/context-generator');
5 var fonts = require('../../web/fonts');
6 const mixinHbsDataForVueLeftMenu = require('./vue/mixin-vue-left-menu-data');
8 var WELCOME_MESSAGES = [
11 "Let's try something new",
12 'Computers are pretty cool',
14 'Make the world better',
15 'Computers need people',
16 'Everyone secretly loves robots',
19 'From everywhere, with love',
21 'UDP like you just dont care',
22 'Lovely code for lovely people',
23 "Don't drop your computer",
24 'Learn, Teach, Repeat. Always Repeat.',
25 'Help out on the projects you love',
26 "HTTP 418: I'm a teapot",
27 'Hey there, nice to see you',
31 async function renderHomePage(req, res, next) {
33 .generateBasicContext(req)
34 .then(async function(troupeContext) {
35 const page = 'userhome-template';
37 var osName = req.getParsedUserAgent().os.family.toLowerCase();
39 var isLinux = osName.indexOf('linux') >= 0;
40 var isOsx = osName.indexOf('mac') >= 0;
41 var isWindows = osName.indexOf('windows') >= 0;
43 // show everything if we cant confirm the os
44 var showOsxApp = !isLinux && !isWindows;
45 var showWindowsApp = !isLinux && !isOsx;
46 var showLinuxApp = !isOsx && !isWindows;
50 await mixinHbsDataForVueLeftMenu(req, {
51 bootScriptName: 'router-userhome',
52 cssFileName: 'styles/userhome.css',
53 hasCachedFonts: fonts.hasCachedFonts(req.cookies),
54 fonts: fonts.getFonts(),
55 welcomeMessage: WELCOME_MESSAGES[Math.floor(Math.random() * WELCOME_MESSAGES.length)],
56 showOsxApp: showOsxApp,
57 showWindowsApp: showWindowsApp,
58 showLinuxApp: showLinuxApp,
59 troupeContext: troupeContext,
60 isNativeDesktopApp: troupeContext.isNativeDesktopApp
67 module.exports = exports = {
68 renderHomePage: asyncHandler(renderHomePage)