3 Commits

Author SHA1 Message Date
c8d6096354 add woodpecker ci
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
2025-01-03 23:45:31 -08:00
d99ee9ef1e more layout improvements 2025-01-01 21:48:34 -08:00
32ab4104a7 super mega layout improvements 2025-01-01 17:15:12 -08:00
11 changed files with 196 additions and 146 deletions

View File

@@ -0,0 +1,32 @@
when:
- event: [push]
steps:
- name: echos
image: alpine
commands:
- echo $CI_REPO
- echo $CI_REPO_REMOTE_ID
- echo $CI_REPO_URL
- echo $CI_REPO_CLONE_URL
- echo $${CI_COMMIT_BRANCH/\\//-}
- echo $USERNAME:$PASSWORD
environment:
USERNAME:
from_secret: registry-username
PASSWORD:
from_secret: registry-password
- name: build
image: woodpeckerci/plugin-kaniko
settings:
registry: gitea.cazzzer.com
username:
from_secret: registry-username
password:
from_secret: registry-password
repo: gitea.cazzzer.com/${CI_REPO}
# replace '/' with '_' in branch name
# remove 'feature/' prefix in branch name
# tags: ${CI_COMMIT_BRANCH##feature/}
# auto_tag: true
tags: ci
# cache: true

View File

@@ -44,6 +44,8 @@
--sidebar-accent-foreground: 240 5.9% 10%; --sidebar-accent-foreground: 240 5.9% 10%;
--sidebar-border: 220 13% 91%; --sidebar-border: 220 13% 91%;
--sidebar-ring: 217.2 91.2% 59.8%; --sidebar-ring: 217.2 91.2% 59.8%;
--surface: 210 26% 76%;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@@ -85,6 +87,8 @@
--sidebar-accent-foreground: 240 4.8% 95.9%; --sidebar-accent-foreground: 240 4.8% 95.9%;
--sidebar-border: 240 3.7% 15.9%; --sidebar-border: 240 3.7% 15.9%;
--sidebar-ring: 217.2 91.2% 59.8%; --sidebar-ring: 217.2 91.2% 59.8%;
--surface: 217.2 40.6% 10.5%;
} }
} }
} }
@@ -99,11 +103,10 @@
} }
ol > li { ol > li {
@apply flex; @apply flex flex-wrap gap-x-2;
counter-increment: counterName; counter-increment: counterName;
} }
ol > li:before { ol > li:before {
@apply mr-2;
content: counter(counterName) '.'; content: counter(counterName) '.';
} }
} }

View File

@@ -6,7 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head% %sveltekit.head%
</head> </head>
<body data-sveltekit-preload-data="hover"> <body
<div class="flex min-h-screen flex-col gap-8 p-4 max-sm:px-2">%sveltekit.body%</div> data-sveltekit-preload-data="hover"
class="flex min-h-screen flex-col items-center gap-8 p-4 max-sm:px-2"
>
%sveltekit.body%
</body> </body>
</html> </html>

View File

@@ -16,52 +16,59 @@
let wasCopied = $state(false); let wasCopied = $state(false);
const roundedPre = copy || download ? 'rounded-b-lg' : 'rounded-lg';
async function copyToClipboard() { async function copyToClipboard() {
await navigator.clipboard.writeText(data); await navigator.clipboard.writeText(data);
wasCopied = true; wasCopied = true;
} }
</script> </script>
<div class="relative max-w-fit overflow-x-hidden rounded-lg bg-accent"> <div class="flex max-w-full flex-grow flex-col rounded-lg bg-accent">
<div class="flex items-start overflow-x-auto p-2">
<pre><code>{data}</code></pre>
{#if copy || download} {#if copy || download}
<!--Copy button--> <!--Copy and download buttons-->
<!--Flex reverse for peer hover to work properly--> <div class="b flex flex-wrap items-center justify-between gap-4 rounded-t-lg p-2">
<div class="absolute right-2 flex flex-col gap-2"> Configuration
<div class="flex gap-2">
{#if copy} {#if copy}
<div class="flex flex-row-reverse items-center gap-1">
<Button <Button
class="peer size-10 p-2" class="action-button group"
onclick={copyToClipboard} onclick={copyToClipboard}
onmouseleave={() => (wasCopied = false)} onmouseleave={() => (wasCopied = false)}
> >
<LucideClipboardCopy /> <LucideClipboardCopy />
</Button> <span class="group-hover:block">
<span class="hidden rounded-lg bg-background p-2 text-xs peer-hover:block">
{wasCopied ? 'Copied' : 'Copy to clipboard'} {wasCopied ? 'Copied' : 'Copy to clipboard'}
</span> </span>
</div> </Button>
{/if} {/if}
{#if download} {#if download}
<div class="flex flex-row-reverse items-center gap-1">
<a <a
class="peer contents" class="contents"
href={`data:application/octet-stream;charset=utf-8,${encodeURIComponent(data)}`} href={`data:application/octet-stream;charset=utf-8,${encodeURIComponent(data)}`}
download={filename} download={filename}
> >
<Button class="size-10 p-2"> <Button class="action-button group">
<LucideDownload /> <LucideDownload />
<span class="group-hover:block">Download</span>
</Button> </Button>
</a> </a>
<span class="hidden rounded-lg bg-background p-2 text-xs peer-hover:block">
Download
</span>
</div>
{/if} {/if}
</div> </div>
</div>
{/if} {/if}
<div class="bg-surface flex items-start overflow-x-auto {roundedPre} p-2">
<pre><code>{data}</code></pre>
</div> </div>
</div> </div>
<style>
:global(.action-button) {
@apply relative size-auto p-2;
}
:global(.action-button > span) {
@apply absolute bottom-full mb-3 hidden rounded-lg bg-muted p-2 text-xs text-foreground;
}
</style>

View File

@@ -5,7 +5,7 @@
import guideVideo from '$lib/assets/guide-client.mp4'; import guideVideo from '$lib/assets/guide-client.mp4';
</script> </script>
<Tabs.Root value="android" class="max-w-xl"> <Tabs.Root value="android">
<Tabs.List class="grid w-full grid-cols-3"> <Tabs.List class="grid w-full grid-cols-3">
<Tabs.Trigger value="android">Android</Tabs.Trigger> <Tabs.Trigger value="android">Android</Tabs.Trigger>
<Tabs.Trigger value="windows">Windows</Tabs.Trigger> <Tabs.Trigger value="windows">Windows</Tabs.Trigger>
@@ -35,7 +35,7 @@
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<p>Download the configuration file and import it</p> <p>Download the configuration file and import it</p>
<aside>Alternatively, you can scan the QR code with the WireGuard app</aside> <aside>Alternatively, you can scan the QR code with the WireGuard app</aside>
<video controls muted preload="metadata" class="max-h-screen"> <video autoplay loop controls muted preload="metadata" class="max-h-screen">
<source src={guideVideo} type="video/mp4" /> <source src={guideVideo} type="video/mp4" />
</video> </video>
</div> </div>

View File

@@ -14,10 +14,12 @@
} }
</script> </script>
<header class="sm:flex"> <header class="flex w-full flex-wrap justify-between gap-x-6 gap-y-4 xl:max-w-screen-xl">
<span class=" mr-6 font-bold sm:inline-block">VPGen</span> <a href="/" class="contents">
<nav> <span class="font-bold sm:inline-block">VPGen</span>
<ul class="flex items-center gap-6 text-sm"> </a>
<nav class="max-w-full">
<ul class="flex items-center gap-6 overflow-x-auto text-sm">
<li><a href="/" class={getNavClass(/^\/$/)}>Home</a></li> <li><a href="/" class={getNavClass(/^\/$/)}>Home</a></li>
{#if user} {#if user}
<li><a href="/user" class={getNavClass(/^\/user$/)}>Profile</a></li> <li><a href="/user" class={getNavClass(/^\/user$/)}>Profile</a></li>
@@ -27,13 +29,16 @@
</ul> </ul>
</nav> </nav>
</header> </header>
<main class="flex flex-grow flex-col gap-4"> <main class="flex min-w-full max-w-full flex-grow flex-col gap-4 xl:min-w-[78rem]">
{@render children()} {@render children()}
</main> </main>
<!--https://github.com/sveltejs/kit/discussions/7585#discussioncomment-9997936--> <!--https://github.com/sveltejs/kit/discussions/7585#discussioncomment-9997936-->
<!--Some shenanings needed to be done to get the footer position to stick correctly, <!--Some shenanings needed to be done to get the footer position to stick correctly,
didn't work with display: contents--> didn't work with display: contents-->
<footer class="relative inset-x-0 bottom-0 text-center"> <footer class="inset-x-0 bottom-0 w-full text-center">
<p>&copy; 2024</p> <p>&copy; 2024</p>
</footer> </footer>
<style>
</style>

View File

@@ -10,7 +10,7 @@
<title>VPGen</title> <title>VPGen</title>
</svelte:head> </svelte:head>
<h1 class="mb-2 scroll-m-20 text-3xl font-extrabold tracking-tight lg:text-4xl"> <h1 class="mb-2 scroll-m-20 text-center text-3xl font-extrabold tracking-tight lg:text-4xl">
Welcome to VPGen Welcome to VPGen
</h1> </h1>
@@ -21,7 +21,7 @@
<section id="get-started" class="border-l-2 pl-6"> <section id="get-started" class="border-l-2 pl-6">
<p> <p>
To get started, To get started,
<Button class="ml-2 p-2" href="/clients?add=New+Client">Create a New Client</Button> <Button class="ml-2" href="/clients?add=New+Client">Create a New Client</Button>
</p> </p>
</section> </section>
<!-- <section id="using-wireguard">--> <!-- <section id="using-wireguard">-->
@@ -34,8 +34,8 @@
<!-- </details>--> <!-- </details>-->
<!-- </section>--> <!-- </section>-->
{:else} {:else}
<AuthForm class="p-4" /> <AuthForm />
<p>VPGen is a VPN generator that allows you to create and manage VPN connections.</p> <!-- <p>VPGen is a VPN generator that allows you to create and manage VPN connections.</p>-->
{/if} {/if}
<style> <style>

View File

@@ -38,7 +38,7 @@
</Table.Header> </Table.Header>
<Table.Body class="divide-y-2 divide-background"> <Table.Body class="divide-y-2 divide-background">
{#each data.clients as client} {#each data.clients as client}
<Table.Row class="group hover:bg-background hover:bg-opacity-40"> <Table.Row class="hover:bg-surface group">
<Table.Head scope="row"> <Table.Head scope="row">
<a <a
href={`/clients/${client.id}`} href={`/clients/${client.id}`}
@@ -61,13 +61,13 @@
</Table.Root> </Table.Root>
<!--Floating action button for adding a new client--> <!--Floating action button for adding a new client-->
<!--Not sure if this is the best place for the input field, will think about it later--> <Dialog.Root bind:open={dialogOpen}>
<div class="mt-auto flex self-end pt-4"> <div class="mt-auto flex self-end pt-4">
<Dialog.Root bind:open={dialogOpen}> <Dialog.Trigger class={buttonVariants({ variant: 'default' }) + ' flex gap-4'}>
<Dialog.Trigger class={buttonVariants({ variant: "default" }) + "flex gap-4"}>
<LucidePlus /> <LucidePlus />
Add Client New Client
</Dialog.Trigger> </Dialog.Trigger>
</div>
<Dialog.Content class="max-w-xs"> <Dialog.Content class="max-w-xs">
<form class="contents" method="post" action="?/create"> <form class="contents" method="post" action="?/create">
<Dialog.Header class=""> <Dialog.Header class="">
@@ -90,5 +90,4 @@
</Dialog.Footer> </Dialog.Footer>
</form> </form>
</Dialog.Content> </Dialog.Content>
</Dialog.Root> </Dialog.Root>
</div>

View File

@@ -2,7 +2,7 @@
import type { PageData } from './$types'; import type { PageData } from './$types';
import QRCode from 'qrcode-svg'; import QRCode from 'qrcode-svg';
import { CodeSnippet } from '$lib/components/app/code-snippet'; import { CodeSnippet } from '$lib/components/app/code-snippet';
import { WireguardGuide } from '$lib/components/app/wireguard-guide/index.js'; import { WireguardGuide } from '$lib/components/app/wireguard-guide';
const { data }: { data: PageData } = $props(); const { data }: { data: PageData } = $props();
@@ -16,6 +16,8 @@
content: data.config, content: data.config,
join: true, join: true,
background: 'hsl(var(--accent-light))', background: 'hsl(var(--accent-light))',
width: 296,
height: 296,
}); });
</script> </script>
@@ -25,14 +27,14 @@
<h1 class="w-fit rounded-lg bg-accent p-2 text-lg">{data.client.name}</h1> <h1 class="w-fit rounded-lg bg-accent p-2 text-lg">{data.client.name}</h1>
<section id="client-configuration" class="flex flex-wrap gap-4"> <section id="client-configuration" class="flex flex-wrap items-center justify-center gap-4">
<CodeSnippet data={data.config} filename={clientWgCleanedName} copy download /> <CodeSnippet data={data.config} filename={clientWgCleanedName} copy download />
<div class="overflow-hidden rounded-lg"> <div class="size-fit overflow-auto rounded-lg">
{@html qrCode.svg()} {@html qrCode.svg()}
</div> </div>
</section> </section>
<section id="usage" class="flex flex-col gap-2"> <section id="usage" class="flex w-full flex-col gap-2">
<h2 class="text-xl font-semibold">Usage</h2> <h2 class="text-xl font-semibold">Usage</h2>
<p>To use VPGen, you need to install the WireGuard app on your device.</p> <p>To use VPGen, you need to install the WireGuard app on your device.</p>
<WireguardGuide /> <WireguardGuide />

View File

@@ -17,13 +17,11 @@
}); });
function getSize(size: number) { function getSize(size: number) {
let sizes = ['Bytes', 'KiB', 'MiB', 'GiB', let sizes = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
for (let i = 1; i < sizes.length; i++) { for (let i = 1; i < sizes.length; i++) {
if (size < Math.pow(1024, i)) if (size < Math.pow(1024, i))
return (Math.round((size / Math.pow( return Math.round((size / Math.pow(1024, i - 1)) * 100) / 100 + ' ' + sizes[i - 1];
1024, i - 1)) * 100) / 100) + ' ' + sizes[i - 1];
} }
return size; return size;
} }
@@ -33,7 +31,7 @@
<title>Connections</title> <title>Connections</title>
</svelte:head> </svelte:head>
<Table.Root class="bg-accent rounded-lg overflow-hidden divide-y-2 divide-background"> <Table.Root class="divide-y-2 divide-background overflow-hidden rounded-lg bg-accent">
<Table.Header> <Table.Header>
<Table.Row> <Table.Row>
<Table.Head scope="col">Name</Table.Head> <Table.Head scope="col">Name</Table.Head>
@@ -49,14 +47,14 @@
</Table.Header> </Table.Header>
<Table.Body class="divide-y-2 divide-background"> <Table.Body class="divide-y-2 divide-background">
{#each data.peers.rows as peer} {#each data.peers.rows as peer}
<Table.Row class="hover:bg-background hover:bg-opacity-40"> <Table.Row class="hover:bg-surface">
<Table.Head scope="row">{peer.name}</Table.Head> <Table.Head scope="row">{peer.name}</Table.Head>
<Table.Cell class="truncate max-w-[10ch]">{peer['public-key']}</Table.Cell> <Table.Cell class="max-w-[10ch] truncate">{peer['public-key']}</Table.Cell>
<Table.Cell>{peer.endpoint}</Table.Cell> <Table.Cell>{peer.endpoint}</Table.Cell>
<Table.Cell> <Table.Cell>
<div class="flex flex-wrap gap-1"> <div class="flex flex-wrap gap-1">
{#each peer['allowed-ips'].split(',') as addr} {#each peer['allowed-ips'].split(',') as addr}
<Badge class="bg-background select-auto" variant="secondary">{addr}</Badge> <Badge class="select-auto bg-background" variant="secondary">{addr}</Badge>
{/each} {/each}
</div> </div>
</Table.Cell> </Table.Cell>

View File

@@ -1,92 +1,93 @@
import { fontFamily } from "tailwindcss/defaultTheme"; import { fontFamily } from 'tailwindcss/defaultTheme';
import type { Config } from "tailwindcss"; import type { Config } from 'tailwindcss';
import tailwindcssAnimate from "tailwindcss-animate"; import tailwindcssAnimate from 'tailwindcss-animate';
const config: Config = { const config: Config = {
darkMode: ["media"], darkMode: ['media'],
content: ["./src/**/*.{html,js,svelte,ts}"], content: ['./src/**/*.{html,js,svelte,ts}'],
safelist: ["dark"], safelist: ['dark'],
theme: { theme: {
container: { container: {
center: true, center: true,
padding: "2rem", padding: '2rem',
screens: { screens: {
"2xl": "1400px" '2xl': '1400px',
} },
}, },
extend: { extend: {
colors: { colors: {
border: "hsl(var(--border) / <alpha-value>)", border: 'hsl(var(--border) / <alpha-value>)',
input: "hsl(var(--input) / <alpha-value>)", input: 'hsl(var(--input) / <alpha-value>)',
ring: "hsl(var(--ring) / <alpha-value>)", ring: 'hsl(var(--ring) / <alpha-value>)',
background: "hsl(var(--background) / <alpha-value>)", background: 'hsl(var(--background) / <alpha-value>)',
foreground: "hsl(var(--foreground) / <alpha-value>)", foreground: 'hsl(var(--foreground) / <alpha-value>)',
primary: { primary: {
DEFAULT: "hsl(var(--primary) / <alpha-value>)", DEFAULT: 'hsl(var(--primary) / <alpha-value>)',
foreground: "hsl(var(--primary-foreground) / <alpha-value>)" foreground: 'hsl(var(--primary-foreground) / <alpha-value>)',
}, },
secondary: { secondary: {
DEFAULT: "hsl(var(--secondary) / <alpha-value>)", DEFAULT: 'hsl(var(--secondary) / <alpha-value>)',
foreground: "hsl(var(--secondary-foreground) / <alpha-value>)" foreground: 'hsl(var(--secondary-foreground) / <alpha-value>)',
}, },
destructive: { destructive: {
DEFAULT: "hsl(var(--destructive) / <alpha-value>)", DEFAULT: 'hsl(var(--destructive) / <alpha-value>)',
foreground: "hsl(var(--destructive-foreground) / <alpha-value>)" foreground: 'hsl(var(--destructive-foreground) / <alpha-value>)',
}, },
muted: { muted: {
DEFAULT: "hsl(var(--muted) / <alpha-value>)", DEFAULT: 'hsl(var(--muted) / <alpha-value>)',
foreground: "hsl(var(--muted-foreground) / <alpha-value>)" foreground: 'hsl(var(--muted-foreground) / <alpha-value>)',
}, },
accent: { accent: {
DEFAULT: "hsl(var(--accent) / <alpha-value>)", DEFAULT: 'hsl(var(--accent) / <alpha-value>)',
foreground: "hsl(var(--accent-foreground) / <alpha-value>)" foreground: 'hsl(var(--accent-foreground) / <alpha-value>)',
}, },
popover: { popover: {
DEFAULT: "hsl(var(--popover) / <alpha-value>)", DEFAULT: 'hsl(var(--popover) / <alpha-value>)',
foreground: "hsl(var(--popover-foreground) / <alpha-value>)" foreground: 'hsl(var(--popover-foreground) / <alpha-value>)',
}, },
card: { card: {
DEFAULT: "hsl(var(--card) / <alpha-value>)", DEFAULT: 'hsl(var(--card) / <alpha-value>)',
foreground: "hsl(var(--card-foreground) / <alpha-value>)" foreground: 'hsl(var(--card-foreground) / <alpha-value>)',
}, },
sidebar: { sidebar: {
DEFAULT: "hsl(var(--sidebar-background))", DEFAULT: 'hsl(var(--sidebar-background))',
foreground: "hsl(var(--sidebar-foreground))", foreground: 'hsl(var(--sidebar-foreground))',
primary: "hsl(var(--sidebar-primary))", primary: 'hsl(var(--sidebar-primary))',
"primary-foreground": "hsl(var(--sidebar-primary-foreground))", 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
accent: "hsl(var(--sidebar-accent))", accent: 'hsl(var(--sidebar-accent))',
"accent-foreground": "hsl(var(--sidebar-accent-foreground))", 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
border: "hsl(var(--sidebar-border))", border: 'hsl(var(--sidebar-border))',
ring: "hsl(var(--sidebar-ring))", ring: 'hsl(var(--sidebar-ring))',
}, },
surface: 'hsl(var(--surface) / <alpha-value>)',
}, },
borderRadius: { borderRadius: {
xl: "calc(var(--radius) + 4px)", xl: 'calc(var(--radius) + 4px)',
lg: "var(--radius)", lg: 'var(--radius)',
md: "calc(var(--radius) - 2px)", md: 'calc(var(--radius) - 2px)',
sm: "calc(var(--radius) - 4px)" sm: 'calc(var(--radius) - 4px)',
}, },
fontFamily: { fontFamily: {
sans: [...fontFamily.sans] sans: [...fontFamily.sans],
}, },
keyframes: { keyframes: {
"accordion-down": { 'accordion-down': {
from: { height: "0" }, from: { height: '0' },
to: { height: "var(--bits-accordion-content-height)" }, to: { height: 'var(--bits-accordion-content-height)' },
}, },
"accordion-up": { 'accordion-up': {
from: { height: "var(--bits-accordion-content-height)" }, from: { height: 'var(--bits-accordion-content-height)' },
to: { height: "0" }, to: { height: '0' },
}, },
"caret-blink": { 'caret-blink': {
"0%,70%,100%": { opacity: "1" }, '0%,70%,100%': { opacity: '1' },
"20%,50%": { opacity: "0" }, '20%,50%': { opacity: '0' },
}, },
}, },
animation: { animation: {
"accordion-down": "accordion-down 0.2s ease-out", 'accordion-down': 'accordion-down 0.2s ease-out',
"accordion-up": "accordion-up 0.2s ease-out", 'accordion-up': 'accordion-up 0.2s ease-out',
"caret-blink": "caret-blink 1.25s ease-out infinite", 'caret-blink': 'caret-blink 1.25s ease-out infinite',
}, },
}, },
}, },