|
@@ -88,7 +88,7 @@ function Submit(req) {
|
|
|
fs.mkdirSync("tmp")
|
|
|
}
|
|
|
fs.writeFileSync("tmp/" + uuid, new Buffer.from(r));
|
|
|
- await webp.cwebp("tmp/" + uuid, "tmp/" + uuid + ".webp", "-q 50", "-v")
|
|
|
+ await webp.cwebp("tmp/" + uuid, "tmp/" + uuid + ".webp", "-q 50 -mt ", "-v")
|
|
|
albumCover = fs.readFileSync("tmp/" + uuid + ".webp")
|
|
|
})
|
|
|
})
|
|
@@ -254,7 +254,11 @@ async function SubmitWrapper(req, res) {
|
|
|
Submit(req)
|
|
|
})
|
|
|
currentTask.push({
|
|
|
- name: req.body.name, albumName: req.body.albumName, kind: req.body.kind, artist: req.body.artist,
|
|
|
+ name: req.body.name,
|
|
|
+ albumName: req.body.albumName,
|
|
|
+ kind: req.body.kind,
|
|
|
+ artist: req.body.artist,
|
|
|
+ email: req.body.email !== undefined ? req.body.email : null,
|
|
|
})
|
|
|
|
|
|
console.log(queue.contents)
|
|
@@ -355,36 +359,51 @@ app.options('/search_api', function (req, res) {
|
|
|
})
|
|
|
app.get("/getSingle", function (req, res) {
|
|
|
let uuid = crypto.randomUUID()
|
|
|
-
|
|
|
if (req.query.id) {
|
|
|
- db.execute("SELECT song_name, album_name, artist, kind, albumcover FROM instrunet_entry WHERE uuid = ?", [req.query.id], async function (err, rows) {
|
|
|
- if (err) {
|
|
|
- console.log(err);
|
|
|
- }
|
|
|
- res.contentType("application/json");
|
|
|
- res.header("Access-Control-Allow-Origin", "*");
|
|
|
- res.header("Access-Control-Allow-Headers", "Content-Type");
|
|
|
- if (rows[0] !== undefined) {
|
|
|
- if (rows[0].albumcover !== null) {
|
|
|
- if (!fs.existsSync("tmp")) {
|
|
|
- fs.mkdirSync("tmp")
|
|
|
+ if (req.query.albumcover === "true") {
|
|
|
+ db.execute("SELECT albumcover FROM instrunet_entry WHERE uuid = ?", [req.query.id], async function (err, rows) {
|
|
|
+ if (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ res.contentType("application/json");
|
|
|
+ res.header("Access-Control-Allow-Origin", "*");
|
|
|
+ res.header("Access-Control-Allow-Headers", "Content-Type");
|
|
|
+ if (rows[0] !== undefined) {
|
|
|
+ if (rows[0].albumcover !== null) {
|
|
|
+ if (!fs.existsSync("tmp")) {
|
|
|
+ fs.mkdirSync("tmp")
|
|
|
+ }
|
|
|
+ fs.writeFileSync("tmp/" + uuid, rows[0].albumcover);
|
|
|
+ await webp.cwebp("tmp/" + uuid, "tmp/" + uuid + ".webp", "-q 50 -mt", "-v")
|
|
|
+ rows[0].albumcover = fs.readFileSync("tmp/" + uuid + ".webp")
|
|
|
+
|
|
|
}
|
|
|
- fs.writeFileSync("tmp/" + uuid, rows[0].albumcover);
|
|
|
- await webp.cwebp("tmp/" + uuid, "tmp/" + uuid + ".webp", "-q 50", "-v")
|
|
|
- rows[0].albumcover = fs.readFileSync("tmp/" + uuid + ".webp")
|
|
|
+ }
|
|
|
+
|
|
|
+ res.end(JSON.stringify(rows[0]));
|
|
|
+ try {
|
|
|
+ fs.rmSync("tmp/" + uuid)
|
|
|
+ fs.rmSync("tmp/" + uuid + ".webp")
|
|
|
+ } catch (err) {
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- res.end(JSON.stringify(rows[0]));
|
|
|
- try {
|
|
|
- fs.rmSync("tmp/" + uuid)
|
|
|
- fs.rmSync("tmp/" + uuid + ".webp")
|
|
|
- } catch (err) {
|
|
|
+ })
|
|
|
+ } else
|
|
|
|
|
|
- }
|
|
|
+ db.execute("SELECT song_name, album_name, artist, kind FROM instrunet_entry WHERE uuid = ?", [req.query.id], async function (err, rows) {
|
|
|
+ if (err) {
|
|
|
+ console.log(err);
|
|
|
+ }
|
|
|
+ res.contentType("application/json");
|
|
|
+ res.header("Access-Control-Allow-Origin", "*");
|
|
|
+ res.header("Access-Control-Allow-Headers", "Content-Type");
|
|
|
|
|
|
- })
|
|
|
+
|
|
|
+ res.end(JSON.stringify(rows[0]));
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
|
|
|
} else {
|
|
|
res.contentType("application/json");
|