feat: Basic white labeled version

This commit is contained in:
Andras Bacsai 2022-04-06 22:01:41 +02:00
parent f3cdda29bc
commit 3e8a8364dc
4 changed files with 17 additions and 6 deletions

3
src/app.d.ts vendored
View File

@ -19,14 +19,13 @@ declare namespace App {
} }
interface SessionData { interface SessionData {
whiteLabeled: boolean;
version?: string; version?: string;
userId?: string | null; userId?: string | null;
teamId?: string | null; teamId?: string | null;
permission?: string; permission?: string;
isAdmin?: boolean; isAdmin?: boolean;
expires?: string | null; expires?: string | null;
gitlabToken?: string | null;
ghToken?: string | null;
} }
type DateTimeFormatOptions = { type DateTimeFormatOptions = {

View File

@ -2,7 +2,6 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Coolify</title> <title>Coolify</title>
%svelte.head% %svelte.head%

View File

@ -7,6 +7,8 @@ import { version } from '$lib/common';
import cookie from 'cookie'; import cookie from 'cookie';
import { dev } from '$app/env'; import { dev } from '$app/env';
const whiteLabeled = process.env['COOLIFY_WHITE_LABELED'] === 'true';
export const handle = handleSession( export const handle = handleSession(
{ {
secret: process.env['COOLIFY_SECRET_KEY'], secret: process.env['COOLIFY_SECRET_KEY'],
@ -71,6 +73,7 @@ export const handle = handleSession(
export const getSession: GetSession = function ({ locals }) { export const getSession: GetSession = function ({ locals }) {
return { return {
version, version,
whiteLabeled,
...locals.session.data ...locals.session.data
}; };
}; };

View File

@ -134,13 +134,18 @@
<svelte:head> <svelte:head>
<title>Coolify</title> <title>Coolify</title>
{#if !$session.whiteLabeled}
<link rel="icon" href="/favicon.png" />
{/if}
</svelte:head> </svelte:head>
<SvelteToast options={{ intro: { y: -64 }, duration: 3000, pausable: true }} /> <SvelteToast options={{ intro: { y: -64 }, duration: 3000, pausable: true }} />
{#if $session.userId} {#if $session.userId}
<nav class="nav-main"> <nav class="nav-main">
<div class="flex h-screen w-full flex-col items-center transition-all duration-100"> <div class="flex h-screen w-full flex-col items-center transition-all duration-100">
<div class="my-4 h-10 w-10"><img src="/favicon.png" alt="coolLabs logo" /></div> {#if !$session.whiteLabeled}
<div class="flex flex-col space-y-4 py-2"> <div class="my-4 h-10 w-10"><img src="/favicon.png" alt="coolLabs logo" /></div>
{/if}
<div class="flex flex-col space-y-4 py-2" class:mt-2={$session.whiteLabeled}>
<a <a
sveltekit:prefetch sveltekit:prefetch
href="/" href="/"
@ -312,7 +317,6 @@
<path d="M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-12" /> <path d="M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-12" />
</svg> </svg>
</a> </a>
<div class="border-t border-stone-700" />
</div> </div>
<div class="flex-1" /> <div class="flex-1" />
@ -514,6 +518,12 @@
</div> </div>
</div> </div>
</nav> </nav>
{#if $session.whiteLabeled}
<span class="fixed bottom-0 left-[50px] z-50 m-2 px-4 text-xs text-stone-700"
>Powered by <a href="https://coolify.io" target="_blank">Coolify</a></span
>
{/if}
<select <select
class="fixed right-0 bottom-0 z-50 m-2 w-64 bg-opacity-30 p-2 px-4" class="fixed right-0 bottom-0 z-50 m-2 w-64 bg-opacity-30 p-2 px-4"
bind:value={selectedTeamId} bind:value={selectedTeamId}