Adds update checker with user preference
Introduces an update checker feature that respects the user's preference, allowing them to enable or disable automatic update checks. The setting is persisted in the config file and synced to the backend. Also introduces a page dedicated to listing music that inspired the project, and makes some minor UI improvements
This commit is contained in:
@@ -98,3 +98,33 @@ func (a *App) ImportSettings() (string, error) {
|
||||
|
||||
return string(data), nil
|
||||
}
|
||||
|
||||
// SetUpdateCheckerEnabled updates the UPDATE_CHECK_ENABLED setting in config.ini
|
||||
// based on the user's preference from the GUI settings.
|
||||
//
|
||||
// Parameters:
|
||||
// - enabled: true to enable update checking, false to disable
|
||||
//
|
||||
// Returns:
|
||||
// - error: Error if loading or saving config fails
|
||||
func (a *App) SetUpdateCheckerEnabled(enabled bool) error {
|
||||
// Load current config
|
||||
config := a.GetConfig()
|
||||
if config == nil {
|
||||
return fmt.Errorf("failed to load config")
|
||||
}
|
||||
|
||||
// Update the setting
|
||||
if enabled {
|
||||
config.EMLy.UpdateCheckEnabled = "true"
|
||||
} else {
|
||||
config.EMLy.UpdateCheckEnabled = "false"
|
||||
}
|
||||
|
||||
// Save config back to disk
|
||||
if err := a.SaveConfig(config); err != nil {
|
||||
return fmt.Errorf("failed to save config: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user