mirror of
https://github.com/sasjs/server.git
synced 2025-12-12 11:54:35 +00:00
fix(autoexec): usage in case of desktop from file
This commit is contained in:
@@ -2,7 +2,13 @@ import express from 'express'
|
||||
import { Request, Security, Route, Tags, Post, Body } from 'tsoa'
|
||||
import { ExecuteReturnJson, ExecutionController } from './internal'
|
||||
import { ExecuteReturnJsonResponse } from '.'
|
||||
import { getPreProgramVariables, parseLogToArray } from '../utils'
|
||||
import {
|
||||
getDesktopUserAutoExecPath,
|
||||
getPreProgramVariables,
|
||||
ModeType,
|
||||
parseLogToArray
|
||||
} from '../utils'
|
||||
import { readFile } from '@sasjs/utils'
|
||||
|
||||
interface ExecuteSASCodePayload {
|
||||
/**
|
||||
@@ -34,13 +40,18 @@ const executeSASCode = async (
|
||||
{ code }: ExecuteSASCodePayload
|
||||
) => {
|
||||
const { user } = req
|
||||
const userAutoExec =
|
||||
process.env.MODE === ModeType.Server
|
||||
? user?.autoExec
|
||||
: await readFile(getDesktopUserAutoExecPath())
|
||||
|
||||
try {
|
||||
const { webout, log, httpHeaders } =
|
||||
(await new ExecutionController().executeProgram(
|
||||
code,
|
||||
getPreProgramVariables(req),
|
||||
{ ...req.query, _debug: 131 },
|
||||
{ userAutoExec: user?.autoExec },
|
||||
{ userAutoExec },
|
||||
true
|
||||
)) as ExecuteReturnJson
|
||||
|
||||
|
||||
Reference in New Issue
Block a user