diff --git a/web/deno.ts b/web/deno.ts index 10e7d55..a2ca13c 100644 --- a/web/deno.ts +++ b/web/deno.ts @@ -1,5 +1,5 @@ import * as BunnySDK from "https://esm.sh/@bunny.net/edgescript-sdk@0.11.2"; -import { generate_github_chart } from "https://esm.sh/githubchart-rust@5.1.3/githubchart_rust_deno.js"; +import { generate_github_chart } from "https://esm.sh/githubchart-rust@5.1.4/githubchart_rust_deno.js"; /** * Executes a WASM binary and returns the response value @@ -10,15 +10,17 @@ BunnySDK.net.http.serve(async (req: Request): Promise => { try { // parse incoming request const url = new URL(req.url); + const splittedUrl = url.pathname.split("/"); // extract username from path - const username = url.pathname.split("/")[1]; + const username = splittedUrl[1]; + const color = splittedUrl[2] || "default"; // check if username is provided if (!username) return new Response("No username provided", { status: 400 }); // generate chart - const chart = await generate_github_chart(username, "default"); + const chart = await generate_github_chart(username, color); // return response return new Response(chart, {