Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dependencies upgraded #31

Open
wants to merge 13 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ Components Control. Can be configured to do one o more things (or nothing)
| Variable Name | Usage |
| ----- | ----- |
| COMMANDER_DISABLED | disable internal commander api |
| MONITORING_DISABLED | disable monitoring system. system monitors will not be checked anymore. will only change when bots and agents send updates |
| MONITORING_DISABLED | disable monitoring system. The core will stop checking monitors status. Events for monitor status will be triggered on API updates |
| API_DISABLED | disable rest api |
| SCHEDULER_JOBS_DISABLED | disable internal scheduler execution. scheduler-jobs will be created using the rest api but task will never be executed. theeye-jobs execution timeout will be never checked. |
| SCHEDULER_JOBS_DISABLED | disable internal scheduler execution. scheduled jobs can be created but jobs will not be created. |

### Start development sample

Expand Down
1 change: 1 addition & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
file_upload_folder: join(__dirname , '..', 'uploads'),
view_teamplates_path: __dirname + '/../core/view/template',
secret: 'b28d9f2a4d52ace6e5d3ac1dd3e5c2a0e7e66472ec7276ca501b8c4fa1f07679',
secret_uuid: 'a2a29a19-aba1-412b-a9ba-c29668e3c17b',
user: {
username: 'theeye-automatic',
email: 'info@theeye.io',
Expand Down
16 changes: 8 additions & 8 deletions core/app/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ module.exports = function () {

// respond with error middleware
server.use((req, res, next) => {
res.sendError = (error, next) => {
if (error.statusCode < 500) {
res.send(error.statusCode || 400, {
statusCode: error.statusCode,
message: error.message,
errors: error.errors
res.sendError = (err, next) => {
if (err instanceof ErrorHandler.ClientError || err.statusCode < 500) {
res.send(err.statusCode || 400, {
statusCode: err.statusCode,
message: err.message,
errors: err.errors
})
} else {
logger.error(error)
logger.error(err)
const handler = new ErrorHandler()
handler.sendExceptionAlert(error, req)
handler.sendExceptionAlert(err, req)
res.send(500, 'Internal Server Error')
}
if (next) { next() }
Expand Down
10 changes: 6 additions & 4 deletions core/constants/indicator.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

const SHORT_TYPE_CHART = 'chart'
const SHORT_TYPE_TEXT = 'text'
const SHORT_TYPE_CHART = 'chart'
const SHORT_TYPE_TEXT = 'text'
const SHORT_TYPE_PROGRESS = 'progress'
const SHORT_TYPE_COUNTER = 'counter'
const SHORT_TYPE_COUNTER = 'counter'
const SHORT_TYPE_FILE = 'file'

exports.SHORT_TYPE_CHART = SHORT_TYPE_CHART
exports.SHORT_TYPE_CHART = SHORT_TYPE_CHART
exports.SHORT_TYPE_TEXT = SHORT_TYPE_TEXT
exports.SHORT_TYPE_PROGRESS = SHORT_TYPE_PROGRESS
exports.SHORT_TYPE_COUNTER = SHORT_TYPE_COUNTER
exports.SHORT_TYPE_FILE = SHORT_TYPE_FILE
36 changes: 23 additions & 13 deletions core/controllers/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,39 @@ module.exports = (server) => {
}
})

const middlewares = [
server.auth.bearerMiddleware,
router.resolve.customerNameToEntity({ required: true }),
router.ensureCustomer
]

// FETCH
server.get('/:customer/file', middlewares, fetchFiles)
server.get('/:customer/file',
server.auth.bearerMiddleware,
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
fetchFiles
)

// GET
server.get('/:customer/file/:file',
middlewares,
server.auth.bearerMiddleware,
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
router.resolve.idToEntity({ param: 'file', required: true }),
getFile
)

// CREATE
server.post('/:customer/file',
middlewares.concat(router.requireCredential('admin')),
server.auth.bearerMiddleware,
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
router.requireCredential('admin'),
upload.single('file'),
createFile,
audit.afterCreate('file', { display: 'filename' })
)

// UPDATE
server.put('/:customer/file/:file',
middlewares,
server.auth.bearerMiddleware,
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
router.requireCredential('admin'),
router.resolve.idToEntity({ param:'file', required:true }),
upload.single('file'),
Expand All @@ -59,7 +65,9 @@ module.exports = (server) => {

// DELETE
server.del('/:customer/file/:file',
middlewares,
server.auth.bearerMiddleware,
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
router.requireCredential('admin'),
router.resolve.idToEntity({ param: 'file', required: true }),
removeFile,
Expand All @@ -70,15 +78,17 @@ module.exports = (server) => {
server.get('/:customer/file/:file/download',
server.auth.bearerMiddleware,
router.requireCredential('user'),
router.resolve.customerNameToEntity({required:true}),
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
router.resolve.idToEntity({param:'file',required:true}),
downloadFile
)

// GET LINKED MODELS
server.get('/:customer/file/:file/linkedmodels',
middlewares,
server.auth.bearerMiddleware,
router.resolve.customerSessionToEntity(),
router.ensureCustomer,
router.resolve.idToEntity({ param:'file', required:true }),
getLinkedModels
)
Expand Down
Loading