Skip to content
Merged

. #2

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"prod": "deno run --watch --allow-env --env --allow-net --allow-read --allow-write src/main.ts"
},
"imports": {
"@astral/astral": "jsr:@astral/astral@^0.5.3",
"@hono/hono": "jsr:@hono/hono@^4.8.12",
"@std/assert": "jsr:@std/assert@1"
},
Expand Down
15 changes: 1 addition & 14 deletions src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,4 @@ export function formatNumber(n: number): string {
if (n >= 1_000_000) return (n / 1_000_000).toFixed(1).replace(/\.0$/, '') + 'M';
if (n >= 1_000) return (n / 1_000).toFixed(1).replace(/\.0$/, '') + 'K';
return n.toString();
}

export async function takeScreenshot(url: string): Promise<ArrayBufferLike> {
await using browser = await launch();

await using page = await browser.newPage(url);

const screenshot = await page.screenshot();

browser.close()

return screenshot.buffer

}
}
Empty file added src/gh/pkgs/script.ts
Empty file.
18 changes: 18 additions & 0 deletions src/gh/pkgs/templates/pkgs.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/gh/repo/repo.ts → src/gh/repo/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Hono } from '@hono/hono'
import { escapeXml, getLangColor, topLang } from "../../functions.ts";

const api = 'https://api.github.com/repos/'
const key = Deno.env.get('GH_TOKEN')
//const key = Deno.env.get('GH_TOKEN')

export default function getGhRepo(app: Hono) {
app.get('/gh/repo/:owner/:repo', async (c) => {
Expand All @@ -25,7 +25,7 @@ export default function getGhRepo(app: Hono) {
const repo_req = await fetch(`${api}${owner}/${repo}`, {
headers: {
'User-Agent': 'PinStack - @ItsMatheesha[Github]',
'Authorization': `Bearer ${key}`
// 'Authorization': `Bearer ${key}`
}
})
//if the api request failed
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Hono } from '@hono/hono'
import getGhRepo from "./gh/repo/repo.ts";
import getGhprofile from "./gh/profile/profile.ts";
import getGhRepo from "./gh/repo/script.ts";
import getGhprofile from "./gh/profile/script.ts";


const app = new Hono()
Expand Down