fix: Gitlab webhooks fixed

This commit is contained in:
Andras Bacsai 2022-02-19 13:57:56 +01:00
parent 6c9ef34905
commit 64cd5b6e4b
4 changed files with 11 additions and 8 deletions

View File

@ -18,7 +18,7 @@ export const handle = handleSession(
try { try {
if (event.locals.cookies) { if (event.locals.cookies) {
let gitlabToken = event.locals.cookies.gitlabToken || null; let gitlabToken = event.locals.cookies.gitlabToken || null;
let ghToken = event.locals.cookies.ghToken; let ghToken = event.locals.cookies.ghToken || null;
if (event.locals.cookies['kit.session']) { if (event.locals.cookies['kit.session']) {
const { permission, teamId, userId } = await getUserDetails(event, false); const { permission, teamId, userId } = await getUserDetails(event, false);
const newSession = { const newSession = {

View File

@ -36,7 +36,7 @@
function generateUrl() { function generateUrl() {
return browser return browser
? `${database.type}://${database.type === 'redis' ? ':' : ''}${ ? `${database.type}://${
databaseDbUser ? databaseDbUser + ':' : '' databaseDbUser ? databaseDbUser + ':' : ''
}${databaseDbUserPassword}@${ }${databaseDbUserPassword}@${
isPublic isPublic

View File

@ -121,12 +121,15 @@
<Explainer <Explainer
customClass="w-full" customClass="w-full"
text="<span class='font-bold text-base'>Scopes required:</span> text="<span class='font-bold text-base text-white'>Scopes required:</span>
<br>- api (Access the authenticated user's API) <br>- <span class='text-orange-500 font-bold'>api</span> (Access the authenticated user's API)
<br>- read_repository (Allows read-only access to the repository) <br>- <span class='text-orange-500 font-bold'>read_repository</span> (Allows read-only access to the repository)
<br>- email (Allows read-only access to the user's primary email address using OpenID Connect) <br>- <span class='text-orange-500 font-bold'>email</span> (Allows read-only access to the user's primary email address using OpenID Connect)
<br> <br>
<br>For extra security, you can add Expire access tokens!" <br>For extra security, you can set Expire access tokens!
<br><br>Webhook URL: <span class='text-orange-500 font-bold'>{window.location
.origin}/webhooks/gitlab</span>
<br>But if you will set a custom domain name for Coolify, use that instead."
/> />
</form> </form>
<form on:submit|preventDefault={handleSubmit} class="grid grid-flow-row gap-2 py-4 pt-10"> <form on:submit|preventDefault={handleSubmit} class="grid grid-flow-row gap-2 py-4 pt-10">

View File

@ -21,8 +21,8 @@ export const get: RequestHandler = async (event) => {
const code = event.url.searchParams.get('code'); const code = event.url.searchParams.get('code');
const state = event.url.searchParams.get('state'); const state = event.url.searchParams.get('state');
try { try {
const { fqdn } = await db.listSettings();
const application = await db.getApplication({ id: state, teamId }); const application = await db.getApplication({ id: state, teamId });
const { fqdn } = application;
const { appId, appSecret } = application.gitSource.gitlabApp; const { appId, appSecret } = application.gitSource.gitlabApp;
const { htmlUrl } = application.gitSource; const { htmlUrl } = application.gitSource;