Dawnline 0.20.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 / Backend (Go: vet, tests, a real ubusd and uhttpd) (push) Blocked by required conditions
CI / Package files (push) Blocked by required conditions

- **Backend rewritten in Go.** One daemon, `dawnlined`, replaces the whole ucode backend: the rpcd plugin, the agent, the CLI and the updater. The package no longer depends on ucode.
- **Per-architecture builds.** The release carries the backend for arm64, ARMv7, mips, mipsle and amd64; the router fetches its own after the package is installed and checks its sha256. Dawnline does not run on other architectures (older ARM, 32-bit x86, RISC-V).
- **Faster on the router.** A firewall sync takes 0.06 s instead of 0.9 s; a full apply takes about 300 ms. The portal is served by the daemon itself, without a CGI process per request.
- **Live pages.** The admin and the portal follow a live stream from the router instead of re-fetching the whole state every 30 seconds.
- **Admin redesigned in the portal's style.** Three sections (Overview · Log · Settings); a server is a page of its own with People, Places and Settings; a device opens as a dialog over its person.
- **Changes wait for «Apply».** Every setting, and a person's access, is staged in one dock before it reaches the router.
- **Configuration rollout.** After a change that makes devices fetch their configuration again, the admin shows how many have fetched it and who has not. Every setting shows beforehand (⟳N) how many devices it will touch.
- **Waiting for a decision.** Overview and People put first the people who need one (access ended, limit reached, a device that does not connect), each with its one action a tap away.
- **Bulk actions on people.** «Select» (or a long press on a card) picks several people to extend by a month, pause or resume at once.
- **Undo.** An action done from a card or a request is undone from its toast.
- **Update dialogs redesigned.** An update is one view from its question to its result; Dawnline's own update runs in it like every other, and the page reloads itself once the new version answers. Other versions are a list, each with its notes and Install on a page of its own.
- **Site to site: networks behind a router.** A router connected as a device can have networks behind it (up to eight, /16 to /30): the server routes them and applies the router's access to them. A network that shares addresses with a tunnel, the router's own networks or another site is refused by name.
- **Routers from the portal.** People can add a router and name its networks on their own page; the admin accepts or declines with a reason, or lets them through without asking.
- **Check access and Health know the networks behind routers.**
- **Usage limits reworked.** A monthly limit no longer follows the calendar. A person's month starts with their first traffic and ends a month later; the next one starts only when they connect again, so time away uses up none of it. Before, everyone's limit reset on the 1st.
- Extra data lasts until that person's month ends; «Reset usage» starts the month anew.
- A limit is for a month or for the whole term; the admin and the portal show when it resets.
- Charts that said «this month» show the last 30 days.
- After the update nobody loses what was counted: the month that was running becomes the person's first and ends on the 1st.
- **Access by time of day removed.** The Hours limit is gone from the admin, the portal and the backend; saved hours are dropped.
- **Expiry simplified.** An end date always stops access, with a heads-up three days before; the per-person choice is gone.
- **No false disconnects from sleeping phones.** A phone or a tablet stays online through ten minutes of silence.
- **Mobile Safari fixes.** Pressing a control no longer sends the page to its top; tab tracks that do not fit scroll; switches animate after a press.
This commit is contained in:
Aemeath committed 2026-11-13 09:43:50 +03:00
1 parent f8130e39a8
commit ac90575b0b
788 files changed
+139244 -41720

No files matched your search

+147
View File
@@ -0,0 +1,147 @@
package methods
import (
"errors"
"os"
"regexp"
"strconv"
"strings"
"time"
"github.com/tickcount/luci-app-dawnline/backend/files"
"github.com/tickcount/luci-app-dawnline/backend/journal"
"github.com/tickcount/luci-app-dawnline/backend/view"
)
var olderDays = regexp.MustCompile(`^[1-9][0-9]{0,3}$`)
// logsClear removes activity by person, device, category and/or age; nothing given clears it all
// (dawnline.rpc.status logs_clear). What went is written in the service log.
func logsClear(w *view.World, d Deps, person, device, category, older string) (map[string]any, error) {
f := journal.Filter{Device: device}
if person != "" {
if w.M.People[person] == nil {
return nil, errors.New("Unknown person.")
}
f.Person = person
}
if category != "" {
known := false
for _, c := range journal.Categories {
known = known || c == category
}
if !known {
return nil, errors.New("Unknown category.")
}
f.Category = category
}
if older != "" {
if !olderDays.MatchString(older) {
return nil, errors.New("Older than must be a number of days.")
}
days, _ := strconv.ParseInt(older, 10, 64)
f.Before = time.Now().Unix() - days*86400
}
removed := journal.Log{Run: d.RunDir, Data: d.DataDir}.Clear(f)
if removed > 0 && d.Log != nil {
note := []string{strconv.Itoa(removed) + " event"}
if removed != 1 {
note[0] += "s"
}
if f.Category != "" {
note = append(note, f.Category)
}
if f.Person != "" {
note = append(note, w.M.People[f.Person].Name)
}
if older != "" {
note = append(note, "older than "+older+" days")
}
d.Log.Admin("dawnline", "cleared", "", "the activity log", strings.Join(note, " · "))
}
return map[string]any{"ok": true, "removed": removed}, nil
}
// serviceLogClear removes the service log's entries, all of them or those older than a number of days.
func serviceLogClear(d Deps, older string) map[string]any {
// as ucode reads the number: anything that is not one clears it all
days, _ := strconv.ParseInt(strings.TrimSpace(older), 10, 64)
if days < 0 {
days = 0
}
removed := 0
if d.Log != nil {
removed = d.Log.Clear(d.DataDir, days)
if removed > 0 {
note := strconv.Itoa(removed) + " entries"
if removed == 1 {
note = "1 entry"
}
if days > 0 {
note += " older than " + older + " days"
}
d.Log.Admin("dawnline", "cleared", "", "the service log", note)
}
}
return map[string]any{"removed": removed}
}
// usageClear forgets traffic history: everyone's, a person's (with their devices and their limit), a
// device's, or a person's limit month alone (dawnline.rpc.status usage_clear).
func usageClear(w *view.World, d Deps, scope, id string) (map[string]any, error) {
m := w.M
who := "for everyone"
switch scope {
case "all":
case "person", "limit":
if m.People[id] == nil {
return nil, errors.New("Unknown person.")
}
who = "for " + m.People[id].Name
case "device":
dev := m.Devices[id]
if dev == nil {
return nil, errors.New("Unknown device.")
}
owner := ""
if p := m.People[dev.Person]; p != nil {
owner = p.Name
}
who = "for " + dev.Name + " (" + owner + ")"
default:
return nil, errors.New("Unknown scope.")
}
if d.ResetUsage == nil || !d.ResetUsage(scope, id) {
return nil, errors.New("The router is still starting. Try again in a moment.")
}
if d.Log != nil {
msg := "reset traffic history"
if scope == "limit" {
msg = "reset the data limit's usage"
}
d.Log.Admin("dawnline", msg, "", who, "")
}
return map[string]any{"ok": true}, nil
}
// geoClear forgets the places found for addresses, in the live copy and on flash.
func geoClear(d Deps) map[string]any {
empty := map[string]any{"ips": map[string]any{}, "home": nil}
os.MkdirAll(d.RunDir, 0o755)
files.WriteJSON(d.RunDir+"/geo.json", empty, 0o600)
os.MkdirAll(d.DataDir, 0o700)
files.WriteJSON(d.DataDir+"/geo.json", empty, 0o600)
return map[string]any{"ok": true}
}
// backupDelete removes a backup by its name.
func backupDelete(dir, name string) (map[string]any, error) {
if !backupFile.MatchString(name) {
return nil, errors.New("Invalid backup name.")
}
if !exists(dir + "/" + name) {
return nil, errors.New("Backup not found.")
}
os.Remove(dir + "/" + name)
return map[string]any{"ok": true}, nil
}