This commit is contained in:
Shahrad Elahi 2024-05-29 20:01:36 +03:30
parent f0d675dc39
commit 9a6fdaa2a5
No known key found for this signature in database
98 changed files with 230 additions and 196 deletions

View File

@ -12,6 +12,7 @@ concurrency:
env:
BUILD_PLATFORMS: linux/amd64,linux/arm64
DOCKERHUB_SLUG: shahradel/wireadmin
GHCR_SLUG: ghcr.io/wireadmin/wireadmin
TAG: dev
@ -38,6 +39,13 @@ jobs:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
@ -55,4 +63,4 @@ jobs:
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: '${{ env.BUILD_PLATFORMS }}'
tags: '${{ env.GHCR_SLUG }}:${{ env.TAG }}'
tags: "${{ env.GHCR_SLUG }}:${{ env.TAG }},${{ env.DOCKERHUB_SLUG }}:${{ env.TAG }}"

View File

@ -8,6 +8,7 @@ on:
concurrency: '${{ github.workflow }}-${{ github.ref }}'
env:
DOCKERHUB_SLUG: shahradel/wireadmin
GHCR_SLUG: ghcr.io/wireadmin/wireadmin
jobs:
@ -54,6 +55,12 @@ jobs:
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-qemu-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
@ -81,9 +88,13 @@ jobs:
push: true
- name: Check manifest
run: docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
- name: Inspect image
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker pull ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.GHCR_SLUG }}:${{ steps.meta.outputs.version }}

View File

@ -23,7 +23,7 @@
}
}
],
"importOrder": ["<THIRD_PARTY_MODULES>", "", "^types$", "^@lib/(.*)$", "^@/(.*)$", "", "^[./]"],
"importOrder": ["<THIRD_PARTY_MODULES>", "", "^types$", "^\\$lib/(.*)$", "^@/(.*)$", "", "^[./]"],
"plugins": [
"@ianvs/prettier-plugin-sort-imports",
"prettier-plugin-tailwindcss",

View File

@ -39,10 +39,12 @@
| Registry | Image |
| ------------------------------------------------------------------------------------------------------- | ----------------------------- |
| [Docker Hub](https://hub.docker.com/r/shahradel/wireadmin/) | `shahradel/wireadmin` |
| [GitHub Container Registry](https://github.com/users/shahradelahi/packages/container/package/cfw-proxy) | `ghcr.io/wireadmin/wireadmin` |
## Ports
- `53`: Dnsmasq
- `3000`: WebUI
And for any additional ports of WireGuard instance, should be exposed through Docker.
@ -64,15 +66,15 @@ docker compose logs -f
```shell
$ docker run -d \
--name wireadmin \
-e WG_HOST= \
ADMIN_PASSWORD= \
"3000:3000/tcp" \
-e WG_HOST="<YOUR_SERVER_IP>" \
-e ADMIN_PASSWORD="<ADMIN_PASSWORD>" \
-p "3000:3000/tcp" \
-p "51820:51820/udp" \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
--sysctl="net.ipv4.ip_forward=1" \
ghcr.io/wireadmin/wireadmin < YOUR_SERVER_IP > -e < ADMIN_PASSWORD > -p
ghcr.io/wireadmin/wireadmin
```
> 💡 Replace `<YOUR_SERVER_IP>` with the IP address of your server.
@ -83,13 +85,26 @@ The Web UI will now be available on `http://0.0.0.0:3000`.
### Persistent Data
WireAdmin store configurations at `/data`. It's important to mount a volume at this location to ensure that
your data is not lost during container restarts or updates.
It's important to mount a volume to ensure that your data is not lost during container restarts or updates. Here is the list of required volumes:
- `wireadmin-data`: `/data`
- `tor-data`: `/var/lib/tor`
To create a docker volume, use the following command:
```bash
docker volume create wireadmin-data --driver local
$ docker volume create "<volume>" --driver local
```
> 💡 Replace `<volume>` with the name of the volume.
Finally, to mount the volumes with `-v` flag in the `docker run` command:
```bash
$ docker run -d \
-v wireadmin-data:/data \
-v tor-data:/var/lib/tor \
ghcr.io/wireadmin/wireadmin
```
### Environment variables
@ -99,7 +114,7 @@ These options can be configured by setting environment variables using `-e KEY="
| Option | Description | Default | Optional |
| ----------------- | ----------------------------------------------------------------------------------- | ------------------- | -------- |
| `WG_HOST` | The public IP address of the WireGuard server. | - | |
| `ADMIN_PASSWORD` | The password for the admin UI. | `insecure-password` | |
| `ADMIN_PASSWORD` | The password for the web UI. | `insecure-password` | |
| `HOST` | The hostname for the WebUI. | `127.0.0.1` | ✔️ |
| `PORT` | The port for the WebUI. | `3000` | ✔️ |
| `TOR_USE_BRIDGES` | Set this to `1` and then mount the bridges file at `/etc/tor/torrc.d/bridges.conf`. | - | ✔️ |
@ -110,14 +125,14 @@ These options can be configured by setting environment variables using `-e KEY="
Recreate the container whenever I push an update:
```bash
docker compose pull
docker compose up -d
$ docker compose pull
$ docker compose up -d
```
## Contributing
Want to contribute? Awesome! To show your support is to star the project, or to raise issues
on [GitHub](https://github.com/shahradelahi/docker-cfw-proxy).
on [GitHub](https://github.com/wireadmin/wireadmin)
Thanks again for your support, it is much appreciated! 🙏

BIN
assets/screenshot-1.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 65 KiB

BIN
assets/screenshot-2.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 77 KiB

BIN
assets/screenshot-3.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 62 KiB

BIN
assets/screenshot-4.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -7,7 +7,7 @@
"baseColor": "gray"
},
"aliases": {
"components": "@lib/components",
"utils": "@lib/utils"
"components": "$lib/components",
"utils": "$lib/utils"
}
}

View File

@ -2,9 +2,9 @@ import 'dotenv/config';
import { redirect, type Handle } from '@sveltejs/kit';
import { verifyToken } from '@lib/auth';
import { AUTH_COOKIE } from '@lib/constants';
import logger from '@lib/logger';
import { verifyToken } from '$lib/auth';
import { AUTH_COOKIE } from '$lib/constants';
import logger from '$lib/logger';
export const handle: Handle = async ({ event, resolve }) => {
logger.debug(`-> ${event.request.method} ${event.url.pathname}`);

View File

@ -1,9 +1,9 @@
import jwt from 'jsonwebtoken';
import { WG_AUTH_PATH } from '@lib/constants';
import { env } from '@lib/env';
import { storage } from '@lib/storage';
import { sha256 } from '@lib/utils/hash';
import { WG_AUTH_PATH } from '$lib/constants';
import { env } from '$lib/env';
import { storage } from '$lib/storage';
import { sha256 } from '$lib/utils/hash';
interface GenerateTokenParams {
expiresIn: number;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { ClipboardCopyIcon } from 'lucide-svelte';
import { Button } from '@lib/components/ui/button';
import { Button } from '$lib/components/ui/button';
export let showInHover: boolean = false;
export let rootClass: string | undefined = undefined;

View File

@ -1,9 +1,9 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { createEventDispatcher } from 'svelte';
import type { ZodEffects, ZodString } from 'zod';
import { SquarePenIcon } from 'lucide-svelte';
import { Button } from '@lib/components/ui/button';
import { Button } from '$lib/components/ui/button';
export let editMode: boolean = false;
export let schema: ZodString | ZodEffects<any>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { mode } from 'mode-watcher';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<SVGImageElement> & {
borderColor?: string;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { EmptyDescription, EmptySimpleImage, type Props } from '.';
type $$Props = Props;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import Icon from '@lib/components/iconset/icon.svelte';
import type { Props } from '@lib/components/iconset';
import Icon from '$lib/components/iconset/icon.svelte';
import type { Props } from '$lib/components/iconset';
type $$Props = Props;
</script>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
export let name: string | undefined = undefined;
export let color = 'currentColor';

View File

@ -1,6 +1,6 @@
<script lang="ts">
import Icon from '@lib/components/iconset/icon.svelte';
import type { Props } from '@lib/components/iconset';
import Icon from '$lib/components/iconset/icon.svelte';
import type { Props } from '$lib/components/iconset';
type $$Props = Props;
</script>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
export let content: string;
export let maxLength: number = Math.floor(content.length / 2);

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { cn } from '@lib/utils';
import PageFooter from '@lib/components/page/PageFooter.svelte';
import PageHeader from '@lib/components/page/PageHeader.svelte';
import { cn } from '$lib/utils';
import PageFooter from '$lib/components/page/PageFooter.svelte';
import PageHeader from '$lib/components/page/PageHeader.svelte';
export let rootClass: string | undefined = undefined;
let className: string | undefined = undefined;

View File

@ -1,5 +1,5 @@
<script>
import DotDivider from '@lib/components/DotDivider.svelte';
import DotDivider from '$lib/components/DotDivider.svelte';
</script>
<footer class={'flex items-center justify-center'}>

View File

@ -3,7 +3,7 @@
import Moon from 'lucide-svelte/icons/moon';
import { toggleMode } from 'mode-watcher';
import { Button } from '@lib/components/ui/button';
import { Button } from '$lib/components/ui/button';
import { LogOutIcon } from 'lucide-svelte';
export let showLogout: boolean = false;

View File

@ -6,11 +6,11 @@
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@lib/components/ui/dialog';
import { Skeleton } from '@lib/components/ui/skeleton';
} from '$lib/components/ui/dialog';
import { Skeleton } from '$lib/components/ui/skeleton';
import { Dialog as DialogPrimitive } from 'bits-ui';
import { Button } from '@lib/components/ui/button';
import type { SafeReturn } from '@lib/typings';
import { Button } from '$lib/components/ui/button';
import type { SafeReturn } from '$lib/typings';
const DialogClose = DialogPrimitive.Close;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { badgeVariants, type Variant } from '.';
let className: string | undefined | null = undefined;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import Ellipsis from 'lucide-svelte/icons/ellipsis';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLAttributes<HTMLSpanElement> & {
el?: HTMLSpanElement;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLLiAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLLiAttributes & {
el?: HTMLLIElement;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAnchorAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLAnchorAttributes & {
el?: HTMLAnchorElement;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLOlAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLOlAttributes & {
el?: HTMLOListElement;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLAttributes<HTMLSpanElement> & {
el?: HTMLSpanElement;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { HTMLLiAttributes } from 'svelte/elements';
import ChevronRight from 'lucide-svelte/icons/chevron-right';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLLiAttributes & {
el?: HTMLLIElement;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { Button as ButtonPrimitive } from 'bits-ui';
import { type Events, type Props, buttonVariants } from './index';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = Props;
type $$Events = Events;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLParagraphElement>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import type { HeadingLevel } from './index.js';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLHeadingElement> & {
tag?: HeadingLevel;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -2,7 +2,7 @@
import { Checkbox as CheckboxPrimitive } from 'bits-ui';
import Check from 'lucide-svelte/icons/check';
import Minus from 'lucide-svelte/icons/minus';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = CheckboxPrimitive.Props;
type $$Events = CheckboxPrimitive.Events;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { Dialog as DialogPrimitive } from 'bits-ui';
import * as Dialog from '.';
import { cn, flyAndScale } from '@lib/utils';
import { cn, flyAndScale } from '$lib/utils';
import { X } from 'lucide-svelte';
type $$Props = DialogPrimitive.ContentProps;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Dialog as DialogPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = DialogPrimitive.DescriptionProps;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import type { HTMLAttributes } from 'svelte/elements';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import type { HTMLAttributes } from 'svelte/elements';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Dialog as DialogPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { fade } from 'svelte/transition';
type $$Props = DialogPrimitive.OverlayProps;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Dialog as DialogPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = DialogPrimitive.TitleProps;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import * as Button from '@lib/components/ui/button/index.js';
import * as Button from '$lib/components/ui/button/index.js';
type $$Props = Button.Props;
type $$Events = Button.Events;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import * as FormPrimitive from 'formsnap';
import type { HTMLAttributes } from 'svelte/elements';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = HTMLAttributes<HTMLSpanElement>;
let className: string | undefined | null = undefined;

View File

@ -7,7 +7,7 @@
<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPathLeaves<T>">
import type { HTMLAttributes } from 'svelte/elements';
import * as FormPrimitive from 'formsnap';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = FormPrimitive.ElementFieldProps<T, U> & HTMLAttributes<HTMLElement>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import * as FormPrimitive from 'formsnap';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = FormPrimitive.FieldErrorsProps & {
errorClasses?: string | undefined | null;

View File

@ -7,7 +7,7 @@
<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
import type { HTMLAttributes } from 'svelte/elements';
import * as FormPrimitive from 'formsnap';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = FormPrimitive.FieldProps<T, U> & HTMLAttributes<HTMLElement>;

View File

@ -6,7 +6,7 @@
<script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
import * as FormPrimitive from 'formsnap';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = FormPrimitive.FieldsetProps<T, U>;

View File

@ -1,8 +1,8 @@
<script lang="ts">
import type { Label as LabelPrimitive } from 'bits-ui';
import { getFormControl } from 'formsnap';
import { cn } from '@lib/utils.js';
import { Label } from '@lib/components/ui/label/index.js';
import { cn } from '$lib/utils.js';
import { Label } from '$lib/components/ui/label/index.js';
type $$Props = LabelPrimitive.Props;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import * as FormPrimitive from 'formsnap';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = FormPrimitive.LegendProps;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLInputAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import type { InputEvents } from '.';
type $$Props = HTMLInputAttributes;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Label as LabelPrimitive } from 'bits-ui';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = LabelPrimitive.Props;
type $$Events = LabelPrimitive.Events;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
import { Circle } from 'lucide-svelte';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = RadioGroupPrimitive.ItemProps;
type $$Events = RadioGroupPrimitive.ItemEvents;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { RadioGroup as RadioGroupPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = RadioGroupPrimitive.Props;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { Select as SelectPrimitive } from 'bits-ui';
import { scale } from 'svelte/transition';
import { cn, flyAndScale } from '@lib/utils';
import { cn, flyAndScale } from '$lib/utils';
type $$Props = SelectPrimitive.ContentProps;
type $$Events = SelectPrimitive.ContentEvents;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import Check from 'lucide-svelte/icons/check';
import { Select as SelectPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = SelectPrimitive.ItemProps;
type $$Events = SelectPrimitive.ItemEvents;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Select as SelectPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = SelectPrimitive.LabelProps;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Select as SelectPrimitive } from 'bits-ui';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = SelectPrimitive.SeparatorProps;

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { Select as SelectPrimitive } from 'bits-ui';
import ChevronDown from 'lucide-svelte/icons/chevron-down';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = SelectPrimitive.TriggerProps;
type $$Events = SelectPrimitive.TriggerEvents;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import type { HTMLAttributes } from 'svelte/elements';
type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Switch as SwitchPrimitive } from 'bits-ui';
import { cn } from '@lib/utils.js';
import { cn } from '$lib/utils.js';
type $$Props = SwitchPrimitive.Props;
type $$Events = SwitchPrimitive.Events;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import type { HTMLTextareaAttributes } from 'svelte/elements';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
type $$Props = HTMLTextareaAttributes;

View File

@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto';
import { createEnv } from '@t3-oss/env-core';
import { z } from 'zod';
import { sha256 } from '@lib/utils/hash';
import { sha256 } from '$lib/utils/hash';
export const env = createEnv({
runtimeEnv: process.env,

View File

@ -4,8 +4,8 @@ import { trySafe } from 'p-safe';
import pino, { type Logger, type LoggerOptions } from 'pino';
import pretty from 'pino-pretty';
import { env } from '@lib/env';
import { fsAccess } from '@lib/utils/fs-extra';
import { env } from '$lib/env';
import { fsAccess } from '$lib/utils/fs-extra';
const options: LoggerOptions = {
level: env.LOG_LEVEL,

View File

@ -1,8 +1,8 @@
import { promises } from 'node:fs';
import { execa } from 'execa';
import logger from '@lib/logger';
import { fsTouch } from '@lib/utils/fs-extra';
import logger from '$lib/logger';
import { fsTouch } from '$lib/utils/fs-extra';
export const SERVICES = <const>{
tor: {

View File

@ -1,11 +1,11 @@
import { Client, HashMap, MSGPack } from 'storage-box';
import { FsDriver } from 'storage-box/node';
import { WG_SEVER_PATH } from '@lib/constants';
import { env } from '@lib/env';
import logger from '@lib/logger';
import type { WgServer } from '@lib/typings';
import { isJson } from '@lib/utils';
import { WG_SEVER_PATH } from '$lib/constants';
import { env } from '$lib/env';
import logger from '$lib/logger';
import type { WgServer } from '$lib/typings';
import { isJson } from '$lib/utils';
const driver = new FsDriver(env.STORAGE_PATH, { parser: MSGPack });

View File

@ -1,7 +1,7 @@
import { IPV4_REGEX } from 'node-netkit/ip';
import { z } from 'zod';
import { NameSchema, TorSchema } from '@lib/wireguard/schema';
import { NameSchema, TorSchema } from '$lib/wireguard/schema';
export const WgKeySchema = z.object({
privateKey: z.string(),

View File

@ -4,15 +4,15 @@ import deepmerge from 'deepmerge';
import { execa } from 'execa';
import { ip } from 'node-netkit';
import { WG_PATH } from '@lib/constants';
import logger from '@lib/logger';
import Network from '@lib/network';
import { WG_STORE } from '@lib/storage';
import type { Peer, WgKey, WgServer } from '@lib/typings';
import { dynaJoin, sleep } from '@lib/utils';
import { fsAccess } from '@lib/utils/fs-extra';
import { sha256 } from '@lib/utils/hash';
import { getPeerConf } from '@lib/wireguard/utils';
import { WG_PATH } from '$lib/constants';
import logger from '$lib/logger';
import Network from '$lib/network';
import { WG_STORE } from '$lib/storage';
import type { Peer, WgKey, WgServer } from '$lib/typings';
import { dynaJoin, sleep } from '$lib/utils';
import { fsAccess } from '$lib/utils/fs-extra';
import { sha256 } from '$lib/utils/hash';
import { getPeerConf } from '$lib/wireguard/utils';
export class WGServer {
readonly id: string;

View File

@ -1,7 +1,7 @@
import { z } from 'zod';
import { IPV4_REGEX, isPrivateIP } from '@lib/utils/ip';
import { isBetween } from '@lib/utils/number';
import { IPV4_REGEX, isPrivateIP } from '$lib/utils/ip';
import { isBetween } from '$lib/utils/number';
export const NameSchema = z
.string()

View File

@ -1,4 +1,4 @@
import type { WgServer } from '@lib/typings';
import type { WgServer } from '$lib/typings';
type Peer = WgServer['peers'][0];

View File

@ -2,10 +2,10 @@ import { error, fail, type Actions } from '@sveltejs/kit';
import { setError, superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import logger, { errorBox } from '@lib/logger';
import { WG_STORE } from '@lib/storage';
import { generateWgServer, isIPReserved, isPortReserved, WGServer } from '@lib/wireguard';
import { NameSchema } from '@lib/wireguard/schema';
import logger, { errorBox } from '$lib/logger';
import { WG_STORE } from '$lib/storage';
import { generateWgServer, isIPReserved, isPortReserved, WGServer } from '$lib/wireguard';
import { NameSchema } from '$lib/wireguard/schema';
import type { PageServerLoad } from './$types';
import { createServerSchema } from './schema';

View File

@ -1,15 +1,15 @@
<script lang="ts">
import BasePage from '@lib/components/page/BasePage.svelte';
import BasePage from '$lib/components/page/BasePage.svelte';
import type { PageData } from './$types';
import { Card, CardContent, CardHeader, CardTitle } from '@lib/components/ui/card';
import { Card, CardContent, CardHeader, CardTitle } from '$lib/components/ui/card';
import Service from './Service.svelte';
import { Empty } from '@lib/components/empty';
import { Empty } from '$lib/components/empty';
import Server from './Server.svelte';
import fetchAction from '@lib/utils/fetch-action';
import fetchAction from '$lib/utils/fetch-action';
import CreateServerDialog from './CreateServerDialog.svelte';
import { Button } from '@lib/components/ui/button';
import { Button } from '$lib/components/ui/button';
import { PlusIcon } from 'lucide-svelte';
import { DnsmasqIcon, OnionIcon } from '@lib/components/iconset';
import { DnsmasqIcon, OnionIcon } from '$lib/components/iconset';
export let data: PageData;

View File

@ -8,7 +8,7 @@
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@lib/components/ui/dialog';
} from '$lib/components/ui/dialog';
import {
FormButton,
FormControl,
@ -16,18 +16,18 @@
FormField,
FormFieldErrors,
FormLabel,
} from '@lib/components/ui/form';
import { cn } from '@lib/utils';
} from '$lib/components/ui/form';
import { cn } from '$lib/utils';
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from '@lib/components/ui/collapsible';
import { Button } from '@lib/components/ui/button';
} from '$lib/components/ui/collapsible';
import { Button } from '$lib/components/ui/button';
import toast from 'svelte-french-toast';
import { Input } from '@lib/components/ui/input';
import { Input } from '$lib/components/ui/input';
import { zodClient } from 'sveltekit-superforms/adapters';
import { Switch } from '@lib/components/ui/switch';
import { Switch } from '$lib/components/ui/switch';
import { ChevronRightIcon, LoaderCircle } from 'lucide-svelte';
let dialogOpen = false;

View File

@ -1,14 +1,14 @@
<script lang="ts">
import { Button } from '@lib/components/ui/button';
import type { WgServer } from '@lib/typings';
import { EditableText } from '@lib/components/editable-text';
import { CopiableText } from '@lib/components/copiable-text';
import { NameSchema } from '@lib/wireguard/schema';
import { Badge } from '@lib/components/ui/badge';
import { Button } from '$lib/components/ui/button';
import type { WgServer } from '$lib/typings';
import { EditableText } from '$lib/components/editable-text';
import { CopiableText } from '$lib/components/copiable-text';
import { NameSchema } from '$lib/wireguard/schema';
import { Badge } from '$lib/components/ui/badge';
import { createEventDispatcher } from 'svelte';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { LayersIcon } from 'lucide-svelte';
import { OnionIcon } from '@lib/components/iconset';
import { OnionIcon } from '$lib/components/iconset';
export let server: WgServer;
export let addressPort: string = `${server.address}:${server.listen}`;

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Button } from '@lib/components/ui/button';
import { Badge } from '@lib/components/ui/badge';
import { Button } from '$lib/components/ui/button';
import { Badge } from '$lib/components/ui/badge';
import { onMount } from 'svelte';
import { LoaderCircle } from 'lucide-svelte';

View File

@ -1,7 +1,7 @@
<script lang="ts">
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@lib/components/ui/card';
import { Empty } from '@lib/components/empty';
import { Button } from '@lib/components/ui/button';
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '$lib/components/ui/card';
import { Empty } from '$lib/components/empty';
import { Button } from '$lib/components/ui/button';
</script>
<Card>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import BasePage from '@lib/components/page/BasePage.svelte';
import BasePage from '$lib/components/page/BasePage.svelte';
</script>
<BasePage showLogout={true}>

View File

@ -2,10 +2,10 @@ import { error, redirect, type Actions } from '@sveltejs/kit';
import { setError, superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import logger, { errorBox } from '@lib/logger';
import { WG_STORE } from '@lib/storage';
import { generateWgKey, WGServer } from '@lib/wireguard';
import { NameSchema } from '@lib/wireguard/schema';
import logger, { errorBox } from '$lib/logger';
import { WG_STORE } from '$lib/storage';
import { generateWgKey, WGServer } from '$lib/wireguard';
import { NameSchema } from '$lib/wireguard/schema';
import type { PageServerLoad } from './$types';
import { createPeerSchema } from './schema';

View File

@ -1,16 +1,16 @@
<script lang="ts">
import type { PageData } from './$types';
import CreatePeerDialog from './CreatePeerDialog.svelte';
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@lib/components/ui/card';
import { Button } from '@lib/components/ui/button';
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '$lib/components/ui/card';
import { Button } from '$lib/components/ui/button';
import Peer from './Peer.svelte';
import fetchAction from '@lib/utils/fetch-action';
import fetchAction from '$lib/utils/fetch-action';
import DetailRow from './DetailRow.svelte';
import { Badge } from '@lib/components/ui/badge';
import { CopiableText } from '@lib/components/copiable-text';
import { MiddleEllipsis } from '@lib/components/middle-ellipsis';
import { Badge } from '$lib/components/ui/badge';
import { CopiableText } from '$lib/components/copiable-text';
import { MiddleEllipsis } from '$lib/components/middle-ellipsis';
import { goto, invalidateAll } from '$app/navigation';
import { Empty } from '@lib/components/empty';
import { Empty } from '$lib/components/empty';
import prettyBytes from 'pretty-bytes';
import { onDestroy } from 'svelte';
import {
@ -20,7 +20,7 @@
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from '@lib/components/ui/breadcrumb';
} from '$lib/components/ui/breadcrumb';
import { ArrowUpIcon } from 'lucide-svelte';
export let data: PageData;

View File

@ -8,19 +8,19 @@
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@lib/components/ui/dialog';
} from '$lib/components/ui/dialog';
import {
FormButton,
FormControl,
FormField,
FormFieldErrors,
FormLabel,
} from '@lib/components/ui/form';
import { cn } from '@lib/utils';
} from '$lib/components/ui/form';
import { cn } from '$lib/utils';
import { invalidateAll } from '$app/navigation';
import toast from 'svelte-french-toast';
import { zodClient } from 'sveltekit-superforms/adapters';
import { Input } from '@lib/components/ui/input';
import { Input } from '$lib/components/ui/input';
import { LoaderCircle } from 'lucide-svelte';
let loading: boolean = false;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
export let label: string;
</script>

View File

@ -1,13 +1,13 @@
<script lang="ts">
import type { Peer, WgServer } from '@lib/typings';
import { CopiableText } from '@lib/components/copiable-text';
import { EditableText } from '@lib/components/editable-text';
import { NameSchema } from '@lib/wireguard/schema';
import type { Peer, WgServer } from '$lib/typings';
import { CopiableText } from '$lib/components/copiable-text';
import { EditableText } from '$lib/components/editable-text';
import { NameSchema } from '$lib/wireguard/schema';
import PeerActionButton from './PeerActionButton.svelte';
import { createEventDispatcher, onMount } from 'svelte';
import { getPeerConf } from '@lib/wireguard/utils';
import { QRCodeDialog } from '@lib/components/qrcode-dialog';
import { cn } from '@lib/utils';
import { getPeerConf } from '$lib/wireguard/utils';
import { QRCodeDialog } from '$lib/components/qrcode-dialog';
import { cn } from '$lib/utils';
import { DownloadIcon, QrCodeIcon, Trash2Icon, UserIcon } from 'lucide-svelte';
export let peer: Peer;

View File

@ -1,9 +1,9 @@
<script lang="ts">
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
import { createEventDispatcher } from 'svelte';
import { Button } from 'bits-ui';
import { LoaderCircle } from 'lucide-svelte';
import { FormButton } from '@lib/components/ui/form';
import { FormButton } from '$lib/components/ui/form';
type $$Props = Button.Props & {
disabled?: boolean;

View File

@ -1,6 +1,6 @@
import { z } from 'zod';
import { NameSchema } from '@lib/wireguard/schema';
import { NameSchema } from '$lib/wireguard/schema';
export const createPeerSchema = z.object({
name: NameSchema,

View File

@ -1,8 +1,8 @@
import type { RequestHandler } from '@sveltejs/kit';
import { errorBox } from '@lib/logger';
import { WG_STORE } from '@lib/storage';
import { WGServer } from '@lib/wireguard';
import { errorBox } from '$lib/logger';
import { WG_STORE } from '$lib/storage';
import { WGServer } from '$lib/wireguard';
export const GET: RequestHandler = async () => {
try {

View File

@ -1,7 +1,7 @@
import { json, type RequestHandler } from '@sveltejs/kit';
import { errorBox } from '@lib/logger';
import { getService } from '@lib/services';
import { errorBox } from '$lib/logger';
import { getService } from '$lib/services';
export const GET: RequestHandler = async ({ params }) => {
try {

View File

@ -3,7 +3,7 @@ import 'dotenv/config';
import type { RequestHandler } from '@sveltejs/kit';
import { execa } from 'execa';
import logger from '@lib/logger';
import logger from '$lib/logger';
export const GET: RequestHandler = async () => {
let { WG_HOST } = process.env;

View File

@ -1,5 +1,5 @@
<script lang="ts">
import PageFooter from '@lib/components/page/PageFooter.svelte';
import PageFooter from '$lib/components/page/PageFooter.svelte';
</script>
<div class={'w-full min-h-screen flex justify-center px-2 md:px-6 py-2'}>

View File

@ -2,11 +2,11 @@ import { error, fail, type Actions } from '@sveltejs/kit';
import { setError, superValidate } from 'sveltekit-superforms';
import { zod } from 'sveltekit-superforms/adapters';
import { generateToken } from '@lib/auth';
import { AUTH_COOKIE } from '@lib/constants';
import { env } from '@lib/env';
import logger, { errorBox } from '@lib/logger';
import { sha256 } from '@lib/utils/hash';
import { generateToken } from '$lib/auth';
import { AUTH_COOKIE } from '$lib/constants';
import { env } from '$lib/env';
import logger, { errorBox } from '$lib/logger';
import { sha256 } from '$lib/utils/hash';
import type { PageServerLoad } from './$types';
import { formSchema } from './schema';

View File

@ -1,19 +1,19 @@
<script lang="ts">
import { formSchema, type FormSchema } from './schema';
import { type Infer, superForm, type SuperValidated } from 'sveltekit-superforms';
import { Card, CardContent } from '@lib/components/ui/card';
import { Card, CardContent } from '$lib/components/ui/card';
import {
FormButton,
FormControl,
FormField,
FormFieldErrors,
FormLabel,
} from '@lib/components/ui/form';
} from '$lib/components/ui/form';
import { zodClient } from 'sveltekit-superforms/adapters';
import { goto } from '$app/navigation';
import { Input } from '@lib/components/ui/input';
import { Input } from '$lib/components/ui/input';
import { LoaderCircle, UserIcon } from 'lucide-svelte';
import { cn } from '@lib/utils';
import { cn } from '$lib/utils';
export let data: SuperValidated<Infer<FormSchema>>;

View File

@ -1,7 +1,7 @@
import { redirect } from '@sveltejs/kit';
import { revokeToken } from '@lib/auth';
import { AUTH_COOKIE } from '@lib/constants';
import { revokeToken } from '$lib/auth';
import { AUTH_COOKIE } from '$lib/constants';
import type { PageServerLoad } from './$types';

View File

@ -7,7 +7,7 @@ import {
NameSchema,
PortSchema,
TorSchema,
} from '@lib/wireguard/schema';
} from '$lib/wireguard/schema';
export const createServerSchema = z.object({
name: NameSchema,

View File

@ -1,7 +1,7 @@
import { error, type Actions } from '@sveltejs/kit';
import logger, { errorBox } from '@lib/logger';
import { clearLogs, getService, logs, restart, type ServiceName } from '@lib/services';
import logger, { errorBox } from '$lib/logger';
import { clearLogs, getService, logs, restart, type ServiceName } from '$lib/services';
import type { PageServerLoad } from './$types';

View File

@ -1,9 +1,9 @@
<script lang="ts">
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '@lib/components/ui/card';
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '$lib/components/ui/card';
import { onMount } from 'svelte';
import type { PageData } from './$types';
import fetchAction from '@lib/utils/fetch-action';
import { Button } from '@lib/components/ui/button';
import fetchAction from '$lib/utils/fetch-action';
import { Button } from '$lib/components/ui/button';
import toast from 'svelte-french-toast';
import { LoaderCircle } from 'lucide-svelte';
import {
@ -13,9 +13,9 @@
BreadcrumbList,
BreadcrumbPage,
BreadcrumbSeparator,
} from '@lib/components/ui/breadcrumb';
import BasePage from '@lib/components/page/BasePage.svelte';
import { Checkbox } from '@lib/components/ui/checkbox';
} from '$lib/components/ui/breadcrumb';
import BasePage from '$lib/components/page/BasePage.svelte';
import { Checkbox } from '$lib/components/ui/checkbox';
export let data: PageData;