Authenticate ping API
This commit is contained in:
1 parent
344f0ec5e0
commit
7ccdbace70
1 file changed
+1
@@ -660,6 +660,7 @@ router.post("/devices/:id/tags", async (ctx) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get("/ping/:host", async (ctx) => {
|
router.get("/ping/:host", async (ctx) => {
|
||||||
|
if (!ctx.state.user) return void (ctx.status = 401);
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
ping(ctx.params.host, (err, parsed) => {
|
ping(ctx.params.host, (err, parsed) => {
|
||||||
if (parsed) {
|
if (parsed) {
|
||||||
|
|||||||
Reference in new issue
Block a user