admin: Refactor synchronization status report + display last git error

This commit is contained in:
nemunaire 2025-01-13 18:00:27 +01:00
commit 03d02669ea
6 changed files with 81 additions and 49 deletions

View file

@ -8,7 +8,6 @@ import (
"net/http"
"os"
"path"
"reflect"
"strconv"
"time"
@ -26,7 +25,6 @@ func declareSettingsRoutes(router *gin.RouterGroup) {
router.GET("/challenge.json", getChallengeInfo)
router.PUT("/challenge.json", saveChallengeInfo)
router.GET("/settings-ro.json", getROSettings)
router.GET("/settings.json", getSettings)
router.PUT("/settings.json", saveSettings)
router.DELETE("/settings.json", func(c *gin.Context) {
@ -98,24 +96,6 @@ func fullGeneration(c *gin.Context) {
})
}
func getROSettings(c *gin.Context) {
syncMtd := "Disabled"
if sync.GlobalImporter != nil {
syncMtd = sync.GlobalImporter.Kind()
}
var syncId *string
if sync.GlobalImporter != nil {
syncId = sync.GlobalImporter.Id()
}
c.JSON(http.StatusOK, gin.H{
"sync-type": reflect.TypeOf(sync.GlobalImporter).Name(),
"sync-id": syncId,
"sync": syncMtd,
})
}
func GetChallengeInfo() (*settings.ChallengeInfo, error) {
var challengeinfo string
var err error