Browse Source

simp&trad shit

AXCWG 4 months ago
parent
commit
13121df169
6 changed files with 213 additions and 48 deletions
  1. 1 0
      .idea/instrunet_backend.iml
  2. 1 0
      .idea/jsLibraryMappings.xml
  3. 15 0
      Template.html
  4. 24 20
      main.js
  5. 171 28
      package-lock.json
  6. 1 0
      package.json

+ 1 - 0
.idea/instrunet_backend.iml

@@ -8,5 +8,6 @@
     </content>
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="bootstrap" level="application" />
   </component>
   </component>
 </module>
 </module>

+ 1 - 0
.idea/jsLibraryMappings.xml

@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
 <project version="4">
   <component name="JavaScriptLibraryMappings">
   <component name="JavaScriptLibraryMappings">
+    <file url="PROJECT" libraries="{bootstrap}" />
     <includedPredefinedLibrary name="Node.js Core" />
     <includedPredefinedLibrary name="Node.js Core" />
   </component>
   </component>
 </project>
 </project>

+ 15 - 0
Template.html

@@ -0,0 +1,15 @@
+<meta charset="utf-8">
+<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
+<div class="p-5 h-100 container d-flex justify-content-center align-items-center flex-column text-sm-center">
+    <h1 class="display-1 " style="font-size: 3.625rem">哈喽👋</h1>
+    <p>你在伴奏网网站上传的音频已经处理完毕,快来下载吧!<br/><br/>
+        <a href="https://andyxie.cn:4000/" class="d-block">回到网站</a>
+        <br/>
+        与其他网站不一样,本邮件发送邮箱真的有个伞兵在后面!
+        <br/>
+        请随意骚扰!
+    </p>
+    <footer class="bottom-0 position-fixed mb-5">
+        ©Andy Xie Creativity Workgroup 2024
+    </footer>
+</div>

+ 24 - 20
main.js

@@ -19,7 +19,8 @@ const nrc = require('node-run-cmd')
 const https = require("node:https");
 const https = require("node:https");
 const {WebSocketServer} = require("ws");
 const {WebSocketServer} = require("ws");
 const http = require("node:http");
 const http = require("node:http");
-
+const {OpenCC} = require("opencc");
+const converter = new OpenCC('s2t.json')
 app.use(bodyParser.json({"limit": "200mb"}));
 app.use(bodyParser.json({"limit": "200mb"}));
 app.use(express.json());
 app.use(express.json());
 
 
@@ -34,8 +35,6 @@ const transporter = nodemailer.createTransport({
 })
 })
 
 
 
 
-
-
 app.post('/submit', function (req, res) {
 app.post('/submit', function (req, res) {
     let uuid = crypto.randomUUID()
     let uuid = crypto.randomUUID()
     db.connect(function (err) {
     db.connect(function (err) {
@@ -129,7 +128,7 @@ app.post('/submit', function (req, res) {
                 to: req.body.email,
                 to: req.body.email,
                 subject: "你的音频已处理完成。",
                 subject: "你的音频已处理完成。",
                 text: "你的音频已处理完成。",
                 text: "你的音频已处理完成。",
-                html: "<h1>哈喽👋</h1><p>你在伴奏网网站上传的音频已经处理完毕,快来下载吧!<br/>下载链接:<br/><a href='https://andyxie.cn:8201/" + uuid + "'>这里</a><br/><br/>" + "与其他网站不一样,本邮件发送邮箱真的有个伞兵在后面!<br/>" + "请随意骚扰!</p>"
+                html: fs.readFileSync("./Template.html", "utf8").toString()
             }).then((result) => {
             }).then((result) => {
                 console.log("Message sent: %s", result.messageId)
                 console.log("Message sent: %s", result.messageId)
 
 
@@ -149,22 +148,29 @@ app.options('/submit', function (req, res) {
 })
 })
 
 
 
 
-app.post('/search_api', function (req, res) {
-    function OnFetched(err, rows) {
+app.post('/search_api', async function (req, res) {
+    async function OnFetched(err, rows) {
         try {
         try {
-            res.header("Access-Control-Allow-Origin", "*");
-            res.end(JSON.stringify(rows));
-        } catch (e) {
+            db.execute(`SELECT uuid, song_name, album_name, artist, kind
+                        FROM instrunet_entry
+                        WHERE song_name like '%${(req.body.searchStr)}%'
+                           or album_name like '%${(req.body.searchStr)}%'
+                           or artist like '%${(req.body.searchStr)}%'`, (err, result) => {
+                res.header("Access-Control-Allow-Origin", "*");
+                res.end(JSON.stringify(result) === JSON.stringify(rows) ? JSON.stringify(rows) : JSON.stringify(rows.concat(result)));
+            })
 
 
+        } catch (e) {
+            console.log(e)
         }
         }
 
 
     }
     }
 
 
     db.execute(`SELECT uuid, song_name, album_name, artist, kind
     db.execute(`SELECT uuid, song_name, album_name, artist, kind
                 FROM instrunet_entry
                 FROM instrunet_entry
-                WHERE song_name like '%${req.body.searchStr}%'
-                   or album_name like '%${req.body.searchStr}%'
-                   or artist like '%${req.body.searchStr}%'`, OnFetched)
+                WHERE song_name like '%${await converter.convertPromise(req.body.searchStr)}%'
+                   or album_name like '%${await converter.convertPromise(req.body.searchStr)}%'
+                   or artist like '%${await converter.convertPromise(req.body.searchStr)}%'`, OnFetched)
     db.unprepare()
     db.unprepare()
 })
 })
 
 
@@ -197,7 +203,7 @@ app.get("/getSingle", function (req, res) {
     }
     }
 })
 })
 var availCache = {}
 var availCache = {}
-cron.schedule('* */12 * * *', ()=>{
+cron.schedule('* */12 * * *', () => {
     availCache = {}
     availCache = {}
 })
 })
 app_serve.get('/:uuid', function (req, res, next) {
 app_serve.get('/:uuid', function (req, res, next) {
@@ -225,8 +231,8 @@ app_serve.get('/:uuid', function (req, res, next) {
 
 
     if (availCache[uuid] !== undefined) {
     if (availCache[uuid] !== undefined) {
         db.execute(`SELECT song_name
         db.execute(`SELECT song_name
-                FROM instrunet_entry
-                WHERE uuid = '${uuid}'`, (err, rows) => {
+                    FROM instrunet_entry
+                    WHERE uuid = '${uuid}'`, (err, rows) => {
             res.contentType("audio/mp3");
             res.contentType("audio/mp3");
             res.header("Access-Control-Allow-Origin", "*");
             res.header("Access-Control-Allow-Origin", "*");
             res.header("Access-Control-Allow-Headers", "Content-Type");
             res.header("Access-Control-Allow-Headers", "Content-Type");
@@ -235,15 +241,14 @@ app_serve.get('/:uuid', function (req, res, next) {
             res.sendSeekable(availCache[uuid])
             res.sendSeekable(availCache[uuid])
         })
         })
 
 
-    }else{
+    } else {
         db.execute(`SELECT song_name, databinary
         db.execute(`SELECT song_name, databinary
-                FROM instrunet_entry
-                WHERE uuid = '${uuid}'`, Provider)
+                    FROM instrunet_entry
+                    WHERE uuid = '${uuid}'`, Provider)
         db.unprepare()
         db.unprepare()
     }
     }
 
 
 
 
-
 })
 })
 
 
 // TODO Always use HTTPS before publishing.
 // TODO Always use HTTPS before publishing.
@@ -259,6 +264,5 @@ https.createServer({
 
 
 }, app_serve).listen(8079)
 }, app_serve).listen(8079)
 
 
-
 // app.listen(8080)
 // app.listen(8080)
 // app_serve.listen(8079)
 // app_serve.listen(8079)

+ 171 - 28
package-lock.json

@@ -17,6 +17,7 @@
         "node-cron": "^3.0.3",
         "node-cron": "^3.0.3",
         "node-run-cmd": "^1.0.1",
         "node-run-cmd": "^1.0.1",
         "nodemailer": "^6.9.16",
         "nodemailer": "^6.9.16",
+        "opencc": "github:BYVoid/OpenCC",
         "send-seekable": "^1.0.4",
         "send-seekable": "^1.0.4",
         "sqlite3": "^5.1.7",
         "sqlite3": "^5.1.7",
         "swagger-jsdoc": "^6.2.8",
         "swagger-jsdoc": "^6.2.8",
@@ -81,6 +82,74 @@
       "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
       "integrity": "sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==",
       "license": "MIT"
       "license": "MIT"
     },
     },
+    "node_modules/@mapbox/node-pre-gyp": {
+      "version": "1.0.11",
+      "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz",
+      "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==",
+      "license": "BSD-3-Clause",
+      "dependencies": {
+        "detect-libc": "^2.0.0",
+        "https-proxy-agent": "^5.0.0",
+        "make-dir": "^3.1.0",
+        "node-fetch": "^2.6.7",
+        "nopt": "^5.0.0",
+        "npmlog": "^5.0.1",
+        "rimraf": "^3.0.2",
+        "semver": "^7.3.5",
+        "tar": "^6.1.11"
+      },
+      "bin": {
+        "node-pre-gyp": "bin/node-pre-gyp"
+      }
+    },
+    "node_modules/@mapbox/node-pre-gyp/node_modules/are-we-there-yet": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
+      "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==",
+      "deprecated": "This package is no longer supported.",
+      "license": "ISC",
+      "dependencies": {
+        "delegates": "^1.0.0",
+        "readable-stream": "^3.6.0"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/@mapbox/node-pre-gyp/node_modules/gauge": {
+      "version": "3.0.2",
+      "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz",
+      "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==",
+      "deprecated": "This package is no longer supported.",
+      "license": "ISC",
+      "dependencies": {
+        "aproba": "^1.0.3 || ^2.0.0",
+        "color-support": "^1.1.2",
+        "console-control-strings": "^1.0.0",
+        "has-unicode": "^2.0.1",
+        "object-assign": "^4.1.1",
+        "signal-exit": "^3.0.0",
+        "string-width": "^4.2.3",
+        "strip-ansi": "^6.0.1",
+        "wide-align": "^1.1.2"
+      },
+      "engines": {
+        "node": ">=10"
+      }
+    },
+    "node_modules/@mapbox/node-pre-gyp/node_modules/npmlog": {
+      "version": "5.0.1",
+      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz",
+      "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==",
+      "deprecated": "This package is no longer supported.",
+      "license": "ISC",
+      "dependencies": {
+        "are-we-there-yet": "^2.0.0",
+        "console-control-strings": "^1.1.0",
+        "gauge": "^3.0.0",
+        "set-blocking": "^2.0.0"
+      }
+    },
     "node_modules/@npmcli/fs": {
     "node_modules/@npmcli/fs": {
       "version": "1.1.1",
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz",
       "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz",
@@ -134,8 +203,7 @@
       "version": "1.1.1",
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
       "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
       "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
       "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
-      "license": "ISC",
-      "optional": true
+      "license": "ISC"
     },
     },
     "node_modules/accepts": {
     "node_modules/accepts": {
       "version": "1.3.8",
       "version": "1.3.8",
@@ -164,7 +232,6 @@
       "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
       "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
       "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
       "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "debug": "4"
         "debug": "4"
       },
       },
@@ -204,7 +271,6 @@
       "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
       "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
       "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
       "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "engines": {
       "engines": {
         "node": ">=8"
         "node": ">=8"
       }
       }
@@ -213,8 +279,7 @@
       "version": "2.0.0",
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
       "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz",
       "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
       "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==",
-      "license": "ISC",
-      "optional": true
+      "license": "ISC"
     },
     },
     "node_modules/are-we-there-yet": {
     "node_modules/are-we-there-yet": {
       "version": "3.0.1",
       "version": "3.0.1",
@@ -471,7 +536,6 @@
       "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
       "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz",
       "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
       "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==",
       "license": "ISC",
       "license": "ISC",
-      "optional": true,
       "bin": {
       "bin": {
         "color-support": "bin.js"
         "color-support": "bin.js"
       }
       }
@@ -495,8 +559,7 @@
       "version": "1.1.0",
       "version": "1.1.0",
       "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
       "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
       "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
       "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==",
-      "license": "ISC",
-      "optional": true
+      "license": "ISC"
     },
     },
     "node_modules/content-disposition": {
     "node_modules/content-disposition": {
       "version": "0.5.4",
       "version": "0.5.4",
@@ -544,7 +607,6 @@
       "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
       "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
       "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
       "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "ms": "^2.1.3"
         "ms": "^2.1.3"
       },
       },
@@ -602,8 +664,7 @@
       "version": "1.0.0",
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
       "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
       "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
       "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==",
-      "license": "MIT",
-      "optional": true
+      "license": "MIT"
     },
     },
     "node_modules/denque": {
     "node_modules/denque": {
       "version": "2.1.0",
       "version": "2.1.0",
@@ -664,8 +725,7 @@
       "version": "8.0.0",
       "version": "8.0.0",
       "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
       "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
       "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
       "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
-      "license": "MIT",
-      "optional": true
+      "license": "MIT"
     },
     },
     "node_modules/encodeurl": {
     "node_modules/encodeurl": {
       "version": "2.0.0",
       "version": "2.0.0",
@@ -974,7 +1034,6 @@
       "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
       "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
       "deprecated": "Glob versions prior to v9 are no longer supported",
       "deprecated": "Glob versions prior to v9 are no longer supported",
       "license": "ISC",
       "license": "ISC",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "fs.realpath": "^1.0.0",
         "fs.realpath": "^1.0.0",
         "inflight": "^1.0.4",
         "inflight": "^1.0.4",
@@ -1055,8 +1114,7 @@
       "version": "2.0.1",
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
       "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
       "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
       "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==",
-      "license": "ISC",
-      "optional": true
+      "license": "ISC"
     },
     },
     "node_modules/hasown": {
     "node_modules/hasown": {
       "version": "2.0.2",
       "version": "2.0.2",
@@ -1135,7 +1193,6 @@
       "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
       "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
       "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
       "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "agent-base": "6",
         "agent-base": "6",
         "debug": "4"
         "debug": "4"
@@ -1264,7 +1321,6 @@
       "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
       "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
       "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
       "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "engines": {
       "engines": {
         "node": ">=8"
         "node": ">=8"
       }
       }
@@ -1365,6 +1421,30 @@
         "url": "https://github.com/sponsors/wellwelwel"
         "url": "https://github.com/sponsors/wellwelwel"
       }
       }
     },
     },
+    "node_modules/make-dir": {
+      "version": "3.1.0",
+      "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
+      "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
+      "license": "MIT",
+      "dependencies": {
+        "semver": "^6.0.0"
+      },
+      "engines": {
+        "node": ">=8"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
+    "node_modules/make-dir/node_modules/semver": {
+      "version": "6.3.1",
+      "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+      "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+      "license": "ISC",
+      "bin": {
+        "semver": "bin/semver.js"
+      }
+    },
     "node_modules/make-fetch-happen": {
     "node_modules/make-fetch-happen": {
       "version": "9.1.0",
       "version": "9.1.0",
       "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz",
       "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz",
@@ -1655,6 +1735,12 @@
         "node": ">=12"
         "node": ">=12"
       }
       }
     },
     },
+    "node_modules/nan": {
+      "version": "2.22.0",
+      "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz",
+      "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==",
+      "license": "MIT"
+    },
     "node_modules/napi-build-utils": {
     "node_modules/napi-build-utils": {
       "version": "1.0.2",
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
       "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz",
@@ -1701,6 +1787,26 @@
         "node": ">=6.0.0"
         "node": ">=6.0.0"
       }
       }
     },
     },
+    "node_modules/node-fetch": {
+      "version": "2.7.0",
+      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+      "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
+      "license": "MIT",
+      "dependencies": {
+        "whatwg-url": "^5.0.0"
+      },
+      "engines": {
+        "node": "4.x || >=6.0.0"
+      },
+      "peerDependencies": {
+        "encoding": "^0.1.0"
+      },
+      "peerDependenciesMeta": {
+        "encoding": {
+          "optional": true
+        }
+      }
+    },
     "node_modules/node-gyp": {
     "node_modules/node-gyp": {
       "version": "8.4.1",
       "version": "8.4.1",
       "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz",
       "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz",
@@ -1746,7 +1852,6 @@
       "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
       "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
       "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
       "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==",
       "license": "ISC",
       "license": "ISC",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "abbrev": "1"
         "abbrev": "1"
       },
       },
@@ -1774,6 +1879,15 @@
         "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
         "node": "^12.13.0 || ^14.15.0 || >=16.0.0"
       }
       }
     },
     },
+    "node_modules/object-assign": {
+      "version": "4.1.1",
+      "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+      "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+      "license": "MIT",
+      "engines": {
+        "node": ">=0.10.0"
+      }
+    },
     "node_modules/object-inspect": {
     "node_modules/object-inspect": {
       "version": "1.13.3",
       "version": "1.13.3",
       "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz",
       "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.3.tgz",
@@ -1814,6 +1928,19 @@
       "license": "MIT",
       "license": "MIT",
       "peer": true
       "peer": true
     },
     },
+    "node_modules/opencc": {
+      "version": "1.1.9",
+      "resolved": "git+ssh://git@github.com/BYVoid/OpenCC.git#2c7187e33b77bd8a356c676843cda69d2fccf887",
+      "hasInstallScript": true,
+      "license": "Apache-2.0",
+      "dependencies": {
+        "@mapbox/node-pre-gyp": "^1.0.11",
+        "nan": "^2.22.0"
+      },
+      "engines": {
+        "node": ">= 8.0.0"
+      }
+    },
     "node_modules/p-map": {
     "node_modules/p-map": {
       "version": "4.0.0",
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
       "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
@@ -2028,7 +2155,6 @@
       "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
       "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
       "deprecated": "Rimraf versions prior to v4 are no longer supported",
       "deprecated": "Rimraf versions prior to v4 are no longer supported",
       "license": "ISC",
       "license": "ISC",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "glob": "^7.1.3"
         "glob": "^7.1.3"
       },
       },
@@ -2162,8 +2288,7 @@
       "version": "2.0.0",
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
       "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
       "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
       "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
-      "license": "ISC",
-      "optional": true
+      "license": "ISC"
     },
     },
     "node_modules/set-function-length": {
     "node_modules/set-function-length": {
       "version": "1.2.2",
       "version": "1.2.2",
@@ -2210,8 +2335,7 @@
       "version": "3.0.7",
       "version": "3.0.7",
       "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
       "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz",
       "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
       "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
-      "license": "ISC",
-      "optional": true
+      "license": "ISC"
     },
     },
     "node_modules/simple-bufferstream": {
     "node_modules/simple-bufferstream": {
       "version": "1.0.0",
       "version": "1.0.0",
@@ -2372,7 +2496,6 @@
       "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
       "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
       "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
       "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "emoji-regex": "^8.0.0",
         "emoji-regex": "^8.0.0",
         "is-fullwidth-code-point": "^3.0.0",
         "is-fullwidth-code-point": "^3.0.0",
@@ -2387,7 +2510,6 @@
       "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
       "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
       "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
       "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
       "license": "MIT",
       "license": "MIT",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "ansi-regex": "^5.0.1"
         "ansi-regex": "^5.0.1"
       },
       },
@@ -2575,6 +2697,12 @@
         "node": ">=0.6"
         "node": ">=0.6"
       }
       }
     },
     },
+    "node_modules/tr46": {
+      "version": "0.0.3",
+      "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+      "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
+      "license": "MIT"
+    },
     "node_modules/tunnel-agent": {
     "node_modules/tunnel-agent": {
       "version": "0.6.0",
       "version": "0.6.0",
       "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
       "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
@@ -2671,6 +2799,22 @@
         "node": ">= 0.8"
         "node": ">= 0.8"
       }
       }
     },
     },
+    "node_modules/webidl-conversions": {
+      "version": "3.0.1",
+      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+      "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
+      "license": "BSD-2-Clause"
+    },
+    "node_modules/whatwg-url": {
+      "version": "5.0.0",
+      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+      "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
+      "license": "MIT",
+      "dependencies": {
+        "tr46": "~0.0.3",
+        "webidl-conversions": "^3.0.0"
+      }
+    },
     "node_modules/which": {
     "node_modules/which": {
       "version": "2.0.2",
       "version": "2.0.2",
       "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
       "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
@@ -2692,7 +2836,6 @@
       "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
       "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
       "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
       "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
       "license": "ISC",
       "license": "ISC",
-      "optional": true,
       "dependencies": {
       "dependencies": {
         "string-width": "^1.0.2 || 2 || 3 || 4"
         "string-width": "^1.0.2 || 2 || 3 || 4"
       }
       }

+ 1 - 0
package.json

@@ -18,6 +18,7 @@
     "node-cron": "^3.0.3",
     "node-cron": "^3.0.3",
     "node-run-cmd": "^1.0.1",
     "node-run-cmd": "^1.0.1",
     "nodemailer": "^6.9.16",
     "nodemailer": "^6.9.16",
+    "opencc": "github:BYVoid/OpenCC",
     "send-seekable": "^1.0.4",
     "send-seekable": "^1.0.4",
     "sqlite3": "^5.1.7",
     "sqlite3": "^5.1.7",
     "swagger-jsdoc": "^6.2.8",
     "swagger-jsdoc": "^6.2.8",