commit
f82207564f
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coolify",
|
||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||
"version": "2.4.7",
|
||||
"version": "2.4.8",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
"dev": "docker-compose -f docker-compose-dev.yaml up -d && cross-env NODE_ENV=development & svelte-kit dev",
|
||||
|
@ -90,7 +90,7 @@ export async function addGitLabSource({
|
||||
appSecret,
|
||||
groupName
|
||||
}) {
|
||||
const encrptedAppSecret = encrypt(appSecret);
|
||||
const encryptedAppSecret = encrypt(appSecret);
|
||||
await prisma.gitSource.update({ where: { id }, data: { type, apiUrl, htmlUrl, name } });
|
||||
return await prisma.gitlabApp.create({
|
||||
data: {
|
||||
|
@ -46,8 +46,12 @@ export async function login({
|
||||
if (users === 0) {
|
||||
await prisma.setting.update({ where: { id }, data: { isRegistrationEnabled: false } });
|
||||
// Create default network & start Coolify Proxy
|
||||
await asyncExecShell(`docker network create --attachable coolify`);
|
||||
await startCoolifyProxy('/var/run/docker.sock');
|
||||
try {
|
||||
await asyncExecShell(`docker network create --attachable coolify`);
|
||||
} catch (error) {}
|
||||
try {
|
||||
await startCoolifyProxy('/var/run/docker.sock');
|
||||
} catch (error) {}
|
||||
uid = '0';
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,7 @@ export async function generateSSLCerts(): Promise<void> {
|
||||
certificates.includes(ssl.domain) ||
|
||||
certificates.includes(ssl.domain.replace('www.', ''))
|
||||
) {
|
||||
console.log(`Certificate for ${ssl.domain} already exists`);
|
||||
// console.log(`Certificate for ${ssl.domain} already exists`);
|
||||
} else {
|
||||
// Checking DNS entry before generating certificate
|
||||
if (ipv4 || ipv6) {
|
||||
@ -232,7 +232,7 @@ export async function generateSSLCerts(): Promise<void> {
|
||||
(ipv4 && domains4.includes(ipv4.replace('\n', ''))) ||
|
||||
(ipv6 && domains6.includes(ipv6.replace('\n', '')))
|
||||
) {
|
||||
console.log('Generating SSL for', ssl.domain, '.');
|
||||
console.log('Generating SSL for', ssl.domain);
|
||||
return await letsEncrypt(ssl.domain, ssl.id, ssl.isCoolify);
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ export async function generateSSLCerts(): Promise<void> {
|
||||
(ipv4 && domains4.includes(ipv4.replace('\n', ''))) ||
|
||||
(ipv6 && domains6.includes(ipv6.replace('\n', '')))
|
||||
) {
|
||||
console.log('Generating SSL for', ssl.domain, '.');
|
||||
console.log('Generating SSL for', ssl.domain);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
export const publicPaths = [
|
||||
'/login',
|
||||
'/register',
|
||||
'/reset',
|
||||
'/reset/password',
|
||||
'/webhooks/success',
|
||||
'/webhooks/github',
|
||||
'/webhooks/github/install',
|
||||
|
@ -76,10 +76,6 @@
|
||||
on:click|preventDefault={() => goto('/register')}
|
||||
class="bg-transparent hover:bg-coolgray-300 text-white ">Register</button
|
||||
>
|
||||
<button
|
||||
class="bg-transparent hover:bg-coolgray-300"
|
||||
on:click|preventDefault={() => goto('/reset')}>Reset password</button
|
||||
>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -105,6 +105,9 @@
|
||||
{#if userCount === 0}
|
||||
<div class="pt-5">
|
||||
You are registering the first user. It will be the administrator of your Coolify instance.
|
||||
<br />
|
||||
It will take a while, because Coolify will configure itself, the proxy and other docker related
|
||||
stuff.
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
@ -1,26 +0,0 @@
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import * as db from '$lib/database';
|
||||
|
||||
export const get: RequestHandler = async () => {
|
||||
const users = await db.prisma.user.findMany({});
|
||||
return {
|
||||
status: 200,
|
||||
body: {
|
||||
users
|
||||
}
|
||||
};
|
||||
};
|
||||
export const post: RequestHandler = async (event) => {
|
||||
const { secretKey } = await event.request.json();
|
||||
if (secretKey !== process.env.COOLIFY_SECRET_KEY) {
|
||||
return {
|
||||
status: 500,
|
||||
body: {
|
||||
error: 'Invalid secret key.'
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
status: 200
|
||||
};
|
||||
};
|
@ -1,96 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { get, post } from '$lib/api';
|
||||
import CopyPasswordField from '$lib/components/CopyPasswordField.svelte';
|
||||
import { errorNotification } from '$lib/form';
|
||||
import { toast } from '@zerodevx/svelte-toast';
|
||||
|
||||
let secretKey;
|
||||
let password = false;
|
||||
let users = [];
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
await post(`/reset.json`, { secretKey });
|
||||
password = true;
|
||||
const data = await get('/reset.json');
|
||||
users = data.users;
|
||||
return;
|
||||
} catch ({ error }) {
|
||||
return errorNotification(error);
|
||||
}
|
||||
}
|
||||
async function resetPassword(user) {
|
||||
try {
|
||||
await post(`/reset/password.json`, { secretKey, user });
|
||||
toast.push('Password reset done.');
|
||||
return;
|
||||
} catch ({ error }) {
|
||||
return errorNotification(error);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="icons fixed top-0 left-0 m-3 cursor-pointer" on:click={() => goto('/')}>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-6 w-6"
|
||||
viewBox="0 0 24 24"
|
||||
stroke-width="1.5"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
>
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<line x1="5" y1="12" x2="19" y2="12" />
|
||||
<line x1="5" y1="12" x2="11" y2="18" />
|
||||
<line x1="5" y1="12" x2="11" y2="6" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="pb-10 pt-24 text-center text-4xl font-bold">Reset Password</div>
|
||||
<div class="flex items-center justify-center">
|
||||
{#if password}
|
||||
<table class="mx-2 text-left">
|
||||
<thead class="mb-2">
|
||||
<tr>
|
||||
<th class="px-2">Email</th>
|
||||
<th>New password</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each users as user}
|
||||
<tr>
|
||||
<td class="px-2">{user.email}</td>
|
||||
<td class="flex space-x-2">
|
||||
<input
|
||||
id="newPassword"
|
||||
name="newPassword"
|
||||
bind:value={user.newPassword}
|
||||
placeholder="Super secure new password"
|
||||
/>
|
||||
<button
|
||||
class="mx-auto my-4 w-32 bg-coollabs hover:bg-coollabs-100"
|
||||
on:click={() => resetPassword(user)}>Reset</button
|
||||
></td
|
||||
>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
{:else}
|
||||
<form class="flex flex-col" on:submit|preventDefault={handleSubmit}>
|
||||
<div class="text-center text-2xl py-2 font-bold">Secret Key</div>
|
||||
<CopyPasswordField
|
||||
isPasswordField={true}
|
||||
id="secretKey"
|
||||
name="secretKey"
|
||||
bind:value={secretKey}
|
||||
placeholder="You can find it in ~/coolify/.env (COOLIFY_SECRET_KEY)"
|
||||
/>
|
||||
<button type="submit" class="bg-coollabs hover:bg-coollabs-100 mx-auto w-32 my-4"
|
||||
>Submit</button
|
||||
>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
@ -1,27 +0,0 @@
|
||||
import type { RequestHandler } from '@sveltejs/kit';
|
||||
import * as db from '$lib/database';
|
||||
import { ErrorHandler, hashPassword } from '$lib/database';
|
||||
|
||||
export const post: RequestHandler = async (event) => {
|
||||
const { secretKey, user } = await event.request.json();
|
||||
if (secretKey !== process.env.COOLIFY_SECRET_KEY) {
|
||||
return {
|
||||
status: 500,
|
||||
body: {
|
||||
error: 'Invalid secret key.'
|
||||
}
|
||||
};
|
||||
}
|
||||
try {
|
||||
const hashedPassword = await hashPassword(user.newPassword);
|
||||
await db.prisma.user.update({
|
||||
where: { email: user.email },
|
||||
data: { password: hashedPassword }
|
||||
});
|
||||
return {
|
||||
status: 200
|
||||
};
|
||||
} catch (error) {
|
||||
return ErrorHandler(error);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user