fix download routing, fix layout shift
This commit is contained in:
@@ -623,7 +623,9 @@ function CalendarDemo() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div class="flex flex-col items-center gap-4">
|
/* Fixed height: the day panel expands into reserved space, never
|
||||||
|
shifts the page (matters most on mobile's stacked layout). */
|
||||||
|
<div class="flex h-[316px] flex-col items-center gap-4">
|
||||||
<IslandPill
|
<IslandPill
|
||||||
campfire="running"
|
campfire="running"
|
||||||
right={
|
right={
|
||||||
|
|||||||
@@ -8,7 +8,20 @@ import { createSignal, Show } from "solid-js";
|
|||||||
import { useDarkMode } from "~/context/darkMode";
|
import { useDarkMode } from "~/context/darkMode";
|
||||||
import { useSite } from "~/context/SiteContext";
|
import { useSite } from "~/context/SiteContext";
|
||||||
|
|
||||||
const NOOK_DOWNLOAD_URL = "https://freno.me/api/downloads/TheNook-0.2.0.zip";
|
/* The appcast's first enclosure always names the latest release dmg. */
|
||||||
|
async function downloadNook() {
|
||||||
|
try {
|
||||||
|
const res = await fetch("/api/TheNook/appcast.xml");
|
||||||
|
const xml = await res.text();
|
||||||
|
const url =
|
||||||
|
xml.match(/<enclosure url="([^"]+\.dmg)"/)?.[1] ??
|
||||||
|
xml.match(/<enclosure url="([^"]+\.zip)"/)?.[1];
|
||||||
|
if (!url) throw new Error("no enclosure");
|
||||||
|
window.location.href = url;
|
||||||
|
} catch {
|
||||||
|
console.error("Could not resolve latest Nook download");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default function NookLanding() {
|
export default function NookLanding() {
|
||||||
const site = useSite();
|
const site = useSite();
|
||||||
@@ -97,7 +110,7 @@ export default function NookLanding() {
|
|||||||
variant="download"
|
variant="download"
|
||||||
size="lg"
|
size="lg"
|
||||||
color={brandColor()}
|
color={brandColor()}
|
||||||
onClick={() => (window.location.href = NOOK_DOWNLOAD_URL)}
|
onClick={downloadNook}
|
||||||
>
|
>
|
||||||
Download trial
|
Download trial
|
||||||
</Button>
|
</Button>
|
||||||
@@ -154,7 +167,7 @@ export default function NookLanding() {
|
|||||||
variant="download"
|
variant="download"
|
||||||
size="lg"
|
size="lg"
|
||||||
color={brandColor()}
|
color={brandColor()}
|
||||||
onClick={() => (window.location.href = NOOK_DOWNLOAD_URL)}
|
onClick={downloadNook}
|
||||||
>
|
>
|
||||||
Download trial
|
Download trial
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const latestAssets: Record<
|
|||||||
> = {
|
> = {
|
||||||
gaze: { prefix: "downloads/Gaze-", ext: ".dmg" },
|
gaze: { prefix: "downloads/Gaze-", ext: ".dmg" },
|
||||||
inputhalo: { prefix: "downloads/InputHalo-", ext: ".dmg" },
|
inputhalo: { prefix: "downloads/InputHalo-", ext: ".dmg" },
|
||||||
thenook: { prefix: "downloads/TheNook-", ext: ".zip" }
|
thenook: { prefix: "downloads/TheNook-", ext: ".dmg" }
|
||||||
};
|
};
|
||||||
|
|
||||||
export const downloadsRouter = createTRPCRouter({
|
export const downloadsRouter = createTRPCRouter({
|
||||||
|
|||||||
Reference in New Issue
Block a user