Dawnline 0.16.1
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

- Checking one component for updates in Components no longer fails
  with "XHR request timed out": the check starts at once instead of
  keeping the page waiting twenty seconds
- On a router without curl, updates and the installer download release
  files through GitHub's API: GitHub's own download links can make
  OpenWrt's built-in downloader hang
- Adding a device in the admin offers the same four types as the
  personal page: PC, Mobile, Router and Other (phones and tablets are
  one choice)
This commit is contained in:
Aemeath committed 2026-10-26 06:41:54 +03:00
1 parent 2388603322
commit 0fd22b917a
20 files changed
+179 -73

No files matched your search

+27 -12
View File
@@ -17,7 +17,20 @@ import { isOn, sw } from './ui/controls';
import { qrCode } from './ui/qr';
import { deviceNameHelp, type Help } from './netcheck';
import { deviceStatus } from './ui/badges';
import { ago, bytes, defaultName, fitName, homeOf, isoDay, kindLabel, KINDS, netsLabel, todayOf } from '../shared/format';
import {
ago,
bytes,
defaultName,
fitName,
homeOf,
isoDay,
kindLabel,
netsLabel,
pickLabel,
PICKS,
todayOf,
type KindPick,
} from '../shared/format';
import { guardDeviceName } from '../shared/name-guard';
import { fill, fmt, locale, num } from '../shared/i18n';
import { icon } from '../shared/icons';
@@ -610,44 +623,46 @@ export function addDevice(person: Person, o: DeviceOpts) {
while (taken.some((t) => t.toLowerCase() === name.toLowerCase())) name = fitName(base, ` ${++n}`);
return name;
};
let kind: Kind = 'phone';
// Mobile from here is a phone: the admin is never on the device itself (see KindPick).
const kindOf = (p: KindPick): Kind => (p === 'mobile' ? 'phone' : p);
let pick: KindPick = 'mobile';
const nameInput = E('input', {
type: 'text',
class: 'cbi-input-text',
placeholder: suggest(kind),
placeholder: suggest(kindOf(pick)),
}) as HTMLInputElement;
const said = nameGuard(nameInput, () => nameRow.refresh());
const nameRow = liveField(_('Name'), nameInput, () =>
said(
nameInput.value.trim()
? deviceNameHelp(nameInput.value, taken, _('Shown in the portal and in the app.'))
: { text: fmt(_('Named after its type: %s.'), suggest(kind)), bad: false },
: { text: fmt(_('Named after its type: %s.'), suggest(kindOf(pick))), bad: false },
),
);
const kinds = E(
'div',
{ class: 'dl-kinds', role: 'radiogroup', 'aria-label': _('Type') },
KINDS.map((k) =>
PICKS.map((k) =>
E(
'button',
{
type: 'button',
role: 'radio',
class: k === kind ? 'on' : '',
'aria-checked': k === kind ? 'true' : 'false',
class: k === pick ? 'on' : '',
'aria-checked': k === pick ? 'true' : 'false',
'data-kind': k,
click: () => {
kind = k;
pick = k;
kinds.querySelectorAll('button').forEach((c) => {
const on = (c as HTMLElement).dataset.kind === k;
c.classList.toggle('on', on);
c.setAttribute('aria-checked', on ? 'true' : 'false');
});
nameInput.placeholder = suggest(k);
nameInput.placeholder = suggest(kindOf(k));
nameRow.refresh();
},
},
[icon(k), E('span', {}, kindLabel(k))],
[icon(k), E('span', {}, pickLabel(k))],
),
),
);
@@ -704,8 +719,8 @@ export function addDevice(person: Person, o: DeviceOpts) {
notify(h.text, 'warning');
return;
}
const name = nameInput.value.trim() || suggest(kind);
const r = await attempt(() => api.deviceCreate(person.id, name, kind, isOn(bypass)));
const name = nameInput.value.trim() || suggest(kindOf(pick));
const r = await attempt(() => api.deviceCreate(person.id, name, kindOf(pick), isOn(bypass)));
if (!r) return;
closeModal();
notify(fmt(_('%s added'), name), 'success', 3000);
+1 -1
View File
@@ -180,7 +180,7 @@
.dl-fld { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.dl-fld-label { font-size: 13px; font-weight: 500; color: var(--dl-fg); }
.dl-fld .cbi-input-text { width: 100%; box-sizing: border-box; }
.dl-kinds { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.dl-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.dl-kinds button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
height: 68px; border-radius: 10px; border: 1px solid var(--dl-line); color: var(--dl-fg-muted); font-size: 12px; font-weight: 500; text-align: center; min-width: 0; }
.dl-kinds button .dl-icon { width: 20px; height: 20px; }
+2 -1
View File
@@ -93,7 +93,8 @@ export async function runOperation(what: string | null, o: OpOptions, follow?: U
prevId = before?.job?.id;
since = before?.now ?? 0;
const r = await api.updatesRun(what!);
if (r.job && r.job.state === 'running' && r.job.id !== prevId) {
// A quick check may already be over: still this click's job (updates_run never returns an older one).
if (r.job && r.job.id !== prevId) {
job = r.job;
known(r.job);
}