add funtionality to import zip/tgz with maildirs/mboxes to account page

so users can easily take their email out of somewhere else, and import it into mox.

this goes a little way to give feedback as the import progresses: upload
progress is shown (surprisingly, browsers aren't doing this...), imported
mailboxes/messages are counted (batched) and import issues/warnings are
displayed, all sent over an SSE connection. an import token is stored in
sessionstorage. if you reload the page (e.g. after a connection error), the
browser will reconnect to the running import and show its progress again. and
you can just abort the import before it is finished and committed, and nothing
will have changed.

this also imports flags/keywords from mbox files.
This commit is contained in:
Mechiel Lukkien
2023-02-16 09:57:27 +01:00
parent 23b530ae36
commit 5336032088
32 changed files with 1968 additions and 518 deletions

View File

@ -39,11 +39,11 @@ func setup(t *testing.T) (*store.Account, func()) {
err = acc.SetPassword("testtest")
tcheck(t, err, "set password")
switchDone := store.Switchboard()
mox.Shutdown = make(chan struct{})
mox.Shutdown, mox.ShutdownCancel = context.WithCancel(context.Background())
return acc, func() {
acc.Close()
close(mox.Shutdown)
mox.Shutdown = make(chan struct{})
mox.ShutdownCancel()
mox.Shutdown, mox.ShutdownCancel = context.WithCancel(context.Background())
Shutdown()
close(switchDone)
}
@ -341,9 +341,9 @@ func TestQueueStart(t *testing.T) {
defer cleanup()
done := make(chan struct{}, 1)
defer func() {
close(mox.Shutdown)
mox.ShutdownCancel()
<-done
mox.Shutdown = make(chan struct{})
mox.Shutdown, mox.ShutdownCancel = context.WithCancel(context.Background())
}()
err := Start(resolver, done)
tcheck(t, err, "queue start")