Allow instance rebuild via interface
This commit is contained in:
parent
5e7c5b2d23
commit
1e1d1a3cad
2 changed files with 40 additions and 6 deletions
|
|
@ -21,6 +21,12 @@ func (info *Info) serveSocket(conn httpx.WebSocketConnection) {
|
|||
return
|
||||
}
|
||||
info.serverSocketSnapshot(string(slug.Bytes), info.socketWriter(conn))
|
||||
case "rebuild":
|
||||
slug, ok := <-conn.Read()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
info.serverSocketRebuild(string(slug.Bytes), info.socketWriter(conn))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -61,3 +67,24 @@ func (info *Info) serverSocketSnapshot(slug string, writer *status.LineBuffer) {
|
|||
stream.Println("Done")
|
||||
|
||||
}
|
||||
|
||||
func (info *Info) serverSocketRebuild(slug string, writer *status.LineBuffer) {
|
||||
stream := stream.NewIOStream(writer, writer, nil, 0)
|
||||
|
||||
// get the wisski
|
||||
wissKI, err := info.Instances.WissKI(slug)
|
||||
if err != nil {
|
||||
stream.EPrintln(err)
|
||||
return
|
||||
}
|
||||
|
||||
{
|
||||
err := wissKI.Build(stream, true)
|
||||
if err != nil {
|
||||
stream.EPrintln(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
stream.Println("Done")
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue