|
@@ -35,10 +35,29 @@ export default function UserInteractions(opts) {
|
|
app.use(express.json());
|
|
app.use(express.json());
|
|
|
|
|
|
let db = opts.db;
|
|
let db = opts.db;
|
|
|
|
+
|
|
app.options("/*", (req, res) => {
|
|
app.options("/*", (req, res) => {
|
|
|
|
+
|
|
res.set(cwh).end("FUCK YOU CORS")
|
|
res.set(cwh).end("FUCK YOU CORS")
|
|
})
|
|
})
|
|
|
|
+ app.get("/delacc", async (req, res) => {
|
|
|
|
+ if (!req.session.uuid) {
|
|
|
|
+ res.set(cwh).status(500).json({code: 500, R: "IO"})
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ let uuid = req.session.uuid;
|
|
|
|
+ db.execute("DELETE FROM user WHERE uuid = ?", [uuid], async (err, rows) => {
|
|
|
|
+ if (err) {
|
|
|
|
+ res.set(cwh).status(500).json({code: 500, R: "ERR"})
|
|
|
|
+ req.session.destroy()
|
|
|
|
+ } else {
|
|
|
|
+ req.session.destroy()
|
|
|
|
+ res.set(cwh).status(200).json({code: 200, R: "SUCCESS"})
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ })
|
|
|
|
+ })
|
|
app.get("/userapi", (req, res) => {
|
|
app.get("/userapi", (req, res) => {
|
|
if (!req.session.uuid) {
|
|
if (!req.session.uuid) {
|
|
res.set(cwh).status(500).json({code: 500, R: "IO"})
|
|
res.set(cwh).status(500).json({code: 500, R: "IO"})
|