-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate gitlab and refactor frontend (#36)
- Loading branch information
Showing
28 changed files
with
496 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
GITHUB_OAUTH_CLIENT_ID=... | ||
GITHUB_OAUTH_CLIENT_SECRET=... | ||
GITLAB_OAUTH_CLIENT_ID=... | ||
GITLAB_OAUTH_CLIENT_SECRET=... | ||
MONGO_API_KEY=... | ||
MONGO_APP_ID=... | ||
SENTRY_DSN=... | ||
SENTRY_DSN=... | ||
FRONTEND=... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,15 @@ import { Session } from "https://deno.land/x/[email protected]/mod.ts"; | |
import { create, verify } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { exec } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import * as Sentry from "npm:@sentry/node"; | ||
import { oakCors } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
export { | ||
Application, | ||
Context, | ||
create, | ||
exec, | ||
isHttpError, | ||
oakCors, | ||
Router, | ||
Sentry, | ||
Session, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export default async function getProviderUser( | ||
accessToken: string, | ||
provider: string, | ||
) { | ||
let apiUrl = ""; | ||
let authorizationHeader = ""; | ||
|
||
if (provider === "github") { | ||
apiUrl = "https://api.github.com/user"; | ||
authorizationHeader = `Bearer ${accessToken}`; | ||
} else if (provider === "gitlab") { | ||
apiUrl = "https://gitlab.com/api/v4/user"; | ||
authorizationHeader = `Bearer ${accessToken}`; | ||
} else { | ||
throw new Error("Unsupported provider"); | ||
} | ||
|
||
const user_resp = await fetch(apiUrl, { | ||
headers: { | ||
Authorization: authorizationHeader, | ||
}, | ||
}); | ||
|
||
if (user_resp.status !== 200) { | ||
throw new Error(`Failed to fetch user data from ${provider}`); | ||
} | ||
|
||
const user = await user_resp.json(); | ||
|
||
if (provider === "github") { | ||
return user.login; | ||
} else if (provider === "gitlab") { | ||
return user.username; | ||
} else { | ||
throw new Error("Unsupported provider"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
VITE_APP_GITHUB_OAUTH_CLIENT_ID=... | ||
VITE_APP_GITHUB_OAUTH_CLIENT_SECRET=... | ||
VITE_APP_GITHUB_OAUTH_REDIRECT_URL=http://localhost:XXXX/login | ||
VITE_APP_BACKEND_PORT=XXXX | ||
VITE_APP_GITHUB_OAUTH_REDIRECT_URL=.../login | ||
VITE_APP_GITLAB_OAUTH_CLIENT_ID=... | ||
VITE_APP_GITLAB_OAUTH_CLIENT_SECRET=... | ||
VITE_APP_GITLAB_OAUTH_REDIRECT_URL=.../login | ||
VITE_APP_BACKEND=... |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
<template> | ||
<div id="container"> | ||
<h1>404</h1> | ||
<h2>Page Not Found</h2> | ||
<h4>The page you're looking for doesn't exist</h4> | ||
</div> | ||
<div id="container"> | ||
<h1>404</h1> | ||
<h2>Page Not Found</h2> | ||
<h4>The page you're looking for doesn't exist</h4> | ||
</div> | ||
</template> | ||
<script> | ||
export default {}; | ||
</script> |
Oops, something went wrong.