-
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.
Signed-off-by: 0x73746F66 <[email protected]>
- Loading branch information
0x73746F66
committed
Jun 11, 2024
1 parent
648d6ae
commit 465448a
Showing
3 changed files
with
95 additions
and
66 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
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,20 @@ | ||
// Respond to OPTIONS method | ||
export const onRequestOptions: PagesFunction = async () => { | ||
return new Response(null, { | ||
status: 204, | ||
headers: { | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Headers': '*', | ||
'Access-Control-Allow-Methods': 'GET, OPTIONS', | ||
'Access-Control-Max-Age': '86400', | ||
}, | ||
}); | ||
}; | ||
|
||
// Set CORS to all /api responses | ||
export const onRequest: PagesFunction = async (context) => { | ||
const response = await context.next(); | ||
response.headers.set('Access-Control-Allow-Origin', '*'); | ||
response.headers.set('Access-Control-Max-Age', '86400'); | ||
return response; | ||
}; |
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,75 +1,84 @@ | ||
<script setup> | ||
import { useTheme } from 'vuetify'; | ||
import { useTheme } from 'vuetify' | ||
const { global } = useTheme() | ||
const integrations = [] | ||
const urlQuery = Object.fromEntries(location.search.substring(1).split('&').map(item => item.split('=').map(decodeURIComponent))) | ||
if (urlQuery?.setup_action === 'install') { | ||
console.log('urlQuery', urlQuery) | ||
if (urlQuery?.code) { | ||
const url = new URL("https://github.com/login/oauth/access_token") | ||
url.search = new URLSearchParams({ | ||
code: urlQuery.code, | ||
client_id: 'Iv23liW5R5lkjMRgFrWI', | ||
client_secret: '33e8e3bd7c04a4d2bf0a80b8c2d970c8056df085' | ||
}).toString() | ||
fetch(url, { | ||
method: 'POST', | ||
mode: 'no-cors', | ||
}) | ||
.then(console.log) | ||
.catch(console.log) | ||
} | ||
} | ||
const redirect = () => { | ||
location.href = 'https://github.com/apps/trivial-triage/installations/new/' | ||
// /github-integration?code=c1ed5cbf17e7a98da805&installation_id=51710144&setup_action=install | ||
const install = () => { | ||
location.href = 'https://github.com/apps/trivial-triage/installations/new/' | ||
} | ||
</script> | ||
<template> | ||
<VRow> | ||
<VCol cols="12"> | ||
<VCard title="GitHub"> | ||
<VCardText> | ||
<VBtn | ||
text="Connect to GitHub" | ||
prepend-icon="mdi-github" | ||
variant="text" | ||
:color="global.name.value === 'dark' ? '#fff' : '#272727'" | ||
@click="redirect" | ||
/> | ||
</VCardText> | ||
<VTable | ||
height="80%" | ||
fixed-header | ||
> | ||
<thead> | ||
<tr> | ||
<th class="text-uppercase"> | ||
Repository | ||
</th> | ||
<th> | ||
Public | ||
</th> | ||
<th> | ||
Target | ||
</th> | ||
<th> | ||
Type | ||
</th> | ||
<th> | ||
Dependency count | ||
</th> | ||
</tr> | ||
</thead> | ||
<VRow> | ||
<VCol cols="12"> | ||
<VCard title="GitHub"> | ||
<VCardText> | ||
<VBtn text="Connect to GitHub" prepend-icon="mdi-github" variant="text" | ||
:color="global.name.value === 'dark' ? '#fff' : '#272727'" @click="install" /> | ||
</VCardText> | ||
<VTable height="80%" fixed-header> | ||
<thead> | ||
<tr> | ||
<th class="text-uppercase"> | ||
Repository | ||
</th> | ||
<th> | ||
Public | ||
</th> | ||
<th> | ||
Target | ||
</th> | ||
<th> | ||
Type | ||
</th> | ||
<th> | ||
Dependency count | ||
</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="item in integrations" | ||
:key="item.uuid" | ||
> | ||
<td> | ||
{{ item.repo }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.visibility }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.target }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.type }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.Dependencies.length }} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</VTable> | ||
</VCard> | ||
</VCol> | ||
</VRow> | ||
<tbody> | ||
<tr v-for="item in integrations" :key="item.uuid"> | ||
<td> | ||
{{ item.repo }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.visibility }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.target }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.type }} | ||
</td> | ||
<td class="text-center"> | ||
{{ item.Dependencies.length }} | ||
</td> | ||
</tr> | ||
</tbody> | ||
</VTable> | ||
</VCard> | ||
</VCol> | ||
</VRow> | ||
</template> |