From 3ce5eeb6ed1b21d9979a2c0cbad4b304b72b2ca1 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 9 Jul 2024 17:41:19 +0900 Subject: [PATCH 01/16] chore: added manifest.json --- manifest.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 manifest.json diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..6ea0f57 --- /dev/null +++ b/manifest.json @@ -0,0 +1,8 @@ +{ + "name": "Query user", + "commands": [ + "/query" + ], + "example": "/query @ubiquibot", + "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP." +} From 97f3b0220408fb6272c451b713e60636fd4a11d5 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 9 Jul 2024 18:19:42 +0900 Subject: [PATCH 02/16] chore: serve manifest --- src/worker.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/worker.ts b/src/worker.ts index 00befd9..5008f7e 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -2,10 +2,19 @@ import { Value } from "@sinclair/typebox/value"; import { run } from "./run"; import { Env } from "./types/env"; import { commandQueryUserScheme } from "./types/plugin-input"; +import manifest from "../manifest.json"; export default { async fetch(request: Request, env: Env): Promise { try { + if (request.method === "GET") { + console.log(`Request url`, request.url); + if (request.url === "manifest.json") { + return new Response(JSON.stringify(manifest), { + headers: { "content-type": "application/json" }, + }); + } + } if (request.method !== "POST") { return new Response(JSON.stringify({ error: `Only POST requests are supported.` }), { status: 405, From b59a0ed3b7b8292638de8bbe7ad07df82d938bdc Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 9 Jul 2024 18:26:03 +0900 Subject: [PATCH 03/16] chore: url check --- src/worker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/worker.ts b/src/worker.ts index 5008f7e..2397bdc 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -8,8 +8,9 @@ export default { async fetch(request: Request, env: Env): Promise { try { if (request.method === "GET") { - console.log(`Request url`, request.url); - if (request.url === "manifest.json") { + const url = new URL(request.url); + console.log(`Request url`, url); + if (url.pathname === "manifest.json") { return new Response(JSON.stringify(manifest), { headers: { "content-type": "application/json" }, }); From 77cb72bc5bd3276f7d8dc50db8651ecd78fc0527 Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 9 Jul 2024 18:28:09 +0900 Subject: [PATCH 04/16] chore: url check --- src/worker.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/worker.ts b/src/worker.ts index 2397bdc..787ced3 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -14,6 +14,11 @@ export default { return new Response(JSON.stringify(manifest), { headers: { "content-type": "application/json" }, }); + } else { + return new Response(JSON.stringify(url), { + status: 400, + headers: { "content-type": "application/json" }, + }); } } if (request.method !== "POST") { From 6ce88fce6ea58bd08c2ce4032a77edc6c915f28e Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 9 Jul 2024 18:31:19 +0900 Subject: [PATCH 05/16] chore: url check --- src/worker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/worker.ts b/src/worker.ts index 787ced3..09729ce 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -15,7 +15,7 @@ export default { headers: { "content-type": "application/json" }, }); } else { - return new Response(JSON.stringify(url), { + return new Response(JSON.stringify(url.pathname), { status: 400, headers: { "content-type": "application/json" }, }); From 725a0f21020d7d6c5baf6671adee57d67f07d86e Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Tue, 9 Jul 2024 18:32:47 +0900 Subject: [PATCH 06/16] chore: url check --- src/worker.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/worker.ts b/src/worker.ts index 09729ce..bbfb6a7 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -9,16 +9,10 @@ export default { try { if (request.method === "GET") { const url = new URL(request.url); - console.log(`Request url`, url); - if (url.pathname === "manifest.json") { + if (url.pathname === "/manifest.json") { return new Response(JSON.stringify(manifest), { headers: { "content-type": "application/json" }, }); - } else { - return new Response(JSON.stringify(url.pathname), { - status: 400, - headers: { "content-type": "application/json" }, - }); } } if (request.method !== "POST") { From 282f1f74fd7cf25646a281e532b2e0d3a75905b3 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Wed, 10 Jul 2024 11:02:50 +0900 Subject: [PATCH 07/16] chore: changed manifest.json shape --- manifest.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index 6ea0f57..6f05b92 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,11 @@ { "name": "Query user", + "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", "commands": [ - "/query" - ], - "example": "/query @ubiquibot", - "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP." + { + "command": "/query", + "example": "/query @ubiquibot", + "description": "Queries a user's wallet based on its name." + } + ] } From 0de08a8283e3c05288dbaac5e41457879a3db622 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 11 Jul 2024 13:40:04 +0900 Subject: [PATCH 08/16] chore: manifest.json --- manifest.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index 6f05b92..0d4c41e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,11 +1,10 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", - "commands": [ - { - "command": "/query", + "commands": { + "query": { "example": "/query @ubiquibot", - "description": "Queries a user's wallet based on its name." + "description": "Returns the user's wallet, access, and multiplier information." } - ] + } } From d1cdc74ba24c1df405abc49ac42e39e187c3ecaf Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:00:11 +0900 Subject: [PATCH 09/16] chore: manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 0d4c41e..e3599ba 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", "commands": { "query": { - "example": "/query @ubiquibot", + "ubiquity:example": "/query @ubiquibot", "description": "Returns the user's wallet, access, and multiplier information." } } From fa6795476554804edc321ebb92c94fede0b2f454 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:16:21 +0900 Subject: [PATCH 10/16] Update manifest.json --- manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.json b/manifest.json index 0d4c41e..4d75ed7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,7 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", + "ubiquity:runsOn": [ 'issue_comment.created' ], "commands": { "query": { "example": "/query @ubiquibot", From eb47f18831d7c652c2a27810322b50641900ff6b Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:16:41 +0900 Subject: [PATCH 11/16] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4d75ed7..1fd381f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", - "ubiquity:runsOn": [ 'issue_comment.created' ], + "ubiquity:runsOn": [ "issue_comment.created" ], "commands": { "query": { "example": "/query @ubiquibot", From 8b7b589545afdf8c4789ba8ca080fa101020bfd8 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:18:47 +0900 Subject: [PATCH 12/16] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1fd381f..9c3090e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", - "ubiquity:runsOn": [ "issue_comment.created" ], + "ubiquity:runsOn": [ "issue_comment" ], "commands": { "query": { "example": "/query @ubiquibot", From 8c979bb133af63d833a2c23fbadaae67adba797f Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:23:19 +0900 Subject: [PATCH 13/16] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 9c3090e..1fd381f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", - "ubiquity:runsOn": [ "issue_comment" ], + "ubiquity:runsOn": [ "issue_comment.created" ], "commands": { "query": { "example": "/query @ubiquibot", From aba07da59a5646ce08b9c81f3975ae3e2927a30f Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:26:56 +0900 Subject: [PATCH 14/16] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1fd381f..ffba753 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", - "ubiquity:runsOn": [ "issue_comment.created" ], + "ubiquibot:listeners": [ "issue_comment.created" ], "commands": { "query": { "example": "/query @ubiquibot", From 1e54ec7e3c34343ce6ac77a030b7d438fc5eb7cb Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:28:21 +0900 Subject: [PATCH 15/16] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index ffba753..0110abb 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "ubiquibot:listeners": [ "issue_comment.created" ], "commands": { "query": { - "example": "/query @ubiquibot", + "ubiquibot:example": "/query @ubiquibot", "description": "Returns the user's wallet, access, and multiplier information." } } From ae1be494382f83c855037f5ab8b0b10e1703feb4 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:00:11 +0900 Subject: [PATCH 16/16] chore: manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 0110abb..cc0a0b1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "name": "Query user", "description": "Queries a user and retrieves its related information, such as the wallet, the label access control, or the current XP.", - "ubiquibot:listeners": [ "issue_comment.created" ], + "ubiquity:listeners": [ "issue_comment.created" ], "commands": { "query": { - "ubiquibot:example": "/query @ubiquibot", + "ubiquity:example": "/query @ubiquibot", "description": "Returns the user's wallet, access, and multiplier information." } }