small updates webshare/archive interaction.

This commit is contained in:
sawka 2023-04-02 00:20:05 -07:00
parent f808c7b362
commit 59fd629920
2 changed files with 7 additions and 1 deletions

View File

@ -556,7 +556,7 @@ func ScreenArchiveCommand(ctx context.Context, pk *scpacket.FeCommandPacketType)
log.Printf("unarchive screen %s\n", screenId)
err = sstore.UnArchiveScreen(ctx, ids.SessionId, screenId)
if err != nil {
return nil, fmt.Errorf("/screen:archive cannot re-open screen: %v", err)
return nil, fmt.Errorf("/screen:archive cannot un-archive screen: %v", err)
}
screen, err := sstore.GetScreenById(ctx, screenId)
if err != nil {

View File

@ -1037,6 +1037,9 @@ func ArchiveScreen(ctx context.Context, sessionId string, screenId string) (Upda
if !tx.Exists(query, sessionId, screenId) {
return fmt.Errorf("cannot close screen (not found)")
}
if isWebShare(tx, screenId) {
return fmt.Errorf("cannot archive screen while web-sharing. stop web-sharing before trying to archive.")
}
query = `SELECT archived FROM screen WHERE sessionid = ? AND screenid = ?`
closeVal := tx.GetBool(query, sessionId, screenId)
if closeVal {
@ -2435,6 +2438,9 @@ func CanScreenWebShare(screen *ScreenType) error {
if screen.ShareMode != ShareModeLocal {
return fmt.Errorf("screen cannot be shared, invalid current share mode %q (must be local)", screen.ShareMode)
}
if screen.Archived {
return fmt.Errorf("screen cannot be shared, must un-archive before sharing")
}
return nil
}