From f801fc738144af282dbd24c92fd811a0ed50e95c Mon Sep 17 00:00:00 2001 From: ihsangan Date: Sat, 15 Jun 2024 15:47:13 +0800 Subject: [PATCH] update index.js --- index.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index bda6072..8e7f821 100644 --- a/index.js +++ b/index.js @@ -216,6 +216,20 @@ async function callAPI(request) { const data = await response.json() return {success:true,game:"Point Blank",id:id,name:data.confirmationFields.username} } + if (path.includes('/coc')) { + id = id.toUpperCase() + const body = `voucherPricePoint.id=453696&voucherPricePoint.price=16000&voucherPricePoint.variablePrice=0&user.userId=${id}&voucherTypeName=CLASH_OF_CLANS&shopLang=id_ID` + const request = new Request(endpoint, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body + }) + const response = await fetch(request) + const data = await response.json() + return {success:true,game:"Clash Of Clans",id:id,name:data.confirmationFields.username} + } else { return {success:false,message:"Bad request"} } @@ -237,7 +251,7 @@ async function serveResult(request) { result.name = decodeURIComponent(result.name) } } - else if (result.name = undefined) { + else if (result.name = undefined || !result.name) { result = {success:false,message:"Not found"} } if (result.success == false) {