Browse Source

Updated 'Template.html', Integrated README

axcwg 3 months ago
parent
commit
87c1e34a5f
4 changed files with 42 additions and 23 deletions
  1. 24 1
      README.md
  2. 0 18
      Specification Booklet.txt
  3. 7 0
      Template.html
  4. 11 4
      main.js

+ 24 - 1
README.md

@@ -1,2 +1,25 @@
-Backend.
+# Instrunet Backend
 
+Not aimed for public. Classified documents contained. 
+
+
+## Specification 
+    Specification 1.0 for InstruNet
+    
+    - DB
+    Column:
+    uuid - Unique ID per entry
+    song_name - Stands for the name of the song of the entry
+    album_name - Stands for the name of the album of the entry
+    link_to - Stands for the metadata information of the entry
+    databinary - Stands for the binary data of the entry
+    artist - Stands for the artist for the entry
+    kind - Describes the kind of the entry.
+    albumcover - Binary data for album cover. 
+    kind (enum) :
+    0 - Full removal of vocal
+    1 - Karaoke--keeps the harmony
+    2 - vocal only (Not yet implemented) 
+    3 - bass
+    4 - drums
+    5 - others

+ 0 - 18
Specification Booklet.txt

@@ -1,18 +0,0 @@
-Specification 1.0 for InstruNet
-
-- DB
-	Column: 
-		uuid - Unique ID per entry
-		song_name - Stands for the name of the song of the entry
-		album_name - Stands for the name of the album of the entry
-		link_to - Stands for the metadata information of the entry
-		databinary - Stands for the binary data of the entry
-		artist - Stands for the artist for the entry
-		kind - Describes the kind of the entry.
-		kind (enum) :
-			0 - Full removal of vocal
-			1 - Karaoke--keeps the harmony
-			2 - vocal only
-			3 - bass
-			4 - drums
-			5 - others

+ 7 - 0
Template.html

@@ -13471,6 +13471,13 @@
         与其他网站不一样,本邮件发送邮箱真的有个伞兵在后面!
         <br/>
         请随意骚扰!
+        <br><br>
+        <code  style=" display: block ; background-color: lightgray">
+            详情:
+            <br>
+            类别:{kind}
+            专辑:{album}
+        </code>
     </p>
     <footer class="bottom-0 position-fixed mb-5">
         ©Andy Xie Creativity Workgroup 2024

+ 11 - 4
main.js

@@ -8,6 +8,15 @@ const pool = mysql.createPool({
     keepAliveInitialDelay: 0, enableKeepAlive: true,
 })
 
+const Kind = {
+    0: "去和声伴奏",
+    1: "和声伴奏",
+    2: "人声",
+    3: "贝斯",
+    4: "鼓",
+    5: "其他",
+}
+
 const db = mysql.createConnection({
     host: 'mc.andyxie.cn',
     user: 'instrunet',
@@ -168,7 +177,7 @@ function Submit(req, res) {
                 to: req.body.email,
                 subject: "你的音频已处理完成。",
                 text: "你的音频已处理完成。",
-                html: fs.readFileSync("./Template.html", "utf8").toString().replace("{song_name}", req.body.name).replace("{href_link}", "https://andyxie.cn:4000/player?play=" + uuid)
+                html: fs.readFileSync("./Template.html", "utf8").toString().replace("{song_name}", req.body.name).replace("{href_link}", "https://andyxie.cn:4000/player?play=" + uuid).replace("{kind}", Kind[req.body.kind]).replace("{album}", req.body.albumName)
             }).then((result) => {
                 console.log("Message sent: %s", result.messageId)
 
@@ -203,7 +212,7 @@ function SubmitWrapper(req, res) {
 
         if (result.length === 0) {
             // Verify
-            if(req.body.file.substring(0,5) !=="data:"){
+            if (req.body.file.substring(0, 5) !== "data:") {
                 res.status(500).header("Access-Control-Allow-Origin", "*").end("想都别想");
                 return
             }
@@ -229,13 +238,11 @@ function SubmitWrapper(req, res) {
             }
 
 
-
             if (req.body.link === undefined) {
                 req.body.link = ""
             }
 
 
-
             queue.add(() => {
                 Submit(req, res)
             })