mirror of
https://github.com/sasjs/server.git
synced 2025-12-10 11:24:35 +00:00
chore: windows env variables needs to be trimmed
This commit is contained in:
@@ -29,7 +29,7 @@ const authenticateToken = (
|
||||
tokenType: 'accessToken' | 'refreshToken' = 'accessToken'
|
||||
) => {
|
||||
const { MODE } = process.env
|
||||
if (MODE === 'desktop') return next()
|
||||
if (MODE?.trim() === 'desktop') return next()
|
||||
|
||||
const authHeader = req.headers['authorization']
|
||||
const token = authHeader?.split(' ')[1]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const desktopRestrict = (req: any, res: any, next: any) => {
|
||||
const { MODE } = process.env
|
||||
if (MODE === 'desktop')
|
||||
if (MODE?.trim() === 'desktop')
|
||||
return res.status(403).send('Not Allowed while in Desktop Mode.')
|
||||
|
||||
next()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export const verifyAdmin = (req: any, res: any, next: any) => {
|
||||
const { MODE } = process.env
|
||||
if (MODE === 'desktop') return next()
|
||||
if (MODE?.trim() === 'desktop') return next()
|
||||
|
||||
const { user } = req
|
||||
if (!user?.isAdmin) return res.status(401).send('Admin account required')
|
||||
|
||||
@@ -26,7 +26,7 @@ export const populateClients = async () => {
|
||||
|
||||
export const connectDB = () => {
|
||||
const { MODE } = process.env
|
||||
if (MODE === 'desktop') {
|
||||
if (MODE?.trim() === 'desktop') {
|
||||
console.log('Running in Destop Mode, no DB to connect.')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ webRouter.get('/', async (_, res) => {
|
||||
const indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
|
||||
|
||||
const { MODE } = process.env
|
||||
if (MODE === 'desktop') {
|
||||
if (MODE?.trim() === 'desktop') {
|
||||
const content = await readFile(indexHtmlPath)
|
||||
|
||||
const codeToInject = `
|
||||
|
||||
Reference in New Issue
Block a user