A election/utils.go => election/utils.go +22 -0
@@ 0,0 1,22 @@
+package election
+
+import (
+ "fmt"
+ "os"
+ "time"
+
+ "github.com/kyoh86/xdg"
+ log "github.com/sirupsen/logrus"
+ "maunium.net/go/mautrix/id"
+)
+
+func LogUpload(contentURI id.ContentURI) {
+ file, err := os.OpenFile(xdg.DataHome() + "/tallyard/uploads.tsv", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
+ if err != nil {
+ log.Warnf("couldn't open uploads file: %s", err)
+ return
+ }
+ defer file.Close()
+ t, _ := time.Now().UTC().MarshalText()
+ fmt.Fprintf(file, "%s\t%s\n", string(t), contentURI.String())
+}
M election/voter.go => election/voter.go +2 -0
@@ 191,6 191,7 @@ func (el *Election) SendProvingKeys(client *mautrix.Client, eventStore *EventSto
if err != nil {
return fmt.Errorf("couldn't upload eval proving key: %s", err)
}
+ LogUpload(uploadResp.ContentURI)
evalProvingKeyURI = uploadResp.ContentURI
}
@@ 222,6 223,7 @@ func (el *Election) SendProvingKeys(client *mautrix.Client, eventStore *EventSto
if err != nil {
return fmt.Errorf("couldn't upload sum proving key: %s", err)
}
+ LogUpload(uploadResp.ContentURI)
sumProvingKeyURI = uploadResp.ContentURI
}