karin-plugin-teamspeak 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apps/ts3.js +10 -4
- package/package.json +1 -1
package/lib/apps/ts3.js
CHANGED
|
@@ -172,13 +172,13 @@ export const getAllUserList = async () => {
|
|
|
172
172
|
count += clients.length;
|
|
173
173
|
res[channel.name] = clients.map((c) => {
|
|
174
174
|
const connectTimeSec = moment().diff(moment.unix(c.lastconnected), "second");
|
|
175
|
-
let connectTime =
|
|
175
|
+
let connectTime = `${Math.floor(connectTimeSec / 60)}:${Math.floor(connectTimeSec % 60)}`;
|
|
176
176
|
return {
|
|
177
177
|
nickName: c.nickname, //昵称
|
|
178
178
|
lastconnected: moment
|
|
179
179
|
.unix(c.lastconnected)
|
|
180
180
|
.format("YYYY-MM-DD HH:mm:ss"), //上次连接进来的时间
|
|
181
|
-
connectTime, //已经连接的时间 -
|
|
181
|
+
connectTime, //已经连接的时间 - 单位分:秒
|
|
182
182
|
};
|
|
183
183
|
});
|
|
184
184
|
}
|
|
@@ -196,6 +196,12 @@ router.get("/getAllUserList", async (req, res) => {
|
|
|
196
196
|
const result = await getAllUserList();
|
|
197
197
|
res.send(result);
|
|
198
198
|
});
|
|
199
|
-
|
|
200
|
-
app.use(
|
|
199
|
+
//将路由挂载到express实例中
|
|
200
|
+
app.use("/api/teamspeak", router);
|
|
201
|
+
//将静态资源挂载到express实例中 - 供外部单页应用网页部署时使用
|
|
202
|
+
app.use("/teamspeak", express.static(dirPath + "/resources/static"));
|
|
203
|
+
//供外部单页应用网页部署时使用 可用 ip:port/ts3 访问部署的网页
|
|
204
|
+
app.get("/teamspeak", (req, res) => {
|
|
205
|
+
res.sendFile(dirPath + "/resources/static/index.html");
|
|
206
|
+
});
|
|
201
207
|
export default teamspeak3;
|