Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const requestLanguage = request.getLanguage();
return {
apiUrl: API_ROUTE_PATH,
baseUrl: host,
basename: requestLanguage === 'en-US' ? '' : `/${requestLanguage}`, // basename is the 'base path' for the application - usually a localeCode
enableServiceWorker,
requestLanguage,
supportedLangs: server.settings.app.supportedLangs,
initialNow: new Date().getTime(),
isProdApi: server.settings.app.api.isProd,
isQL: parseMemberCookie(state).ql === 'true',
memberId: parseMemberCookie(state).id, // deprecated, use member.id
// the member cookie is not structured the same way as the member object returned from /member/self
// be careful relying on it to have the same properties downstream
member: parseMemberCookie(state),
variants: getVariants(state),
entryPath: url.pathname, // the path that the user entered the app on
media: getMedia(userAgent, userAgentDevice),
browserId: parseBrowserIdCookie(state),
clientIp,
siftSessionId: parseSiftSessionCookie(state),
isBot: isBot(request.headers['user-agent']),
};
};
initializeStore(resolvedRoutes).then(store => {
// the initial addFlags call will only be key'd by member ID
return addFlags(store, { id: parseMemberCookie(request.state).id })
.then(() => populateStore(store))
.then(
store =>
// create tracer and immediately invoke the resulting function.
// trace should start before rendering, finish after rendering
newrelic.createTracer('serverRender', getRouterRenderer)({
request,
h,
appContext,
routes: resolvedRoutes,
store,
scripts,
cssLinks,
}) // immediately invoke callback
);
})
const host = `${requestProtocol}://${domain}`;
const userAgent = headers['user-agent'];
const userAgentDevice = headers['x-ua-device'] || ''; // set by fastly
const requestLanguage = request.getLanguage();
return {
apiUrl: API_ROUTE_PATH,
baseUrl: host,
basename: requestLanguage === 'en-US' ? '' : `/${requestLanguage}`, // basename is the 'base path' for the application - usually a localeCode
enableServiceWorker,
requestLanguage,
supportedLangs: server.settings.app.supportedLangs,
initialNow: new Date().getTime(),
isProdApi: server.settings.app.api.isProd,
isQL: parseMemberCookie(state).ql === 'true',
memberId: parseMemberCookie(state).id, // deprecated, use member.id
// the member cookie is not structured the same way as the member object returned from /member/self
// be careful relying on it to have the same properties downstream
member: parseMemberCookie(state),
variants: getVariants(state),
entryPath: url.pathname, // the path that the user entered the app on
media: getMedia(userAgent, userAgentDevice),
browserId: parseBrowserIdCookie(state),
clientIp,
siftSessionId: parseSiftSessionCookie(state),
isBot: isBot(request.headers['user-agent']),
};
};
info.remoteAddress;
const host = `${requestProtocol}://${domain}`;
const userAgent = headers['user-agent'];
const userAgentDevice = headers['x-ua-device'] || ''; // set by fastly
const requestLanguage = request.getLanguage();
return {
apiUrl: API_ROUTE_PATH,
baseUrl: host,
basename: requestLanguage === 'en-US' ? '' : `/${requestLanguage}`, // basename is the 'base path' for the application - usually a localeCode
enableServiceWorker,
requestLanguage,
supportedLangs: server.settings.app.supportedLangs,
initialNow: new Date().getTime(),
isProdApi: server.settings.app.api.isProd,
isQL: parseMemberCookie(state).ql === 'true',
memberId: parseMemberCookie(state).id, // deprecated, use member.id
// the member cookie is not structured the same way as the member object returned from /member/self
// be careful relying on it to have the same properties downstream
member: parseMemberCookie(state),
variants: getVariants(state),
entryPath: url.pathname, // the path that the user entered the app on
media: getMedia(userAgent, userAgentDevice),
browserId: parseBrowserIdCookie(state),
clientIp,
siftSessionId: parseSiftSessionCookie(state),
isBot: isBot(request.headers['user-agent']),
};
};