mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 11:44:34 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25dc5dd215 | ||
|
|
503994dbd2 | ||
|
|
0dceb5c3c3 | ||
|
|
1af04fa3b3 | ||
|
|
efa81fec77 | ||
|
|
10caf1918a | ||
|
|
4ed20a3b75 | ||
|
|
98b2c5fa25 | ||
|
|
3ad327b85f | ||
|
|
dd3acce393 | ||
|
|
8065727b9b | ||
|
|
e1223ec3f8 | ||
|
|
1f89279264 | ||
|
|
a07f47a1ba | ||
|
|
2548c82dfe |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.0.70](https://github.com/sasjs/server/compare/v0.0.69...v0.0.70) (2022-05-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* CSP_DISABLE env option ([dd3acce](https://github.com/sasjs/server/commit/dd3acce3935e7cfc0b2c44a401314306915a3a10))
|
||||||
|
|
||||||
|
### [0.0.69](https://github.com/sasjs/server/compare/v0.0.68...v0.0.69) (2022-05-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **upload:** appStream uses CSRF + Session authentication ([1f89279](https://github.com/sasjs/server/commit/1f8927926405887f3d134c0a1dd6452ffa33876e))
|
||||||
|
|
||||||
|
### [0.0.68](https://github.com/sasjs/server/compare/v0.0.67...v0.0.68) (2022-05-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* using monaco editor locally ([2548c82](https://github.com/sasjs/server/commit/2548c82dfe1149e62a570a00546dddd9e30049b1))
|
||||||
|
|
||||||
### [0.0.67](https://github.com/sasjs/server/compare/v0.0.66...v0.0.67) (2022-05-01)
|
### [0.0.67](https://github.com/sasjs/server/compare/v0.0.66...v0.0.67) (2022-05-01)
|
||||||
|
|
||||||
### [0.0.66](https://github.com/sasjs/server/compare/v0.0.64...v0.0.66) (2022-05-01)
|
### [0.0.66](https://github.com/sasjs/server/compare/v0.0.64...v0.0.66) (2022-05-01)
|
||||||
|
|||||||
72
README.md
72
README.md
@@ -48,15 +48,22 @@ When launching the app, it will make use of specific environment variables. Thes
|
|||||||
Example contents of a `.env` file:
|
Example contents of a `.env` file:
|
||||||
|
|
||||||
```
|
```
|
||||||
# options: [desktop|server] default: `desktop`
|
#
|
||||||
|
## Core Settings
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# MODE options: [desktop|server] default: `desktop`
|
||||||
|
# Desktop mode is single user and designed for workstation use
|
||||||
|
# Server mode is multi-user and suitable for intranet / internet use
|
||||||
MODE=
|
MODE=
|
||||||
|
|
||||||
# options: [disable|enable] default: `disable` for `server` & `enable` for `desktop`
|
# Path to SAS executable (sas.exe / sas.sh)
|
||||||
# If enabled, be sure to also configure the WHITELIST of third party servers.
|
SAS_PATH=/path/to/sas/executable.exe
|
||||||
CORS=
|
|
||||||
|
|
||||||
# options: <http://localhost:3000 https://abc.com ...> space separated urls
|
# Path to working directory
|
||||||
WHITELIST=
|
# This location is for SAS WORK, staged files, DRIVE, configuration etc
|
||||||
|
DRIVE_PATH=/tmp
|
||||||
|
|
||||||
# options: [http|https] default: http
|
# options: [http|https] default: http
|
||||||
PROTOCOL=
|
PROTOCOL=
|
||||||
@@ -65,16 +72,22 @@ PROTOCOL=
|
|||||||
PORT=
|
PORT=
|
||||||
|
|
||||||
|
|
||||||
# optional
|
#
|
||||||
# for MODE: `desktop`, prompts user
|
## Additional SAS Options
|
||||||
# for MODE: `server` gets value from api/package.json `configuration.sasPath`
|
#
|
||||||
SAS_PATH=/path/to/sas/executable.exe
|
|
||||||
|
|
||||||
|
|
||||||
# optional
|
# On windows use SAS_OPTIONS and on unix use SASV9_OPTIONS
|
||||||
# for MODE: `desktop`, prompts user
|
# Any options set here are automatically applied in the SAS session
|
||||||
# for MODE: `server` defaults to /tmp
|
# See: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p0wrdmqp8k0oyyn1xbx3bp3qy2wl.htm
|
||||||
DRIVE_PATH=/tmp
|
# And: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostwin/p0drw76qo0gig2n1kcoliekh605k.htm#p09y7hx0grw1gin1giuvrjyx61m6
|
||||||
|
SAS_OPTIONS= -NOXCMD
|
||||||
|
SASV9_OPTIONS= -NOXCMD
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
## Additional Web Server Options
|
||||||
|
#
|
||||||
|
|
||||||
# ENV variables required for PROTOCOL: `https`
|
# ENV variables required for PROTOCOL: `https`
|
||||||
PRIVATE_KEY=privkey.pem
|
PRIVATE_KEY=privkey.pem
|
||||||
@@ -87,13 +100,30 @@ AUTH_CODE_SECRET=<secret>
|
|||||||
SESSION_SECRET=<secret>
|
SESSION_SECRET=<secret>
|
||||||
DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWrites=true&w=majority
|
DB_CONNECT=mongodb+srv://<DB_USERNAME>:<DB_PASSWORD>@<CLUSTER>/<DB_NAME>?retryWrites=true&w=majority
|
||||||
|
|
||||||
# SAS Options
|
# options: [disable|enable] default: `disable` for `server` & `enable` for `desktop`
|
||||||
# On windows use SAS_OPTIONS and on unix use SASV9_OPTIONS
|
# If enabled, be sure to also configure the WHITELIST of third party servers.
|
||||||
# Any options set here are automatically applied in the SAS session
|
CORS=
|
||||||
# See: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostunx/p0wrdmqp8k0oyyn1xbx3bp3qy2wl.htm
|
|
||||||
# And: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/hostwin/p0drw76qo0gig2n1kcoliekh605k.htm#p09y7hx0grw1gin1giuvrjyx61m6
|
# options: <http://localhost:3000 https://abc.com ...> space separated urls
|
||||||
SAS_OPTIONS= -NOXCMD
|
WHITELIST=
|
||||||
SASV9_OPTIONS= -NOXCMD
|
|
||||||
|
# HELMET Cross Origin Embedder Policy
|
||||||
|
# Sets the Cross-Origin-Embedder-Policy header to require-corp when `true`
|
||||||
|
# options: [true|false] default: true
|
||||||
|
# Docs: https://helmetjs.github.io/#reference (`crossOriginEmbedderPolicy`)
|
||||||
|
HELMET_COEP=
|
||||||
|
|
||||||
|
# HELMET Content Security Policy
|
||||||
|
# Path to a json file containing HELMET `contentSecurityPolicy` directives
|
||||||
|
# Docs: https://helmetjs.github.io/#reference
|
||||||
|
#
|
||||||
|
# Example config:
|
||||||
|
# {
|
||||||
|
# "img-src": ["'self'", "domain.com"],
|
||||||
|
# "script-src": ["'self'", "'unsafe-inline'"],
|
||||||
|
# "script-src-attr": ["'self'", "'unsafe-inline'"]
|
||||||
|
# }
|
||||||
|
HELMET_CSP_CONFIG_PATH=./csp.config.json
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ FULL_CHAIN=fullchain.pem
|
|||||||
|
|
||||||
PORT=[5000] default value is 5000
|
PORT=[5000] default value is 5000
|
||||||
|
|
||||||
|
HELMET_CSP_CONFIG_PATH=./csp.config.json if omitted HELMET default will be used
|
||||||
|
HELMET_COEP=[true|false] if omitted HELMET default will be used
|
||||||
|
|
||||||
ACCESS_TOKEN_SECRET=<secret>
|
ACCESS_TOKEN_SECRET=<secret>
|
||||||
REFRESH_TOKEN_SECRET=<secret>
|
REFRESH_TOKEN_SECRET=<secret>
|
||||||
AUTH_CODE_SECRET=<secret>
|
AUTH_CODE_SECRET=<secret>
|
||||||
|
|||||||
5
api/csp.config.example.json
Normal file
5
api/csp.config.example.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"img-src": ["'self'", "domen.com"],
|
||||||
|
"script-src": ["'self'", "'unsafe-inline'"],
|
||||||
|
"script-src-attr": ["'self'", "'unsafe-inline'"]
|
||||||
|
}
|
||||||
49
api/public/app-streams-script.js
Normal file
49
api/public/app-streams-script.js
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
const inputElement = document.getElementById('fileId')
|
||||||
|
|
||||||
|
document.getElementById('uploadButton').addEventListener('click', function () {
|
||||||
|
inputElement.click()
|
||||||
|
})
|
||||||
|
|
||||||
|
inputElement.addEventListener(
|
||||||
|
'change',
|
||||||
|
function () {
|
||||||
|
const fileList = this.files /* now you can work with the file list */
|
||||||
|
|
||||||
|
updateFileUploadMessage('Requesting ...')
|
||||||
|
|
||||||
|
const file = fileList[0]
|
||||||
|
const formData = new FormData()
|
||||||
|
|
||||||
|
formData.append('file', file)
|
||||||
|
|
||||||
|
axios
|
||||||
|
.post('/SASjsApi/drive/deploy/upload', formData)
|
||||||
|
.then((res) => res.data)
|
||||||
|
.then((data) => {
|
||||||
|
return (
|
||||||
|
data.message +
|
||||||
|
'\nstreamServiceName: ' +
|
||||||
|
data.streamServiceName +
|
||||||
|
'\nrefreshing page once alert box closes.'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.then((message) => {
|
||||||
|
alert(message)
|
||||||
|
location.reload()
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
alert(error.response.data)
|
||||||
|
resetFileUpload()
|
||||||
|
updateFileUploadMessage('Upload New App')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
false
|
||||||
|
)
|
||||||
|
|
||||||
|
function updateFileUploadMessage(message) {
|
||||||
|
document.getElementById('uploadMessage').innerHTML = message
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetFileUpload() {
|
||||||
|
inputElement.value = null
|
||||||
|
}
|
||||||
3
api/public/axios.min.js
vendored
Normal file
3
api/public/axios.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -17,6 +17,7 @@ import {
|
|||||||
setProcessVariables,
|
setProcessVariables,
|
||||||
setupFolders
|
setupFolders
|
||||||
} from './utils'
|
} from './utils'
|
||||||
|
import { getEnvCSPDirectives } from './utils/parseHelmetConfig'
|
||||||
|
|
||||||
dotenv.config()
|
dotenv.config()
|
||||||
|
|
||||||
@@ -25,7 +26,8 @@ const app = express()
|
|||||||
app.use(cookieParser())
|
app.use(cookieParser())
|
||||||
app.use(morgan('tiny'))
|
app.use(morgan('tiny'))
|
||||||
|
|
||||||
const { MODE, CORS, WHITELIST, PROTOCOL } = process.env
|
const { MODE, CORS, WHITELIST, PROTOCOL, HELMET_CSP_CONFIG_PATH, HELMET_COEP } =
|
||||||
|
process.env
|
||||||
|
|
||||||
export const cookieOptions = {
|
export const cookieOptions = {
|
||||||
secure: PROTOCOL === 'https',
|
secure: PROTOCOL === 'https',
|
||||||
@@ -33,6 +35,10 @@ export const cookieOptions = {
|
|||||||
maxAge: 24 * 60 * 60 * 1000 // 24 hours
|
maxAge: 24 * 60 * 60 * 1000 // 24 hours
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cspConfigJson = getEnvCSPDirectives(HELMET_CSP_CONFIG_PATH)
|
||||||
|
const coepFlag =
|
||||||
|
HELMET_COEP === 'true' || HELMET_COEP === undefined ? true : false
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* CSRF Protection *
|
* CSRF Protection *
|
||||||
***********************************/
|
***********************************/
|
||||||
@@ -41,8 +47,17 @@ export const csrfProtection = csrf({ cookie: cookieOptions })
|
|||||||
/***********************************
|
/***********************************
|
||||||
* Handle security and origin *
|
* Handle security and origin *
|
||||||
***********************************/
|
***********************************/
|
||||||
// TODO: fix monaco loader from npm package before enabling helmet
|
app.use(
|
||||||
// app.use(helmet())
|
helmet({
|
||||||
|
contentSecurityPolicy: {
|
||||||
|
directives: {
|
||||||
|
...helmet.contentSecurityPolicy.getDefaultDirectives(),
|
||||||
|
...cspConfigJson
|
||||||
|
}
|
||||||
|
},
|
||||||
|
crossOriginEmbedderPolicy: coepFlag
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
/***********************************
|
/***********************************
|
||||||
* Enabling CORS *
|
* Enabling CORS *
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ export class WebController {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Get('/')
|
@Get('/')
|
||||||
public async home(@Request() req: express.Request) {
|
public async home() {
|
||||||
return home(req)
|
return home()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,16 +44,13 @@ export class WebController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const home = async (req: express.Request) => {
|
const home = async () => {
|
||||||
const indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
|
const indexHtmlPath = path.join(getWebBuildFolderPath(), 'index.html')
|
||||||
|
|
||||||
// Attention! Cannot use fileExists here,
|
// Attention! Cannot use fileExists here,
|
||||||
// due to limitation after building executable
|
// due to limitation after building executable
|
||||||
const content = await readFile(indexHtmlPath)
|
const content = await readFile(indexHtmlPath)
|
||||||
|
|
||||||
req.res?.cookie('XSRF-TOKEN', req.csrfToken())
|
|
||||||
req.res?.setHeader('Content-Type', 'text/html')
|
|
||||||
|
|
||||||
return content
|
return content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { AppStreamConfig } from '../../types'
|
import { AppStreamConfig } from '../../types'
|
||||||
import { script } from './script'
|
|
||||||
import { style } from './style'
|
import { style } from './style'
|
||||||
|
|
||||||
const defaultAppLogo = '/sasjs-logo.svg'
|
const defaultAppLogo = '/sasjs-logo.svg'
|
||||||
@@ -39,6 +38,7 @@ export const appStreamHtml = (appStreamConfig: AppStreamConfig) => `
|
|||||||
<span id="uploadMessage">Upload New App</span>
|
<span id="uploadMessage">Upload New App</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
${script}
|
<script src="/axios.min.js"></script>
|
||||||
|
<script src="/app-streams-script.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>`
|
</html>`
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import { appStreamHtml } from './appStreamHtml'
|
|||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
router.get('/', async (_, res) => {
|
router.get('/', async (req, res) => {
|
||||||
const content = appStreamHtml(process.appStreamConfig)
|
const content = appStreamHtml(process.appStreamConfig)
|
||||||
|
|
||||||
|
res.cookie('XSRF-TOKEN', req.csrfToken())
|
||||||
|
|
||||||
return res.send(content)
|
return res.send(content)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
export const script = `<script>
|
|
||||||
const inputElement = document.getElementById('fileId')
|
|
||||||
|
|
||||||
document
|
|
||||||
.getElementById('uploadButton')
|
|
||||||
.addEventListener('click', function () {
|
|
||||||
inputElement.click()
|
|
||||||
})
|
|
||||||
|
|
||||||
inputElement.addEventListener(
|
|
||||||
'change',
|
|
||||||
function () {
|
|
||||||
const fileList = this.files /* now you can work with the file list */
|
|
||||||
|
|
||||||
updateFileUploadMessage('Requesting ...')
|
|
||||||
|
|
||||||
const file = fileList[0]
|
|
||||||
const formData = new FormData()
|
|
||||||
|
|
||||||
formData.append('file', file)
|
|
||||||
fetch('/SASjsApi/drive/deploy/upload', {
|
|
||||||
method: 'POST',
|
|
||||||
body: formData
|
|
||||||
})
|
|
||||||
.then(async (res) => {
|
|
||||||
const { status, ok } = res
|
|
||||||
if (status === 200 && ok) {
|
|
||||||
const data = await res.json()
|
|
||||||
return (
|
|
||||||
data.message +
|
|
||||||
'\\nstreamServiceName: ' +
|
|
||||||
data.streamServiceName +
|
|
||||||
'\\nrefreshing page once alert box closes.'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
throw await res.text()
|
|
||||||
})
|
|
||||||
.then((message) => {
|
|
||||||
alert(message)
|
|
||||||
location.reload()
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
alert(error)
|
|
||||||
resetFileUpload()
|
|
||||||
updateFileUploadMessage('Upload New App')
|
|
||||||
})
|
|
||||||
},
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
function updateFileUploadMessage(message) {
|
|
||||||
document.getElementById('uploadMessage').innerHTML = message
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetFileUpload() {
|
|
||||||
inputElement.value = null
|
|
||||||
}
|
|
||||||
</script>`
|
|
||||||
@@ -4,14 +4,16 @@ import webRouter from './web'
|
|||||||
import apiRouter from './api'
|
import apiRouter from './api'
|
||||||
import appStreamRouter from './appStream'
|
import appStreamRouter from './appStream'
|
||||||
|
|
||||||
|
import { csrfProtection } from '../app'
|
||||||
|
|
||||||
export const setupRoutes = (app: Express) => {
|
export const setupRoutes = (app: Express) => {
|
||||||
app.use('/SASjsApi', apiRouter)
|
app.use('/SASjsApi', apiRouter)
|
||||||
|
|
||||||
app.use('/AppStream', function (req, res, next) {
|
app.use('/AppStream', csrfProtection, function (req, res, next) {
|
||||||
// this needs to be a function to hook on
|
// this needs to be a function to hook on
|
||||||
// whatever the current router is
|
// whatever the current router is
|
||||||
appStreamRouter(req, res, next)
|
appStreamRouter(req, res, next)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.use('/', webRouter)
|
app.use('/', csrfProtection, webRouter)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import { csrfProtection } from '../../app'
|
|
||||||
import webRouter from './web'
|
import webRouter from './web'
|
||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
|
|
||||||
router.use(csrfProtection)
|
|
||||||
|
|
||||||
router.use('/', webRouter)
|
router.use('/', webRouter)
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ const controller = new WebController()
|
|||||||
|
|
||||||
webRouter.get('/', async (req, res) => {
|
webRouter.get('/', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const response = await controller.home(req)
|
const response = await controller.home()
|
||||||
|
|
||||||
|
res.cookie('XSRF-TOKEN', req.csrfToken())
|
||||||
|
|
||||||
return res.send(response)
|
return res.send(response)
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
return res.send('Web Build is not present')
|
return res.send('Web Build is not present')
|
||||||
|
|||||||
33
api/src/utils/parseHelmetConfig.ts
Normal file
33
api/src/utils/parseHelmetConfig.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import path from 'path'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
export const getEnvCSPDirectives = (
|
||||||
|
HELMET_CSP_CONFIG_PATH: string | undefined
|
||||||
|
) => {
|
||||||
|
let cspConfigJson = {
|
||||||
|
'script-src': ["'self'", "'unsafe-inline'"]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
typeof HELMET_CSP_CONFIG_PATH === 'string' &&
|
||||||
|
HELMET_CSP_CONFIG_PATH.length > 0
|
||||||
|
) {
|
||||||
|
const cspConfigPath = path.join(process.cwd(), HELMET_CSP_CONFIG_PATH)
|
||||||
|
|
||||||
|
try {
|
||||||
|
let file = fs.readFileSync(cspConfigPath).toString()
|
||||||
|
|
||||||
|
try {
|
||||||
|
cspConfigJson = JSON.parse(file)
|
||||||
|
} catch (e) {
|
||||||
|
console.error(
|
||||||
|
'Parsing Content Security Policy JSON config failed. Make sure it is valid json'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error reading HELMET CSP config file', e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cspConfigJson
|
||||||
|
}
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.67",
|
"version": "0.0.70",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.67",
|
"version": "0.0.70",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^2.3.1",
|
||||||
"standard-version": "^9.3.2"
|
"standard-version": "^9.3.2"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "server",
|
"name": "server",
|
||||||
"version": "0.0.67",
|
"version": "0.0.70",
|
||||||
"description": "NodeJS wrapper for calling the SAS binary executable",
|
"description": "NodeJS wrapper for calling the SAS binary executable",
|
||||||
"repository": "https://github.com/sasjs/server",
|
"repository": "https://github.com/sasjs/server",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
373
web/package-lock.json
generated
373
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.4.1",
|
"@emotion/react": "^11.4.1",
|
||||||
"@emotion/styled": "^11.3.0",
|
"@emotion/styled": "^11.3.0",
|
||||||
"@monaco-editor/react": "^4.3.1",
|
|
||||||
"@mui/icons-material": "^5.0.3",
|
"@mui/icons-material": "^5.0.3",
|
||||||
"@mui/lab": "^5.0.0-alpha.50",
|
"@mui/lab": "^5.0.0-alpha.50",
|
||||||
"@mui/material": "^5.0.3",
|
"@mui/material": "^5.0.3",
|
||||||
@@ -21,8 +20,11 @@
|
|||||||
"@types/node": "^12.20.28",
|
"@types/node": "^12.20.28",
|
||||||
"@types/react": "^17.0.27",
|
"@types/react": "^17.0.27",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
|
"monaco-editor": "^0.33.0",
|
||||||
|
"monaco-editor-webpack-plugin": "^7.0.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
|
"react-monaco-editor": "^0.48.0",
|
||||||
"react-router-dom": "^5.3.0"
|
"react-router-dom": "^5.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'
|
|||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
import Editor from '@monaco-editor/react'
|
import Editor from 'react-monaco-editor'
|
||||||
|
|
||||||
import Box from '@mui/material/Box'
|
import Box from '@mui/material/Box'
|
||||||
import Paper from '@mui/material/Paper'
|
import Paper from '@mui/material/Paper'
|
||||||
@@ -125,6 +125,7 @@ const Main = (props: Props) => {
|
|||||||
{!isLoading && props?.selectedFilePath && editMode && (
|
{!isLoading && props?.selectedFilePath && editMode && (
|
||||||
<Editor
|
<Editor
|
||||||
height="95%"
|
height="95%"
|
||||||
|
language="sas"
|
||||||
value={fileContent}
|
value={fileContent}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
if (val) setFileContent(val)
|
if (val) setFileContent(val)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import axios from 'axios'
|
|||||||
import Box from '@mui/material/Box'
|
import Box from '@mui/material/Box'
|
||||||
import { Button, Paper, Stack, Tab, Tooltip } from '@mui/material'
|
import { Button, Paper, Stack, Tab, Tooltip } from '@mui/material'
|
||||||
import { makeStyles } from '@mui/styles'
|
import { makeStyles } from '@mui/styles'
|
||||||
import Editor, { OnMount } from '@monaco-editor/react'
|
import Editor, { EditorDidMount } from 'react-monaco-editor'
|
||||||
import { useLocation } from 'react-router-dom'
|
import { useLocation } from 'react-router-dom'
|
||||||
import { TabContext, TabList, TabPanel } from '@mui/lab'
|
import { TabContext, TabList, TabPanel } from '@mui/lab'
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ const Studio = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const editorRef = useRef(null as any)
|
const editorRef = useRef(null as any)
|
||||||
const handleEditorDidMount: OnMount = (editor) => {
|
const handleEditorDidMount: EditorDidMount = (editor) => {
|
||||||
editor.focus()
|
editor.focus()
|
||||||
editorRef.current = editor
|
editorRef.current = editor
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,7 @@ const Studio = () => {
|
|||||||
<Tooltip title="CTRL+ENTER will also run SAS code">
|
<Tooltip title="CTRL+ENTER will also run SAS code">
|
||||||
<Button onClick={handleRunBtnClick} className={classes.runButton}>
|
<Button onClick={handleRunBtnClick} className={classes.runButton}>
|
||||||
<img
|
<img
|
||||||
|
alt=""
|
||||||
draggable="false"
|
draggable="false"
|
||||||
style={{ width: '25px' }}
|
style={{ width: '25px' }}
|
||||||
src="/running-sas.png"
|
src="/running-sas.png"
|
||||||
@@ -161,8 +162,9 @@ const Studio = () => {
|
|||||||
>
|
>
|
||||||
<Editor
|
<Editor
|
||||||
height="98%"
|
height="98%"
|
||||||
|
language="sas"
|
||||||
value={fileContent}
|
value={fileContent}
|
||||||
onMount={handleEditorDidMount}
|
editorDidMount={handleEditorDidMount}
|
||||||
options={{ readOnly: ctrlPressed }}
|
options={{ readOnly: ctrlPressed }}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
if (val) setFileContent(val)
|
if (val) setFileContent(val)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin'
|
||||||
import { Configuration } from 'webpack'
|
import { Configuration } from 'webpack'
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
||||||
import CopyPlugin from 'copy-webpack-plugin'
|
import CopyPlugin from 'copy-webpack-plugin'
|
||||||
@@ -53,7 +54,8 @@ const config: Configuration = {
|
|||||||
new CopyPlugin({
|
new CopyPlugin({
|
||||||
patterns: [{ from: 'public' }]
|
patterns: [{ from: 'public' }]
|
||||||
}),
|
}),
|
||||||
new dotenv()
|
new dotenv(),
|
||||||
|
new MonacoWebpackPlugin()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user