Final Improvement for CV Editor
All checks were successful
Neutral/pipeline/head This commit looks good
All checks were successful
Neutral/pipeline/head This commit looks good
This commit is contained in:
12
routes/cv.js
12
routes/cv.js
@ -428,7 +428,15 @@ router.post("/", function(req, res, next) {
|
||||
|
||||
fs.readdirSync("../MD_TEST/project/").forEach((file) => {
|
||||
|
||||
allProject.push((file).replace(".md", ""))
|
||||
|
||||
if(fs.statSync("../MD_TEST/project/" + file).isDirectory()) {
|
||||
console.log(file)
|
||||
|
||||
} else {
|
||||
allProject.push((file).replace(".md", ""))
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
@ -513,7 +521,7 @@ router.post("/", function(req, res, next) {
|
||||
|
||||
} else {
|
||||
|
||||
fs.writeFile(projectFolder + bod.value + ".md", "**" + bod.value + "**" ,(err) => {
|
||||
fs.writeFile("../MD_TEST/project/" + bod.value + ".md", "**" + bod.value + "**" ,(err) => {
|
||||
|
||||
if(err) {
|
||||
res.send({"result":"success", "content":"ERROR_NOT_PERMITTED"})
|
||||
|
@ -164,6 +164,42 @@ router.post("/", function(req, res, next) {
|
||||
|
||||
|
||||
|
||||
} else if(req.headers.uploadforproject != null) {
|
||||
|
||||
const projectFolder = "/home/gitlab-ci/cv/dashboard-raphael/public/images/"
|
||||
|
||||
if(fs.existsSync(projectFolder)) {
|
||||
|
||||
image.mv(projectFolder + req.headers.uploadforproject + ".png", (error) => {
|
||||
|
||||
if(error) {
|
||||
res.send({"result":"ERROR"})
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"SUCCESS"})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
const mdtestfolder = "../MD_TEST/project/image/"
|
||||
|
||||
image.mv(mdtestfolder + req.headers.uploadforproject + ".png", (error) => {
|
||||
|
||||
if(error) {
|
||||
res.send({"result":"ERROR"})
|
||||
|
||||
} else {
|
||||
|
||||
res.send({"result":"SUCCESS"})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user