Dawnline 0.17.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
- Redraw the admin's charts in the connection map's style: the live speed as lines, the last 30 days and a device's week as stacked download and upload bars, a device's days as a strip, data use as meters. - Read any chart point by point with the pointer, a tap or the arrow keys; a day's tooltip compares it with the average and shows its download and upload. - Show where a data limit leads at the recent pace: the week ahead on the meter, and when the limit fills or what a monthly one reaches by the reset. - Make Speed now live, one point a second, on a person's page, in the People list and in an online person's card. - Name every place an online person's devices connect from, and the city each device connects from now. - Portal: read the month and the week by tap or arrow keys, see how a day compares with the others, the pace toward the data limit and how long the allowed hours still run. - Send VPN clients' DNS to the LAN's DNS after its interceptors, so transparent proxies such as forkop also handle their lookups.
This commit is contained in:
1 parent
b0d9982796
commit
18e3013047
50 files changed
+1683
-425
No files matched your search
@@ -23,6 +23,10 @@ msgstr ""
|
||||
msgid "%s (router time)"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/shared/pace.ts
|
||||
msgid "%s a day lately"
|
||||
msgstr ""
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc
|
||||
msgid "%s already has %d device. Remove one first to lower the limit to %d."
|
||||
msgid_plural "%s already has %d devices. Remove one first to lower the limit to %d."
|
||||
@@ -161,6 +165,10 @@ msgstr ""
|
||||
msgid "%s your time"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "%s, last 7 days"
|
||||
msgstr ""
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc
|
||||
msgid "%s: <%s> is not a tag AmneziaWG apps accept: use <b 0x…> with an even number of hex digits, <r N>, <rc N> or <rd N> with N from 1 to 1000, or <t>."
|
||||
msgstr ""
|
||||
@@ -1412,6 +1420,10 @@ msgstr ""
|
||||
msgid "Your access is paused."
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "Your data this month"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Your devices"
|
||||
msgstr ""
|
||||
@@ -1436,6 +1448,14 @@ msgstr ""
|
||||
msgid "Your network may be blocking the connection."
|
||||
msgstr ""
|
||||
|
||||
#: web/src/shared/pace.ts
|
||||
msgid "about %s by the reset on %s"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "about average"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/shared/format.ts
|
||||
msgid "bit/s"
|
||||
msgstr ""
|
||||
@@ -1482,6 +1502,12 @@ msgstr ""
|
||||
msgid "ends tomorrow"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/shared/pace.ts
|
||||
msgid "full in about %s day, %s"
|
||||
msgid_plural "full in about %s days, %s"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: web/src/shared/format.ts
|
||||
msgid "just now"
|
||||
msgstr ""
|
||||
@@ -1502,6 +1528,14 @@ msgstr ""
|
||||
msgid "no limit"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "not used"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "opens in %s"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/setup.ts
|
||||
msgid "phone"
|
||||
msgstr ""
|
||||
@@ -1520,6 +1554,10 @@ msgctxt "on the"
|
||||
msgid "router"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "so far"
|
||||
msgstr ""
|
||||
|
||||
#: web/src/portal/setup.ts
|
||||
msgid "tablet"
|
||||
msgstr ""
|
||||
|
||||
@@ -25,6 +25,10 @@ msgstr "%s (на Android: %s)"
|
||||
msgid "%s (router time)"
|
||||
msgstr "%s (по времени роутера)"
|
||||
|
||||
#: web/src/shared/pace.ts
|
||||
msgid "%s a day lately"
|
||||
msgstr "%s в день за последние дни"
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc
|
||||
msgid "%s already has %d device. Remove one first to lower the limit to %d."
|
||||
msgid_plural "%s already has %d devices. Remove one first to lower the limit to %d."
|
||||
@@ -166,6 +170,10 @@ msgstr "%s в этом месяце"
|
||||
msgid "%s your time"
|
||||
msgstr "%s по вашему времени"
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "%s, last 7 days"
|
||||
msgstr "%s, последние 7 дней"
|
||||
|
||||
#: package/luci-app-dawnline/root/usr/share/ucode/dawnline/awg.uc
|
||||
msgid "%s: <%s> is not a tag AmneziaWG apps accept: use <b 0x…> with an even number of hex digits, <r N>, <rc N> or <rd N> with N from 1 to 1000, or <t>."
|
||||
msgstr "%s: тег <%s> не примут приложения AmneziaWG: используйте <b 0x…> с чётным числом шестнадцатеричных цифр, <r N>, <rc N> или <rd N> с N от 1 до 1000 либо <t>."
|
||||
@@ -1419,6 +1427,10 @@ msgstr "Ваш доступ закончился."
|
||||
msgid "Your access is paused."
|
||||
msgstr "Ваш доступ на паузе."
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "Your data this month"
|
||||
msgstr "Ваш трафик за месяц"
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "Your devices"
|
||||
msgstr "Ваши устройства"
|
||||
@@ -1443,6 +1455,14 @@ msgstr "Ваша локальная сеть остаётся доступной
|
||||
msgid "Your network may be blocking the connection."
|
||||
msgstr "Возможно, ваша сеть блокирует подключение."
|
||||
|
||||
#: web/src/shared/pace.ts
|
||||
msgid "about %s by the reset on %s"
|
||||
msgstr "около %s к сбросу %s"
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "about average"
|
||||
msgstr "около среднего"
|
||||
|
||||
#: web/src/shared/format.ts
|
||||
msgid "bit/s"
|
||||
msgstr "бит/с"
|
||||
@@ -1491,6 +1511,13 @@ msgstr "закончится сегодня"
|
||||
msgid "ends tomorrow"
|
||||
msgstr "закончится завтра"
|
||||
|
||||
#: web/src/shared/pace.ts
|
||||
msgid "full in about %s day, %s"
|
||||
msgid_plural "full in about %s days, %s"
|
||||
msgstr[0] "закончится примерно через %s день, %s"
|
||||
msgstr[1] "закончится примерно через %s дня, %s"
|
||||
msgstr[2] "закончится примерно через %s дней, %s"
|
||||
|
||||
#: web/src/shared/format.ts
|
||||
msgid "just now"
|
||||
msgstr "только что"
|
||||
@@ -1511,6 +1538,14 @@ msgstr "никогда"
|
||||
msgid "no limit"
|
||||
msgstr "без лимита"
|
||||
|
||||
#: web/src/portal/page/devices.ts
|
||||
msgid "not used"
|
||||
msgstr "без трафика"
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "opens in %s"
|
||||
msgstr "откроется через %s"
|
||||
|
||||
#: web/src/portal/setup.ts
|
||||
msgid "phone"
|
||||
msgstr "телефон"
|
||||
@@ -1529,6 +1564,10 @@ msgctxt "on the"
|
||||
msgid "router"
|
||||
msgstr "роутере"
|
||||
|
||||
#: web/src/portal/page/access.ts
|
||||
msgid "so far"
|
||||
msgstr "пока"
|
||||
|
||||
#: web/src/portal/setup.ts
|
||||
msgid "tablet"
|
||||
msgstr "планшет"
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
// keeps the rows on the page and changes what they hold in place.
|
||||
|
||||
import type { Pair, Person } from '../../shared/types';
|
||||
import { accessLabel, byDeviceState, bytes, date, daysLeft, endsSoon, parseDay } from '../../shared/format';
|
||||
import { accessLabel, byDeviceState, bytes, date, daysLeft, duration, endsSoon, parseDay } from '../../shared/format';
|
||||
import { paceOf, paceWords, vsAverage } from '../../shared/pace';
|
||||
import { fill, fmt, locale, num, plural } from '../../shared/i18n';
|
||||
import { h, ic, markup } from '../dom';
|
||||
import { calendar, clockOf, hoursFor, minuteAt, monthOf, stretches } from '../days';
|
||||
import { SMOOTH, play } from '../motion';
|
||||
import { now, today, type State } from '../state';
|
||||
import { accordion, regrow, type Accordion } from '../ui/accordion';
|
||||
import { bars, upDown } from '../ui/bars';
|
||||
import { bars, readBars, upDown } from '../ui/bars';
|
||||
import { copy } from '../ui/feedback';
|
||||
import { glass } from '../ui/glass';
|
||||
import { morphChanged, morphInto, setText, textOf, textsOf } from '../ui/morph';
|
||||
@@ -107,17 +108,21 @@ function month(p: Person, used: number, pct: number): HTMLElement {
|
||||
const read = upDown('m');
|
||||
const left = p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - used))) : _('No limit');
|
||||
const side = h('span', { class: 'num', 'data-t': 'm-left' }, left);
|
||||
const say = (v: Pair, d?: number) => {
|
||||
read.set(v);
|
||||
setText(side, d ? short(d) : left);
|
||||
side.classList.toggle('bad-t', !d && p.state === 'quota');
|
||||
const totals = series.map(([rx, tx]) => rx + tx);
|
||||
// A picked day says its date and how it compares with the month's other days ("21 Oct · +62%").
|
||||
const against = (i: number) => {
|
||||
if (i === totals.length - 1) return _('so far');
|
||||
const v = vsAverage(totals, i);
|
||||
return Math.abs(v) < 5 ? _('about average') : v > 0 ? `+${num(v)}%` : `−${num(-v)}%`;
|
||||
};
|
||||
say(p.month);
|
||||
const say = (i: number) => {
|
||||
read.set(i >= 0 ? series[i] : p.month);
|
||||
setText(side, i >= 0 ? `${short(i + 1)} · ${against(i)}` : left);
|
||||
side.classList.toggle('bad-t', i < 0 && p.state === 'quota');
|
||||
};
|
||||
say(-1);
|
||||
const chart = bars(series, 'bars-month', 64, days - day);
|
||||
chart.cols.forEach((col, i) => {
|
||||
col.addEventListener('pointerenter', () => say(series[i], i + 1));
|
||||
col.addEventListener('pointerleave', () => say(p.month));
|
||||
});
|
||||
readBars(chart, _('Your data this month'), say);
|
||||
// "Today" under its bar; the month's ends step aside when it comes close.
|
||||
const td = h('span', { class: 'td' }, _('Today'));
|
||||
td.style.left = pc(day - 0.5, days);
|
||||
@@ -128,7 +133,22 @@ function month(p: Person, used: number, pct: number): HTMLElement {
|
||||
td,
|
||||
h('span', { class: day >= days - 3 ? 'hide' : '' }, short(days)),
|
||||
);
|
||||
return h('div', { class: 'month' }, chart.el, axis, h('div', { class: 'month-read' }, read.el, side), p.quota_limit ? meter(pct) : null);
|
||||
// With a limit not yet reached: the pace lately (the devices' last 7 days, so the month's first days have one
|
||||
// too) and when the limit fills at it, orange within a week.
|
||||
const pace = paceOf(
|
||||
Array.from({ length: 7 }, (_x, k) => p.devices.reduce((a, d) => a + (d.spark[k]?.[0] ?? 0) + (d.spark[k]?.[1] ?? 0), 0)),
|
||||
);
|
||||
const words = p.quota_limit && used < p.quota_limit ? paceWords(used, p.quota_limit, pace, p.quota_period === 'month', today()) : '';
|
||||
const soon = pace > 0 && (p.quota_limit - used) / pace <= 7;
|
||||
return h(
|
||||
'div',
|
||||
{ class: 'month' },
|
||||
chart.el,
|
||||
axis,
|
||||
h('div', { class: 'month-read' }, read.el, side),
|
||||
p.quota_limit ? meter(pct) : null,
|
||||
words ? h('div', { class: `month-pace${soon ? ' warn-t' : ''}` }, words) : null,
|
||||
);
|
||||
}
|
||||
|
||||
/** The days left as a number over a calendar of the weeks to the end (the last day ringed). */
|
||||
@@ -190,6 +210,10 @@ function hoursBar(hours: string, tzOffset: number | undefined): HTMLElement | nu
|
||||
const mark = h('span', { class: `hours-now${inside ? '' : ' out'}`, title: fmt(_('Now, %s'), clockOf(at)) });
|
||||
mark.style.left = pc(at, 1440);
|
||||
bar.appendChild(mark);
|
||||
// How long the window still runs, or until it opens (a stretch may run past midnight: the next starts are a day on).
|
||||
const end = segs.find(([a, b]) => at >= a && at < b)?.[1];
|
||||
const next = Math.min(...segs.map(([a]) => (a > at ? a : a + 1440)));
|
||||
const runs = inside ? fmt(_('%s left'), duration((end! - at) * 60)) : fmt(_('opens in %s'), duration((next - at) * 60));
|
||||
return h(
|
||||
'div',
|
||||
{ class: 'hours' },
|
||||
@@ -205,6 +229,7 @@ function hoursBar(hours: string, tzOffset: number | undefined): HTMLElement | nu
|
||||
{ class: 'hours-axis' },
|
||||
['00', '06', '12', '18', '24'].map((x) => h('span', {}, x)),
|
||||
),
|
||||
h('div', { class: `hours-left${inside ? '' : ' warn-t'}` }, runs),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { fmt, locale, num, plural } from '../../shared/i18n';
|
||||
import { h, ic } from '../dom';
|
||||
import { BOUNCY, EASE_IN, EASE_OUT, SMOOTH, calm, play } from '../motion';
|
||||
import { now, today, type RepaintOpts, type State } from '../state';
|
||||
import { bars, sumDays, upDown } from '../ui/bars';
|
||||
import { bars, readBars, sumDays, upDown } from '../ui/bars';
|
||||
import { copy } from '../ui/feedback';
|
||||
import { glass } from '../ui/glass';
|
||||
import { openMenu, type MenuItem } from '../ui/menu';
|
||||
@@ -129,17 +129,17 @@ function usage(d: Device): HTMLElement {
|
||||
const val = upDown(d.id);
|
||||
val.set(week);
|
||||
const chart = bars(d.spark, 'bars-week', 34);
|
||||
chart.cols.forEach((col, i) => {
|
||||
const back = d.spark.length - 1 - i;
|
||||
// What the pointer reads off the bars changes at once: no morph while it moves.
|
||||
col.addEventListener('pointerenter', () => {
|
||||
setText(lbl, dayName(back));
|
||||
val.set(d.spark[i]);
|
||||
});
|
||||
col.addEventListener('pointerleave', () => {
|
||||
// What the pointer, a tap or the keys pick changes at once: no morph while it moves. A day with nothing says so.
|
||||
readBars(chart, fmt(_('%s, last 7 days'), d.name), (i) => {
|
||||
if (i < 0) {
|
||||
setText(lbl, _('Last 7 days'));
|
||||
val.set(week);
|
||||
});
|
||||
return;
|
||||
}
|
||||
const [rx, tx] = d.spark[i];
|
||||
const name = dayName(d.spark.length - 1 - i);
|
||||
setText(lbl, rx || tx ? name : `${name} · ${_('not used')}`);
|
||||
val.set(d.spark[i]);
|
||||
});
|
||||
return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, h('span', { class: 'use-val' }, val.el)), chart.el);
|
||||
}
|
||||
|
||||
@@ -158,6 +158,11 @@
|
||||
font-size: 15px;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
.month-pace {
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.meter {
|
||||
height: 6px;
|
||||
border-radius: 3px;
|
||||
@@ -312,6 +317,15 @@
|
||||
.hours-now.out {
|
||||
background: var(--warn);
|
||||
}
|
||||
.hours-left {
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
color: var(--text-2);
|
||||
}
|
||||
.month-pace.warn-t,
|
||||
.hours-left.warn-t {
|
||||
color: var(--warn);
|
||||
}
|
||||
.hours-axis {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
@@ -65,15 +65,24 @@
|
||||
.bars .today .up {
|
||||
background: color-mix(in srgb, var(--accent) 45%, transparent);
|
||||
}
|
||||
.bars .col:not(.future):hover .dn {
|
||||
/* A day under the pointer, or picked by a tap or the keys (.on, ui/bars.ts readBars). */
|
||||
.bars .col:not(.future):is(:hover, .on) .dn {
|
||||
background: var(--text-2);
|
||||
}
|
||||
.bars .col:not(.future):hover .up {
|
||||
.bars .col:not(.future):is(:hover, .on) .up {
|
||||
background: color-mix(in srgb, var(--text-2) 50%, transparent);
|
||||
}
|
||||
.bars .today:hover .dn {
|
||||
.bars .today:is(:hover, .on) .dn {
|
||||
background: color-mix(in srgb, var(--accent) 75%, var(--text));
|
||||
}
|
||||
/* Read with the keys: focus shows as a ring around the bars; the pointer keeps its arrow. */
|
||||
.bars.scrub {
|
||||
outline: none;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.bars.scrub:focus-visible {
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent);
|
||||
}
|
||||
.bars .future i {
|
||||
height: 3px;
|
||||
background: color-mix(in srgb, var(--bar) 45%, transparent);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import type { Pair } from '../../shared/types';
|
||||
import { bytes } from '../../shared/format';
|
||||
import { scrub } from '../../shared/scrub';
|
||||
import { h, ic } from '../dom';
|
||||
import { setText } from './morph';
|
||||
|
||||
@@ -57,6 +58,27 @@ export function bars(days: Pair[], cls: string, height: number, future = 0): Bar
|
||||
return { el, cols };
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the bars a day at a time (shared/scrub.ts): the pointer, a tap that stays
|
||||
* until a tap elsewhere, ← → with the chart focused. The picked column looks as
|
||||
* under the pointer (.on); `pick` gets its index, -1 when let go.
|
||||
*/
|
||||
export function readBars(b: Bars, label: string, pick: (i: number) => void): void {
|
||||
b.el.removeAttribute('aria-hidden');
|
||||
scrub(
|
||||
b.el,
|
||||
{
|
||||
indexAt: (x) =>
|
||||
b.cols.findIndex((c) => {
|
||||
const r = c.getBoundingClientRect();
|
||||
return x >= r.left && x < r.right;
|
||||
}),
|
||||
mark: (i) => b.cols.forEach((c, k) => c.classList.toggle('on', k === i)),
|
||||
},
|
||||
{ count: () => b.cols.length, pick, label },
|
||||
);
|
||||
}
|
||||
|
||||
export interface UpDown {
|
||||
el: HTMLElement;
|
||||
/** Show these, at once (a repaint morphs them by their keys). */
|
||||
|
||||
Reference in new issue
Block a user