Code style: All uppercase acronyms URL, ISRC, ID, HTTP

This commit is contained in:
Philipp Wolfer 2025-04-29 13:23:41 +02:00
parent 39b31fc664
commit d51c97c648
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
26 changed files with 137 additions and 137 deletions

View file

@ -25,21 +25,21 @@ import (
type lastfmStrategy struct {
client *lastfm.Api
redirectUrl *url.URL
redirectURL *url.URL
}
func (s lastfmStrategy) Config() oauth2.Config {
return oauth2.Config{}
}
func (s lastfmStrategy) AuthCodeURL(verifier string, state string) auth.AuthUrl {
func (s lastfmStrategy) AuthCodeURL(verifier string, state string) auth.AuthURL {
// Last.fm does not use OAuth2, but the provided authorization flow with
// callback URL is close enough we can shoehorn it into the existing
// authentication strategy.
// TODO: Investigate and use callback-less flow with api.GetAuthTokenUrl(token)
url := s.client.GetAuthRequestUrl(s.redirectUrl.String())
return auth.AuthUrl{
Url: url,
url := s.client.GetAuthRequestUrl(s.redirectURL.String())
return auth.AuthURL{
URL: url,
State: "", // last.fm does not use state
Param: "token",
}

View file

@ -62,9 +62,9 @@ func (b *LastfmApiBackend) Options() []models.BackendOption {
}
func (b *LastfmApiBackend) InitConfig(config *config.ServiceConfig) error {
clientId := config.GetString("client-id")
clientID := config.GetString("client-id")
clientSecret := config.GetString("client-secret")
b.client = lastfm.New(clientId, clientSecret)
b.client = lastfm.New(clientID, clientSecret)
b.username = config.GetString("username")
return nil
}
@ -72,10 +72,10 @@ func (b *LastfmApiBackend) InitConfig(config *config.ServiceConfig) error {
func (b *LastfmApiBackend) StartImport() error { return nil }
func (b *LastfmApiBackend) FinishImport() error { return nil }
func (b *LastfmApiBackend) OAuth2Strategy(redirectUrl *url.URL) auth.OAuth2Strategy {
func (b *LastfmApiBackend) OAuth2Strategy(redirectURL *url.URL) auth.OAuth2Strategy {
return lastfmStrategy{
client: b.client,
redirectUrl: redirectUrl,
redirectURL: redirectURL,
}
}