mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
Merge commit from fork
This commit is contained in:
@@ -1789,8 +1789,11 @@ app.get("/status", async (req, res) => {
|
|||||||
|
|
||||||
const result: Record<number, StatusEntry> = {};
|
const result: Record<number, StatusEntry> = {};
|
||||||
for (const [id, entry] of pollingManager.getAllStatuses().entries()) {
|
for (const [id, entry] of pollingManager.getAllStatuses().entries()) {
|
||||||
|
const access = await permissionManager.canAccessHost(userId, id, "read");
|
||||||
|
if (access.hasAccess) {
|
||||||
result[id] = entry;
|
result[id] = entry;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
res.json(result);
|
res.json(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1827,6 +1830,11 @@ app.get("/status/:id", validateHostId, async (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const access = await permissionManager.canAccessHost(userId, id, "read");
|
||||||
|
if (!access.hasAccess) {
|
||||||
|
return res.status(404).json({ error: "Status not available" });
|
||||||
|
}
|
||||||
|
|
||||||
const statuses = pollingManager.getAllStatuses();
|
const statuses = pollingManager.getAllStatuses();
|
||||||
if (statuses.size === 0) {
|
if (statuses.size === 0) {
|
||||||
await pollingManager.initializePolling(userId);
|
await pollingManager.initializePolling(userId);
|
||||||
@@ -1854,7 +1862,7 @@ app.get("/status/:id", validateHostId, async (req, res) => {
|
|||||||
* 401:
|
* 401:
|
||||||
* description: Session expired - please log in again.
|
* description: Session expired - please log in again.
|
||||||
*/
|
*/
|
||||||
app.post("/clear-connections", async (req, res) => {
|
app.post("/clear-connections", requireAdmin, async (req, res) => {
|
||||||
const userId = (req as AuthenticatedRequest).userId;
|
const userId = (req as AuthenticatedRequest).userId;
|
||||||
|
|
||||||
if (!SimpleDBOps.isUserDataUnlocked(userId)) {
|
if (!SimpleDBOps.isUserDataUnlocked(userId)) {
|
||||||
@@ -1873,7 +1881,7 @@ app.post("/clear-connections", async (req, res) => {
|
|||||||
* /refresh:
|
* /refresh:
|
||||||
* post:
|
* post:
|
||||||
* summary: Refresh polling
|
* summary: Refresh polling
|
||||||
* description: Clears all SSH connections and refreshes host polling.
|
* description: Refreshes host polling for the authenticated user.
|
||||||
* tags:
|
* tags:
|
||||||
* - Host Metrics
|
* - Host Metrics
|
||||||
* responses:
|
* responses:
|
||||||
@@ -1892,8 +1900,6 @@ app.post("/refresh", async (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
connectionPool.clearAllConnections();
|
|
||||||
|
|
||||||
await pollingManager.refreshHostPolling(userId);
|
await pollingManager.refreshHostPolling(userId);
|
||||||
res.json({ message: "Polling refreshed" });
|
res.json({ message: "Polling refreshed" });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user