From bb7f0ce9f36a6ba73061d2acf753c6c1674a365d Mon Sep 17 00:00:00 2001 From: davidh Date: Mon, 12 Jun 2023 03:09:38 +0200 Subject: [PATCH] readme zu markdown --- readme => README.md | 0 app.js | 140 ++++++++++++++++++++++---------------------- 2 files changed, 70 insertions(+), 70 deletions(-) rename readme => README.md (100%) diff --git a/readme b/README.md similarity index 100% rename from readme rename to README.md diff --git a/app.js b/app.js index b92be11..1099ac1 100644 --- a/app.js +++ b/app.js @@ -125,43 +125,43 @@ server.get('/getonepic-norefresh', async function (req, res) { }) -server.get('/getonepic-old', async function (req, res) { - fs.readdir(sliderpath, function (err, files) { - if (err) { - res.status(500).send("Unable to scan directory: " + err) - return console.log('Unable to scan directory: ' + err) - } - console.log(files.length) - let newpictureliststr = "" - files.forEach(function (file) { - newpictureliststr += file - }) - console.log(pictureliststr) - console.log(newpictureliststr) - if (pictureliststr != newpictureliststr) { - console.log("New files in folder") - picturelist = files - count = files.length - counter = 0 - pictureliststr = newpictureliststr - } - if (count == 0) { - console.log("Empty directory"); - return res.status(500).send("Empty directory") - } - if (counter == count) { - console.log("Starting over") - counter = 0 - } - let currcounter = counter - counter++ - // res.set("Content-Disposition", 'attachment; filename="picture.png"') - // res.set("Content-Disposition", 'inline; filename="picture.png"') - // res.setHeader('content-type', 'image/jpeg') - return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter], { headers: { 'Content-Type': 'image/jpeg' } }) +// server.get('/getonepic-old', async function (req, res) { +// fs.readdir(sliderpath, function (err, files) { +// if (err) { +// res.status(500).send("Unable to scan directory: " + err) +// return console.log('Unable to scan directory: ' + err) +// } +// console.log(files.length) +// let newpictureliststr = "" +// files.forEach(function (file) { +// newpictureliststr += file +// }) +// console.log(pictureliststr) +// console.log(newpictureliststr) +// if (pictureliststr != newpictureliststr) { +// console.log("New files in folder") +// picturelist = files +// count = files.length +// counter = 0 +// pictureliststr = newpictureliststr +// } +// if (count == 0) { +// console.log("Empty directory"); +// return res.status(500).send("Empty directory") +// } +// if (counter == count) { +// console.log("Starting over") +// counter = 0 +// } +// let currcounter = counter +// counter++ +// // res.set("Content-Disposition", 'attachment; filename="picture.png"') +// // res.set("Content-Disposition", 'inline; filename="picture.png"') +// // res.setHeader('content-type', 'image/jpeg') +// return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter], { headers: { 'Content-Type': 'image/jpeg' } }) - }) -}) +// }) +// }) server.get('/get4pic/:id', async function (req, res) { let currid = req.params.id @@ -200,41 +200,41 @@ server.get('/get4pic/:id', async function (req, res) { }) -server.get('/getonepic-test', async function (req, res) { - fs.readdir(sliderpath, function (err, files) { - if (err) { - res.status(500).send("Unable to scan directory: " + err) - return console.log('Unable to scan directory: ' + err) - } - console.log(files.length) - let newpictureliststr = "" - files.forEach(function (file) { - newpictureliststr += file - }) - console.log(pictureliststr) - console.log(newpictureliststr) - if (pictureliststr != newpictureliststr) { - console.log("New files in folder") - picturelist = files - count = files.length - counter = 0 - pictureliststr = newpictureliststr - } - if (count == 0) { - console.log("Empty directory"); - return res.status(500).send("Empty directory") - } - if (counter == count) { - console.log("Starting over") - counter = 0 - } - let currcounter = counter - counter++ - res.set("Content-Disposition", 'attachment; filename="picture.png"') - return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter]) +// server.get('/getonepic-test', async function (req, res) { +// fs.readdir(sliderpath, function (err, files) { +// if (err) { +// res.status(500).send("Unable to scan directory: " + err) +// return console.log('Unable to scan directory: ' + err) +// } +// console.log(files.length) +// let newpictureliststr = "" +// files.forEach(function (file) { +// newpictureliststr += file +// }) +// console.log(pictureliststr) +// console.log(newpictureliststr) +// if (pictureliststr != newpictureliststr) { +// console.log("New files in folder") +// picturelist = files +// count = files.length +// counter = 0 +// pictureliststr = newpictureliststr +// } +// if (count == 0) { +// console.log("Empty directory"); +// return res.status(500).send("Empty directory") +// } +// if (counter == count) { +// console.log("Starting over") +// counter = 0 +// } +// let currcounter = counter +// counter++ +// res.set("Content-Disposition", 'attachment; filename="picture.png"') +// return res.status(200).sendFile(sliderpath + "/" + picturelist[currcounter]) - }) -}) +// }) +// })