Final Improvement for CV Editor
All checks were successful
Neutral/pipeline/head This commit looks good

This commit is contained in:
Raphix
2023-03-29 18:48:39 +02:00
parent 12b340e0f1
commit eafa16e46d
4 changed files with 108 additions and 5 deletions

View File

@ -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"})

View File

@ -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 {