From abb957c573606081f8fbcf2e182dca260fd26316 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Fri, 29 Mar 2024 01:53:32 -0400 Subject: [PATCH] feat: restart docker container --- .env.example | 1 + app/root.tsx | 4 ++ app/routes/_data.dns._index/domains.tsx | 4 +- app/routes/_data.dns._index/rename.tsx | 32 +++++++++++++-- app/routes/_data.dns._index/route.tsx | 29 ++------------ app/utils/docker.ts | 44 +++++++++++++++++++++ app/utils/headscale.ts | 52 +++++++++++-------------- compose.yaml | 1 + package.json | 1 + pnpm-lock.yaml | 8 ++++ 10 files changed, 115 insertions(+), 61 deletions(-) create mode 100644 app/utils/docker.ts diff --git a/.env.example b/.env.example index 3c0e349..6ff946c 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ API_KEY=abcdefghijklmnopqrstuvwxyz COOKIE_SECRET=abcdefghijklmnopqrstuvwxyz DISABLE_API_KEY_LOGIN=true +HEADSCALE_CONTAINER=headscale HOST=0.0.0.0 PORT=3000 CONFIG_FILE=/etc/headscale/config.yaml diff --git a/app/root.tsx b/app/root.tsx index 5d4684d..fdabc2e 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -39,6 +39,10 @@ export async function loader() { throw new Error('The API_KEY environment variable is required') } + if (!process.env.HEADSCALE_CONTAINER) { + throw new Error('The HEADSCALE_CONTAINER environment variable is required') + } + // eslint-disable-next-line unicorn/no-null return null } diff --git a/app/routes/_data.dns._index/domains.tsx b/app/routes/_data.dns._index/domains.tsx index 4c2962e..1ada78d 100644 --- a/app/routes/_data.dns._index/domains.tsx +++ b/app/routes/_data.dns._index/domains.tsx @@ -30,7 +30,7 @@ export default function Domains({ baseDomain, searchDomains }: Properties) { const [activeId, setActiveId] = useState(null) const [localDomains, setLocalDomains] = useState(searchDomains) const [newDomain, setNewDomain] = useState('') - const fetcher = useFetcher({ key: 'search-domains' }) + const fetcher = useFetcher() useEffect(() => { setLocalDomains(searchDomains) @@ -154,7 +154,7 @@ type DomainProperties = { } function Domain({ domain, id, localDomains, isDrag }: DomainProperties) { - const fetcher = useFetcher({ key: 'individual-domain' }) + const fetcher = useFetcher() const { attributes, diff --git a/app/routes/_data.dns._index/rename.tsx b/app/routes/_data.dns._index/rename.tsx index b72fa07..9352e7c 100644 --- a/app/routes/_data.dns._index/rename.tsx +++ b/app/routes/_data.dns._index/rename.tsx @@ -2,6 +2,7 @@ /* eslint-disable unicorn/no-keyword-prefix */ import { Dialog } from '@headlessui/react' import { useFetcher } from '@remix-run/react' +import clsx from 'clsx' import { useState } from 'react' type Properties = { @@ -14,7 +15,30 @@ export default function Modal({ name }: Properties) { const fetcher = useFetcher() return ( - <> +
+

Tailnet Name

+

+ This is the base domain name of your Tailnet. + Devices are accessible at + {' '} + + [device].[user].{name} + + {' '} + when Magic DNS is enabled. +

+ { + event.target.select() + }} + />