From 96b5638c9fc4fdc0e00e5dc09eda0327161c4e25 Mon Sep 17 00:00:00 2001 From: cletqui Date: Thu, 4 Jul 2024 17:38:10 +0200 Subject: [PATCH] v0.6.3 --- README.md | 7 +++---- src/utils/octokit.tsx | 2 -- src/utils/state.tsx | 2 -- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6beef89..0b8f37a 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,6 @@ npm run deploy - [x] Cloudflare - [ ] GitHub - [ ] Heroku -- [ ] Implement fine-grained tokens for GitHub apps (instead of global access_token) -- [ ] Use middlewares - - [ ] to declare the octokit instance - - [x] to add auth header if access_token is valid (to allow API use when `access_token` is defined) - [x] fix API by adding 404 not found if no repo by id is found - [x] Add icons in footer - [x] Find `MAX_ID` dynamically and store in Cookies @@ -65,3 +61,6 @@ npm run deploy - [x] change GitHub App icon - [x] handle `state` verification - [x] handle `access_token` refresh with `refresh_token` +- [x] Use middlewares + - [x] to declare the octokit instance + - [x] to add auth header if access_token is valid (to allow API use when `access_token` is defined) diff --git a/src/utils/octokit.tsx b/src/utils/octokit.tsx index 75e76df..1570d0b 100644 --- a/src/utils/octokit.tsx +++ b/src/utils/octokit.tsx @@ -39,7 +39,6 @@ export const apiAuth = createMiddleware( c: Context<{ Bindings: Bindings; Variables: Variables }>, next: Next ) => { - console.log("MIDDLEWARE", "apiAuth"); const { access_token } = c.var; const accessToken = access_token || c.req.header("Authorization"); if (accessToken && (await verifyToken(accessToken, c))) { @@ -61,7 +60,6 @@ export const handleOctokit = createMiddleware( c: Context<{ Bindings: Bindings; Variables: Variables }>, next: Next ) => { - console.log("MIDDLEWARE", "handleOctokit"); const octokit = getOctokitInstance(c); c.set("octokit", octokit); await next(); diff --git a/src/utils/state.tsx b/src/utils/state.tsx index 2e177d3..03e9646 100644 --- a/src/utils/state.tsx +++ b/src/utils/state.tsx @@ -17,7 +17,6 @@ export const generateState = createMiddleware( c: Context<{ Bindings: Bindings; Variables: Variables }>, next: Next ) => { - console.log("MIDDLEWARE", "generateState"); const state = generateRandomString(); setCookie(c, "state", state, { path: "/github", @@ -44,7 +43,6 @@ export const handleState = createMiddleware( c: Context<{ Bindings: Bindings; Variables: Variables }>, next: Next ): Promise => { - console.log("MIDDLEWARE", "handleState"); const secret = getCookie(c, "state", "secure"); const { state } = c.req.query(); if (secret === state) {