Skip to content

Commit

Permalink
version 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark-Aak committed Aug 7, 2024
1 parent 39e2a1a commit 6aaddfb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "明日方舟辅助插件",
"slug": "arknights_plugin",
"description": "一些有用的小功能",
"version": "1.0.0",
"version": "1.0.1",
"authors": [
{
"name": "Federico",
Expand Down
15 changes: 3 additions & 12 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,11 @@ const express = require('express');
const app = express();

let waitForReport = [];
let waitForPushdown = [];
let tasksInQueue = [];

const getTasks = () => {
return waitForPushdown;
};

const clearTasks = () => {
waitForPushdown = [];
};

const addTask = (taskType, contact, param = null) => {
const taskId = getRandomString(15, '0123456789');
waitForPushdown.push(param ? {id: taskId, type: taskType, params: param} : {id: taskId, type: taskType})
tasksInQueue.push({ id: taskId, type: taskType, contact: contact });
tasksInQueue.push(param ? {id: taskId, type: taskType, params: param, contact: contact } : {id: taskId, type: taskType, contact: contact });
return taskId;
}

Expand All @@ -55,14 +45,15 @@ function finish(taskId, status) {
async function initExpress() {
let options = await LiteLoader.api.config.get("arknights_plugin");
app.use(express.json());
app.get('/get', (req, res) => res.status(200).json({ tasks: tasksInQueue }));
app.post('/get', async (req, res) => {
const { user } = req.body;
let options = await LiteLoader.api.config.get("arknights_plugin");
if (user !== options.userId) {
res.status(400).json({ message: 'UserId does not match' });
}
else {
res.status(200).json({ tasks: getTasks() });
res.status(200).json({ tasks: tasksInQueue });
clearTasks();
}
});
Expand Down

0 comments on commit 6aaddfb

Please sign in to comment.