mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 12:25:17 +00:00
Import file fron shutdown fix
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
aca81cedb0
commit
226cdc9f80
@ -190,6 +190,7 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
|
||||
// todo remove it after update all customers chrome extensions
|
||||
app.get('/import', (req, res) => {
|
||||
try {
|
||||
const authHeader = req.headers.authorization
|
||||
if (authHeader === undefined) {
|
||||
res.status(403).send()
|
||||
@ -200,6 +201,10 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
const url = req.query.url as string
|
||||
const cookie = req.query.cookie as string | undefined
|
||||
const attachedTo = req.query.attachedTo as Ref<Doc> | undefined
|
||||
if (url === undefined) {
|
||||
res.status(500).send('URL param is not defined')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('importing from', url)
|
||||
console.log('cookie', cookie)
|
||||
@ -265,9 +270,14 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
res.status(500).send(err)
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
res.status(500).send()
|
||||
}
|
||||
})
|
||||
|
||||
app.post('/import', (req, res) => {
|
||||
try {
|
||||
const authHeader = req.headers.authorization
|
||||
if (authHeader === undefined) {
|
||||
res.status(403).send()
|
||||
@ -276,6 +286,10 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
const token = authHeader.split(' ')[1]
|
||||
const payload = decodeToken(token)
|
||||
const { url, cookie, attachedTo, space } = req.body
|
||||
if (url === undefined) {
|
||||
res.status(500).send('URL param is not defined')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('importing from', url)
|
||||
console.log('cookie', cookie)
|
||||
@ -340,6 +354,10 @@ export function start (config: { transactorEndpoint: string, elasticUrl: string,
|
||||
res.status(500).send(err)
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
res.status(500).send()
|
||||
}
|
||||
})
|
||||
|
||||
app.get('*', function (request, response) {
|
||||
|
Loading…
Reference in New Issue
Block a user