mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Add Google Reader API implementation (experimental)
Co-authored-by: Sebastian Kempken <sebastian@kempken.io> Co-authored-by: Gergan Penkov <gergan@gmail.com> Co-authored-by: Dave Marquard <dave@marquard.org> Co-authored-by: Moritz Fago <4459068+MoritzFago@users.noreply.github.com>
This commit is contained in:
parent
2935aaef45
commit
4b6e46d9ab
29 changed files with 1923 additions and 36 deletions
|
@ -22,6 +22,9 @@ type IntegrationForm struct {
|
|||
FeverEnabled bool
|
||||
FeverUsername string
|
||||
FeverPassword string
|
||||
GoogleReaderEnabled bool
|
||||
GoogleReaderUsername string
|
||||
GoogleReaderPassword string
|
||||
WallabagEnabled bool
|
||||
WallabagURL string
|
||||
WallabagClientID string
|
||||
|
@ -50,6 +53,8 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
|
|||
integration.InstapaperPassword = i.InstapaperPassword
|
||||
integration.FeverEnabled = i.FeverEnabled
|
||||
integration.FeverUsername = i.FeverUsername
|
||||
integration.GoogleReaderEnabled = i.GoogleReaderEnabled
|
||||
integration.GoogleReaderUsername = i.GoogleReaderUsername
|
||||
integration.WallabagEnabled = i.WallabagEnabled
|
||||
integration.WallabagURL = i.WallabagURL
|
||||
integration.WallabagClientID = i.WallabagClientID
|
||||
|
@ -67,7 +72,7 @@ func (i IntegrationForm) Merge(integration *model.Integration) {
|
|||
integration.TelegramBotChatID = i.TelegramBotChatID
|
||||
}
|
||||
|
||||
// NewIntegrationForm returns a new AuthForm.
|
||||
// NewIntegrationForm returns a new IntegrationForm.
|
||||
func NewIntegrationForm(r *http.Request) *IntegrationForm {
|
||||
return &IntegrationForm{
|
||||
PinboardEnabled: r.FormValue("pinboard_enabled") == "1",
|
||||
|
@ -80,6 +85,9 @@ func NewIntegrationForm(r *http.Request) *IntegrationForm {
|
|||
FeverEnabled: r.FormValue("fever_enabled") == "1",
|
||||
FeverUsername: r.FormValue("fever_username"),
|
||||
FeverPassword: r.FormValue("fever_password"),
|
||||
GoogleReaderEnabled: r.FormValue("googlereader_enabled") == "1",
|
||||
GoogleReaderUsername: r.FormValue("googlereader_username"),
|
||||
GoogleReaderPassword: r.FormValue("googlereader_password"),
|
||||
WallabagEnabled: r.FormValue("wallabag_enabled") == "1",
|
||||
WallabagURL: r.FormValue("wallabag_url"),
|
||||
WallabagClientID: r.FormValue("wallabag_client_id"),
|
||||
|
|
|
@ -38,6 +38,8 @@ func (h *handler) showIntegrationPage(w http.ResponseWriter, r *http.Request) {
|
|||
InstapaperPassword: integration.InstapaperPassword,
|
||||
FeverEnabled: integration.FeverEnabled,
|
||||
FeverUsername: integration.FeverUsername,
|
||||
GoogleReaderEnabled: integration.GoogleReaderEnabled,
|
||||
GoogleReaderUsername: integration.GoogleReaderUsername,
|
||||
WallabagEnabled: integration.WallabagEnabled,
|
||||
WallabagURL: integration.WallabagURL,
|
||||
WallabagClientID: integration.WallabagClientID,
|
||||
|
|
|
@ -49,6 +49,19 @@ func (h *handler) updateIntegration(w http.ResponseWriter, r *http.Request) {
|
|||
integration.FeverToken = ""
|
||||
}
|
||||
|
||||
if integration.GoogleReaderUsername != "" && h.store.HasDuplicateGoogleReaderUsername(user.ID, integration.GoogleReaderUsername) {
|
||||
sess.NewFlashErrorMessage(printer.Printf("error.duplicate_googlereader_username"))
|
||||
html.Redirect(w, r, route.Path(h.router, "integrations"))
|
||||
return
|
||||
}
|
||||
|
||||
if integration.GoogleReaderEnabled {
|
||||
if integrationForm.GoogleReaderPassword != "" {
|
||||
integration.GoogleReaderPassword = integrationForm.GoogleReaderPassword
|
||||
}
|
||||
} else {
|
||||
integration.GoogleReaderPassword = ""
|
||||
}
|
||||
err = h.store.UpdateIntegration(integration)
|
||||
if err != nil {
|
||||
html.ServerError(w, r, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue