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
2 changes: 1 addition & 1 deletion src/apps/r3dr/__tests__/CopyButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function stubClipboard(writeText: (text: string) => Promise<void>) {
})
}

const TEXT = 'https://iili.uk/r/AQA'
const TEXT = 'https://i.iili.uk/r/AQA'

describe('CopyButton', () => {
it('copies the exact text and confirms', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/apps/r3dr/__tests__/R3drPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('R3drPage', () => {
await user.click(screen.getByRole('button', { name: 'Shorten' }))

const recent = await screen.findByRole('region', { name: 'Recent links' })
expect(within(recent).getByRole('link', { name: 'iili.uk/r/AQA' })).toBeDefined()
expect(within(recent).getByRole('link', { name: 'i.iili.uk/r/AQA' })).toBeDefined()
expect(localStorage.getItem('r3dr.recent')).toContain('"AQA"')
})

Expand All @@ -43,7 +43,7 @@ describe('R3drPage', () => {
render(<R3drPage />)

const recent = screen.getByRole('region', { name: 'Recent links' })
expect(within(recent).getByRole('link', { name: 'iili.uk/r/AQA' })).toBeDefined()
expect(within(recent).getByRole('link', { name: 'i.iili.uk/r/AQA' })).toBeDefined()
expect(within(recent).queryByText(/DAA/)).toBeNull()
})

Expand Down
4 changes: 2 additions & 2 deletions src/apps/r3dr/__tests__/ShortenCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const NOW = 1755000000000
const MINUTE = 60 * 1000
const HOUR = 60 * MINUTE
const DAY = 24 * HOUR
const LINK_NAME = 'iili.uk/r/AQA'
const LINK_NAME = 'i.iili.uk/r/AQA'

describe('ShortenCard', () => {
beforeEach(() => {
Expand All @@ -37,7 +37,7 @@ describe('ShortenCard', () => {
expect(api.shorten).toHaveBeenCalledWith('https://example.com/page', NOW + 7 * DAY)
expect(await screen.findByRole('link', { name: LINK_NAME })).toHaveAttribute(
'href',
'https://iili.uk/r/AQA'
'https://i.iili.uk/r/AQA'
)
expect(screen.getByText(/expires in 7 days/)).toBeDefined()
expect(onMinted).toHaveBeenCalledWith({
Expand Down
6 changes: 3 additions & 3 deletions src/apps/r3dr/__tests__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ describe('shorten', () => {
})

describe('shortLink', () => {
it('mints iili.uk short links, labelled sans scheme', () => {
expect(shortLink('AQA')).toBe('https://iili.uk/r/AQA')
expect(shortLinkLabel('AQA')).toBe('iili.uk/r/AQA')
it('mints i.iili.uk short links, labelled sans scheme', () => {
expect(shortLink('AQA')).toBe('https://i.iili.uk/r/AQA')
expect(shortLinkLabel('AQA')).toBe('i.iili.uk/r/AQA')
})
})
7 changes: 4 additions & 3 deletions src/apps/r3dr/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
const API_BASE: string =
(import.meta.env.VITE_R3DR_API_URL as string | undefined) || 'https://api.muchq.com/r3dr/v2'

// Short links live on the standalone site's short domain, whose worker
// 302s /r/{slug} through the same API this page mints against.
const SHORT_LINK_BASE = 'https://iili.uk/r/'
// Short links resolve on i.iili.uk, where Caddy on the consolidated host
// rewrites /r/{slug} onto the same API this page mints against. The
// standalone SPA lives at iili.uk; the short domain only redirects.
const SHORT_LINK_BASE = 'https://i.iili.uk/r/'

export function shortLink(slug: string): string {
// Identity on the slug alphabet; a URL-context barrier for anything else.
Expand Down
1 change: 1 addition & 0 deletions src/shared/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const MENU: MenuGroup[] = [
{ label: 'tty1', to: 'https://tty1.uk', external: true, description: 'Web terminal' },
{ label: '里に春が来ました', to: 'https://sato-ni-haru-ga-kimashita.uk', external: true, description: 'Japanese sentence breakdown' },
{ label: 'p2bx', to: 'https://p2bx.uk', external: true, description: 'Stone–Čech compactification' },
{ label: 'iili', to: 'https://iili.uk', external: true, description: 'URL shortener' },
],
},
{
Expand Down
1 change: 1 addition & 0 deletions src/shared/components/__tests__/Navigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ describe('Navigation', () => {
[/^tty1\s?\(external site\)/, 'https://tty1.uk', 'Web terminal'],
[/^里に春が来ました\s?\(external site\)/, 'https://sato-ni-haru-ga-kimashita.uk', 'Japanese sentence breakdown'],
[/^p2bx\s?\(external site\)/, 'https://p2bx.uk', 'Stone–Čech compactification'],
[/^iili\s?\(external site\)/, 'https://iili.uk', 'URL shortener'],
]
for (const [name, href, description] of expected) {
const link = group.getByRole('link', { name })
Expand Down
Loading