Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@
];

let copied = $state(false);
let isWindows = $state(false);
const installCommand = $derived(
isWindows ? 'irm https://llama.app/install.ps1 | iex' : 'curl -LsSf https://llama.app/install.sh | bash'
);

$effect(() => {
isWindows = navigator.userAgent.toLowerCase().includes('windows');
});

async function handleCopy() {
navigator.clipboard.writeText('curl -fsSL https://llama.app/install.sh | bash');
navigator.clipboard.writeText(installCommand);
toast.success('Copied to clipboard!');
copied = true;
setTimeout(() => {
Expand Down Expand Up @@ -82,9 +90,7 @@

<div class="bg-foreground/[0.04] w-full max-w-2xl rounded-xl">
<div class="flex items-center justify-between gap-4 px-6 py-5">
<code class="text-foreground/90 font-mono text-[15px]"
>curl -fsSL https://llama.app/install.sh | bash</code
>
<code class="text-foreground/90 font-mono text-[15px]">{installCommand}</code>
<button
class="text-foreground/70 hover:text-foreground cursor-pointer"
aria-label={copied ? 'Copied command' : 'Copy command'}
Expand Down
19 changes: 19 additions & 0 deletions src/routes/install.ps1/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { error } from '@sveltejs/kit';
import type { RequestHandler } from './$types';

export const prerender = true;

export const GET: RequestHandler = async ({ fetch }) => {
const res = await fetch('https://installama.sh/', {
headers: { 'user-agent': 'PowerShell/7.0' }
});
if (!res.ok) {
throw error(502, `Failed to fetch installama.sh: ${res.status}`);
}
const body = await res.text();
return new Response(body, {
headers: {
'content-type': 'text/plain; charset=utf-8'
}
});
};
2 changes: 1 addition & 1 deletion tests/e2e/home.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect, test } from '@playwright/test';
test('home page loads with expected content', async ({ page }) => {
await page.goto('http://localhost:4173/');

await expect(page.getByText('curl -fsSL https://llama.app/install.sh | bash')).toBeVisible();
await expect(page.getByText('curl -LsSf https://llama.app/install.sh | bash')).toBeVisible();

const packageManagersLink = page.getByRole('link', { name: 'Package managers' });
await expect(packageManagersLink).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/page.svelte.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest';
import { render } from 'vitest-browser-svelte';
import HomePage from '../../src/routes/+page.svelte';

const INSTALL_COMMAND = 'curl -fsSL https://llama.app/install.sh | bash';
const INSTALL_COMMAND = 'curl -LsSf https://llama.app/install.sh | bash';

describe('+page.svelte', () => {
it('renders install command and package manager link', async () => {
Expand Down
Loading