Skip to content

Commit

Permalink
fix: /api/clusters/:id 不返回请求数据
Browse files Browse the repository at this point in the history
  • Loading branch information
SALTWOOD committed Nov 10, 2024
1 parent 19ce9f6 commit 5a5bc74
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ export class Server {
ack([{message: `Failed to add DNS record for "${enableData.host || address}". Please contact admin.`}, false]);
return;
}
console.log(`Adding A record for cluster ${cluster.clusterId}, address "${address}".`);
console.log(`Adding record for cluster ${cluster.clusterId}, address "${address}".`);

this.db.update(cluster);
}
Expand Down
8 changes: 7 additions & 1 deletion src/routes/ApiClusters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ export class ApiClusters {
res.status(404).json({ error: "Cluster not found" });
return;
}
res.json(cluster.getJson(true, true));
const stat = inst.stats.find(s => s.id === cluster.clusterId)?.getTodayStats();
res.json({
...cluster,
ownerName: inst.db.getEntity<UserEntity>(UserEntity, cluster.owner)?.username || '',
hits: stat?.hits || 0,
bytes: stat?.bytes || 0
});
});

inst.app.post("/api/clusters", async (req, res) => {
Expand Down

0 comments on commit 5a5bc74

Please sign in to comment.