mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
fix output of "mox checkupdate", and specify changes to be from newest to oldest
This commit is contained in:
parent
cafccefad1
commit
4e5030ff38
4 changed files with 14 additions and 7 deletions
10
main.go
10
main.go
|
@ -1634,8 +1634,14 @@ printed.
|
||||||
if latest.After(current) {
|
if latest.After(current) {
|
||||||
changelog, err := updates.FetchChangelog(context.Background(), changelogURL, current, changelogPubKey)
|
changelog, err := updates.FetchChangelog(context.Background(), changelogURL, current, changelogPubKey)
|
||||||
xcheckf(err, "fetching changelog")
|
xcheckf(err, "fetching changelog")
|
||||||
fmt.Printf("Changelog\n\n")
|
if len(changelog.Changes) == 0 {
|
||||||
fmt.Println(changelog)
|
log.Printf("no changes in changelog")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("Changelog")
|
||||||
|
for _, c := range changelog.Changes {
|
||||||
|
fmt.Println("\n" + strings.TrimSpace(c.Text))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
serve.go
4
serve.go
|
@ -235,8 +235,8 @@ requested, other TLS certificates are requested on demand.
|
||||||
}
|
}
|
||||||
|
|
||||||
var cl string
|
var cl string
|
||||||
for i := len(changelog.Changes) - 1; i >= 0; i-- {
|
for _, c := range changelog.Changes {
|
||||||
cl += changelog.Changes[i].Text + "\n\n"
|
cl += c.Text + "\n\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
a, err := store.OpenAccount(mox.Conf.Static.Postmaster.Account)
|
a, err := store.OpenAccount(mox.Conf.Static.Postmaster.Account)
|
||||||
|
|
|
@ -51,11 +51,12 @@ func cmdUpdatesAddSigned(c *cmd) {
|
||||||
// todo future: enforce this format?
|
// todo future: enforce this format?
|
||||||
sig := ed25519.Sign(privKey, buf)
|
sig := ed25519.Sign(privKey, buf)
|
||||||
|
|
||||||
changelog.Changes = append(changelog.Changes, updates.Change{
|
change := updates.Change{
|
||||||
PubKey: privKey.Public().(ed25519.PublicKey),
|
PubKey: privKey.Public().(ed25519.PublicKey),
|
||||||
Sig: sig,
|
Sig: sig,
|
||||||
Text: string(buf),
|
Text: string(buf),
|
||||||
})
|
}
|
||||||
|
changelog.Changes = append([]updates.Change{change}, changelog.Changes...)
|
||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
enc := json.NewEncoder(&b)
|
enc := json.NewEncoder(&b)
|
||||||
|
|
|
@ -76,7 +76,7 @@ type Change struct {
|
||||||
// prevent a potential future different domain owner from notifying users about
|
// prevent a potential future different domain owner from notifying users about
|
||||||
// new versions.
|
// new versions.
|
||||||
type Changelog struct {
|
type Changelog struct {
|
||||||
Changes []Change
|
Changes []Change // Newest first.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookup looks up the updates DNS TXT record at "_updates.<domain>" and returns
|
// Lookup looks up the updates DNS TXT record at "_updates.<domain>" and returns
|
||||||
|
|
Loading…
Reference in a new issue