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

+8 -15
View File
@@ -7,7 +7,7 @@
// to add it there.
import type { ClientConfig, Kind } from '../../shared/types';
import { defaultName, fitName, kindLabel, netsLabel } from '../../shared/format';
import { defaultName, fitName, netsLabel, pickLabel, pickOf, PICKS, type KindPick } from '../../shared/format';
import { guardDeviceName } from '../../shared/name-guard';
import { shake } from '../../shared/shake';
import { fmt, num, plural } from '../../shared/i18n';
@@ -77,15 +77,8 @@ function guessName(kind: Kind): string {
return defaultName(kind);
}
/*
* Phones and tablets are one choice. The device is still kept as a phone or a
* tablet (the lines say "the tablet"): on the device itself the browser tells
* which; picked from elsewhere it is a phone.
*/
type Pick = 'computer' | 'mobile' | 'router' | 'other';
const pickLabel = (p: Pick): string => (p === 'mobile' ? _('Mobile') : kindLabel(p));
const pickOf = (k: Kind): Pick => (k === 'phone' || k === 'tablet' ? 'mobile' : k);
const kindOf = (p: Pick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet' ? 'tablet' : 'phone');
// Mobile is a tablet when this page is open on one (see KindPick).
const kindOf = (p: KindPick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet' ? 'tablet' : 'phone');
/**
* What they chose so far, kept outside the view: Back from "Open on the device"
@@ -93,7 +86,7 @@ const kindOf = (p: Pick): Kind => (p !== 'mobile' ? p : guessKind() === 'tablet'
* typed (unset while the name is still the guess).
*/
interface Draft {
pick?: Pick;
pick?: KindPick;
bypass: boolean;
name?: string;
}
@@ -142,11 +135,11 @@ function vAdd(draft: Draft): View {
const st = state()!;
const p = st.person;
// The kinds this router takes, as the four choices.
const picks = (['computer', 'mobile', 'router', 'other'] as Pick[]).filter((k) => st.kinds.some((x) => pickOf(x) === k));
const picks = PICKS.filter((k) => st.kinds.some((x) => pickOf(x) === k));
const guess = picks.includes(pickOf(guessKind())) ? pickOf(guessKind()) : picks[0];
let pick: Pick = draft.pick && picks.includes(draft.pick) ? draft.pick : guess;
let pick: KindPick = draft.pick && picks.includes(draft.pick) ? draft.pick : guess;
const taken = new Set(p.devices.map((d) => d.name.toLowerCase()));
const suggest = (k: Pick) => {
const suggest = (k: KindPick) => {
const n = k === pickOf(guessKind()) ? guessName(kindOf(k)) : defaultName(k === 'mobile' ? 'phone' : k);
// Stripped of what the router refuses and cut to its limit, the number after it too ("Galaxy S24+ 2").
if (!taken.has(fitName(n).toLowerCase())) return fitName(n);
@@ -230,7 +223,7 @@ function vAdd(draft: Draft): View {
if (draft.name === undefined && pick === pickOf(guessKind())) input.value = suggest(pick);
});
// The picked tile rings itself where it stands (the ring does not travel between tiles).
function choose(k: Pick) {
function choose(k: KindPick) {
pick = draft.pick = k;
tiles.forEach((t, i) => {
const on = picks[i] === k;
+1 -1
View File
@@ -808,7 +808,7 @@ msgstr ""
msgid "Method not allowed."
msgstr ""
#: web/src/portal/flows/add.ts
#: web/src/shared/format.ts
msgid "Mobile"
msgstr ""
+1 -1
View File
@@ -813,7 +813,7 @@ msgstr "Мбит/с"
msgid "Method not allowed."
msgstr "Метод не поддерживается."
#: web/src/portal/flows/add.ts
#: web/src/shared/format.ts
msgid "Mobile"
msgstr "Мобильный"