-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
89 additions
and
2 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 +1,6 @@ | ||
VITE_SESSION_SECRET=MY_SUPER_VALUE | ||
VITE_SESSION_SECRET=MY_SUPER_VALUE | ||
|
||
# Requires the `repo` scope. | ||
GITHUB_TOKEN_TRIGGER_SPONSORS=MY_SUPER_VALUE | ||
|
||
WEBHOOK_PATH="/webhook/something" |
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,32 @@ | ||
import { GITHUB_TOKEN_TRIGGER_SPONSORS, WEBHOOK_PATH } from '$env/static/private' | ||
import { json } from '@sveltejs/kit' | ||
|
||
/** @type {import('@sveltejs/kit').Handle} */ | ||
export const webhookHandle = async ({ event, resolve }) => { | ||
// if WEBHOOK_PATH is defined and the request match, let's go | ||
if (WEBHOOK_PATH && event.url.pathname === WEBHOOK_PATH) { | ||
// trigger the CI | ||
const result = await event.fetch( | ||
`https://api.github.com/repos/HoudiniGraphql/sponsors/actions/workflows/generate.yml/dispatches`, | ||
{ | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/vnd.github+json', | ||
Authorization: `Bearer ${GITHUB_TOKEN_TRIGGER_SPONSORS}`, | ||
'X-GitHub-Api-Version': '2022-11-28' | ||
}, | ||
body: JSON.stringify({ ref: 'main' }) | ||
} | ||
) | ||
|
||
let data = null | ||
try { | ||
data = await result.json() | ||
} catch (error) {} | ||
|
||
return json({ status: result.status, statusText: result.statusText, data }) | ||
} | ||
|
||
const response = await resolve(event) | ||
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
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,6 @@ | ||
export const load = async (event) => { | ||
const result = await event.fetch( | ||
'https://raw.githubusercontent.com/HoudiniGraphql/sponsors/main/generated/sponsors.svg' | ||
) | ||
return { svg: await result.text() } | ||
} |
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,34 @@ | ||
<script> | ||
import { browser } from '$app/environment' | ||
import Logo from '~/components/Logo.svelte' | ||
export let data | ||
$: ui_theme = browser | ||
? parseInt(document.cookie.match('(^|;)\\s*' + 'ui_theme' + '\\s*=\\s*([^;]+)')?.pop() || '0') | ||
: data?.ui_theme | ||
</script> | ||
<a href="/"> | ||
<div style="margin: 14px"> | ||
<div style="display: flex; align-items: center; gap: 7px"> | ||
<Logo size={30} color={ui_theme === 0 ? 'white' : 'black'} /> | ||
<span class="logo-text">Houdini</span> | ||
</div> | ||
</div> | ||
</a> | ||
{@html data.svg} | ||
<style> | ||
.logo-text { | ||
color: white; | ||
font-size: 22px; | ||
font-family: 'Hind', sans-serif; | ||
font-weight: 600; | ||
} | ||
a { | ||
text-decoration: none; | ||
} | ||
</style> |
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