1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-30 19:22:11 +00:00

feat(integrations): automatically disable googlereader/fever when not used #3543

When there is no user of Fever/GoogleReader, there is no need to expose their
endpoints. This reduces quite a bit the exposition surface of miniflux, while
not breaking any existing deployments, and is pretty self-contained.
This commit is contained in:
jvoisin 2025-08-02 22:58:36 +02:00
parent 10b2b36895
commit 0e28c0610a
5 changed files with 73 additions and 1 deletions

View file

@ -52,6 +52,21 @@ func (s *Storage) UserByFeverToken(token string) (*model.User, error) {
}
}
func (s *Storage) IsFeverUsed() (bool, error) {
query := `SELECT true FROM integrations WHERE fever_enabled=true LIMIT 1`
result := false
err := s.db.QueryRow(query).Scan(&result)
if err != nil {
if err == sql.ErrNoRows {
return false, nil
}
return false, fmt.Errorf(`store: unable to check if fever is used: %v`, err)
}
return result, nil
}
// GoogleReaderUserCheckPassword validates the Google Reader hashed password.
func (s *Storage) GoogleReaderUserCheckPassword(username, password string) error {
var hash string
@ -105,6 +120,21 @@ func (s *Storage) GoogleReaderUserGetIntegration(username string) (*model.Integr
return &integration, nil
}
func (s *Storage) IsGoogleReaderUsed() (bool, error) {
query := `SELECT true FROM integrations WHERE googlereader_enabled=true LIMIT 1`
var result bool
err := s.db.QueryRow(query).Scan(&result)
if err != nil {
if err == sql.ErrNoRows {
return false, nil
}
return false, fmt.Errorf(`store: unable to check if Google Reader is used: %v`, err)
}
return result, nil
}
// Integration returns user integration settings.
func (s *Storage) Integration(userID int64) (*model.Integration, error) {
query := `