Initial commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
.git
|
||||
.gitignore
|
||||
.gitea
|
||||
.react-router
|
||||
build
|
||||
dist
|
||||
node_modules
|
||||
logs
|
||||
*.log
|
||||
.env
|
||||
.env.*
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
.editorconfig
|
||||
.vscode
|
||||
.idea
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Build and publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- staging
|
||||
paths:
|
||||
- app/**
|
||||
- scripts/**
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- react-router.config.ts
|
||||
- vite.config.ts
|
||||
- tsconfig.json
|
||||
- Dockerfile
|
||||
- .dockerignore
|
||||
- .gitea/workflows/build.yml
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v4
|
||||
with:
|
||||
registry: git.fossy.my.id
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push main
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please-frontend:latest
|
||||
- name: Build and push staging
|
||||
if: github.ref == 'refs/heads/staging'
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please-frontend:staging
|
||||
@@ -0,0 +1,8 @@
|
||||
.DS_Store
|
||||
.env
|
||||
/node_modules/
|
||||
/dist/
|
||||
|
||||
# React Router
|
||||
/.react-router/
|
||||
/build/
|
||||
@@ -0,0 +1,703 @@
|
||||
---
|
||||
version: alpha
|
||||
name: tunel.live / Field Guide
|
||||
description: Light-first design system for the hosted tunel.live service, with a working SSH command builder, real regional choices, and a restrained self-hosting path.
|
||||
colors:
|
||||
primary: "#16323C"
|
||||
primary-hover: "#214B57"
|
||||
on-primary: "#FFFFFF"
|
||||
body: "#334E58"
|
||||
muted: "#586C72"
|
||||
canvas: "#F4F7F6"
|
||||
surface: "#FFFFFF"
|
||||
surface-subtle: "#E7EFED"
|
||||
border: "#C7D3D0"
|
||||
action: "#006B7D"
|
||||
go-blue: "#00ADD8"
|
||||
safety-orange: "#F28C28"
|
||||
accent-soft: "#FDF0DF"
|
||||
terminal-bg: "#102930"
|
||||
terminal-text: "#EAF6FA"
|
||||
success: "#1F6B4F"
|
||||
success-bg: "#E5F3EB"
|
||||
warning: "#7A430C"
|
||||
warning-bg: "#FFF0DC"
|
||||
error: "#A52A45"
|
||||
error-bg: "#F9E8EC"
|
||||
typography:
|
||||
h1:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 64px
|
||||
fontWeight: 500
|
||||
lineHeight: 1.05
|
||||
letterSpacing: -0.03em
|
||||
h1-small-screen:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 40px
|
||||
fontWeight: 500
|
||||
lineHeight: 1.1
|
||||
letterSpacing: -0.025em
|
||||
h2:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 40px
|
||||
fontWeight: 500
|
||||
lineHeight: 1.15
|
||||
letterSpacing: -0.025em
|
||||
h3:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 24px
|
||||
fontWeight: 500
|
||||
lineHeight: 1.3
|
||||
letterSpacing: -0.015em
|
||||
body-lg:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 18px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.6
|
||||
letterSpacing: 0em
|
||||
body-md:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 16px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.6
|
||||
letterSpacing: 0em
|
||||
body-sm:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 14px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.5
|
||||
letterSpacing: 0em
|
||||
navigation:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 15px
|
||||
fontWeight: 500
|
||||
lineHeight: 1.4
|
||||
letterSpacing: 0em
|
||||
button:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 15px
|
||||
fontWeight: 600
|
||||
lineHeight: 1
|
||||
letterSpacing: 0em
|
||||
code:
|
||||
fontFamily: IBM Plex Mono
|
||||
fontSize: 15px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.6
|
||||
letterSpacing: 0em
|
||||
caption:
|
||||
fontFamily: IBM Plex Sans
|
||||
fontSize: 13px
|
||||
fontWeight: 400
|
||||
lineHeight: 1.5
|
||||
letterSpacing: 0em
|
||||
rounded:
|
||||
none: 0px
|
||||
sm: 4px
|
||||
md: 8px
|
||||
lg: 12px
|
||||
spacing:
|
||||
2xs: 4px
|
||||
xs: 8px
|
||||
sm: 12px
|
||||
md: 16px
|
||||
lg: 24px
|
||||
xl: 32px
|
||||
2xl: 48px
|
||||
3xl: 64px
|
||||
section: 96px
|
||||
gutter: 24px
|
||||
components:
|
||||
page:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.primary}"
|
||||
typography: "{typography.body-md}"
|
||||
button-primary:
|
||||
backgroundColor: "{colors.primary}"
|
||||
textColor: "{colors.on-primary}"
|
||||
typography: "{typography.button}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
button-primary-hover:
|
||||
backgroundColor: "{colors.primary-hover}"
|
||||
textColor: "{colors.on-primary}"
|
||||
typography: "{typography.button}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
button-secondary:
|
||||
backgroundColor: "{colors.surface-subtle}"
|
||||
textColor: "{colors.primary}"
|
||||
typography: "{typography.button}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
navigation-link:
|
||||
backgroundColor: "{colors.canvas}"
|
||||
textColor: "{colors.muted}"
|
||||
typography: "{typography.navigation}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
text-link:
|
||||
textColor: "{colors.action}"
|
||||
typography: "{typography.body-md}"
|
||||
selection:
|
||||
backgroundColor: "{colors.action}"
|
||||
textColor: "{colors.on-primary}"
|
||||
content-panel:
|
||||
backgroundColor: "{colors.surface}"
|
||||
textColor: "{colors.primary}"
|
||||
rounded: "{rounded.md}"
|
||||
padding: 32px
|
||||
quiet-panel:
|
||||
backgroundColor: "{colors.surface-subtle}"
|
||||
textColor: "{colors.body}"
|
||||
rounded: "{rounded.md}"
|
||||
padding: 24px
|
||||
field:
|
||||
backgroundColor: "{colors.surface}"
|
||||
textColor: "{colors.primary}"
|
||||
typography: "{typography.body-md}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
segmented-control:
|
||||
backgroundColor: "{colors.surface-subtle}"
|
||||
textColor: "{colors.body}"
|
||||
typography: "{typography.button}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 4px
|
||||
segment-selected:
|
||||
backgroundColor: "{colors.primary}"
|
||||
textColor: "{colors.on-primary}"
|
||||
typography: "{typography.button}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
server-option:
|
||||
backgroundColor: "{colors.surface}"
|
||||
textColor: "{colors.body}"
|
||||
rounded: "{rounded.md}"
|
||||
padding: 16px
|
||||
server-option-selected:
|
||||
backgroundColor: "{colors.surface-subtle}"
|
||||
textColor: "{colors.primary}"
|
||||
rounded: "{rounded.md}"
|
||||
padding: 16px
|
||||
terminal:
|
||||
backgroundColor: "{colors.terminal-bg}"
|
||||
textColor: "{colors.terminal-text}"
|
||||
typography: "{typography.code}"
|
||||
rounded: "{rounded.md}"
|
||||
padding: 24px
|
||||
route-connector:
|
||||
backgroundColor: "{colors.action}"
|
||||
height: 2px
|
||||
route-endpoint:
|
||||
backgroundColor: "{colors.primary}"
|
||||
rounded: "{rounded.sm}"
|
||||
size: 8px
|
||||
brand-accent:
|
||||
backgroundColor: "{colors.go-blue}"
|
||||
size: 8px
|
||||
mascot-accent:
|
||||
backgroundColor: "{colors.safety-orange}"
|
||||
size: 8px
|
||||
mascot-note:
|
||||
backgroundColor: "{colors.accent-soft}"
|
||||
textColor: "{colors.primary}"
|
||||
rounded: "{rounded.lg}"
|
||||
padding: 24px
|
||||
divider:
|
||||
backgroundColor: "{colors.border}"
|
||||
height: 1px
|
||||
status-success:
|
||||
backgroundColor: "{colors.success-bg}"
|
||||
textColor: "{colors.success}"
|
||||
typography: "{typography.body-sm}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
status-warning:
|
||||
backgroundColor: "{colors.warning-bg}"
|
||||
textColor: "{colors.warning}"
|
||||
typography: "{typography.body-sm}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
status-error:
|
||||
backgroundColor: "{colors.error-bg}"
|
||||
textColor: "{colors.error}"
|
||||
typography: "{typography.body-sm}"
|
||||
rounded: "{rounded.sm}"
|
||||
padding: 12px
|
||||
---
|
||||
|
||||
# tunel.live website design system
|
||||
|
||||
This file governs the **hosted tunel.live website** and its landing-page command configurator. The hosted service is the primary path. The separately deployable **Tunnel Please** server remains available as a secondary self-hosting path.
|
||||
|
||||
The current `https://tunel.live/` site is a functional and content reference, **not** a visual reference. Preserve its useful command-building workflow, free/no-registration access, location choices, protocol choices, and optional sign-in. Replace its dark Geist/emerald template, centered presentation, generic feature cards, unsupported trust claims, and stale navigation/content rather than reskinning them.
|
||||
|
||||
This file does not prescribe a signed-in dashboard redesign or invent paid plans.
|
||||
|
||||
## Overview
|
||||
|
||||
**Design direction: a useful network utility presented like a well-made technical field guide.** The visitor should be able to configure and copy a valid SSH command without first reading a long sales pitch. The visual identity comes from exact controls, readable output, clear routes, and a restrained miner-gopher/Go-blue connection to the underlying project.
|
||||
|
||||
The primary audience is developers and technical small teams who need a hosted public endpoint for a local service. A secondary audience wants to deploy the Tunnel Please server on its own infrastructure.
|
||||
|
||||
The first screen must answer:
|
||||
|
||||
1. What is it? A free hosted SSH reverse-tunnel service at tunel.live.
|
||||
2. What can I do? Give a local app an HTTP/HTTPS address or forward a supported TCP port.
|
||||
3. Do I need an account? Not for ordinary HTTP/HTTPS or TCP tunnels. Custom domains and signed-in features require authentication; saved-configuration/history benefits must be verified before being promoted.
|
||||
4. What happens next? Choose a server and guest-supported forwarding mode, enter the local port, copy the generated command, run it, then use the public address shown in the terminal.
|
||||
|
||||
### Experience principles
|
||||
|
||||
- **The tool is the hero.** The command builder is authentic product evidence. Do not replace it with decorative network art or a fictional dashboard.
|
||||
- **Hosted first, self-hosted second.** The main action is **Configure a tunnel**. Self-hosting remains visible but does not compete with trying tunel.live.
|
||||
- **No registration wall for core tunnels.** Keep HTTP/HTTPS and TCP configuration and command copying available to guests. Custom domain selection has a clear sign-in requirement, not a surprise interstitial after configuration.
|
||||
- **Real choices, not fake metrics.** Use a verified, maintained source for server names, protocols, and port ranges. The current browser bundle contains a static 3-server snapshot behind an artificial delay; do not present that as a live inventory response. Latency is actually measured in the visitor's browser or honestly marked unavailable.
|
||||
- **Plain-language trust.** Explain what SSH and HTTPS protect without claiming universal end-to-end encryption, anonymity, private tunnels, or guaranteed reliability.
|
||||
- **Progressive disclosure.** Show only fields relevant to the selected forwarding mode. Keep advanced deployment and controller details out of the landing page.
|
||||
- **One recognizable motif.** A simple labeled route line explains the relationship between a visitor, the selected tunel.live server, the SSH connection, and the local app.
|
||||
- **Restrained character.** The existing miner gopher may appear once beside a useful instruction. It is not a substitute for the configurator.
|
||||
|
||||
The desired impression is **direct, competent, approachable, and operational**. A visitor should think “I can run this now,” not “this is another generated SaaS template.”
|
||||
|
||||
## Colors
|
||||
|
||||
The palette comes from the Tunnel Please terminal and miner-gopher artwork: Go blue, safety orange, deep petroleum ink, and cool mineral neutrals. It deliberately replaces the current site's dark-gray/emerald/Geist appearance and avoids purple gradients, gradient text, glowing cyan, and decorative grids.
|
||||
|
||||
Most of the page is canvas, white surface, and ink. Blue and orange are small accents. Orange is not a default button color, and bright Go blue is never body text on a light background.
|
||||
|
||||
### Core roles
|
||||
|
||||
- **Primary** ({colors.primary} — #16323C): Headings, wordmark, primary-button fill, selected segments, and high-emphasis content.
|
||||
- **Primary hover** ({colors.primary-hover} — #214B57): Primary-button hover. Lighten without moving or scaling the control.
|
||||
- **On primary** ({colors.on-primary} — #FFFFFF): Text on primary and selected controls.
|
||||
- **Body** ({colors.body} — #334E58): Paragraphs, field values, radio descriptions, and longer copy.
|
||||
- **Muted** ({colors.muted} — #586C72): Captions, inactive navigation, secondary metadata, and form-control borders. At full strength it has sufficient contrast; never fade it into unreadability.
|
||||
- **Canvas** ({colors.canvas} — #F4F7F6): Default page floor. Cool mineral, not generic cream/beige.
|
||||
- **Surface** ({colors.surface} — #FFFFFF): Configurator, fields, location options, and the existing white-background mascot asset.
|
||||
- **Subtle surface** ({colors.surface-subtle} — #E7EFED): Selected location background, segmented-control track, and quiet grouped content.
|
||||
- **Border** ({colors.border} — #C7D3D0): Non-interactive separators only. It is too faint to be the sole indicator of a field, selected option, focus, or status.
|
||||
|
||||
### Brand and interaction roles
|
||||
|
||||
- **Action** ({colors.action} — #006B7D): Links, selected-option outlines, meaningful route lines, and keyboard focus.
|
||||
- **Go blue** ({colors.go-blue} — #00ADD8): Small brand details on light surfaces, where its 2.45:1 canvas contrast means it cannot carry information by itself. It is also the focus-ring color on `terminal-bg`, where its 5.77:1 contrast makes focus visible.
|
||||
- **Safety orange** ({colors.safety-orange} — #F28C28): A tiny decorative echo of the gopher's helmet and vest. Do not use it as the sole status indicator, a glow, or a stripe on every card.
|
||||
- **Soft accent** ({colors.accent-soft} — #FDF0DF): Background for the optional single mascot note.
|
||||
|
||||
### Terminal and semantic roles
|
||||
|
||||
- **Terminal background** ({colors.terminal-bg} — #102930): Generated SSH command blocks only; the whole marketing page does not become a dark terminal theme.
|
||||
- **Terminal text** ({colors.terminal-text} — #EAF6FA): Command and endpoint content.
|
||||
- **Success / warning / error** ({colors.success}, {colors.warning}, {colors.error}): Text paired with their corresponding backgrounds. Status always includes words or an icon as well as color.
|
||||
- **Success / warning / error backgrounds** ({colors.success-bg}, {colors.warning-bg}, {colors.error-bg}): Real validation, connection, or copy feedback only. Never reuse these as generic feature-card backgrounds.
|
||||
|
||||
Verified pairs include white on primary (13.50:1), body on canvas (8.22:1), muted on canvas (5.12:1), action on canvas (5.73:1), terminal text on terminal background (13.79:1), and primary on safety orange (5.50:1). Re-check every new pairing.
|
||||
|
||||
## Typography
|
||||
|
||||
Use **IBM Plex Sans** for reading, controls, and UI and **IBM Plex Mono** only for generated commands, hostnames, addresses, ports, and values people copy. Do not reuse the current Geist/Geist Mono pairing or substitute Inter, Space Grotesk, or an italic serif accent.
|
||||
|
||||
Self-host the required WOFF2 subsets where licensing permits, preload only the primary regular face, and use `font-display: swap`. Suitable fallbacks are `"IBM Plex Sans", "Segoe UI", sans-serif` and `"IBM Plex Mono", "SFMono-Regular", Consolas, monospace`.
|
||||
|
||||
### Hierarchy rules
|
||||
|
||||
- Use {typography.h1} once on the page and {typography.h1-small-screen} below 640px.
|
||||
- Use {typography.h2} for major sections and {typography.h3} for form groups and subsections. Small-screen h2 may render at 32px.
|
||||
- Use {typography.body-lg} for hero support and {typography.body-md} for controls and normal content.
|
||||
- Keep explanatory text around 60–75 characters per line. Left-align; never justify.
|
||||
- Use only 400, 500, and 600 weights. Prefer hierarchy through size, placement, and spacing over extra-bold text.
|
||||
- Use sentence case. No all-caps eyebrows, tiny section numbers, random badges, or crushed tracking.
|
||||
- Use `text-wrap: balance` for short headings and `text-wrap: pretty` for paragraphs as progressive enhancements.
|
||||
- Monospace is for technical values, not a general developer aesthetic. Navigation, field labels, buttons, and helper text stay in Plex Sans.
|
||||
- Tabular technical values such as ports and latency use appropriate numeric font features. Do not use tiny text to fit them.
|
||||
- Layouts must survive 200% text zoom and user line-height overrides without overlap or clipping.
|
||||
|
||||
## Layout
|
||||
|
||||
Use a fluid grid inside a **1200px maximum container**. The configurator may use approximately 1080px; explanatory reading stays around 680px.
|
||||
|
||||
- **Desktop:** 12 columns, 24px gutters, 32–48px page gutters.
|
||||
- **Tablet:** 8 columns, 20px gutters, 32px page gutters.
|
||||
- **Mobile:** one content column, 16px internal gaps, 20px page gutters.
|
||||
- **Sections:** {spacing.section} (96px) on large screens and {spacing.3xl} (64px) on small screens.
|
||||
- **Scale:** only {spacing.2xs} through {spacing.section}, plus content-driven gutters. Related controls stay closer than separate groups.
|
||||
|
||||
Design and inspect at 375px, 768px, 1024px, and 1440px. Reflow around 768px and 1024px as the content requires. Support 320px without horizontal page scrolling.
|
||||
|
||||
### Composition
|
||||
|
||||
- **Hero:** a compact asymmetric text composition with proposition/actions on the left and a short orientation note on the right. The actual configurator begins in the opening desktop viewport. Do not repeat the same command in a decorative hero card and again in the form.
|
||||
- **Configurator:** the first major visual and the core of the opening composition—a white working surface with controls on the left and generated command on the right on wide screens. On mobile, controls come first and command output follows; no sticky output covers fields or focused content.
|
||||
- **Location options:** 3 selectable options on wide screens, one column on mobile. They are functional radio controls, not decorative feature cards.
|
||||
- **Form groups:** use labels, spacing, and restrained dividers before adding panels. No nested cards inside cards.
|
||||
- **How it works:** a readable route explanation and security notes share the same section so the visitor sees operational consequences in context.
|
||||
- **Self-hosting:** a short secondary band aligned to the same grid, not a competing enterprise CTA.
|
||||
- **Alignment:** labels, fields, route text, and command output share visible edges. No arbitrary floating overlap.
|
||||
|
||||
The header is static by default. If sticky behavior is later justified, use a solid surface, add `scroll-margin` to anchored sections, and keep all focused content visible below it. No glass-blur header.
|
||||
|
||||
## Elevation & Depth
|
||||
|
||||
The system is predominantly flat. Hierarchy comes from typography, spacing, contrast, and selected states.
|
||||
|
||||
- Standard content and configurator surfaces use 1px {colors.border} and **no shadow**.
|
||||
- Interactive field borders use {colors.muted}; selected/focused borders use {colors.action}. Do not rely on the faint decorative border token for control identification.
|
||||
- Use either an outline or a shadow, not both as a styling recipe.
|
||||
- The only shadow allowed is for a real overlay such as a small menu: `0 8px 30px rgb(22 50 60 / 12%)`.
|
||||
- No glow, neon edges, ambient spotlights, hard offset shadows, floating orbs, or soft shadows around every option.
|
||||
- Dark command output represents a terminal. It is not decorative elevation.
|
||||
|
||||
## Shapes
|
||||
|
||||
The shape language is **workmanlike and slightly softened**.
|
||||
|
||||
- Inputs, buttons, segmented controls: {rounded.sm} (4px).
|
||||
- Configurator, location options, and terminal output: {rounded.md} (8px).
|
||||
- Optional mascot note: {rounded.lg} (12px).
|
||||
- Dividers and route lines: {rounded.none} with square ends.
|
||||
- Do not give every element the same radius; controls, panels, and terminal output need distinct roles.
|
||||
- Avoid pill-shaped containers around every label, 24–32px card radii, decorative side tabs, and circular icon tiles.
|
||||
|
||||
The route motif uses a 2px {colors.action} connector and {colors.primary} endpoints. Go-blue/orange details are decorative and redundant. No decorative grid, circuitry, or animated packet field.
|
||||
|
||||
## Components
|
||||
|
||||
### Wordmark and navigation
|
||||
|
||||
Use **tunel.live** as the public hosted-service wordmark in IBM Plex Sans 600. Keep `tunel` and `.live` the same solid color; no gradient or green/emerald carryover is required. The underlying project name **Tunnel Please** belongs in self-hosting and source content.
|
||||
|
||||
Desktop navigation:
|
||||
|
||||
- **Product** → `/#product`
|
||||
- **Configure** → `/#configure`
|
||||
- **How it works** → `/#how-it-works`
|
||||
- **Self-host** → `/#self-host`
|
||||
- **Source** → `https://git.fossy.my.id/bagas/tunnel-please`
|
||||
- **Sign in** → `/login`, as a quiet text/secondary action rather than the loudest button
|
||||
|
||||
Do not add Pricing, Customers, Dashboard, Terms, Privacy, or Support links until their real destinations and content exist. Current 404 destinations must not be reproduced as finished navigation.
|
||||
|
||||
Mobile uses a Menu button with `aria-expanded` and `aria-controls`, an inline expanding region, Escape support, logical focus order, and 44×44px minimum targets.
|
||||
|
||||
### Hero actions
|
||||
|
||||
- Primary: **Configure a tunnel** → `/#configure`.
|
||||
- Secondary text link: **Self-host the server** → `/#self-host`.
|
||||
- Do not add a second filled CTA beside the primary action.
|
||||
- Buttons, fields, and segmented controls use a **minimum** height of 48px, never a fixed height; text zoom and helper/error content must allow them to grow.
|
||||
- Hover changes color without moving the control. Focus uses a visible 2px {colors.action} ring with a 3px offset on light surfaces and a 2px {colors.go-blue} ring on `terminal-bg`.
|
||||
- Text links stay underlined. Sign in is not required before accessing HTTP/HTTPS or TCP configuration.
|
||||
|
||||
### Tunnel configurator
|
||||
|
||||
The configurator is the core workflow and must remain usable to guests.
|
||||
|
||||
#### 1. Server location
|
||||
|
||||
Present real location options as a labeled radio group. At the time of research, the deployed configurator exposed:
|
||||
|
||||
- Chicago, United States — `us.tunel.live`
|
||||
- Frankfurt, Germany — `eu.tunel.live`
|
||||
- Singapore, Singapore — `sgp.tunel.live`
|
||||
|
||||
The current public bundle returns these 3 entries from a hardcoded array after an artificial 2-second delay; no inventory API was identified during research. Remove the fake delay. Prefer one maintained service configuration shared by frontend and backend. If that source is not available for this redesign, use a clearly maintained static snapshot like the verified list above and do not call it a live response or display fictitious fetch/loading states. Do not repeat the stale Indonesia claim unless that location is actually supported and selectable.
|
||||
|
||||
Each option shows city, country, hostname, supported protocols, and real latency state. Selection uses a 2px {colors.action} outline, subtle surface, and the word **Selected** or a labeled check icon. Do not use a green dot alone.
|
||||
|
||||
Latency rules:
|
||||
|
||||
- Measure from the visitor's browser to the selected endpoint using the deployed mechanism.
|
||||
- Show **Checking latency…** while measuring and **Latency unavailable** on failure.
|
||||
- Never fabricate millisecond values, “Excellent/Poor” scores, or a recommended location from static mock data.
|
||||
- If locality guidance is useful, explain that lower measured delay is one factor; do not promise tunnel throughput from a single ping.
|
||||
|
||||
#### 2. Forwarding mode
|
||||
|
||||
Use a segmented or radio control for **HTTP/HTTPS**, **TCP**, and **Custom domain**.
|
||||
|
||||
- HTTP/HTTPS and TCP remain usable by guests. HTTP/HTTPS exposes server port **443 (HTTPS)** or **80 (HTTP)**.
|
||||
- TCP exposes a supported remote server port and requires the configured local destination port. The observed static range was `20000–21000`; maintain/verify this configuration rather than presenting it as an API-discovered fact.
|
||||
- The current guest behavior for Custom domain is an authentication gate, not another domain form. When a guest selects it, show **Custom Domain Requires Sign In**, explain that domain ownership verification/DNS management requires an account, keep their existing HTTP/TCP selections intact, and provide **Sign in to use custom domains** → `/login`. Signed-in selection continues to `/custom-domain`, the existing deployed route.
|
||||
- Do not show an unauthenticated Domain field, silently substitute custom subdomains, invent automatic DNS setup, or force sign in for ordinary HTTP/HTTPS and TCP tunnels.
|
||||
- Use descriptive helper text. HTTP is not encrypted, and raw TCP receives no automatic TLS wrapper.
|
||||
|
||||
#### 3. Local service details
|
||||
|
||||
- Use persistent visible labels such as **Local port** and, for guest TCP configuration, **Server port**. Custom-domain inputs belong on the authenticated `/custom-domain` route, outside this guest flow.
|
||||
- `8000` may be shown as an example/default consistent with the deployed configurator, but the user must be able to change it.
|
||||
- Validate numeric ports as integers in the appropriate allowed range. Put specific errors beside the field and retain valid inputs.
|
||||
- On invalid input, retain but visibly label the **Previous valid command**, explain that it does not include the invalid edits, and disable copying until corrected. Never silently copy a stale or newly invalid command.
|
||||
- Placeholder text never replaces a label.
|
||||
- Use actual input types, keyboard operation, and accessible descriptions, not clickable generic divs.
|
||||
- Reveal only fields relevant to the chosen guest mode; do not hide essential explanation in an info-icon tooltip.
|
||||
|
||||
#### 4. Generated command
|
||||
|
||||
Display the resulting SSH command immediately as real selectable text in {components.terminal}. The default illustrative state may use:
|
||||
|
||||
```bash
|
||||
ssh sgp.tunel.live -p 2200 -R 443:localhost:8000
|
||||
```
|
||||
|
||||
Label it **Singapore · HTTPS · local port 8000** so the example is not mistaken for every user's final configuration. Update host, server port, and local port from the actual selections. For signed-in HTTP/HTTPS/TCP users, retain the deployed generator's authenticated destination form: `ssh <SSH_IDENTIFIER>@<HOST> -p 2200 -R <SERVER_PORT>:localhost:<LOCAL_PORT>`, using the real session's `sshIdentifier`. Never hardcode a guest destination for an authenticated session or invent an identifier.
|
||||
|
||||
Include:
|
||||
|
||||
- **Copy command** with a visible text label.
|
||||
- A polite **Copied** confirmation after success and a useful failure fallback that keeps the text selectable.
|
||||
- Use the assigned public address, not the bare SSH host, and derive scheme/authority from the actual selections: HTTPS/443 → `Internet → https://<assigned-subdomain>.<HOST> → localhost:8000`; HTTP/80 → `Internet → http://<assigned-subdomain>.<HOST> → localhost:8000`; TCP → `Internet → <HOST>:<TCP_PORT> → localhost:8000`. For the default Singapore/HTTPS example, `<HOST>` is `sgp.tunel.live`.
|
||||
- The reminder **Run this in your terminal and keep the SSH session open while using the tunnel.**
|
||||
- A post-command step: **Use the public URL or endpoint shown in your terminal after connecting.** For HTTP tunnels, that is the assigned subdomain, not merely `sgp.tunel.live:443`.
|
||||
|
||||
Do not show **Start tunnel** unless the website itself can actually perform that operation. Copying a command is the action; never fake deployment progress, an assigned URL before the server issues one, or a connected state.
|
||||
|
||||
On mobile, use a contained, keyboard-reachable horizontal code scroller if needed. Keep the copy button outside it.
|
||||
|
||||
#### Loading, empty, and failure states
|
||||
|
||||
- Do not reproduce the bundle's artificial 2-second loading state. If the implementation later fetches a real inventory/configuration endpoint, then show stable lightweight field skeletons and **Loading available servers…**, not a full-screen spinner.
|
||||
- A real inventory request failure should say locations could not be loaded, provide **Try again**, and retain valid selections. A maintained static snapshot needs no fabricated network-error state.
|
||||
- If JavaScript is unavailable, keep the static server details, an illustrative guest command, and self-host source link readable. Do not leave a blank configuration card.
|
||||
- Do not report a live tunnel or connected server merely because the form loaded successfully. Actual browser latency checks still have their own honest checking/failure states.
|
||||
|
||||
### Optional sign-in explanation
|
||||
|
||||
Place one quiet sentence near the configurator or header:
|
||||
|
||||
> HTTP/HTTPS and TCP tunnels need no registration. Sign in to use custom domains or access account features.
|
||||
|
||||
The current hosted site claims saved configurations and history; verify that functionality and its authenticated command behavior before adding those specific benefits back to public copy. Never expand into usage statistics, sync, premium, or priority support without evidence. Do not show a fake dashboard preview or paid-plan upsell.
|
||||
|
||||
### Route explanation
|
||||
|
||||
Use 3 labeled locations: visitor/webhook provider, selected tunel.live server/public endpoint, and developer's machine/local app. Explain **setup separately from traffic**:
|
||||
|
||||
1. **Setup:** the developer's SSH client establishes an outbound connection to the selected tunel.live server and requests remote forwarding. It must stay open.
|
||||
2. **Incoming request:** the visitor connects to the assigned public HTTP subdomain or selected TCP endpoint.
|
||||
3. **Forwarding:** the server forwards the request through the existing SSH connection to the local app; responses return in the opposite direction.
|
||||
|
||||
Do not draw SSH as a separate network hop, and do not imply requests originate at the local app. Provide the complete explanation as adjacent text. Meaningful connectors and endpoints meet 3:1 non-text contrast.
|
||||
|
||||
### Security notes
|
||||
|
||||
Use a quiet but visible note in the How-it-works section, not a tooltip or footer disclaimer:
|
||||
|
||||
- A tunnel can make an app reachable to others. Protect sensitive applications with their own authorization.
|
||||
- SSH encrypts the connection between the local machine and the tunnel server. This is not a blanket promise of end-to-end encryption between every visitor and local app.
|
||||
- Choose HTTPS for encrypted visitor connections where supported. HTTP and raw TCP need separate protection.
|
||||
- Closing the SSH session removes the connection-scoped tunnel.
|
||||
- The hosted service intentionally allows tunnel creation without registration; do not imply that a public address is private or authenticated.
|
||||
|
||||
The self-host section additionally warns:
|
||||
|
||||
> Standalone interactive SSH forwarding currently accepts connections without SSH account authentication. Restrict a self-hosted server's SSH port to trusted networks and clients with deployment-level controls; do not expose it to untrusted networks. Review node/controller deployments separately before making them reachable.
|
||||
|
||||
### Mascot note
|
||||
|
||||
The existing `docs/images/gopher.png` may appear once beside **Keep the terminal open while your tunnel is connected.** Use a modest size, preserve its aspect ratio, and place the current white-background asset on {colors.surface}. Do not recolor, AI-redraw, shrink it into a logo, or put it on serious security/error messaging. Omit it when it adds no useful information.
|
||||
|
||||
### Footer
|
||||
|
||||
Use concise groups:
|
||||
|
||||
- **Product:** Configure (`/#configure`), How it works (`/#how-it-works`), Self-host (`/#self-host`), Sign in (`/login`).
|
||||
- **Project:** Source (`https://git.fossy.my.id/bagas/tunnel-please`), Issues (`https://git.fossy.my.id/bagas/tunnel-please/issues`), License (`https://git.fossy.my.id/bagas/tunnel-please/src/branch/main/LICENSE.md`).
|
||||
- **Service:** include this group only when the external status page is operational; then link **Status** to `https://status.fossy.my.id/status/services`. Otherwise omit the entire group rather than render an empty heading or dead link.
|
||||
|
||||
Do not add dead Terms/Privacy/Support links, a newsletter form, social-icon cloud, customer logos, or repetitive final-signup banner.
|
||||
|
||||
## Do's and Don'ts
|
||||
|
||||
| Do | Don't |
|
||||
|---|---|
|
||||
| Put the working command builder and real hosted workflow at the center. | Replace the tool with generic 3D network art or a fictional dashboard. |
|
||||
| Say the current service is free and requires no registration for basic use. | Invent pricing, paid tiers, trials, premium benefits, or a signup wall. |
|
||||
| Show actual location inventory and honest measured/unavailable latency. | Use random ping values, fake speed scores, or unsupported global-performance claims. |
|
||||
| Explain SSH, HTTPS, public reachability, and session lifetime precisely. | Say “secure by default,” “end-to-end encrypted,” “private,” or “zero logs” as blanket promises. |
|
||||
| Use cool neutral surfaces, IBM Plex, small radii, and restrained brand accents. | Preserve the current dark Geist/emerald theme or add purple gradients, glow, neon, glass, or decorative grids. |
|
||||
| Use labels, proximity, and dividers to organize the configurator. | Add icon-tile feature cards, nested cards, side stripes, or a shadow to every control. |
|
||||
| Use the gopher once beside a useful terminal instruction, if at all. | Generate a replacement mascot or scatter gopher art across every section. |
|
||||
| Use direct, concrete copy and functional status messages. | Use “fast and reliable,” “next-gen,” “seamless,” “supercharge,” or meaningless “LIVE” pills. |
|
||||
| Keep all user-entered values after validation and service errors. | Clear the form, hide the command, or pretend a failure is a successful connection. |
|
||||
| Link only to real, working destinations. | Reproduce the current dead Terms, Privacy, Support, or fallback Dashboard links as finished features. |
|
||||
| Let content stay visible without animation or JavaScript where practical. | Use scroll reveals, marquees, decorative terminal typing, pulsing dots, or bouncing controls. |
|
||||
| Publish only attributable product evidence. | Add fake customers, avatars, GitHub counts, SLA numbers, usage stats, or testimonials. |
|
||||
|
||||
## Website scope and information architecture
|
||||
|
||||
The initial hosted website needs:
|
||||
|
||||
- **Landing/configurator (`/`):** understand the hosted offer, configure a command, learn how routing works, and find the self-host option.
|
||||
- **Sign in (`/login`):** retain the existing optional account entry. Its visual redesign is a separate task.
|
||||
- **Tunnel unavailable (`/tunnel-not-found`):** support the server's `?slug=<slug>` redirect contract.
|
||||
- **Not found:** an ordinary 404 with links to Home and the configurator.
|
||||
- **Self-host/source:** link to the real Tunnel Please repository rather than inventing a hosted documentation portal in this design pass.
|
||||
|
||||
Do not create a browser tunnel dashboard, pricing flow, traffic inspector, request replay UI, analytics screen, or admin console as part of this landing-page redesign.
|
||||
|
||||
### Landing-page sequence
|
||||
|
||||
1. **Header:** tunel.live wordmark, mapped navigation, Source, Sign in.
|
||||
2. **Compact hero (`#product`):** hosted-service proposition and orientation only, with the configurator beginning in the opening desktop viewport. Primary action moves focus to it; self-host is the quiet alternative. Do not repeat a decorative command card.
|
||||
3. **Configurator (`#configure`):** verified location configuration, guest HTTP/HTTPS/TCP modes, custom-domain sign-in gate, local-service fields, live command output, copy interaction, post-command URL guidance, and honest latency states.
|
||||
4. **How it works (`#how-it-works`):** accurate route diagram, session lifetime, and security notes. No separate generic feature-card grid.
|
||||
5. **Self-host (`#self-host`):** concise Tunnel Please deployment path, domain requirement, Compose availability, source link, and standalone access warning.
|
||||
6. **Footer:** concise working links only. No repetitive CTA banner.
|
||||
|
||||
Do not add a separate “Global Network,” “Flexible Configuration,” or “100% Free Service” card section just to repeat what the hero and configurator already demonstrate.
|
||||
|
||||
## Starting copy
|
||||
|
||||
**Page title:** `tunel.live | Free SSH tunnels for local development`
|
||||
|
||||
**Meta description:** `Create an HTTP/HTTPS or TCP tunnel to your local service with one SSH command. Free hosted servers, no registration required, or self-host Tunnel Please.`
|
||||
|
||||
**Hero heading:**
|
||||
|
||||
> One SSH command. Your app, online.
|
||||
|
||||
**Supporting text:**
|
||||
|
||||
> tunel.live gives your local app a public HTTP/HTTPS address or TCP endpoint through a free hosted Tunnel Please server. No registration required.
|
||||
|
||||
**Primary action:** `Configure a tunnel` → `/#configure`
|
||||
|
||||
**Secondary action:** `Self-host the server` → `/#self-host`
|
||||
|
||||
**Configurator heading:** `Build your tunnel command`
|
||||
|
||||
**Configurator introduction:**
|
||||
|
||||
> Choose a server and forwarding mode, enter your local service details, then run the generated command in your terminal.
|
||||
|
||||
**Guest-access note:**
|
||||
|
||||
> HTTP/HTTPS and TCP tunnels need no registration. Sign in to use custom domains or access account features.
|
||||
|
||||
**Security note:**
|
||||
|
||||
> A tunnel can make your app reachable to other people. Protect sensitive applications with their own authorization. SSH secures the connection to the tunnel server; use HTTPS where supported for encrypted visitor connections. HTTP and raw TCP need separate protection.
|
||||
|
||||
Copy may be tightened, but claims must not become broader. Avoid the current vague “fast,” “reliable,” and blanket “end-to-end encryption” language unless specific evidence supports a narrower statement.
|
||||
|
||||
## Tunnel-not-found experience
|
||||
|
||||
The application redirects inactive or unknown subdomains to `/tunnel-not-found?slug=<slug>`.
|
||||
|
||||
- Heading: **This tunnel isn't connected.**
|
||||
- Explanation: “No active tunnel was found for this address. The SSH session may have closed, the HTTP subdomain may have changed, or the link may be incorrect. If someone shared this link with you, ask them to check it or start their tunnel again.”
|
||||
- Primary action: **Configure a new tunnel** → `/#configure`.
|
||||
- Secondary action: **Return to tunel.live** → `/`.
|
||||
- Explain that creating a new tunnel does not restore the content the visitor expected.
|
||||
- Parse the query with a standard URL query parser. Display the slug as text only, never HTML or an attribute, and only when it is 3–20 lowercase `a-z`/digit/hyphen characters without leading/trailing hyphens. Otherwise omit it.
|
||||
- Do not claim that the tunnel expired or the server is down. Do not retry forever, show fake loading, or use a joking mascot.
|
||||
|
||||
## Interaction and motion
|
||||
|
||||
Motion confirms state changes rather than advertising animation.
|
||||
|
||||
- Hover/color transitions: 120–180ms `ease-out`.
|
||||
- Menu and small disclosure transitions: 160–240ms `ease-out`, with faster exits.
|
||||
- Limit motion to menu state, copy confirmation, selection changes, and genuine validation/loading changes.
|
||||
- No entrance animation is required. Content is visible immediately and never hidden behind reveal JavaScript.
|
||||
- Respect `prefers-reduced-motion: reduce` for all non-essential motion.
|
||||
- No smooth-scroll hijacking, autoplay media, marquees, animated route packets, blinking terminal cursor, parallax, or pulsing status dots.
|
||||
- Toasts never steal focus. Field errors and copy status remain available as text.
|
||||
|
||||
## Accessibility and quality gates
|
||||
|
||||
Target **WCAG 2.2 AA** and test the rendered configurator, not just static swatches.
|
||||
|
||||
- Semantic landmarks, one h1, sequential heading levels, skip link, and a meaningful page title.
|
||||
- Use native labels, radio groups, fields, and buttons. Keyboard-test every mode, location, port field, copy action, menu, and code scroller.
|
||||
- Normal text contrast ≥4.5:1; large text and meaningful non-text indicators ≥3:1. Selection/status never depends on color alone.
|
||||
- Minimum 44×44 CSS px interactive targets where possible, with spacing that prevents accidental changes.
|
||||
- Field errors are associated with their controls; invalid submission focuses an error summary or the first invalid field without destroying other values.
|
||||
- Dynamic copy/loading messages use suitable live regions and do not announce rapid ping fluctuations continuously.
|
||||
- Meaningful images have alt text; decorative images use empty alt. The route diagram has a complete text equivalent.
|
||||
- Support 200% text zoom, 400% browser zoom/reflow where applicable, reduced motion, forced-colors mode, and user spacing overrides.
|
||||
- Declare media dimensions, subset fonts, and keep the example command/source/self-host content useful without JavaScript.
|
||||
- Aim for LCP ≤2.5s, INP ≤200ms, and CLS ≤0.1 at the 75th percentile. Do not let repeated latency checks cause layout shifts or excessive requests.
|
||||
- Test guest flow, keyboard-only operation, loading failure, invalid ports, all forwarding modes, 375px, 1440px, reduced motion, and a screen reader.
|
||||
|
||||
The page is not complete until a guest can choose a location and mode, correct an invalid port, copy the right command, and understand session lifetime and exposure risk without assistance.
|
||||
|
||||
## Content and implementation guardrails
|
||||
|
||||
### Supported by the current hosted site
|
||||
|
||||
- tunel.live is a hosted SSH tunnel service; current copy says the basic service is free. Ordinary HTTP/HTTPS and TCP tunnels require no registration.
|
||||
- HTTP/HTTPS and TCP configuration and custom port configuration.
|
||||
- Custom domain is an authenticated feature: the current guest UI explains the sign-in requirement and `/custom-domain` is the existing signed-in route.
|
||||
- Optional sign-in currently claims saved configurations and history; verify the live account implementation before promoting those benefits.
|
||||
- Current selectable locations include Chicago, Frankfurt, and Singapore; the deployed inventory remains the source of truth.
|
||||
- The Tunnel Please server can also be self-hosted from the supplied source and Compose configurations.
|
||||
|
||||
### Claims that require live qualification
|
||||
|
||||
- **Locations, protocols, and ranges:** use a maintained shared configuration or an explicitly maintained static snapshot. The researched frontend had no real inventory API and inserted a fake 2-second delay; remove that behavior. Do not repeat Indonesia or preserve `20000–21000` after service configuration changes.
|
||||
- **Custom domain:** guest selection explains and links to sign in; signed-in users continue to `/custom-domain`. Never present it as a guest mode or as unrelated custom-subdomain behavior.
|
||||
- **Authenticated commands:** preserve the deployed `sshIdentifier@host` construction using real session data. Verify saved configurations/history before promoting them, and never add statistics, sync, premium features, or support levels without verification.
|
||||
- **HTTPS:** applies to supported HTTPS endpoint configuration. It does not automatically encrypt HTTP or raw TCP.
|
||||
- **Public address:** public reachability depends on the selected hosted endpoint and network. The address is not private merely because SSH is used.
|
||||
- **Live tunnel:** the tunnel exists while its connection/session remains active; loading or copying the command does not prove it connected.
|
||||
- **Self-hosting:** standalone interactive forwarding currently accepts connections without SSH account authentication. Disclose this with deployment instructions and re-verify when implementation changes.
|
||||
|
||||
### Do not claim without new evidence
|
||||
|
||||
- Guaranteed speed, low latency, reliability, uptime, SLA, or a globally optimized network.
|
||||
- Universal end-to-end encryption, private/authenticated public URLs, IP anonymity, zero logging, or zero knowledge.
|
||||
- Paid plans, trials, premium support, team roles, managed account dashboards, traffic inspection/replay, analytics, or persistent tunnel reservations.
|
||||
- Customer adoption, usage totals, benchmark results, or testimonial proof.
|
||||
- Permissive “open source” positioning. The repository uses CC BY-NC-ND 4.0; use precise “source available” wording when discussing its license.
|
||||
|
||||
## Current-site corrections behind the redesign
|
||||
|
||||
These are observed content/UX issues to fix, not visual details to preserve:
|
||||
|
||||
- Replace Geist, dark-gray/emerald surfaces, centered brand hero, circular icon tiles, and repetitive generic feature cards.
|
||||
- Keep the useful configurator but make its real workflow, loading/error states, and generated output the central experience.
|
||||
- Resolve the mismatch between stale copy mentioning **Indonesia** and the rendered **Frankfurt** option. Update metadata that currently describes only Singapore.
|
||||
- Remove the artificial 2-second inventory delay. Use maintained configuration without pretending a hardcoded array is a live API response.
|
||||
- Scope “no registration” to HTTP/HTTPS and TCP. Preserve Custom domain's actual sign-in gate and signed-in `/custom-domain` route.
|
||||
- Replace blanket “fast and reliable” and “End-to-end encryption” statements with bounded operational explanations.
|
||||
- Reconcile “100% Free Service” with sign-in copy promising “premium features and priority support”; omit premium/priority-support language until a real offer exists.
|
||||
- The audited `/terms`, `/privacy`, and `/support` URLs returned 404. Do not carry them into redesigned navigation or login consent until implemented.
|
||||
- The audited `/dashboard` URL fell back to the landing page. Do not advertise a finished dashboard until it exists.
|
||||
- The external status page returned an error during audit. Verify it before presenting status as a reliable service resource.
|
||||
|
||||
## Research basis
|
||||
|
||||
Reviewed for the hosted-service redesign on 2026-11-14. Sources inform behavior and design decisions; their identities and copy are not to be copied.
|
||||
|
||||
### Primary product reference
|
||||
|
||||
- [tunel.live](https://tunel.live/): current hosted-service offer, free/no-registration proposition, working command configurator, current location/protocol modes, and optional sign-in entry.
|
||||
- [tunel.live sign in](https://tunel.live/login): current saved-configuration/history proposition and optional guest path. Its premium/support wording and dead consent/support links require correction rather than promotion.
|
||||
- [Tunnel Please source](https://git.fossy.my.id/bagas/tunnel-please): self-hosting implementation and project license.
|
||||
|
||||
### Format and human-centered design guidance
|
||||
|
||||
- [Google Stitch DESIGN.md overview](https://stitch.google.com/docs/design-md/overview) and [official specification](https://github.com/google-labs-code/design.md/blob/main/docs/spec.md): machine-readable tokens, design rationale, canonical sections, and linting.
|
||||
- [Figma UI design principles](https://www.figma.com/resource-library/ui-design-principles/): hierarchy, progressive disclosure, consistency, contrast, accessibility, proximity, and alignment.
|
||||
- [Figma visual hierarchy](https://www.figma.com/resource-library/what-is-visual-hierarchy/): arrange content by user importance and use negative space deliberately.
|
||||
- [Figma typography fundamentals](https://www.figma.com/resource-library/typography-in-design/): readable body defaults, clear hierarchy, 45–75 character measures, and text resizing.
|
||||
- [Figma accessibility and inclusion](https://www.figma.com/resource-library/creating-accessible-and-inclusive-design/): people-first content, keyboard access, contrast, alternative text, and testing beyond the designer's own abilities.
|
||||
- [Figma responsive website design](https://www.figma.com/resource-library/responsive-website-design/): fluid layouts, responsive forms/media/type/navigation, and viewport testing.
|
||||
- [Figma design tokens](https://www.figma.com/resource-library/design-tokens/): role-based semantic names shared by design and code.
|
||||
|
||||
### Competitive product patterns
|
||||
|
||||
- [ngrok](https://ngrok.com): immediate product definition and task-based routes into documentation; do not inherit its enterprise breadth.
|
||||
- [LocalCan](https://www.localcan.com/): visible command and concise workflow structure; do not import its stable-URL proposition when tunel.live sessions are connection-scoped.
|
||||
- [Tailscale](https://tailscale.com/): clear technical resource paths; avoid its sprawling multi-menu structure for this focused service.
|
||||
|
||||
### Anti-slop review
|
||||
|
||||
- [Impeccable's Slop catalog](https://impeccable.style/slop): avoid cardocalypse, default-font sameness, meaningless badges, decorative grids, glass/glow, low contrast, generic copy, and meaningless motion.
|
||||
- [Paralect's signs of AI slop](https://www.paralect.com/blog/signs-of-ai-slop-in-design): avoid generic claims, placeholders, fake proof, repeated icon cards, overstyled radii, fake demos, and scroll reveal on every block.
|
||||
- [DesignCode: Avoid AI Slop in Vibe-Coded Landing Pages](https://www.youtube.com/watch?v=M4DNgmI7MIM): audit selected states, weak content, random status pills, generic illustrations, glow effects, and product-disconnected visuals.
|
||||
|
||||
The anti-slop rule is not “make it strange.” It is **build around the real hosted workflow, use authentic service data, and remove anything that does not help the visitor configure or understand a tunnel**.
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FROM node:24-alpine AS development-dependencies-env
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm ci
|
||||
FROM node:24-alpine AS production-dependencies-env
|
||||
COPY package.json package-lock.json /app/
|
||||
WORKDIR /app
|
||||
RUN npm ci --omit=dev
|
||||
FROM node:24-alpine AS build-env
|
||||
COPY . /app/
|
||||
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
|
||||
WORKDIR /app
|
||||
RUN npm run build
|
||||
FROM node:24-alpine
|
||||
COPY package.json package-lock.json /app/
|
||||
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
|
||||
COPY --from=build-env /app/build /app/build
|
||||
WORKDIR /app
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "run", "start"]
|
||||
@@ -0,0 +1,46 @@
|
||||
# tunel.live website
|
||||
|
||||
Official React Router 8 framework-mode SSR + Tailwind CSS v4 app for the public tunel.live site. It implements `DESIGN.md` in this folder.
|
||||
|
||||
```bash
|
||||
npm install # Node.js 24+
|
||||
npm run dev # http://localhost:5173, also on 0.0.0.0
|
||||
npm test
|
||||
npm run build
|
||||
npm run typecheck
|
||||
npm run start # production SSR server on port 3000
|
||||
```
|
||||
|
||||
## Framework
|
||||
|
||||
Routes are defined in `app/routes.ts`; SSR remains enabled by `react-router.config.ts`. Requires Node.js 24+.
|
||||
|
||||
## Routes
|
||||
|
||||
- `/` landing page with the tunnel configurator
|
||||
- `*` not found
|
||||
|
||||
## Tailwind
|
||||
|
||||
Styling is utilities only, plus one `@theme` block in `app/app.css` that maps the DESIGN.md tokens to semantic names: `canvas`, `surface`, `subtle`, `ink`, `body`, `muted`, `line`, `action`, `go`, `orange`, `term`. Dark mode swaps the CSS variables under `.dark`, so the same utilities work in both themes with no `dark:` duplication.
|
||||
|
||||
Breakpoints: `sm` 640, `md` 768, `lg` 1024, `xl` 1280.
|
||||
|
||||
## Responsive check
|
||||
|
||||
`scripts/responsive-check` drives Chromium at 320–1440 px and asserts no horizontal overflow, the navigation switch at `md`, map markers staying inside the map, the theme toggle, and the configurator logic.
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
npx playwright install chromium # once
|
||||
npm run check:responsive
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- No backend and no auth; the site is a single landing page.
|
||||
- The server list in `app/data/servers` is a maintained snapshot, not a live API response.
|
||||
- Ping opens a WebSocket handshake to each host and times it. The tunnel hosts answer every HTTP path with a redirect loop, so a `fetch` never settles; the handshake still gives a real TCP + TLS round trip.
|
||||
- Ping runs once on load and caches the result under `tunel-ping` for 10 minutes, so repeat visits do not re-probe the hosts. The Check ping button bypasses and refreshes the cache.
|
||||
- Theme is stored under `tunel-theme` and applied in `app/entry.client` before the first render.
|
||||
- Run as the generated Node SSR server with `npm run start` (port 3000), or use the generated Docker image.
|
||||
+262
@@ -0,0 +1,262 @@
|
||||
/* Self-hosted IBM Plex (OFL). Sans is the variable font served for all weights;
|
||||
Mono is the static 400 cut. */
|
||||
@font-face {
|
||||
font-family: 'IBM Plex Sans';
|
||||
font-style: normal;
|
||||
font-weight: 100 700;
|
||||
font-display: swap;
|
||||
src: url('./assets/fonts/plex-sans.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'IBM Plex Mono';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url('./assets/fonts/plex-mono.woff2') format('woff2');
|
||||
}
|
||||
|
||||
@import 'tailwindcss';
|
||||
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
/* Semantic tokens. Values swap in .dark; utilities below stay the same. */
|
||||
:root {
|
||||
--c-canvas: #f4f7f6;
|
||||
--c-surface: #ffffff;
|
||||
--c-subtle: #e7efed;
|
||||
--c-ink: #16323c;
|
||||
--c-ink-hover: #214b57;
|
||||
--c-on-ink: #ffffff;
|
||||
--c-body: #334e58;
|
||||
--c-muted: #586c72;
|
||||
--c-line: #c7d3d0;
|
||||
--c-action: #006b7d;
|
||||
--c-go: #00add8;
|
||||
--c-orange: #f28c28;
|
||||
--c-term: #102930;
|
||||
--c-term-text: #eaf6fa;
|
||||
--c-success: #1f6b4f;
|
||||
--c-error: #a52a45;
|
||||
--c-error-bg: #f9e8ec;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--c-canvas: #0e1a1e;
|
||||
--c-surface: #173035;
|
||||
--c-subtle: #1e3a40;
|
||||
--c-ink: #f4f7f6;
|
||||
--c-ink-hover: #e7efed;
|
||||
--c-on-ink: #16323c;
|
||||
--c-body: #d5e2e0;
|
||||
--c-muted: #a9bdb8;
|
||||
--c-line: #3c5558;
|
||||
--c-action: #7ddeea;
|
||||
--c-go: #00add8;
|
||||
--c-error: #f2a0b4;
|
||||
--c-error-bg: #3a2028;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-canvas: var(--c-canvas);
|
||||
--color-surface: var(--c-surface);
|
||||
--color-subtle: var(--c-subtle);
|
||||
--color-ink: var(--c-ink);
|
||||
--color-ink-hover: var(--c-ink-hover);
|
||||
--color-on-ink: var(--c-on-ink);
|
||||
--color-body: var(--c-body);
|
||||
--color-muted: var(--c-muted);
|
||||
--color-line: var(--c-line);
|
||||
--color-action: var(--c-action);
|
||||
--color-go: var(--c-go);
|
||||
--color-orange: var(--c-orange);
|
||||
--color-term: var(--c-term);
|
||||
--color-term-text: var(--c-term-text);
|
||||
--color-success: var(--c-success);
|
||||
--color-error: var(--c-error);
|
||||
--color-error-bg: var(--c-error-bg);
|
||||
|
||||
--font-sans: 'IBM Plex Sans', 'Segoe UI', sans-serif;
|
||||
--font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
|
||||
|
||||
--radius-sm: 4px;
|
||||
--radius-md: 8px;
|
||||
--radius-lg: 12px;
|
||||
}
|
||||
|
||||
@theme {
|
||||
--ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
--animate-field-in: field-in 180ms ease-out;
|
||||
--animate-pop: pop 180ms var(--ease-soft) both;
|
||||
--animate-page-in: page-in 260ms var(--ease-soft) both;
|
||||
|
||||
@keyframes field-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: 0 -4px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pop {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: 0 3px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes page-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: 0 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Scroll-driven entrance for whole sections. Browsers without view timelines
|
||||
just render them, and reduced motion keeps everything still. */
|
||||
@keyframes reveal {
|
||||
from {
|
||||
opacity: 0;
|
||||
translate: 0 18px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Three-dot loader for the ping probe. Layered so utilities can resize it. */
|
||||
@layer components {
|
||||
.dot-loader {
|
||||
width: 32px;
|
||||
aspect-ratio: 4;
|
||||
--_g: no-repeat radial-gradient(circle closest-side, currentColor 90%, transparent);
|
||||
background:
|
||||
var(--_g) 0% 50%,
|
||||
var(--_g) 50% 50%,
|
||||
var(--_g) 100% 50%;
|
||||
background-size: calc(100% / 3) 100%;
|
||||
animation: dot-loader 1s infinite linear;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes dot-loader {
|
||||
33% {
|
||||
background-size:
|
||||
calc(100% / 3) 0%,
|
||||
calc(100% / 3) 100%,
|
||||
calc(100% / 3) 100%;
|
||||
}
|
||||
50% {
|
||||
background-size:
|
||||
calc(100% / 3) 100%,
|
||||
calc(100% / 3) 0%,
|
||||
calc(100% / 3) 100%;
|
||||
}
|
||||
66% {
|
||||
background-size:
|
||||
calc(100% / 3) 100%,
|
||||
calc(100% / 3) 100%,
|
||||
calc(100% / 3) 0%;
|
||||
}
|
||||
}
|
||||
|
||||
@supports (animation-timeline: view()) {
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.reveal {
|
||||
animation: reveal linear both;
|
||||
animation-timeline: view();
|
||||
animation-range: entry 10% entry 60%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@layer base {
|
||||
html {
|
||||
color-scheme: light;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background-color: var(--c-action);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* Fill the viewport and keep the footer at the bottom on short pages. */
|
||||
#root, body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
min-height: 100dvh;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
|
||||
/* Theme changes cross-fade instead of snapping; component utilities win
|
||||
because they live in the utilities layer. */
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
transition-property: background-color, border-color, color, fill, stroke, outline-color;
|
||||
transition-duration: 160ms;
|
||||
transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
}
|
||||
|
||||
@keyframes caret {
|
||||
0%,
|
||||
45% {
|
||||
opacity: 1;
|
||||
}
|
||||
50%,
|
||||
95% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.caret {
|
||||
animation: caret 1.1s steps(1, end) infinite;
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply bg-canvas font-sans text-body antialiased;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
@apply text-ink;
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
p {
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--c-action);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
/* The command block is dark in both themes, so it needs the Go-blue ring. */
|
||||
.terminal :focus-visible {
|
||||
outline-color: var(--c-go);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
transition-duration: 0.01ms !important;
|
||||
animation-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,367 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { buildCommand, parsePort, TCP_MAX, TCP_MIN } from '../lib/command'
|
||||
import { DEFAULT_SERVER, SERVERS } from '../data/servers'
|
||||
import { BTN_TERM, CONTAINER, SECTION } from '../lib/ui'
|
||||
import LocationMap from './LocationMap'
|
||||
import CopiedToast from './CopiedToast'
|
||||
import { useReducedMotion } from '../lib/useReducedMotion'
|
||||
import { readPingCache, writePingCache } from '../lib/pingCache'
|
||||
import { copyText } from '../lib/clipboard'
|
||||
import type { LatencyMap } from '../lib/pingCache'
|
||||
|
||||
const MODES = [
|
||||
{ id: 'http', label: 'HTTPS' },
|
||||
{ id: 'tcp', label: 'TCP' },
|
||||
]
|
||||
|
||||
const SEGMENT =
|
||||
'flex min-h-12 flex-1 cursor-pointer items-center justify-center rounded-sm px-2 text-center text-sm font-semibold text-body transition-colors duration-150 hover:text-ink peer-checked:text-on-ink peer-checked:hover:text-on-ink peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-action'
|
||||
|
||||
const LOCKED_SEGMENT =
|
||||
'flex min-h-12 w-full cursor-not-allowed items-center justify-center gap-1.5 rounded-sm px-2 text-center text-sm font-semibold text-muted'
|
||||
|
||||
// The tunnel hosts answer every HTTP path with a redirect loop, so a fetch
|
||||
// never settles. A WebSocket handshake gives a real TCP + TLS round trip and
|
||||
// fails fast, which is what we time here.
|
||||
// shortcut: 3s cap keeps a worst-case all-hosts-down sweep at ~9s, not 15s.
|
||||
function probe(host: string, timeout = 3000): Promise<number | null> {
|
||||
return new Promise((resolve: (value: number | null) => void) => {
|
||||
const start = performance.now()
|
||||
let settled = false
|
||||
let socket: WebSocket | undefined
|
||||
|
||||
const finish = (value: number | null) => {
|
||||
if (settled) return
|
||||
settled = true
|
||||
try {
|
||||
socket?.close()
|
||||
} catch {
|
||||
// already closed
|
||||
}
|
||||
resolve(value)
|
||||
}
|
||||
|
||||
try {
|
||||
socket = new WebSocket(`wss://${host}`)
|
||||
} catch {
|
||||
finish(null)
|
||||
return
|
||||
}
|
||||
|
||||
const measure = () => finish(Math.round(performance.now() - start))
|
||||
socket.onerror = measure
|
||||
socket.onopen = measure
|
||||
setTimeout(() => finish(null), timeout)
|
||||
})
|
||||
}
|
||||
|
||||
async function measure(host: string): Promise<number | null> {
|
||||
const first = await probe(host)
|
||||
if (first === null) return null
|
||||
const second = await probe(host)
|
||||
return second === null ? first : Math.min(first, second)
|
||||
}
|
||||
|
||||
export default function Configurator() {
|
||||
const [serverId, setServerId] = useState(DEFAULT_SERVER)
|
||||
const [mode, setMode] = useState('http')
|
||||
const [localPort, setLocalPort] = useState('8000')
|
||||
const [serverPort, setServerPort] = useState('20443')
|
||||
|
||||
const [latency, setLatency] = useState<LatencyMap>({})
|
||||
const [checking, setChecking] = useState(false)
|
||||
|
||||
const [copyState, setCopyState] = useState<'error' | null>(null)
|
||||
const [copied, setCopied] = useState(false)
|
||||
const copyTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)
|
||||
|
||||
const reduced = useReducedMotion()
|
||||
const terminalRef = useRef<HTMLDivElement>(null)
|
||||
const played = useRef(false)
|
||||
const [phase, setPhase] = useState<'idle' | 'typing' | 'done'>('idle')
|
||||
const [typed, setTyped] = useState(0)
|
||||
|
||||
const server = SERVERS.find((item) => item.id === serverId) ?? SERVERS[0]
|
||||
const command = buildCommand({ host: server.host, mode, webPort: 443, serverPort, localPort })
|
||||
const validCommand = useRef(command)
|
||||
|
||||
useEffect(() => {
|
||||
if (command) validCommand.current = command
|
||||
}, [command])
|
||||
const shownCommand = command ?? validCommand.current
|
||||
|
||||
const localPortError = parsePort(localPort) === null ? 'Enter a whole port between 1 and 65535.' : null
|
||||
const serverPortError =
|
||||
mode === 'tcp' && parsePort(serverPort, TCP_MIN, TCP_MAX) === null
|
||||
? `Enter a remote port between ${TCP_MIN} and ${TCP_MAX}.`
|
||||
: null
|
||||
|
||||
useEffect(() => () => clearTimeout(copyTimer.current), [])
|
||||
|
||||
// Play the session once, when the terminal first comes into view.
|
||||
useEffect(() => {
|
||||
if (!shownCommand) return
|
||||
if (reduced) {
|
||||
setPhase('done')
|
||||
setTyped(shownCommand.length)
|
||||
return
|
||||
}
|
||||
if (played.current) return
|
||||
const node = terminalRef.current
|
||||
if (!node) return
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
if (!entries[0].isIntersecting || played.current) return
|
||||
played.current = true
|
||||
observer.disconnect()
|
||||
setTyped(0)
|
||||
setPhase('typing')
|
||||
},
|
||||
{ threshold: 0.4 },
|
||||
)
|
||||
observer.observe(node)
|
||||
return () => observer.disconnect()
|
||||
}, [reduced, shownCommand])
|
||||
|
||||
// Type the command once the terminal is on screen.
|
||||
useEffect(() => {
|
||||
if (phase !== 'typing' || !shownCommand) return
|
||||
if (typed >= shownCommand.length) {
|
||||
setPhase('done')
|
||||
return
|
||||
}
|
||||
const step = setTimeout(() => setTyped((count) => count + 1), 38)
|
||||
return () => clearTimeout(step)
|
||||
}, [phase, typed, shownCommand])
|
||||
|
||||
async function runPing() {
|
||||
setChecking(true)
|
||||
setLatency({})
|
||||
// One server at a time: concurrent probes share the browser's sockets and
|
||||
// queue behind each other, which inflates the numbers.
|
||||
const next: LatencyMap = {}
|
||||
for (const item of SERVERS) {
|
||||
next[item.id] = await measure(item.host)
|
||||
setLatency({ ...next })
|
||||
}
|
||||
writePingCache(next)
|
||||
setChecking(false)
|
||||
}
|
||||
|
||||
// Measure once on load, unless a fresh cache is available.
|
||||
const autoPinged = useRef(false)
|
||||
useEffect(() => {
|
||||
if (autoPinged.current) return
|
||||
autoPinged.current = true
|
||||
const cached = readPingCache()
|
||||
if (cached) {
|
||||
setLatency(cached)
|
||||
return
|
||||
}
|
||||
runPing()
|
||||
}, [])
|
||||
|
||||
async function onCopy() {
|
||||
if (!command) return
|
||||
if (await copyText(command)) {
|
||||
setCopyState(null)
|
||||
setCopied(true)
|
||||
clearTimeout(copyTimer.current)
|
||||
copyTimer.current = setTimeout(() => setCopied(false), 4000)
|
||||
return
|
||||
}
|
||||
setCopyState('error')
|
||||
clearTimeout(copyTimer.current)
|
||||
copyTimer.current = setTimeout(() => setCopyState(null), 4000)
|
||||
}
|
||||
|
||||
return (
|
||||
<section id="configure" className="border-b border-line">
|
||||
<div className={`${CONTAINER} ${SECTION} reveal`}>
|
||||
<div className="mb-6 max-w-[44em]">
|
||||
<h2 className="text-[28px] font-medium leading-[1.15] tracking-[-0.025em] sm:text-[32px] lg:text-[40px]">
|
||||
Build your tunnel command
|
||||
</h2>
|
||||
<p className="mt-2 text-muted">
|
||||
Choose a server and forwarding mode, enter your local service details, then run the generated
|
||||
command in your terminal.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border border-line bg-surface p-5 lg:p-8">
|
||||
<div className="grid gap-8 lg:grid-cols-[1.05fr_0.95fr] lg:items-start">
|
||||
<div className="flex flex-col gap-6">
|
||||
<LocationMap
|
||||
selected={serverId}
|
||||
onSelect={setServerId}
|
||||
latency={latency}
|
||||
checking={checking}
|
||||
onCheckPing={runPing}
|
||||
/>
|
||||
|
||||
<fieldset>
|
||||
<legend className="mb-2 text-sm font-semibold text-ink">Forwarding mode</legend>
|
||||
<div className="relative flex gap-1 rounded-sm bg-subtle p-1">
|
||||
{/* shortcut: the thumb spans one of three equal slots; update the calc if a fourth mode arrives. */}
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className={`absolute bottom-1 left-1 top-1 w-[calc((100%-1rem)/3)] rounded-sm bg-ink transition-[translate] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] ${
|
||||
mode === 'tcp' ? 'translate-x-[calc(100%+0.25rem)]' : 'translate-x-0'
|
||||
}`}
|
||||
/>
|
||||
{MODES.map((item) => (
|
||||
<label key={item.id} className="relative z-10 flex flex-1 cursor-pointer">
|
||||
<input
|
||||
type="radio"
|
||||
name="mode"
|
||||
value={item.id}
|
||||
checked={mode === item.id}
|
||||
onChange={() => setMode(item.id)}
|
||||
className="peer sr-only"
|
||||
/>
|
||||
<span className={SEGMENT}>{item.label}</span>
|
||||
</label>
|
||||
))}
|
||||
|
||||
<div className="group relative z-10 flex flex-1">
|
||||
<button
|
||||
type="button"
|
||||
aria-disabled="true"
|
||||
aria-describedby="custom-domain-tip"
|
||||
className={LOCKED_SEGMENT}
|
||||
>
|
||||
Custom domain
|
||||
<svg viewBox="0 0 24 24" width="13" height="13" aria-hidden="true" focusable="false">
|
||||
<rect x="5" y="10.5" width="14" height="9.5" rx="2" fill="none" stroke="currentColor" strokeWidth="1.8" />
|
||||
<path d="M8.5 10.5V8a3.5 3.5 0 0 1 7 0v2.5" fill="none" stroke="currentColor" strokeWidth="1.8" />
|
||||
</svg>
|
||||
</button>
|
||||
<span
|
||||
id="custom-domain-tip"
|
||||
role="tooltip"
|
||||
className="pointer-events-none absolute bottom-[calc(100%+8px)] right-0 z-20 w-max max-w-[15rem] rounded-sm bg-ink px-2.5 py-1.5 text-left text-[12px] font-medium leading-snug text-on-ink opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100"
|
||||
>
|
||||
Custom domains are disabled for now.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{mode === 'tcp' && (
|
||||
<div className="animate-field-in">
|
||||
<label htmlFor="server-port" className="mb-2 block text-sm font-semibold text-ink">
|
||||
Server port
|
||||
</label>
|
||||
<input
|
||||
id="server-port"
|
||||
type="number"
|
||||
inputMode="numeric"
|
||||
min={TCP_MIN}
|
||||
max={TCP_MAX}
|
||||
value={serverPort}
|
||||
onChange={(event) => setServerPort(event.target.value)}
|
||||
aria-invalid={Boolean(serverPortError)}
|
||||
aria-describedby={serverPortError ? 'server-port-error' : 'server-port-hint'}
|
||||
className={`min-h-12 w-full rounded-sm border bg-surface px-3 text-base text-ink focus:border-action ${
|
||||
serverPortError ? 'border-error' : 'border-muted'
|
||||
}`}
|
||||
/>
|
||||
{serverPortError ? (
|
||||
<p id="server-port-error" role="alert" className="mt-1.5 text-[13px] font-medium text-error">
|
||||
{serverPortError}
|
||||
</p>
|
||||
) : (
|
||||
<p id="server-port-hint" className="mt-1.5 text-[13px] text-muted">
|
||||
Allowed range {TCP_MIN}–{TCP_MAX}.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div>
|
||||
<label htmlFor="local-port" className="mb-2 block text-sm font-semibold text-ink">
|
||||
Local port
|
||||
</label>
|
||||
<input
|
||||
id="local-port"
|
||||
type="number"
|
||||
inputMode="numeric"
|
||||
min="1"
|
||||
max="65535"
|
||||
value={localPort}
|
||||
onChange={(event) => setLocalPort(event.target.value)}
|
||||
aria-invalid={Boolean(localPortError)}
|
||||
aria-describedby={localPortError ? 'local-port-error' : 'local-port-hint'}
|
||||
className={`min-h-12 w-full rounded-sm border bg-surface px-3 text-base text-ink focus:border-action ${
|
||||
localPortError ? 'border-error' : 'border-muted'
|
||||
}`}
|
||||
/>
|
||||
{localPortError ? (
|
||||
<p id="local-port-error" role="alert" className="mt-1.5 text-[13px] font-medium text-error">
|
||||
{localPortError}
|
||||
</p>
|
||||
) : (
|
||||
<p id="local-port-hint" className="mt-1.5 text-[13px] text-muted">
|
||||
The port your service listens on locally.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex min-w-0 flex-col gap-3">
|
||||
<div ref={terminalRef} className="terminal rounded-md border border-line bg-term p-5 text-term-text">
|
||||
<div className="flex items-center gap-2 border-b border-term-text/15 pb-3">
|
||||
<span aria-hidden="true" className="flex gap-1.5">
|
||||
<span className="h-2.5 w-2.5 rounded-full bg-term-text/20" />
|
||||
<span className="h-2.5 w-2.5 rounded-full bg-term-text/20" />
|
||||
<span className="h-2.5 w-2.5 rounded-full bg-term-text/20" />
|
||||
</span>
|
||||
<span className="ml-1 font-mono text-[12px] text-term-text/55">bash</span>
|
||||
<span className="ml-auto truncate text-[12px] text-term-text/65">
|
||||
{command
|
||||
? `${server.city} · ${mode === 'tcp' ? 'TCP' : 'HTTPS'} · local port ${localPort}`
|
||||
: 'Previous valid command'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<pre className="mt-3 overflow-x-auto rounded-sm border border-term-text/15 bg-black/25 px-3.5 py-3 font-mono text-[13px] leading-relaxed">
|
||||
<code>
|
||||
<span className="text-go">$ </span>
|
||||
{phase === 'done' ? shownCommand : shownCommand?.slice(0, typed)}
|
||||
{phase !== 'done' && (
|
||||
<span aria-hidden="true" className="caret text-term-text/70">
|
||||
▌
|
||||
</span>
|
||||
)}
|
||||
</code>
|
||||
</pre>
|
||||
|
||||
<div className="mt-4 flex flex-wrap gap-2">
|
||||
<button type="button" className={BTN_TERM} onClick={onCopy} disabled={!command}>
|
||||
Copy command
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p key={copyState} className="mt-3 min-h-[1.6em] animate-pop text-[13px] text-term-text/85" role="status">
|
||||
{copyState === 'error' && 'Copy failed. Select the command and copy it manually.'}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<CopiedToast open={copied} command={shownCommand ?? ''} />
|
||||
|
||||
<p className="text-[13px] leading-relaxed text-muted">
|
||||
Run this in your terminal. After connecting, use the public address printed there. Closing the
|
||||
SSH session removes the tunnel.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="mt-4 max-w-[44em] text-sm text-muted">
|
||||
HTTPS and TCP tunnels need no registration. Custom domains are disabled for now.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
|
||||
// Copy confirmation as a non-blocking toast: it announces itself, never takes
|
||||
// focus, and stays out of the way of the command box.
|
||||
export default function CopiedToast({ open, command }: { open: boolean; command: string }) {
|
||||
const [mounted, setMounted] = useState(open)
|
||||
const [shown, setShown] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setMounted(true)
|
||||
const frame = requestAnimationFrame(() => setShown(true))
|
||||
return () => cancelAnimationFrame(frame)
|
||||
}
|
||||
setShown(false)
|
||||
const timer = setTimeout(() => setMounted(false), 180)
|
||||
return () => clearTimeout(timer)
|
||||
}, [open])
|
||||
|
||||
if (!mounted) return null
|
||||
|
||||
// Portal: the configurator section is translated by its reveal animation,
|
||||
// which would otherwise become the containing block for position:fixed.
|
||||
return createPortal(
|
||||
<div
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
className={`fixed bottom-5 left-1/2 z-40 flex w-[calc(100%-2rem)] max-w-[400px] -translate-x-1/2 items-start gap-3 rounded-md border border-line bg-surface p-4 shadow-[0_8px_30px_rgb(22_50_60/12%)] transition-[opacity,translate] duration-200 ease-soft ${
|
||||
shown ? 'translate-y-0 opacity-100' : 'translate-y-2 opacity-0'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
aria-hidden="true"
|
||||
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-subtle text-action"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" focusable="false">
|
||||
<path
|
||||
d="M5 12.5l4.5 4.5L19 7.5"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2.2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
|
||||
<div className="min-w-0">
|
||||
<p className="text-sm font-semibold text-ink">Command copied</p>
|
||||
<p className="mt-0.5 truncate font-mono text-[12px] text-muted">{command}</p>
|
||||
</div>
|
||||
</div>,
|
||||
document.body,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Link } from 'react-router'
|
||||
import { ISSUES, LICENSE, SOURCE } from '../data/servers'
|
||||
import { CONTAINER } from '../lib/ui'
|
||||
|
||||
const LINK = 'flex min-h-11 items-center text-sm text-muted transition-colors duration-150 hover:text-action hover:underline'
|
||||
|
||||
export default function Footer() {
|
||||
return (
|
||||
<footer className="border-t border-line bg-surface">
|
||||
<div className={`${CONTAINER} flex flex-wrap gap-x-16 gap-y-8 py-10`}>
|
||||
<div className="flex min-w-[8rem] flex-col gap-1.5">
|
||||
<span className="mb-1 text-sm font-semibold text-ink">Product</span>
|
||||
<Link className={LINK} to="/#configure">
|
||||
Configure
|
||||
</Link>
|
||||
<Link className={LINK} to="/#self-host">
|
||||
Self-host
|
||||
</Link>
|
||||
</div>
|
||||
<div className="flex min-w-[8rem] flex-col gap-1.5">
|
||||
<span className="mb-1 text-sm font-semibold text-ink">Project</span>
|
||||
<a className={LINK} href={SOURCE} target="_blank" rel="noreferrer">
|
||||
Source
|
||||
</a>
|
||||
<a className={LINK} href={ISSUES} target="_blank" rel="noreferrer">
|
||||
Issues
|
||||
</a>
|
||||
<a className={LINK} href={LICENSE} target="_blank" rel="noreferrer">
|
||||
License
|
||||
</a>
|
||||
</div>
|
||||
<p className="ml-auto self-end text-[13px] text-muted">
|
||||
tunel.live · Tunnel Please
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import { useEffect } from 'react'
|
||||
import { Link, Outlet, useLocation } from 'react-router'
|
||||
import ThemeToggle from './ThemeToggle'
|
||||
import Footer from './Footer'
|
||||
import { CONTAINER } from '../lib/ui'
|
||||
import { SOURCE } from '../data/servers'
|
||||
import type { MouseEvent, KeyboardEvent } from 'react'
|
||||
|
||||
const LINKS = [
|
||||
{ to: '/#configure', label: 'Configure' },
|
||||
{ to: '/#self-host', label: 'Self-host' },
|
||||
]
|
||||
|
||||
export default function Layout() {
|
||||
const { pathname, hash } = useLocation()
|
||||
|
||||
// Hash links are this site's anchor navigation; move focus with the scroll.
|
||||
useEffect(() => {
|
||||
if (!hash) return
|
||||
const target = document.getElementById(hash.slice(1))
|
||||
if (!target) return
|
||||
target.scrollIntoView({ block: 'start' })
|
||||
const heading = target.querySelector('h1, h2')
|
||||
if (heading) {
|
||||
heading.setAttribute('tabindex', '-1')
|
||||
if (heading instanceof HTMLElement) heading.focus({ preventScroll: true })
|
||||
}
|
||||
}, [pathname, hash])
|
||||
|
||||
function closeMenu(event: MouseEvent<HTMLDivElement>) {
|
||||
event.currentTarget.closest('details')?.removeAttribute('open')
|
||||
}
|
||||
|
||||
// Native <details> has no Escape handling; close and return focus to the summary.
|
||||
function onMenuKeyDown(event: KeyboardEvent<HTMLDetailsElement>) {
|
||||
if (event.key !== 'Escape') return
|
||||
const details = event.currentTarget
|
||||
if (!details.open) return
|
||||
details.removeAttribute('open')
|
||||
details.querySelector('summary')?.focus()
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<a
|
||||
href="#main"
|
||||
className="sr-only focus:not-sr-only focus:absolute focus:left-4 focus:top-3 focus:z-40 focus:rounded-sm focus:border focus:border-line focus:bg-surface focus:px-4 focus:py-2 focus:text-ink"
|
||||
>
|
||||
Skip to content
|
||||
</a>
|
||||
|
||||
<header className="border-b border-line bg-surface">
|
||||
<div className={`${CONTAINER} flex min-h-16 flex-wrap items-center justify-between gap-x-8 gap-y-2 py-3`}>
|
||||
<Link to="/" className="text-[19px] font-semibold tracking-[-0.01em] text-ink">
|
||||
tunel.live
|
||||
</Link>
|
||||
|
||||
<nav className="hidden items-center gap-1 md:flex" aria-label="Main">
|
||||
{LINKS.map((link) => (
|
||||
<Link
|
||||
key={link.to}
|
||||
to={link.to}
|
||||
className="rounded-sm px-3 py-2 text-[15px] font-medium text-muted transition-colors duration-150 hover:text-ink inline-flex min-h-11 items-center"
|
||||
>
|
||||
{link.label}
|
||||
</Link>
|
||||
))}
|
||||
<a
|
||||
href={SOURCE}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="rounded-sm px-3 py-2 text-[15px] font-medium text-muted transition-colors duration-150 hover:text-ink inline-flex min-h-11 items-center"
|
||||
>
|
||||
Source
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<ThemeToggle />
|
||||
<details className="relative md:hidden" onKeyDown={onMenuKeyDown}>
|
||||
<summary className="flex min-h-11 cursor-pointer list-none items-center gap-1.5 rounded-sm border border-line px-3 text-sm font-medium text-ink [&::-webkit-details-marker]:hidden">
|
||||
Menu
|
||||
</summary>
|
||||
<div
|
||||
className="absolute right-0 z-30 mt-2 w-56 origin-top rounded-md border border-line bg-surface p-2 shadow-[0_8px_30px_rgb(22_50_60/12%)] transition-[opacity,translate] duration-200 ease-soft starting:opacity-0 starting:-translate-y-1"
|
||||
onClick={closeMenu}
|
||||
>
|
||||
<nav className="flex flex-col" aria-label="Main">
|
||||
{LINKS.map((link) => (
|
||||
<Link
|
||||
key={link.to}
|
||||
to={link.to}
|
||||
className="rounded-sm px-3 py-2.5 text-[15px] font-medium text-muted hover:bg-subtle hover:text-ink inline-flex min-h-11 items-center"
|
||||
>
|
||||
{link.label}
|
||||
</Link>
|
||||
))}
|
||||
<a
|
||||
href={SOURCE}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="rounded-sm px-3 py-2.5 text-[15px] font-medium text-muted hover:bg-subtle hover:text-ink inline-flex min-h-11 items-center"
|
||||
>
|
||||
Source
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="main">
|
||||
<div key={pathname} className="animate-page-in">
|
||||
<Outlet />
|
||||
</div>
|
||||
</main>
|
||||
<Footer />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
import { geoNaturalEarth1, geoPath } from 'd3-geo'
|
||||
import { feature } from 'topojson-client'
|
||||
import land from 'world-atlas/land-110m.json'
|
||||
import { SERVERS } from '../data/servers'
|
||||
import type { Polygon } from 'geojson'
|
||||
import type { Topology, GeometryCollection } from 'topojson-specification'
|
||||
import type { LatencyMap } from '../lib/pingCache'
|
||||
|
||||
const WIDTH = 800
|
||||
const HEIGHT = 400
|
||||
type LandTopology = Topology<{ land: GeometryCollection }>
|
||||
const landTopology = land as unknown as LandTopology
|
||||
const landShape = feature(landTopology, landTopology.objects.land)
|
||||
|
||||
// Fit the visible band, not the whole sphere: Antarctica otherwise squeezes
|
||||
// every real location into the top third of the map.
|
||||
const frame = {
|
||||
type: 'Polygon',
|
||||
coordinates: [
|
||||
[
|
||||
[-180, 80],
|
||||
[180, 80],
|
||||
[180, -58],
|
||||
[-180, -58],
|
||||
[-180, 80],
|
||||
],
|
||||
],
|
||||
}
|
||||
|
||||
const projection = geoNaturalEarth1().fitExtent(
|
||||
[
|
||||
[6, 6],
|
||||
[WIDTH - 6, HEIGHT - 6],
|
||||
],
|
||||
frame as Polygon,
|
||||
)
|
||||
const landPath = geoPath(projection)(landShape) ?? ''
|
||||
|
||||
type Server = (typeof SERVERS)[number]
|
||||
function pinPosition(server: Server) {
|
||||
const point = projection([server.lon, server.lat])
|
||||
if (!point) return { left: '0%', top: '0%' }
|
||||
const [x, y] = point
|
||||
return { left: `${(x / WIDTH) * 100}%`, top: `${(y / HEIGHT) * 100}%` }
|
||||
}
|
||||
|
||||
function latencyLabel(value: number | null | undefined) {
|
||||
if (value === undefined) return 'Ping not checked'
|
||||
if (value === null) return 'Ping unavailable'
|
||||
return `~${value} ms`
|
||||
}
|
||||
|
||||
type Props = { selected: string; onSelect: (id: string) => void; latency: LatencyMap; checking: boolean; onCheckPing: () => void }
|
||||
export default function LocationMap({ selected, onSelect, latency, checking, onCheckPing }: Props) {
|
||||
return (
|
||||
<div>
|
||||
<div className="mb-3 flex items-baseline justify-between gap-3">
|
||||
<h3 id="locations-heading" className="text-[15px] font-semibold text-ink">
|
||||
Server location
|
||||
</h3>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onCheckPing}
|
||||
disabled={checking}
|
||||
aria-label={checking ? 'Checking ping' : undefined}
|
||||
className={`inline-flex min-h-11 min-w-[74px] items-center justify-end rounded-sm px-1 text-[13px] font-medium text-action hover:text-ink disabled:cursor-not-allowed disabled:text-muted ${
|
||||
checking ? '' : 'underline underline-offset-4'
|
||||
}`}
|
||||
>
|
||||
{checking ? <span className="dot-loader text-action" aria-hidden="true" /> : 'Check ping'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="relative overflow-hidden rounded-md border border-line bg-surface">
|
||||
<svg
|
||||
className="block h-auto w-full"
|
||||
viewBox={`0 0 ${WIDTH} ${HEIGHT}`}
|
||||
role="img"
|
||||
aria-label="World map showing hosted servers in Chicago, Frankfurt and Singapore"
|
||||
>
|
||||
<path className="fill-subtle stroke-line" strokeWidth="0.7" d={landPath} />
|
||||
</svg>
|
||||
|
||||
{SERVERS.map((server) => {
|
||||
const active = server.id === selected
|
||||
return (
|
||||
<span
|
||||
key={server.id}
|
||||
aria-hidden="true"
|
||||
style={pinPosition(server)}
|
||||
className="absolute flex -translate-x-1/2 -translate-y-1/2 items-center gap-1.5"
|
||||
>
|
||||
<span
|
||||
className={`h-2.5 w-2.5 shrink-0 rounded-sm border-2 border-surface outline outline-2 outline-offset-1 transition-[background-color,scale,outline-color] duration-200 ${
|
||||
active ? 'scale-125 bg-action outline-action' : 'bg-ink outline-transparent'
|
||||
}`}
|
||||
/>
|
||||
<span
|
||||
className={`hidden rounded-sm border bg-surface px-1.5 py-0.5 text-[10.5px] font-semibold leading-tight sm:block ${
|
||||
active ? 'border-action text-action' : 'border-line text-ink'
|
||||
} ${server.id === 'sgp' ? 'order-first' : ''}`}
|
||||
>
|
||||
{server.city}
|
||||
</span>
|
||||
</span>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div role="radiogroup" aria-labelledby="locations-heading" aria-busy={checking} className="mt-3 flex flex-col gap-1.5">
|
||||
{SERVERS.map((server) => {
|
||||
const active = server.id === selected
|
||||
return (
|
||||
<label key={server.id} className="relative block cursor-pointer">
|
||||
<input
|
||||
type="radio"
|
||||
name="server"
|
||||
value={server.id}
|
||||
checked={active}
|
||||
onChange={() => onSelect(server.id)}
|
||||
className="peer sr-only"
|
||||
/>
|
||||
<span
|
||||
className={`flex items-center justify-between gap-3 rounded-sm border px-3 py-2.5 transition-colors duration-150 peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-action ${
|
||||
active
|
||||
? 'border-action bg-subtle ring-1 ring-action'
|
||||
: 'border-line bg-surface hover:border-action'
|
||||
}`}
|
||||
>
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm font-semibold text-ink">
|
||||
{server.city}
|
||||
<span className="font-normal text-muted">, {server.country}</span>
|
||||
</span>
|
||||
<span className="block font-mono text-[11px] text-muted">{server.host}</span>
|
||||
</span>
|
||||
<span className="shrink-0 text-right">
|
||||
{checking && latency[server.id] === undefined ? (
|
||||
<span className="dot-loader ml-auto block w-5 text-action" aria-hidden="true" />
|
||||
) : (
|
||||
<span
|
||||
key={latency[server.id] ?? 'unchecked'}
|
||||
className="block animate-pop font-mono text-[11px] text-body"
|
||||
>
|
||||
{latencyLabel(latency[server.id])}
|
||||
</span>
|
||||
)}
|
||||
{active && <span className="block animate-pop text-[11px] font-semibold text-action">Selected</span>}
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<p className="mt-2 text-[13px] leading-snug text-muted">
|
||||
Ping is the approximate time to open a connection from your browser, not a throughput guarantee.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { LICENSE, SOURCE } from '../data/servers'
|
||||
import { CONTAINER, SECTION, TEXT_LINK } from '../lib/ui'
|
||||
|
||||
const FACTS = [
|
||||
['Docker Compose', 'HTTP/HTTPS-only and controlled TCP deployments ship with the repository.'],
|
||||
['Domain', 'Required for subdomain routing.'],
|
||||
]
|
||||
|
||||
export default function SelfHost() {
|
||||
return (
|
||||
<section id="self-host">
|
||||
<div className={`${CONTAINER} ${SECTION} reveal`}>
|
||||
<div className="grid gap-8 lg:grid-cols-[1.05fr_0.95fr] lg:gap-16 lg:items-start">
|
||||
<div>
|
||||
<h2 className="text-[28px] font-medium leading-[1.15] tracking-[-0.025em] sm:text-[32px] lg:text-[40px]">
|
||||
Prefer to run your own server?
|
||||
</h2>
|
||||
<p className="mt-4 max-w-[38em] leading-relaxed">
|
||||
The same Tunnel Please server behind tunel.live can run on your own machine. You bring a domain for
|
||||
the public subdomains, then use the included Docker Compose files for an HTTP/HTTPS server or a
|
||||
controlled TCP deployment.
|
||||
</p>
|
||||
<p className="mt-3 max-w-[38em] leading-relaxed">
|
||||
Guests on tunel.live never need this. It is the path for putting the relay on infrastructure you
|
||||
control.
|
||||
</p>
|
||||
<a className={`${TEXT_LINK} mt-5 inline-block`} href={SOURCE} target="_blank" rel="noreferrer">
|
||||
View the source and deployment files
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border border-line bg-surface p-6">
|
||||
<dl className="flex flex-col gap-4">
|
||||
{FACTS.map(([term, detail]) => (
|
||||
<div key={term}>
|
||||
<dt className="text-sm font-semibold text-ink">{term}</dt>
|
||||
<dd className="mt-0.5 text-sm leading-relaxed">{detail}</dd>
|
||||
</div>
|
||||
))}
|
||||
<div>
|
||||
<dt className="text-sm font-semibold text-ink">License</dt>
|
||||
<dd className="mt-0.5 text-sm leading-relaxed">
|
||||
Source available under CC BY-NC-ND 4.0. See the{' '}
|
||||
<a className="text-action underline underline-offset-4" href={LICENSE} target="_blank" rel="noreferrer">
|
||||
license file
|
||||
</a>
|
||||
.
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p className="mt-5 border-t border-line pt-4 text-[13px] leading-relaxed text-muted">
|
||||
Standalone interactive SSH forwarding currently accepts connections without SSH account
|
||||
authentication. Restrict the SSH port to trusted networks when you deploy.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import { useTheme } from '../lib/theme'
|
||||
|
||||
export default function ThemeToggle() {
|
||||
const { theme, toggle } = useTheme()
|
||||
const dark = theme === 'dark'
|
||||
const label = dark ? 'Switch to light mode' : 'Switch to dark mode'
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggle}
|
||||
aria-label={label}
|
||||
title={label}
|
||||
className="inline-flex min-h-11 items-center gap-1.5 rounded-sm border border-line bg-surface px-3 text-sm font-medium text-ink transition-colors duration-150 hover:border-action hover:text-action"
|
||||
>
|
||||
<span key={theme} className="animate-pop">
|
||||
{dark ? (
|
||||
<svg viewBox="0 0 24 24" width="15" height="15" aria-hidden="true" focusable="false">
|
||||
<circle cx="12" cy="12" r="4.2" fill="none" stroke="currentColor" strokeWidth="1.8" />
|
||||
<path
|
||||
d="M12 2.6v2.2M12 19.2v2.2M2.6 12h2.2M19.2 12h2.2M5.3 5.3l1.6 1.6M17.1 17.1l1.6 1.6M18.7 5.3l-1.6 1.6M6.9 17.1l-1.6 1.6"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.8"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
</svg>
|
||||
) : (
|
||||
<svg viewBox="0 0 24 24" width="15" height="15" aria-hidden="true" focusable="false">
|
||||
<path
|
||||
d="M20 14.2A8.2 8.2 0 0 1 9.8 4a8.4 8.4 0 1 0 10.2 10.2Z"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.8"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)}
|
||||
</span>
|
||||
<span>{dark ? 'Light' : 'Dark'}</span>
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import type { PointerEvent } from 'react'
|
||||
|
||||
const CARDS = [
|
||||
{
|
||||
title: 'Share a local web app',
|
||||
body: 'Open it from another device, or send the address to a teammate.',
|
||||
code: 'https://<assigned>.sgp.tunel.live',
|
||||
},
|
||||
{
|
||||
title: 'Receive webhooks',
|
||||
body: 'Point a service like Stripe or GitHub at a port on your machine.',
|
||||
code: 'https://<assigned>.sgp.tunel.live → localhost:8000',
|
||||
},
|
||||
{
|
||||
title: 'Reach a local database or game server',
|
||||
body: 'Forward a TCP port when the client needs a raw socket.',
|
||||
code: 'sgp.tunel.live:20443 → localhost:5432',
|
||||
},
|
||||
]
|
||||
|
||||
const AUTOPLAY_MS = 4000
|
||||
const DRAG_THRESHOLD = 56
|
||||
|
||||
const POSITION = [
|
||||
'translate-x-0 translate-y-0 opacity-100',
|
||||
'translate-x-2 -translate-y-2 opacity-55 lg:translate-x-3.5 lg:-translate-y-3.5',
|
||||
'translate-x-4 -translate-y-4 opacity-30 lg:translate-x-7 lg:-translate-y-7',
|
||||
]
|
||||
|
||||
export default function UseCaseStack() {
|
||||
const [active, setActive] = useState(0)
|
||||
const [hovered, setHovered] = useState(false)
|
||||
const [reduced, setReduced] = useState(false)
|
||||
const [dragging, setDragging] = useState(false)
|
||||
const [dragX, setDragX] = useState(0)
|
||||
const startX = useRef<number | null>(null)
|
||||
|
||||
useEffect(() => {
|
||||
const query = matchMedia('(prefers-reduced-motion: reduce)')
|
||||
const sync = () => setReduced(query.matches)
|
||||
sync()
|
||||
query.addEventListener('change', sync)
|
||||
return () => query.removeEventListener('change', sync)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (hovered || reduced || dragging) return
|
||||
const timer = setInterval(() => setActive((index) => (index + 1) % CARDS.length), AUTOPLAY_MS)
|
||||
return () => clearInterval(timer)
|
||||
}, [hovered, reduced, dragging])
|
||||
|
||||
function onPointerDown(event: PointerEvent<HTMLDivElement>) {
|
||||
if (event.pointerType === 'mouse' && event.button !== 0) return
|
||||
startX.current = event.clientX
|
||||
setDragging(true)
|
||||
setDragX(0)
|
||||
event.currentTarget.setPointerCapture(event.pointerId)
|
||||
}
|
||||
|
||||
function onPointerMove(event: PointerEvent<HTMLDivElement>) {
|
||||
if (startX.current === null) return
|
||||
setDragX(event.clientX - startX.current)
|
||||
}
|
||||
|
||||
function finishDrag(event: PointerEvent<HTMLDivElement>) {
|
||||
if (startX.current === null) return
|
||||
const delta = event.clientX - startX.current
|
||||
startX.current = null
|
||||
setDragging(false)
|
||||
setDragX(0)
|
||||
// Both directions advance: the card peeking up-right behind the front is
|
||||
// the one the drag exposes either way, so it always becomes the new front.
|
||||
if (Math.abs(delta) > DRAG_THRESHOLD) {
|
||||
setActive((index) => (index + 1) % CARDS.length)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="flex flex-col gap-3" aria-label="What you can do with a tunnel">
|
||||
<div
|
||||
className={`relative h-[300px] touch-pan-y sm:h-[280px] lg:h-[300px] ${
|
||||
dragging ? 'cursor-grabbing select-none' : 'cursor-grab'
|
||||
}`}
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
onFocusCapture={() => setHovered(true)}
|
||||
onBlurCapture={(event) => {
|
||||
if (!event.currentTarget.contains(event.relatedTarget)) setHovered(false)
|
||||
}}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={finishDrag}
|
||||
onPointerCancel={finishDrag}
|
||||
>
|
||||
{CARDS.map((card, index) => {
|
||||
const position = (index - active + CARDS.length) % CARDS.length
|
||||
const isFront = position === 0
|
||||
return (
|
||||
<article
|
||||
key={card.title}
|
||||
aria-hidden={!isFront}
|
||||
style={{
|
||||
zIndex: CARDS.length - position,
|
||||
...(isFront && dragging ? { translate: `${dragX}px 0px`, transitionDuration: '0s' } : null),
|
||||
}}
|
||||
className={`absolute inset-x-0 bottom-0 top-8 rounded-md border border-line bg-surface p-5 transition-[translate,opacity] duration-700 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[translate,opacity] sm:p-6 ${POSITION[position]}`}
|
||||
>
|
||||
<h2 className="text-[19px] font-medium leading-snug tracking-[-0.01em]">{card.title}</h2>
|
||||
<p className="mt-2 max-w-[30em] text-[15px] leading-relaxed text-body">{card.body}</p>
|
||||
<code className="mt-4 block overflow-x-auto whitespace-nowrap rounded-sm bg-subtle px-2.5 py-2 font-mono text-[12.5px] text-ink">
|
||||
{card.code}
|
||||
</code>
|
||||
</article>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-1 pl-0.5">
|
||||
{CARDS.map((card, index) => (
|
||||
<button
|
||||
key={card.title}
|
||||
type="button"
|
||||
onClick={() => setActive(index)}
|
||||
aria-label={`Show: ${card.title}`}
|
||||
aria-current={index === active ? 'true' : undefined}
|
||||
className="group inline-flex min-h-11 items-center rounded-sm px-1.5"
|
||||
>
|
||||
<span
|
||||
className={`h-[3px] w-4 transition-colors duration-500 ${
|
||||
index === active ? 'bg-action' : 'bg-line group-hover:bg-muted'
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Hosted server inventory. This is a maintained snapshot, not a live API response.
|
||||
export const SERVERS = [
|
||||
{ id: 'us', city: 'Chicago', country: 'United States', host: 'us.tunel.live', lon: -87.6298, lat: 41.8781 },
|
||||
{ id: 'eu', city: 'Frankfurt', country: 'Germany', host: 'eu.tunel.live', lon: 8.6821, lat: 50.1109 },
|
||||
{ id: 'sgp', city: 'Singapore', country: 'Singapore', host: 'sgp.tunel.live', lon: 103.8198, lat: 1.3521 },
|
||||
]
|
||||
|
||||
export const DEFAULT_SERVER = 'sgp'
|
||||
|
||||
export const SOURCE = 'https://git.fossy.my.id/bagas/tunnel-please'
|
||||
export const ISSUES = `${SOURCE}/issues`
|
||||
export const LICENSE = `${SOURCE}/src/branch/main/LICENSE.md`
|
||||
@@ -0,0 +1,14 @@
|
||||
import { startTransition, StrictMode } from 'react'
|
||||
import { hydrateRoot } from 'react-dom/client'
|
||||
import { HydratedRouter } from 'react-router/dom'
|
||||
import { applyStoredTheme } from './lib/theme'
|
||||
|
||||
applyStoredTheme()
|
||||
startTransition(() => {
|
||||
hydrateRoot(
|
||||
document,
|
||||
<StrictMode>
|
||||
<HydratedRouter />
|
||||
</StrictMode>,
|
||||
)
|
||||
})
|
||||
@@ -0,0 +1,30 @@
|
||||
// navigator.clipboard only exists in a secure context and can still be denied
|
||||
// by permissions, so fall back to the selection trick for plain-http access.
|
||||
export async function copyText(text: string): Promise<boolean> {
|
||||
try {
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(text)
|
||||
return true
|
||||
}
|
||||
} catch {
|
||||
// denied or unfocused: fall through
|
||||
}
|
||||
|
||||
const field = document.createElement('textarea')
|
||||
field.value = text
|
||||
field.setAttribute('readonly', '')
|
||||
field.style.position = 'fixed'
|
||||
field.style.top = '0'
|
||||
field.style.opacity = '0'
|
||||
const previous = document.activeElement
|
||||
document.body.append(field)
|
||||
field.select()
|
||||
try {
|
||||
return document.execCommand('copy')
|
||||
} catch {
|
||||
return false
|
||||
} finally {
|
||||
field.remove()
|
||||
if (previous instanceof HTMLElement) previous.focus()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildCommand, parsePort } from './command'
|
||||
|
||||
describe('parsePort', () => {
|
||||
it('accepts integers in range only', () => {
|
||||
expect(parsePort('8000')).toBe(8000)
|
||||
expect(parsePort(' 443 ')).toBe(443)
|
||||
expect(parsePort('0')).toBeNull()
|
||||
expect(parsePort('65536')).toBeNull()
|
||||
expect(parsePort('80.5')).toBeNull()
|
||||
expect(parsePort('abc')).toBeNull()
|
||||
expect(parsePort('')).toBeNull()
|
||||
})
|
||||
|
||||
it('honours the TCP range', () => {
|
||||
expect(parsePort('19999', 20000, 21000)).toBeNull()
|
||||
expect(parsePort('20443', 20000, 21000)).toBe(20443)
|
||||
expect(parsePort('21001', 20000, 21000)).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildCommand', () => {
|
||||
it('builds the HTTPS command', () => {
|
||||
expect(buildCommand({ host: 'sgp.tunel.live', mode: 'http', webPort: 443, localPort: '8000' })).toBe(
|
||||
'ssh sgp.tunel.live -p 2200 -R 443:localhost:8000',
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps the HTTP port when selected', () => {
|
||||
expect(buildCommand({ host: 'eu.tunel.live', mode: 'http', webPort: 80, localPort: 3000 })).toBe(
|
||||
'ssh eu.tunel.live -p 2200 -R 80:localhost:3000',
|
||||
)
|
||||
})
|
||||
|
||||
it('builds the TCP command inside the supported range', () => {
|
||||
expect(buildCommand({ host: 'eu.tunel.live', mode: 'tcp', serverPort: '20443', localPort: '5432' })).toBe(
|
||||
'ssh eu.tunel.live -p 2200 -R 20443:localhost:5432',
|
||||
)
|
||||
})
|
||||
|
||||
it('returns null instead of emitting an invalid command', () => {
|
||||
expect(buildCommand({ host: 'sgp.tunel.live', mode: 'http', localPort: '0' })).toBeNull()
|
||||
expect(buildCommand({ host: 'sgp.tunel.live', mode: 'tcp', serverPort: '9999', localPort: '5432' })).toBeNull()
|
||||
expect(buildCommand({ host: 'sgp.tunel.live', mode: 'custom', localPort: '8000' })).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,27 @@
|
||||
export const SSH_PORT = 2200
|
||||
export const TCP_MIN = 20000
|
||||
export const TCP_MAX = 21000
|
||||
|
||||
/** Returns the port as a number, or null when it is not a valid integer in range. */
|
||||
export function parsePort(value: unknown, min = 1, max = 65535): number | null {
|
||||
const text = String(value ?? '').trim()
|
||||
if (!/^\d+$/.test(text)) return null
|
||||
const port = Number(text)
|
||||
return port >= min && port <= max ? port : null
|
||||
}
|
||||
|
||||
/** The SSH command for the selected guest mode, or null while inputs are invalid. */
|
||||
export function buildCommand({ host, mode, webPort = 443, serverPort, localPort }: { host: string; mode: string; webPort?: number | string; serverPort?: number | string; localPort: number | string }): string | null {
|
||||
const local = parsePort(localPort)
|
||||
if (!host || !local || mode === 'custom') return null
|
||||
|
||||
if (mode === 'http') {
|
||||
return `ssh ${host} -p ${SSH_PORT} -R ${webPort}:localhost:${local}`
|
||||
}
|
||||
if (mode === 'tcp') {
|
||||
const remote = parsePort(serverPort, TCP_MIN, TCP_MAX)
|
||||
if (!remote) return null
|
||||
return `ssh ${host} -p ${SSH_PORT} -R ${remote}:localhost:${local}`
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import { PING_TTL, readPingCache, writePingCache } from './pingCache'
|
||||
|
||||
const store = new Map()
|
||||
globalThis.localStorage = {
|
||||
getItem: (key: string) => store.get(key) ?? null,
|
||||
setItem: (key: string, value: string) => { store.set(key, String(value)) },
|
||||
} as unknown as Storage
|
||||
|
||||
describe('ping cache', () => {
|
||||
beforeEach(() => store.clear())
|
||||
|
||||
it('returns fresh results', () => {
|
||||
const latency = { sgp: 20, eu: 558, us: 670 }
|
||||
writePingCache(latency, 1000)
|
||||
expect(readPingCache(1000 + PING_TTL - 1)).toEqual(latency)
|
||||
})
|
||||
|
||||
it('expires after the TTL', () => {
|
||||
writePingCache({ sgp: 20 }, 1000)
|
||||
expect(readPingCache(1000 + PING_TTL + 1)).toBeNull()
|
||||
})
|
||||
|
||||
it('ignores an empty or corrupt entry', () => {
|
||||
expect(readPingCache()).toBeNull()
|
||||
store.set('tunel-ping', 'not json')
|
||||
expect(readPingCache()).toBeNull()
|
||||
store.set('tunel-ping', JSON.stringify({ latency: { sgp: 20 } }))
|
||||
expect(readPingCache()).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,29 @@
|
||||
// Ping results are cached so a repeat visit does not probe the tunnel hosts
|
||||
// again. The manual "Check ping" button bypasses the cache.
|
||||
const KEY = 'tunel-ping'
|
||||
export const PING_TTL = 10 * 60 * 1000
|
||||
|
||||
export type LatencyMap = Record<string, number | null>
|
||||
function isLatencyMap(value: unknown): value is LatencyMap {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.values(value).every((item) => item === null || (typeof item === 'number' && Number.isFinite(item)))
|
||||
}
|
||||
export function readPingCache(now = Date.now()): LatencyMap | null {
|
||||
try {
|
||||
const raw = localStorage.getItem(KEY)
|
||||
if (!raw) return null
|
||||
const cached: unknown = JSON.parse(raw)
|
||||
if (!cached || typeof cached !== 'object' || !('at' in cached) || typeof cached.at !== 'number' || now - cached.at > PING_TTL) return null
|
||||
if (!('latency' in cached) || !isLatencyMap(cached.latency)) return null
|
||||
return cached.latency
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function writePingCache(latency: LatencyMap, now = Date.now()) {
|
||||
try {
|
||||
localStorage.setItem(KEY, JSON.stringify({ at: now, latency }))
|
||||
} catch {
|
||||
// storage blocked or full: the next visit simply probes again
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { useCallback, useSyncExternalStore } from 'react'
|
||||
|
||||
const KEY = 'tunel-theme'
|
||||
const THEME_EVENT = 'tunel-theme-change'
|
||||
type Theme = 'light' | 'dark'
|
||||
|
||||
export function applyStoredTheme() {
|
||||
try {
|
||||
const saved = localStorage.getItem(KEY)
|
||||
const dark = saved === 'dark' || (!saved && matchMedia('(prefers-color-scheme: dark)').matches)
|
||||
document.documentElement.classList.toggle('dark', dark)
|
||||
} catch {
|
||||
// Storage may be unavailable; the light theme remains the safe fallback.
|
||||
}
|
||||
}
|
||||
|
||||
const read = (): Theme =>
|
||||
typeof document === 'undefined' ? 'light' : document.documentElement.classList.contains('dark') ? 'dark' : 'light'
|
||||
|
||||
const subscribe = (onChange: () => void) => {
|
||||
const onStorage = (event: StorageEvent) => {
|
||||
if (event.key !== KEY) return
|
||||
document.documentElement.classList.toggle('dark', event.newValue === 'dark')
|
||||
onChange()
|
||||
}
|
||||
addEventListener('storage', onStorage)
|
||||
addEventListener(THEME_EVENT, onChange)
|
||||
return () => {
|
||||
removeEventListener('storage', onStorage)
|
||||
removeEventListener(THEME_EVENT, onChange)
|
||||
}
|
||||
}
|
||||
|
||||
export function useTheme() {
|
||||
const theme = useSyncExternalStore(subscribe, read, () => 'light' as Theme)
|
||||
const toggle = useCallback(() => {
|
||||
const next = read() === 'dark' ? 'light' : 'dark'
|
||||
document.documentElement.classList.toggle('dark', next === 'dark')
|
||||
try {
|
||||
localStorage.setItem(KEY, next)
|
||||
} catch {
|
||||
// Private mode: the toggle still works for this page view.
|
||||
}
|
||||
dispatchEvent(new Event(THEME_EVENT))
|
||||
}, [])
|
||||
return { theme, toggle }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
export const CONTAINER = 'mx-auto w-full max-w-[1200px] px-5 lg:px-8'
|
||||
export const SECTION = 'py-12 lg:py-24'
|
||||
|
||||
export const BTN =
|
||||
'inline-flex min-h-12 items-center justify-center gap-2 rounded-sm border border-transparent bg-ink px-5 text-[15px] font-semibold text-on-ink transition-[background-color,scale] duration-150 hover:bg-ink-hover active:scale-[0.98] disabled:cursor-not-allowed disabled:bg-subtle disabled:text-muted'
|
||||
|
||||
|
||||
export const BTN_TERM =
|
||||
'inline-flex min-h-12 items-center justify-center rounded-sm border border-transparent bg-surface px-5 text-[15px] font-semibold text-ink transition-[background-color,scale] duration-150 hover:bg-subtle active:scale-[0.98] disabled:cursor-not-allowed disabled:bg-subtle disabled:text-muted'
|
||||
|
||||
export const TEXT_LINK = 'inline-flex min-h-11 items-center text-[15px] font-medium text-action underline underline-offset-4 hover:text-ink'
|
||||
|
||||
export const H1 =
|
||||
'text-[40px] font-medium leading-[1.08] tracking-[-0.03em] sm:text-[46px] lg:text-[50px] lg:leading-[1.05] xl:text-[64px]'
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
export function useReducedMotion() {
|
||||
const [reduced, setReduced] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
const query = matchMedia('(prefers-reduced-motion: reduce)')
|
||||
const sync = () => setReduced(query.matches)
|
||||
sync()
|
||||
query.addEventListener('change', sync)
|
||||
return () => query.removeEventListener('change', sync)
|
||||
}, [])
|
||||
|
||||
return reduced
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Link } from 'react-router'
|
||||
import UseCaseStack from '../components/UseCaseStack'
|
||||
import Configurator from '../components/Configurator'
|
||||
import SelfHost from '../components/SelfHost'
|
||||
import { BTN, CONTAINER, H1, TEXT_LINK } from '../lib/ui'
|
||||
|
||||
export default function Landing() {
|
||||
return (
|
||||
<>
|
||||
<section id="product" className="border-b border-line">
|
||||
{/* shortcut: 4.3125rem is the header height; update it if the header grows. */}
|
||||
<div className={`${CONTAINER} reveal grid min-h-[calc(100dvh-4.3125rem)] content-center gap-10 py-12 lg:grid-cols-[1.05fr_0.95fr] lg:gap-16 lg:py-16`}>
|
||||
<div className="flex flex-col items-start">
|
||||
<h1 className={H1}>
|
||||
One SSH command.
|
||||
<br />
|
||||
Your app, online.
|
||||
</h1>
|
||||
<p className="mt-5 max-w-[32em] text-lg leading-relaxed text-body">
|
||||
tunel.live gives your local app a public HTTP/HTTPS address or TCP endpoint through a free hosted
|
||||
Tunnel Please server. No registration required for standard tunnels.
|
||||
</p>
|
||||
<div className="mt-7 flex flex-wrap items-center gap-x-6 gap-y-3">
|
||||
<Link className={BTN} to="/#configure">
|
||||
Configure a tunnel
|
||||
</Link>
|
||||
<Link className={TEXT_LINK} to="/#self-host">
|
||||
Self-host the server
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<UseCaseStack />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<Configurator />
|
||||
<SelfHost />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Link } from 'react-router'
|
||||
import { CONTAINER } from '../lib/ui'
|
||||
|
||||
export default function NotFound() {
|
||||
return (
|
||||
<div className={`${CONTAINER} max-w-[680px] py-16`}>
|
||||
<h1 className="text-[30px] font-medium tracking-[-0.025em] sm:text-[34px]">Page not found</h1>
|
||||
<p className="mt-3 text-muted">That address does not exist on this site.</p>
|
||||
<p className="mt-4">
|
||||
<Link className="text-action underline underline-offset-4" to="/">
|
||||
Return to tunel.live
|
||||
</Link>{' '}
|
||||
or{' '}
|
||||
<Link className="text-action underline underline-offset-4" to="/#configure">
|
||||
configure a tunnel
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import { MemoryRouter } from 'react-router'
|
||||
import type { ReactNode } from 'react'
|
||||
import Landing from '../pages/Landing'
|
||||
import NotFound from '../pages/NotFound'
|
||||
|
||||
function render(element: ReactNode) {
|
||||
return renderToStaticMarkup(<MemoryRouter>{element}</MemoryRouter>)
|
||||
}
|
||||
|
||||
describe('pages render', () => {
|
||||
it('landing shows the terminal and the server picker', () => {
|
||||
const html = render(<Landing />)
|
||||
expect(html).toContain('Build your tunnel command')
|
||||
expect(html).toContain('Copy command')
|
||||
expect(html).toContain('$ ')
|
||||
expect(html).toContain('Server location')
|
||||
expect(html).toContain('us.tunel.live')
|
||||
expect(html).toContain('eu.tunel.live')
|
||||
expect(html).toContain('role="radiogroup"')
|
||||
expect((html.match(/type="radio"/g) || []).length).toBeGreaterThanOrEqual(3)
|
||||
})
|
||||
|
||||
it('landing does not invent latency or offline claims', () => {
|
||||
const html = render(<Landing />)
|
||||
expect(html).not.toMatch(/\d+\s?ms/)
|
||||
expect(html).not.toContain('Operational')
|
||||
expect(html).not.toContain('open source')
|
||||
})
|
||||
|
||||
it('not found page offers a route back', () => {
|
||||
expect(render(<NotFound />)).toContain('Page not found')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,69 @@
|
||||
import {
|
||||
isRouteErrorResponse,
|
||||
Links,
|
||||
Meta,
|
||||
Outlet,
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
} from 'react-router'
|
||||
import type { Route } from './+types/root'
|
||||
import './app.css'
|
||||
import fontSans from './assets/fonts/plex-sans.woff2?url'
|
||||
|
||||
export const links: Route.LinksFunction = () => [
|
||||
{
|
||||
rel: 'preload',
|
||||
href: fontSans,
|
||||
as: 'font',
|
||||
type: 'font/woff2',
|
||||
crossOrigin: 'anonymous',
|
||||
},
|
||||
]
|
||||
|
||||
export function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<Meta />
|
||||
<Links />
|
||||
</head>
|
||||
<body>
|
||||
{children}
|
||||
<ScrollRestoration />
|
||||
<Scripts />
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return <Outlet />
|
||||
}
|
||||
|
||||
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
||||
let message = 'Oops!'
|
||||
let details = 'An unexpected error occurred.'
|
||||
let stack: string | undefined
|
||||
|
||||
if (isRouteErrorResponse(error)) {
|
||||
message = error.status === 404 ? '404' : 'Error'
|
||||
details = error.statusText || details
|
||||
} else if (import.meta.env.DEV && error instanceof Error) {
|
||||
details = error.message
|
||||
stack = error.stack
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="mx-auto max-w-3xl p-6 text-body">
|
||||
<h1 className="text-3xl font-medium text-ink">{message}</h1>
|
||||
<p className="mt-3">{details}</p>
|
||||
{stack && (
|
||||
<pre className="mt-4 overflow-x-auto rounded-md bg-term p-4 text-sm text-term-text">
|
||||
<code>{stack}</code>
|
||||
</pre>
|
||||
)}
|
||||
</main>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
import { layout, index, route, type RouteConfig } from '@react-router/dev/routes'
|
||||
export default [layout('routes/layout.tsx', [index('routes/home.tsx'), route('*', 'routes/not-found.tsx')])] satisfies RouteConfig
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { Route } from './+types/home'
|
||||
import Landing from '../pages/Landing'
|
||||
export const SITE_TITLE = 'tunel.live | Free SSH tunnels for local development'
|
||||
export const SITE_DESCRIPTION = 'Create an HTTP/HTTPS or TCP tunnel to your local service with one SSH command. Free hosted servers, no registration required, or self-host Tunnel Please.'
|
||||
export function meta({}: Route.MetaArgs) { return [{ title: SITE_TITLE }, { name: 'description', content: SITE_DESCRIPTION }] }
|
||||
export default Landing
|
||||
@@ -0,0 +1,2 @@
|
||||
import Layout from '../components/Layout'
|
||||
export default Layout
|
||||
@@ -0,0 +1,4 @@
|
||||
import type { Route } from './+types/not-found'
|
||||
import NotFound from '../pages/NotFound'
|
||||
export function meta({}: Route.MetaArgs) { return [{ title: 'Page not found | tunel.live' }, { name: 'description', content: 'That address does not exist on tunel.live.' }] }
|
||||
export default NotFound
|
||||
Generated
+3842
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "tunel-web",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "npm run typecheck && react-router build",
|
||||
"dev": "react-router dev",
|
||||
"start": "react-router-serve ./build/server/index.js",
|
||||
"typecheck": "react-router typegen && tsc",
|
||||
"preview": "react-router-serve ./build/server/index.js",
|
||||
"test": "vitest run",
|
||||
"check:responsive": "node scripts/responsive-check.ts",
|
||||
"check:contrast": "node scripts/contrast-check.ts",
|
||||
"check": "npm run check:responsive && npm run check:contrast"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-router/node": "^8.5.1",
|
||||
"@react-router/serve": "^8.5.1",
|
||||
"isbot": "^5.1.36",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8",
|
||||
"react-router": "^8.5.1",
|
||||
"d3-geo": "^3.1.1",
|
||||
"topojson-client": "^3.1.0",
|
||||
"world-atlas": "^2.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-router/dev": "^8.5.1",
|
||||
"@tailwindcss/vite": "^4.2.2",
|
||||
"@types/node": "^22",
|
||||
"@types/react": "^19.2.18",
|
||||
"@types/react-dom": "^19.2.7",
|
||||
"tailwindcss": "^4.2.2",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^8.0.3",
|
||||
"@types/d3-geo": "^3.1.1",
|
||||
"@types/geojson": "^7946.0.16",
|
||||
"@types/topojson-client": "^3.1.5",
|
||||
"@types/topojson-specification": "^1.0.5",
|
||||
"playwright": "^1.65.1",
|
||||
"vitest": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=24"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { Config } from "@react-router/dev/config";
|
||||
|
||||
export default {
|
||||
// Config options...
|
||||
// Server-side render by default, to enable SPA mode set this to `false`
|
||||
ssr: true,
|
||||
} satisfies Config;
|
||||
@@ -0,0 +1,217 @@
|
||||
// Fails when text becomes unreadable against its own background, including
|
||||
// while hovered or focused. Catches invisible states like white-on-white
|
||||
// checked segments.
|
||||
import { chromium } from 'playwright'
|
||||
|
||||
const BASE = process.env.BASE_URL || 'http://127.0.0.1:5173'
|
||||
const THEMES = ['light', 'dark']
|
||||
let failures = 0
|
||||
type Color = { r: number; g: number; b: number; a: number }
|
||||
|
||||
const AUDIT = () => {
|
||||
const clamp = (v: number) => Math.min(1, Math.max(0, v))
|
||||
const gamma = (v: number) => (v <= 0.0031308 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055)
|
||||
|
||||
// Chromium reports Tailwind's color-mix() output as oklab().
|
||||
const oklabToRgb = (L: number, a: number, b: number) => {
|
||||
const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3
|
||||
const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3
|
||||
const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3
|
||||
return [
|
||||
4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
||||
-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
||||
-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
|
||||
].map((v: number) => clamp(gamma(v)) * 255)
|
||||
}
|
||||
|
||||
const parseColor = (css: string) => {
|
||||
if (css.startsWith('rgb')) {
|
||||
const n = (css.match(/[\d.]+/g) ?? []).map(Number)
|
||||
return { r: n[0], g: n[1], b: n[2], a: n[3] ?? 1 }
|
||||
}
|
||||
if (css.startsWith('oklab')) {
|
||||
const [coords, alpha] = css.slice(6, -1).split('/')
|
||||
const n = coords.trim().split(/\s+/).map(Number)
|
||||
const [r, g, b] = oklabToRgb(n[0], n[1], n[2])
|
||||
return { r, g, b, a: alpha ? Number(alpha) : 1 }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
const luminance = ({ r, g, b }: { r: number; g: number; b: number }) => {
|
||||
const f = (v: number) => {
|
||||
v /= 255
|
||||
return v <= 0.03928 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4
|
||||
}
|
||||
return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b)
|
||||
}
|
||||
|
||||
const over = (top: Color, bottom: Color): Color => ({
|
||||
r: top.r * top.a + bottom.r * (1 - top.a),
|
||||
g: top.g * top.a + bottom.g * (1 - top.a),
|
||||
b: top.b * top.a + bottom.b * (1 - top.a),
|
||||
a: 1,
|
||||
})
|
||||
|
||||
const composite = (nodes: Element[]): Color => {
|
||||
const layers: Color[] = []
|
||||
for (const node of nodes) {
|
||||
const c = parseColor(getComputedStyle(node).backgroundColor)
|
||||
if (!c || c.a === 0) continue
|
||||
layers.push(c)
|
||||
if (c.a === 1) break
|
||||
}
|
||||
return layers.reduceRight((base, c) => over(c, base), { r: 255, g: 255, b: 255, a: 1 })
|
||||
}
|
||||
|
||||
const ancestors = (el: Element): Color => {
|
||||
const chain: Element[] = []
|
||||
for (let node: Element | null = el; node; node = node.parentElement) chain.push(node)
|
||||
return composite(chain)
|
||||
}
|
||||
|
||||
// Walk the paint stack under the text, not just its ancestors: a sliding
|
||||
// segment thumb is a sibling painted behind the label.
|
||||
const backdrop = (el: Element): Color => {
|
||||
let rect = el.getBoundingClientRect()
|
||||
const offscreen =
|
||||
!rect.width || !rect.height || rect.bottom < 0 || rect.right < 0 || rect.top > innerHeight || rect.left > innerWidth
|
||||
if (offscreen) {
|
||||
// In-view elements only: elementsFromPoint cannot see points outside the
|
||||
// viewport, and ancestor-walking misses sibling backdrops like the
|
||||
// sliding segment thumb.
|
||||
el.scrollIntoView({ block: 'center' })
|
||||
rect = el.getBoundingClientRect()
|
||||
}
|
||||
if (!rect.width || !rect.height) return ancestors(el)
|
||||
|
||||
const stack = document.elementsFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2)
|
||||
const start = stack.indexOf(el)
|
||||
return start === -1 ? ancestors(el) : composite(stack.slice(start))
|
||||
}
|
||||
|
||||
const opacityOf = (el: Element) => {
|
||||
let o = 1
|
||||
for (let node: Element | null = el; node; node = node.parentElement) o *= Number(getComputedStyle(node).opacity)
|
||||
return o
|
||||
}
|
||||
|
||||
const hidden = (el: Element) => {
|
||||
const s = getComputedStyle(el)
|
||||
if (s.display === 'none' || s.visibility === 'hidden' || opacityOf(el) < 0.05) return true
|
||||
return Boolean(el.closest('[aria-hidden="true"], [hidden], script, style'))
|
||||
}
|
||||
|
||||
const rows: Array<{ text: string; ratio: number | null; required: number; color: string; bg?: string }> = []
|
||||
for (const target of document.querySelectorAll('a[href], button, label, summary')) {
|
||||
if (hidden(target) || target.matches('[aria-hidden="true"]')) continue
|
||||
const disabled = target.matches('[disabled], [aria-disabled="true"]')
|
||||
|
||||
// Measure every text node separately: a span may carry its own color.
|
||||
const walker = document.createTreeWalker(target, NodeFilter.SHOW_TEXT)
|
||||
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
||||
const text = node.textContent?.trim() ?? ''
|
||||
if (!text) continue
|
||||
const leaf = node.parentElement
|
||||
if (!leaf || hidden(leaf)) continue
|
||||
|
||||
const style = getComputedStyle(leaf)
|
||||
const fg = parseColor(style.color)
|
||||
const bg = backdrop(leaf)
|
||||
if (!fg) {
|
||||
rows.push({ text: text.slice(0, 28), ratio: null, required: 0, color: style.color })
|
||||
continue
|
||||
}
|
||||
|
||||
const alpha = fg.a * opacityOf(leaf)
|
||||
const shown = over({ ...fg, a: alpha }, bg)
|
||||
const [hi, lo] = [luminance(shown), luminance(bg)].sort((a, b) => b - a)
|
||||
const ratio = (hi + 0.05) / (lo + 0.05)
|
||||
const size = parseFloat(style.fontSize)
|
||||
const large = size >= 24 || (Number(style.fontWeight) >= 700 && size >= 18.66)
|
||||
|
||||
rows.push({
|
||||
text: text.slice(0, 28),
|
||||
ratio: Math.round(ratio * 100) / 100,
|
||||
required: disabled ? 3 : large ? 3 : 4.5,
|
||||
color: style.color,
|
||||
bg: `rgb(${Math.round(bg.r)}, ${Math.round(bg.g)}, ${Math.round(bg.b)})`,
|
||||
})
|
||||
}
|
||||
}
|
||||
return rows
|
||||
}
|
||||
|
||||
function check(state: string, row: { ratio: number | null; required: number; color: string; text: string; bg?: string }, theme: string) {
|
||||
if (row.ratio === null) {
|
||||
failures++
|
||||
console.log(`FAIL ${theme} ${state}: unreadable color "${row.color}" on "${row.text}"`)
|
||||
return
|
||||
}
|
||||
if (row.ratio < row.required) {
|
||||
failures++
|
||||
console.log(
|
||||
`FAIL ${theme} ${state}: ${row.ratio}:1 < ${row.required}:1 — "${row.text}" ${row.color} on ${row.bg}`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const browser = await chromium.launch()
|
||||
for (const theme of THEMES) {
|
||||
const page = await browser.newPage({ viewport: { width: 1440, height: 1000 }, reducedMotion: 'reduce' })
|
||||
await page.goto(BASE, { waitUntil: 'networkidle' })
|
||||
if (theme === 'dark') {
|
||||
await page.getByRole('button', { name: 'Switch to dark mode' }).click()
|
||||
await page.waitForTimeout(200)
|
||||
}
|
||||
|
||||
const controls = await page.evaluate(() =>
|
||||
[...document.querySelectorAll('a[href], button, label, summary')]
|
||||
.filter((el) => !el.closest('[aria-hidden="true"]'))
|
||||
.map((el, i) => ({
|
||||
i,
|
||||
text: el.textContent.trim().slice(0, 24),
|
||||
inert: el.matches('[disabled], [aria-disabled="true"]'),
|
||||
}))
|
||||
.filter((item) => item.text),
|
||||
)
|
||||
|
||||
for (const item of controls) {
|
||||
const loc = page.locator('a[href], button, label, summary').nth(item.i)
|
||||
const rest = await page.evaluate(AUDIT)
|
||||
if (item.inert) continue // no hover state to compare
|
||||
|
||||
try {
|
||||
await loc.hover({ timeout: 1500 })
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
await page.waitForTimeout(250)
|
||||
const hovered = await page.evaluate(AUDIT)
|
||||
await page.mouse.move(2, 2)
|
||||
await page.waitForTimeout(150)
|
||||
|
||||
// Compare the same text before and after: only report a regression, so a
|
||||
// control that was already failing at rest is reported once, not per hover.
|
||||
const worse = hovered.filter((after) => {
|
||||
const before = rest.find((r) => r.text === after.text)
|
||||
return before && after.ratio !== null && after.ratio < (before.ratio ?? Infinity) - 0.01
|
||||
})
|
||||
for (const row of worse) check(`hover "${item.text}"`, row, theme)
|
||||
}
|
||||
|
||||
const restRows = await page.evaluate(AUDIT)
|
||||
const seen = new Set()
|
||||
for (const row of restRows) {
|
||||
if (row.ratio !== null && row.ratio >= row.required) continue
|
||||
if (seen.has(row.text)) continue
|
||||
seen.add(row.text)
|
||||
check('rest', row, theme)
|
||||
}
|
||||
|
||||
await page.close()
|
||||
}
|
||||
await browser.close()
|
||||
|
||||
console.log(failures === 0 ? '\nCONTRAST OK' : `\n${failures} CONTRAST FAILURE(S)`)
|
||||
process.exit(failures === 0 ? 0 : 1)
|
||||
@@ -0,0 +1,127 @@
|
||||
import { chromium } from 'playwright'
|
||||
|
||||
const BASE = process.env.BASE_URL || 'http://127.0.0.1:5173'
|
||||
const widths = [320, 375, 414, 768, 1024, 1280, 1440]
|
||||
const results: string[] = []
|
||||
let failures = 0
|
||||
|
||||
function check(label: string, ok: boolean, detail = '') {
|
||||
if (!ok) failures++
|
||||
results.push(`${ok ? 'PASS' : 'FAIL'} ${label}${detail ? ' — ' + detail : ''}`)
|
||||
}
|
||||
|
||||
const browser = await chromium.launch()
|
||||
const page = await browser.newPage()
|
||||
await page.goto(BASE, { waitUntil: 'networkidle' })
|
||||
|
||||
for (const width of widths) {
|
||||
await page.setViewportSize({ width, height: 900 })
|
||||
await page.waitForTimeout(320)
|
||||
const m = await page.evaluate(() => {
|
||||
const html = document.documentElement
|
||||
const desktopNav = document.querySelector('nav[aria-label="Main"]')
|
||||
const menu = document.querySelector('details')
|
||||
const h1 = document.querySelector('h1')
|
||||
const mapEl = document.querySelector('#configure svg')!.parentElement!
|
||||
const map = mapEl.getBoundingClientRect()
|
||||
const markers = [...mapEl.querySelectorAll(':scope > span')].map((el) => el.getBoundingClientRect())
|
||||
return {
|
||||
scrollW: html.scrollWidth,
|
||||
clientW: html.clientWidth,
|
||||
desktopNavDisplay: desktopNav ? getComputedStyle(desktopNav).display : 'missing',
|
||||
menuDisplay: menu ? getComputedStyle(menu).display : 'missing',
|
||||
h1Size: h1 ? getComputedStyle(h1).fontSize : null,
|
||||
markersInside: markers.every(
|
||||
(r) => r.left >= map.left - 1 && r.right <= map.right + 1 && r.top >= map.top - 1 && r.bottom <= map.bottom + 1,
|
||||
),
|
||||
}
|
||||
})
|
||||
check(`${width}px: no horizontal overflow`, m.scrollW <= m.clientW + 1, `scrollW=${m.scrollW} clientW=${m.clientW}`)
|
||||
check(
|
||||
`${width}px: navigation switches at md`,
|
||||
width >= 768 ? m.desktopNavDisplay !== 'none' : m.menuDisplay !== 'none',
|
||||
`desktop=${m.desktopNavDisplay} mobileMenu=${m.menuDisplay}`,
|
||||
)
|
||||
check(`${width}px: map markers stay inside the map`, m.markersInside === true)
|
||||
console.log(`${width}px h1=${m.h1Size}`)
|
||||
}
|
||||
|
||||
await page.setViewportSize({ width: 1440, height: 900 })
|
||||
const lightBg = await page.evaluate(() => getComputedStyle(document.body).backgroundColor)
|
||||
await page.getByRole('button', { name: 'Switch to dark mode' }).click()
|
||||
// 300ms: the global theme cross-fade runs 160ms, so sample after it settles.
|
||||
await page.waitForTimeout(300)
|
||||
const dark = await page.evaluate(() => ({
|
||||
bg: getComputedStyle(document.body).backgroundColor,
|
||||
cls: document.documentElement.className,
|
||||
stored: localStorage.getItem('tunel-theme'),
|
||||
label: document.querySelector('header button[aria-label]')?.getAttribute('aria-label'),
|
||||
}))
|
||||
check('theme switches to dark', dark.cls.includes('dark') && dark.bg === 'rgb(14, 26, 30)', `${lightBg} -> ${dark.bg}`)
|
||||
check('theme choice persists', dark.stored === 'dark', `tunel-theme=${dark.stored}`)
|
||||
check('toggle labels the next action', dark.label === 'Switch to light mode', dark.label ?? '')
|
||||
await page.screenshot({ path: '/tmp/opencode/shots/landing-1440-dark.png', fullPage: true })
|
||||
await page.getByRole('button', { name: 'Switch to light mode' }).click()
|
||||
await page.waitForTimeout(320)
|
||||
await page.screenshot({ path: '/tmp/opencode/shots/landing-1440-light.png', fullPage: true })
|
||||
|
||||
await page.setViewportSize({ width: 375, height: 812 })
|
||||
await page.getByText('Menu', { exact: true }).click()
|
||||
const menuLinks = await page.evaluate(() => {
|
||||
const details = document.querySelector('details[open]')
|
||||
return details ? [...details.querySelectorAll('a')].map((a) => a.textContent.trim()) : []
|
||||
})
|
||||
check('mobile menu lists navigation', menuLinks.includes('Configure') && menuLinks.includes('Self-host'), menuLinks.join(','))
|
||||
await page.screenshot({ path: '/tmp/opencode/shots/landing-375-menu.png' })
|
||||
|
||||
await page.goto(`${BASE}/#configure`, { waitUntil: 'networkidle' })
|
||||
await page.locator('#configure .terminal').scrollIntoViewIfNeeded()
|
||||
await page.waitForFunction(() => document.querySelector('#configure pre code')?.textContent.includes('localhost:8000'))
|
||||
await page.getByText('Frankfurt, Germany').click()
|
||||
await page.waitForFunction(() => !document.querySelector('#configure pre code .caret'))
|
||||
const command = await page.locator('pre code').first().textContent()
|
||||
check('choosing a server updates the command', (command ?? '').includes('eu.tunel.live'), command ?? '')
|
||||
|
||||
await page.getByText('TCP', { exact: true }).click()
|
||||
check('TCP exposes a server port field', (await page.locator('#server-port').count()) === 1)
|
||||
|
||||
await page.fill('#local-port', '0')
|
||||
const copyDisabled = await page.getByRole('button', { name: 'Copy command' }).isDisabled()
|
||||
check('invalid port disables copy', copyDisabled === true)
|
||||
check('invalid port keeps the previous command', (await page.locator('pre code').first().textContent() ?? '').includes('localhost'))
|
||||
|
||||
await page.fill('#local-port', '8000')
|
||||
await page.getByRole('button', { name: 'Copy command' }).click()
|
||||
await page.waitForTimeout(400)
|
||||
const toast = await page.evaluate(() => {
|
||||
const el = document.querySelector('[aria-live="polite"]')
|
||||
const rect = el?.getBoundingClientRect()
|
||||
return el && {
|
||||
title: el.querySelector('p')?.textContent.trim(),
|
||||
command: el.querySelectorAll('p')[1]?.textContent,
|
||||
focused: document.activeElement?.textContent?.trim(),
|
||||
rect: rect && { left: rect.left, right: rect.right, bottom: rect.bottom },
|
||||
}
|
||||
})
|
||||
check('copy shows the confirmation toast', toast?.title === 'Command copied', toast?.title)
|
||||
const visibleCommand = (await page.locator('#configure pre code').innerText()).replace(/^\$\s*/, '').trim()
|
||||
check('toast shows the copied command', toast?.command?.trim() === visibleCommand, toast?.command)
|
||||
check('toast does not steal focus', toast?.focused === 'Copy command', toast?.focused)
|
||||
const inside = toast?.rect && toast.rect.left >= 0 && toast.rect.right <= 375 && toast.rect.bottom <= 812
|
||||
check('toast fits inside the viewport', Boolean(inside), toast?.rect ? `${Math.round(toast.rect.left)}..${Math.round(toast.rect.right)}` : '')
|
||||
await page.waitForTimeout(4400)
|
||||
check('toast dismisses itself', (await page.locator('[aria-live="polite"]').count()) === 0)
|
||||
|
||||
await page.setViewportSize({ width: 768, height: 1000 })
|
||||
await page.goto(BASE, { waitUntil: 'networkidle' })
|
||||
await page.screenshot({ path: '/tmp/opencode/shots/landing-768.png', fullPage: true })
|
||||
await page.setViewportSize({ width: 375, height: 812 })
|
||||
await page.waitForTimeout(150)
|
||||
await page.screenshot({ path: '/tmp/opencode/shots/landing-375.png', fullPage: true })
|
||||
await page.setViewportSize({ width: 320, height: 900 })
|
||||
await page.screenshot({ path: '/tmp/opencode/shots/landing-320.png', fullPage: true })
|
||||
|
||||
await browser.close()
|
||||
console.log('\n' + results.join('\n'))
|
||||
console.log(`\n${failures === 0 ? 'ALL CHECKS PASSED' : failures + ' CHECK(S) FAILED'}`)
|
||||
process.exit(failures === 0 ? 0 : 1)
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"include": [
|
||||
"**/*",
|
||||
"**/.server/**/*",
|
||||
"**/.client/**/*",
|
||||
".react-router/types/**/*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
||||
"types": ["node", "vite/client"],
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"moduleResolution": "bundler",
|
||||
"jsx": "react-jsx",
|
||||
"rootDirs": [".", "./.react-router/types"],
|
||||
"paths": {
|
||||
"~/*": ["./app/*"]
|
||||
},
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { reactRouter } from "@react-router/dev/vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [tailwindcss(), reactRouter()],
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 5173,
|
||||
strictPort: true,
|
||||
allowedHosts: true,
|
||||
},
|
||||
resolve: {
|
||||
tsconfigPaths: true,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user