fix dedicated IP panel; add LAN to IP panel; advertise ip.jotto.pw
diff --git a/src/app/components/NavRoot.tsx b/src/app/components/NavRoot.tsx
index 26a84a1..f6719dd 100644
--- a/src/app/components/NavRoot.tsx
+++ b/src/app/components/NavRoot.tsx
@@ -3,24 +3,24 @@
 import { useLoaderData, useLocation, useNavigate } from "@remix-run/react";
 import IPDetailsPage from "./ip/IPDetailsPage";
 import { Helmet } from "react-helmet-async";
-import { useRootData } from "../root";
+import { RootData, useRootData } from "../root";
 
 export default function NavRoot({ children }: { children: React.ReactNode }) {
-    const loaderData = useLoaderData();
+    const loaderData = useLoaderData() as RootData;
     const root = useRootData();
     const location = useLocation();
     const navigate = useNavigate();
 
-    if (location.pathname === "/") return children;
-
-    if (loaderData?.dedicatedPanel) return (
-        <>
+    if (loaderData?.ip?.dedicatedPanel) return (
+        <div className="h-full flex flex-col">
             <Helmet titleTemplate="%s" />
-            <Container>
-                <div className="pt-24">
-                    <IPDetailsPage />
-                </div>
-            </Container>
+            <div className="flex-grow">
+                <Container>
+                    <div className="pt-24">
+                        <IPDetailsPage dedicatedPanel />
+                    </div>
+                </Container>
+            </div>
             <div className="mt-40">
                 <div className="bg-ui-5 rounded-lg py-12">
                     <Container>
@@ -36,9 +36,11 @@
                     </Container>
                 </div>
             </div>
-        </>
+        </div>
     );
 
+    if (location.pathname === "/") return children;
+
     return (
         <div className="h-full">
             <Navbar title="WebDiag" logo="https://emoji.jottocraft.com/highres/1f9f0.svg" logoFullWidth widgets={{
diff --git a/src/app/components/ip/IPDetailsPage.tsx b/src/app/components/ip/IPDetailsPage.tsx
index 620a0ed..850eb13 100644
--- a/src/app/components/ip/IPDetailsPage.tsx
+++ b/src/app/components/ip/IPDetailsPage.tsx
@@ -1,13 +1,15 @@
 import { useLoaderData } from "@remix-run/react";
-import { Button, Link } from "shamrock-ux";
+import { Button, Icon, Link } from "shamrock-ux";
 import DetailRow from "./DetailRow";
 import Widget from "../Widget";
 import Map from "./Map";
-import getIPData, { IPData } from "../../util/ip/getIPData";
+import { IPData } from "../../util/ip/getIPData";
 import { Helmet } from "react-helmet-async";
+import { RootData } from "../../root";
 
-export default function IPDetailsPage() {
-    const data = useLoaderData() as IPData;
+export default function IPDetailsPage({ dedicatedPanel }: { dedicatedPanel?: boolean; }) {
+    const loader = useLoaderData();
+    const data: IPData = dedicatedPanel ? ((loader as RootData).ip as IPData) : (loader as IPData);
 
     return (
         <>
@@ -18,6 +20,19 @@
                 <div className="px-2 space-y-8 flex-shrink">
                     <Widget name="Your IP address" icon="public">
                         <h1 className="text-4xl font-semibold font-mono text-type-0">{data.ip}</h1>
+                        {data.lan ? (
+                            <div className="text-slate-600 dark:text-slate-300 border border-ui-5 mt-4 p-2 rounded-lg">
+                                <p className="mb-2 text-lg flex flex-row justify-between">
+                                    <span>LAN IP:</span>
+                                    <span className="font-medium font-mono">{data.lan.clientIP}</span>
+                                </p>
+                                <p className="mb-2 text-lg flex flex-row justify-between">
+                                    <span>Gateway:</span>
+                                    <span className="font-medium font-mono">{data.lan.routerIP}</span>
+                                </p>
+                                <p className="text-sm italic">{data.lan.label}</p>
+                            </div>
+                        ) : null}
                     </Widget>
                     <Widget name="Internet service providers" icon="router">
                         <div className="space-y-2">
@@ -57,18 +72,24 @@
                         </table>
                     </Widget>
                 </div>
-                {data.geo ? (
-                    <div className="px-2 flex-grow flex-shrink-0 max-w-md space-y-8">
-                        <Widget name="Approximate location" icon="location_searching">
-                            <p className="font-mono">{data.geo.city}, {data.geo.region} {data.geo.postal} {data.geo.country}</p>
-                        </Widget>
-                        <Widget name="Map" icon="map">
-                            <div className="h-80 rounded-lg shadow relative">
-                                <Map />
-                            </div>
-                        </Widget>
-                    </div>
-                ) : null}
+                <div className="px-2 flex-grow flex-shrink-0 max-w-md space-y-8">
+                    {data.geo ? (
+                        <>
+                            <Widget name="Approximate location" icon="location_searching">
+                                <p className="font-mono">{data.geo.city}, {data.geo.region} {data.geo.postal} {data.geo.country}</p>
+                            </Widget>
+                            <Widget name="Map" icon="map">
+                                <div className="h-80 rounded-lg shadow relative">
+                                    <Map data={data} />
+                                </div>
+                            </Widget>
+                        </>
+                    ) : null}
+                    <p className="flex flex-row items-center space-x-3 text-type-20">
+                        <Icon className="text-lg">tips_and_updates</Icon>
+                        <span>Get to this page quickly at <Link href="https://ip.jotto.pw">ip.jotto.pw</Link></span>
+                    </p>
+                </div>
             </div>
             {data.dedicatedPanel ? (
                 <div className="pt-12">
diff --git a/src/app/components/ip/Map.tsx b/src/app/components/ip/Map.tsx
index f528615..62460d0 100644
--- a/src/app/components/ip/Map.tsx
+++ b/src/app/components/ip/Map.tsx
@@ -2,13 +2,12 @@
 import { useTheme } from "shamrock-ux";
 import mapboxgl, { LngLatLike } from "mapbox-gl";
 import { useLoaderData } from "@remix-run/react";
-import { IPData } from "src/app/util/ip/getIPData";
+import { IPData } from "../../util/ip/getIPData";
 import { Helmet } from "react-helmet-async";
 
 const MAPBOX_ACCESS_TOKEN = "pk.eyJ1Ijoiam90dG9jcmFmdCIsImEiOiJjbDU4amN6ejIwMGVmM2xyeDV5M25kbHZ4In0.Omg2bhnW7DhhG_wk0JFOSg";
 
-export default function Map() {
-    const data = useLoaderData() as IPData;
+export default function Map({ data }: { data: IPData; }) {
     if (!data.geo) throw new Error("IP geo data missing. Cannot render a map.");
 
     const pos: LngLatLike = [Number(data.geo.lon), Number(data.geo.lat)];
diff --git a/src/app/root.tsx b/src/app/root.tsx
index a74e5bf..4aafd90 100644
--- a/src/app/root.tsx
+++ b/src/app/root.tsx
@@ -17,7 +17,7 @@
 import getTools, { ToolGroup } from "./tools";
 import { getHQAuth, hqNetAuth } from "./util/intranet/hq-net";
 import { createContext, useContext } from "react";
-import { BuryaCtx } from "src/worker";
+import { BuryaCtx } from "../worker";
 
 export type RootData = {
   tools: ToolGroup[];
@@ -51,7 +51,7 @@
     tools: getTools(request, ctx.hqAuth)
   };
 
-  if (isDedicatedIPPage) rootData.ip = await getIPData(request, ctx.cf, true);
+  if (isDedicatedIPPage) rootData.ip = await getIPData(request, ctx.cf, true, ctx.hqAuth);
   if (ctx.hqAuth) rootData.auth = ctx.hqAuth;
 
   return rootData;
diff --git a/src/app/routes/i226.tsx b/src/app/routes/i226.tsx
index 8baa4e8..3f20ad6 100644
--- a/src/app/routes/i226.tsx
+++ b/src/app/routes/i226.tsx
@@ -58,25 +58,12 @@
                 <title>I-226 LAN</title>

             </Helmet>

             <div>

-                <NetworkHop title="Your device" icon="devices">

-                    <table>

-                        <tbody>

-                            <tr>

-                                <td className="pr-4">

-                                    <p>Local IP:</p>

-                                </td>

-                                <td>

-                                    <code className="font-medium text-type-0">{data.lanIP}</code>

-                                </td>

-                            </tr>

-                        </tbody>

-                    </table>

-                </NetworkHop>

+                <NetworkHop title="Upstream network" icon="public" />

                 <NetworkHop title="I-226 gateway" icon="dns">

                     <table>

                         <tbody>

                             <tr>

-                                <td className="pr-4">

+                                <td className="pr-6">

                                     <p>Gateway IP:</p>

                                 </td>

                                 <td>

@@ -84,7 +71,7 @@
                                 </td>

                             </tr>

                             <tr>

-                                <td className="pr-4">

+                                <td className="pr-6">

                                     <p>Certificate:</p>

                                 </td>

                                 <td>

@@ -92,7 +79,7 @@
                                 </td>

                             </tr>

                             <tr>

-                                <td className="pr-4">

+                                <td className="pr-6">

                                     <p>ARR Logging ID:</p>

                                 </td>

                                 <td>

@@ -100,7 +87,7 @@
                                 </td>

                             </tr>

                             <tr>

-                                <td className="pr-4">

+                                <td className="pr-6">

                                     <p>Handled by:</p>

                                 </td>

                                 <td>

@@ -110,7 +97,20 @@
                         </tbody>

                     </table>

                 </NetworkHop>

-                <NetworkHop title="Upstream network" icon="public" bottom />

+                <NetworkHop title="Your device" icon="devices" bottom>

+                    <table>

+                        <tbody>

+                            <tr>

+                                <td className="pr-6">

+                                    <p>Local IP:</p>

+                                </td>

+                                <td>

+                                    <code className="font-medium text-type-0">{data.lanIP}</code>

+                                </td>

+                            </tr>

+                        </tbody>

+                    </table>

+                </NetworkHop>

             </div>

         </>

     );

diff --git a/src/app/routes/ip.tsx b/src/app/routes/ip.tsx
index 446c235..ecdd8ef 100644
--- a/src/app/routes/ip.tsx
+++ b/src/app/routes/ip.tsx
@@ -1,9 +1,11 @@
 import { json, LinksFunction, LoaderFunction, MetaFunction } from "@remix-run/cloudflare";
 import getIPData, { IPData } from "../util/ip/getIPData";
 import IPDetailsPage from "../components/ip/IPDetailsPage";
+import { BuryaCtx } from "../../worker";
 
 export const loader: LoaderFunction = async ({ request, context }) => {
-  return getIPData(request, context.cf as IncomingRequestCfProperties);
+  const ctx = context as BuryaCtx;
+  return getIPData(request, context.cf as IncomingRequestCfProperties, false, ctx.hqAuth);
 };
 
 export default function IPAddress() {
diff --git a/src/app/util/intranet/hq-net.ts b/src/app/util/intranet/hq-net.ts
index 8d73632..9e1685c 100644
--- a/src/app/util/intranet/hq-net.ts
+++ b/src/app/util/intranet/hq-net.ts
@@ -13,10 +13,14 @@
 });

 

 export async function getHQAuth(request: Request): Promise<hqNetAuth | null> {

-    const jwks = jose.createRemoteJWKSet(new URL("https://jottocraft.cloudflareaccess.com/cdn-cgi/access/certs"));

-    const jwt = request.headers.get("Cf-Access-Jwt-Assertion");

+    // return {

+    //     iat: "today", exp: "tomorrow",

+    //     service: "i226"

+    // };

 

+    const jwt = request.headers.get("Cf-Access-Jwt-Assertion");

     if (!jwt) return null;

+    const jwks = jose.createRemoteJWKSet(new URL("https://jottocraft.cloudflareaccess.com/cdn-cgi/access/certs"));

 

     let payload;

     try {

diff --git a/src/app/util/intranet/i226.ts b/src/app/util/intranet/i226.ts
index 1fad782..e5e7ec7 100644
--- a/src/app/util/intranet/i226.ts
+++ b/src/app/util/intranet/i226.ts
@@ -16,6 +16,17 @@
 }

 

 export function getI226Stats(request: Request, hqAuth: hqNetAuth | null): i226Stats | null {

+    // return {

+    //     lanIP: "1.2.3.4",

+    //     routerIP: "1.2.3.1",

+    //     routerSoftware: "burya-placeholder/1.2.3",

+    //     arrRay: "12345-67890",

+    //     arrCert: {

+    //         o: "i226.net",

+    //         cn: "i226"

+    //     }

+    // };

+

     const lanIP = request.headers.get("X-Forwarded-For")?.split(":")[0];

     const routerIP = request.headers.get("X-Via");

     const routerSoftware = request.headers.get("X-Handled-By");

diff --git a/src/app/util/ip/getIPData.ts b/src/app/util/ip/getIPData.ts
index ed0ce4f..c6dfbc7 100644
--- a/src/app/util/ip/getIPData.ts
+++ b/src/app/util/ip/getIPData.ts
@@ -1,3 +1,6 @@
+import { hqNetAuth } from "../intranet/hq-net";
+import { getI226Stats } from "../intranet/i226";
+
 export type IPData = {
     dedicatedPanel: boolean;
     ip: string;
@@ -20,6 +23,11 @@
         url: string;
     };
     range: string;
+    lan?: {
+        clientIP: string;
+        routerIP: string;
+        label: string;
+    };
 };
 
 export type ISPData = {
@@ -28,7 +36,7 @@
     children?: ISPData[];
 };
 
-export default async function getIPData(request: Request, cf: IncomingRequestCfProperties, dedicatedPanel: boolean = false): Promise<IPData> {
+export default async function getIPData(request: Request, cf: IncomingRequestCfProperties, dedicatedPanel: boolean = false, hqAuth: hqNetAuth | null): Promise<IPData> {
     const ip = request.headers.get("CF-Connecting-IP");
     if (!ip) throw new Error("Unable to retrieve your IP address");
 
@@ -96,15 +104,28 @@
         }
     });
 
+    const data: IPData = {
+        dedicatedPanel,
+        ip,
+        asn: cf.asn,
+        providers: ISPs,
+        rir: rirName,
+        rdapNotices: rdapData.notices,
+        name: rdapData.name,
+        handle: {
+            name: rdapData.handle,
+            url: whoisURL
+        },
+        range: rdapData.startAddress + " - " + rdapData.endAddress
+    };
+
     //Get network description
-    let description;
     if (rdapData.remarks) {
-        description = rdapData.remarks.find(r => r.description)?.description.join("");
+        data.description = rdapData.remarks.find(r => r.description)?.description.join("");
     }
 
-    let geo;
     if ("latitude" in cf) {
-        geo = {
+        data.geo = {
             lat: cf.latitude,
             lon: cf.longitude,
             city: cf.city,
@@ -114,20 +135,15 @@
         }
     }
 
-    return {
-        dedicatedPanel,
-        ip,
-        asn: cf.asn,
-        providers: ISPs,
-        rir: rirName,
-        rdapNotices: rdapData.notices,
-        geo,
-        name: rdapData.name,
-        description,
-        handle: {
-            name: rdapData.handle,
-            url: whoisURL
-        },
-        range: rdapData.startAddress + " - " + rdapData.endAddress
-    };
+    const i226LANData = getI226Stats(request, hqAuth);
+
+    if (i226LANData) {
+        data.lan = {
+            clientIP: i226LANData.lanIP,
+            routerIP: i226LANData.routerIP,
+            label: "via I-226"
+        };
+    }
+
+    return data;
 }
\ No newline at end of file