Dawnline 0.8.0
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- Every field says what is wrong as you type, in the router's own words,
and Save refuses what the router would: UDP port when editing a server,
MTU, keep-alive, public address, DNS for devices, person name, device
limit, end date and data limit, device names (the next free "Phone 2"
is offered), home services, circles, portal title, redirect and other
addresses, defaults, update time
- Cyrillic names give Latin ids, hostnames and file names; names are
counted in characters, the rule names the characters it refuses; end
dates must exist on the calendar; a mistyped extra portal address is
refused instead of dropped
- The public address is checked on the router as it is typed: points at
this router, at another address, behind Cloudflare, or the WAN is
private or CGNAT; the wizard says so before the first step, never
pre-fills a private WAN address and says where its suggestion came
from; the Connection card says when the server was last reached from
the internet; IPv6 names and literals work throughout
- A person can be moved to another server from their page; a server's
tunnel network can be changed in the Danger zone (devices are
renumbered and marked "Update config"); WAN and LAN zones come from the
router's actual devices; when the public IPv4 changed, one click puts
the new one in
- Over the data limit or outside the allowed hours the tunnel stays
connected and the portal explains why nothing gets through, instead of
a silent handshake failure; Health's "devices loaded" compares the
peers themselves, not their count
- Portal: install links for this platform, two first steps on a first
visit, the phone's back button closes a sheet, the file goes through
the share sheet into the app, two QR codes (AmneziaVPN camera, AmneziaWG
and WireGuard apps), the sheet notices the first connection
- Admin: Enter submits a dialog, arrow keys walk the menus, Find in People
("/" focuses it), a device of a paused, ended or over-limit person says
so, "Keep access" past its end date is said on the Overview, Allowed
hours enforce nothing until saved, the invite card shares the link
- Health warns when another package's policy routing (mwan3, pbr) sends
tunnel traffic past the home-device path
- CLI: person ls, device ls, log with -n, --since, --level, --src and
--json; exit code 2 for an unknown command and 1 when health finds an
error; person rm asks for --yes when devices would go; devices added
from the command line get their event and "issued" marker like the
UI's
- Three disguises: Off, Balanced and Maximum. Standard and Strong (1.0-style
junk only, which networks learned to spot) are no longer offered; a server
still on one keeps running and its card says to switch. A new server gets
the strongest disguise its router can run
- Portal: setting up a device is one sheet with two steps. Get the app
(AmneziaVPN first; AmneziaWG, and WireGuard with the disguise off, behind
"Another app") from the store of the device in hand, with the GitHub release
where no store has it and the version the server needs said once; then add
the connection (open in AmneziaVPN, copy the key, share or download the
file). A device set up from another device gets its link to take there, as a
QR code for a phone; a phone set up from a computer also gets the connection
as a code, one code revealed at a time so the camera cannot read the wrong one
- Portal motion: the first visit comes in once (blocks in reading order,
meters fill, the sun rises in the logo); a repaint glides cards to their
new places and brings changed values into focus; sheets slide up on
phones and can be pulled down, come into focus on a computer, follow
their content's height and turn into the next sheet in place; tabs and
segments slide, menus, tooltips and toasts grow out of what opened them,
copy buttons turn into a check, buttons waiting for the router spin;
with reduced motion only the fades remain
- Portal: while a device is set up, a card at the top shows the way from
it to the router with a light running along it; on the first connection
the way fills green, the steps fold away and the sheet closes by itself.
The first connection is the first fresh handshake, so it is no longer
missed while the watcher catches up (or after new keys), and the device's
card goes on to Connected
- Portal: QR codes are light dots on a black card, fuller on dense keys,
with "Show a light code" for scanners that read only dark on light (every
code switches, the choice is kept); the link and code a set-up sheet
hands to another device open that device's set-up there at once
- Portal: Remove and New keys ask in a small alert with the action's icon;
the open one of two cards is not a button; device names are no longer
repeated in every line of the set-up sheet; the code card lines up with
the rest of its card (a class clash gave it the page's padding); text
keeps the arrow cursor, store badges and link buttons are not underlined
This commit is contained in:
1 parent
fd9543ce68
commit
466ca6c7b0
69 files changed
+5182
-686
No files matched your search
@@ -0,0 +1,192 @@
|
||||
// Setting up a device: which app, where it comes from, and whether the page
|
||||
// is open on the device being set up. Pure: the sheet in main.ts draws it.
|
||||
|
||||
import type { Kind } from '../shared/types';
|
||||
|
||||
export type Platform = 'ios' | 'android' | 'windows' | 'mac' | 'linux' | 'unknown';
|
||||
export type AppId = 'vpn' | 'awg' | 'wg';
|
||||
/** The server's disguise generation as the portal sees it. */
|
||||
export type Preset = 'off' | 'balanced' | 'max' | 'legacy';
|
||||
|
||||
export const APP_NAME: Record<AppId, string> = { vpn: 'AmneziaVPN', awg: 'AmneziaWG', wg: 'WireGuard' };
|
||||
|
||||
/** The platform the page is open on. iPadOS Safari calls itself a Mac; touch points tell. */
|
||||
export function platformOf(ua: string, touchPoints = 0): Platform {
|
||||
if (/iPhone|iPad|iPod/.test(ua)) return 'ios';
|
||||
if (/Macintosh/.test(ua) && touchPoints > 1) return 'ios';
|
||||
if (/Android/.test(ua)) return 'android';
|
||||
if (/Windows/.test(ua)) return 'windows';
|
||||
if (/Mac OS X|Macintosh/.test(ua)) return 'mac';
|
||||
if (/CrOS/.test(ua)) return 'unknown';
|
||||
if (/Linux|X11/.test(ua)) return 'linux';
|
||||
return 'unknown';
|
||||
}
|
||||
|
||||
/** A browser inside another app (Telegram, Instagram…): vpn:// and the share sheet do not work there. */
|
||||
export const inWebview = (ua: string): boolean => /Telegram|FBAN|FBAV|Instagram|VKClient|Line\//i.test(ua);
|
||||
|
||||
/** Is the page open on the device being set up? A router never is; an unknown platform never counts. */
|
||||
export function sameDevice(kind: Kind, platform: Platform): boolean {
|
||||
if (kind === 'router' || platform === 'unknown') return false;
|
||||
if (kind === 'phone' || kind === 'tablet') return platform === 'ios' || platform === 'android';
|
||||
if (kind === 'computer') return platform === 'windows' || platform === 'mac' || platform === 'linux';
|
||||
return true;
|
||||
}
|
||||
|
||||
/** The systems a kind may run: a computer's is the person's call, the rest are read from the browser. */
|
||||
export const osGroup = (kind: Kind): Platform[] => (kind === 'computer' || kind === 'other' ? ['windows', 'mac', 'linux'] : []);
|
||||
|
||||
export interface AppChoice {
|
||||
id: AppId;
|
||||
name: string;
|
||||
/** The version this server needs, as "4.8.12" or ""; "current" when only the newest will do. */
|
||||
need: string;
|
||||
sub: string;
|
||||
}
|
||||
|
||||
/** The apps that connect to a server with this disguise, the recommended one first. */
|
||||
export function appsFor(preset: Preset): AppChoice[] {
|
||||
const need = {
|
||||
off: { vpn: '', awg: '' },
|
||||
balanced: { vpn: '4.8.12', awg: '2.0' },
|
||||
max: { vpn: 'current', awg: '3.1' },
|
||||
legacy: { vpn: '', awg: '' },
|
||||
}[preset];
|
||||
const out: AppChoice[] = [
|
||||
{ id: 'vpn', name: APP_NAME.vpn, need: need.vpn, sub: 'Connects from a link, no files' },
|
||||
{ id: 'awg', name: APP_NAME.awg, need: need.awg, sub: 'The light client: a file or a QR code' },
|
||||
];
|
||||
if (preset === 'off') out.push({ id: 'wg', name: APP_NAME.wg, need: '', sub: 'Any WireGuard app: this server has no disguise' });
|
||||
return out;
|
||||
}
|
||||
|
||||
/** "This server needs AmneziaVPN 4.8.12 or newer. …", or "" when any version will do. */
|
||||
export function updateLine(app: AppChoice): string {
|
||||
if (!app.need) return '';
|
||||
const what = app.need === 'current' ? `the current version of ${app.name}` : `${app.name} ${app.need} or newer`;
|
||||
return `This server needs ${what}. Installed a while ago? Update it in the store.`;
|
||||
}
|
||||
|
||||
export type Mark = 'appstore' | 'googleplay' | 'windows' | 'apple' | 'linux' | 'openwrt' | 'github' | 'site';
|
||||
|
||||
export interface Store {
|
||||
href: string;
|
||||
/** The small line and the bold line of the badge. */
|
||||
top: string;
|
||||
main: string;
|
||||
mark: Mark;
|
||||
/** A second source shown beside the first, where the store can fail (Android). */
|
||||
alt?: { href: string; top: string; main: string; mark: Mark; why: string };
|
||||
}
|
||||
|
||||
const GH_CLIENT = 'https://github.com/amnezia-vpn/amnezia-client/releases/latest';
|
||||
const APK: NonNullable<Store['alt']> = {
|
||||
href: GH_CLIENT,
|
||||
top: 'APK file on',
|
||||
main: 'GitHub',
|
||||
mark: 'github',
|
||||
why: 'The APK is for phones without Google Play, or where the store hides the app.',
|
||||
};
|
||||
|
||||
/** Where the app comes from on a platform: the store first, the official GitHub release where no store has it. */
|
||||
export function storeFor(app: AppId, platform: Platform): Store | null {
|
||||
const S: Record<AppId, Partial<Record<Platform, Store>>> = {
|
||||
vpn: {
|
||||
ios: { href: 'https://apps.apple.com/app/amneziavpn/id1600529900', top: 'Download on the', main: 'App Store', mark: 'appstore' },
|
||||
android: {
|
||||
href: 'https://play.google.com/store/apps/details?id=org.amnezia.vpn',
|
||||
top: 'Get it on',
|
||||
main: 'Google Play',
|
||||
mark: 'googleplay',
|
||||
alt: APK,
|
||||
},
|
||||
windows: { href: GH_CLIENT, top: 'Official release on GitHub', main: 'Download for Windows', mark: 'windows' },
|
||||
mac: { href: GH_CLIENT, top: 'Official release on GitHub', main: 'Download for Mac', mark: 'apple' },
|
||||
linux: { href: GH_CLIENT, top: 'Official release on GitHub', main: 'Download for Linux', mark: 'linux' },
|
||||
},
|
||||
awg: {
|
||||
ios: { href: 'https://apps.apple.com/us/app/amneziawg/id6478942365', top: 'Download on the', main: 'App Store', mark: 'appstore' },
|
||||
android: {
|
||||
href: 'https://play.google.com/store/apps/details?id=org.amnezia.awg',
|
||||
top: 'Get it on',
|
||||
main: 'Google Play',
|
||||
mark: 'googleplay',
|
||||
alt: { ...APK, href: 'https://github.com/amnezia-vpn/amneziawg-android/releases' },
|
||||
},
|
||||
windows: {
|
||||
href: 'https://github.com/amnezia-vpn/amneziawg-windows-client/releases',
|
||||
top: 'Official release on GitHub',
|
||||
main: 'Download for Windows',
|
||||
mark: 'windows',
|
||||
},
|
||||
mac: {
|
||||
href: 'https://apps.apple.com/us/app/amneziawg/id6478942365',
|
||||
top: 'Download on the',
|
||||
main: 'Mac App Store',
|
||||
mark: 'appstore',
|
||||
},
|
||||
linux: { href: 'https://github.com/amnezia-vpn/amneziawg-tools', top: 'On GitHub', main: 'amneziawg-tools', mark: 'linux' },
|
||||
},
|
||||
wg: {
|
||||
ios: { href: 'https://apps.apple.com/app/wireguard/id1441195209', top: 'Download on the', main: 'App Store', mark: 'appstore' },
|
||||
android: {
|
||||
href: 'https://play.google.com/store/apps/details?id=com.wireguard.android',
|
||||
top: 'Get it on',
|
||||
main: 'Google Play',
|
||||
mark: 'googleplay',
|
||||
},
|
||||
windows: { href: 'https://www.wireguard.com/install/', top: 'Download from', main: 'wireguard.com', mark: 'windows' },
|
||||
mac: { href: 'https://apps.apple.com/app/wireguard/id1451685025', top: 'Download on the', main: 'Mac App Store', mark: 'appstore' },
|
||||
linux: { href: 'https://www.wireguard.com/install/', top: 'Install from', main: 'wireguard.com', mark: 'linux' },
|
||||
},
|
||||
};
|
||||
return S[app][platform] ?? null;
|
||||
}
|
||||
|
||||
/** Where a router gets its client: OpenWrt packages. */
|
||||
export const routerStore = (app: AppId): Store =>
|
||||
app === 'wg'
|
||||
? {
|
||||
href: 'https://openwrt.org/docs/guide-user/services/vpn/wireguard/start',
|
||||
top: 'OpenWrt packages',
|
||||
main: 'wireguard-tools',
|
||||
mark: 'openwrt',
|
||||
}
|
||||
: { href: 'https://openwrt.org/packages/start', top: 'OpenWrt packages', main: 'amneziawg-tools + kmod', mark: 'openwrt' };
|
||||
|
||||
/** Inside the app: where the scanner and the importer are. */
|
||||
export const scanPath = (app: AppId): string =>
|
||||
app === 'vpn' ? 'Add server → Scan QR' : app === 'awg' ? 'Add tunnel → Scan QR code' : 'Add tunnel → Create from QR code';
|
||||
export const importPath = (app: AppId): string => (app === 'vpn' ? 'Add server → Insert key' : 'Add tunnel → Import from file');
|
||||
|
||||
export const PLATFORM_LABEL: Record<Platform, string> = {
|
||||
ios: 'iPhone / iPad',
|
||||
android: 'Android',
|
||||
windows: 'Windows',
|
||||
mac: 'Mac',
|
||||
linux: 'Linux',
|
||||
unknown: 'this device',
|
||||
};
|
||||
|
||||
/**
|
||||
* The personal link that opens straight on one device's set-up: the page then
|
||||
* starts it by itself. In the fragment, which never reaches the router: the
|
||||
* link stays the key, the device only says where to start.
|
||||
*/
|
||||
export const setupLink = (page: string, id: string): string => `${page}#setup=${id}`;
|
||||
|
||||
/** The device a link asks to set up (`#setup=d_…`), or null; anything else in the fragment is ignored. */
|
||||
export function setupFromHash(hash: string): string | null {
|
||||
return /^#setup=(d_[0-9a-f]{8})$/.exec(hash)?.[1] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* "the phone", "the computer": the device being set up, in a sentence. The
|
||||
* sheet's title already names it; the lines under it do not repeat the name.
|
||||
*/
|
||||
export const deviceNoun = (kind: Kind): string =>
|
||||
({ phone: 'phone', tablet: 'tablet', computer: 'computer', router: 'router', other: 'device' })[kind];
|
||||
|
||||
/** "This iPhone", "This Mac": the pill for the device in hand. */
|
||||
export const hereLabel = (platform: Platform): string =>
|
||||
({ ios: 'This iPhone', android: 'This phone', windows: 'This PC', mac: 'This Mac', linux: 'This PC', unknown: 'This device' })[platform];
|
||||
Reference in new issue
Block a user