feat: implement app update checker and UI notification

This commit is contained in:
Abhinav Raut
2025-02-25 02:49:09 +05:30
parent e8f3f24422
commit fcbd16f042
10 changed files with 167 additions and 5 deletions

View File

@@ -6,8 +6,10 @@ import (
"log"
"os"
"os/signal"
"sync"
"sync/atomic"
"syscall"
"time"
"github.com/abhinavxd/libredesk/internal/ai"
auth_ "github.com/abhinavxd/libredesk/internal/auth"
@@ -83,6 +85,10 @@ type App struct {
ai *ai.Manager
search *search.Manager
notifier *notifier.Service
// Global state that stores data on an available app update.
update *AppUpdate
sync.Mutex
}
func main() {
@@ -242,6 +248,11 @@ func main() {
}
}()
// Start the app update checker.
if ko.Bool("app.check_updates") {
go checkUpdates(versionString, time.Hour*24, app)
}
// Wait for shutdown signal.
<-ctx.Done()
colorlog.Red("Shutting down HTTP server...")