1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add bookmarklet

This commit is contained in:
Frédéric Guillot 2017-11-21 19:37:47 -08:00
parent 1bc43ec2bc
commit 6690f6a70e
26 changed files with 244 additions and 48 deletions

View file

@ -0,0 +1,20 @@
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package controller
import "github.com/miniflux/miniflux2/server/core"
// ShowIntegrations renders the page with all external integrations.
func (c *Controller) ShowIntegrations(ctx *core.Context, request *core.Request, response *core.Response) {
args, err := c.getCommonTemplateArgs(ctx)
if err != nil {
response.HTML().ServerError(err)
return
}
response.HTML().Render("integrations", args.Merge(tplParams{
"menu": "settings",
}))
}

View file

@ -5,13 +5,30 @@
package controller
import (
"log"
"github.com/miniflux/miniflux2/model"
"github.com/miniflux/miniflux2/reader/subscription"
"github.com/miniflux/miniflux2/server/core"
"github.com/miniflux/miniflux2/server/ui/form"
"log"
)
// Bookmarklet prefill the form to add a subscription from the URL provided by the bookmarklet.
func (c *Controller) Bookmarklet(ctx *core.Context, request *core.Request, response *core.Response) {
user := ctx.LoggedUser()
args, err := c.getSubscriptionFormTemplateArgs(ctx, user)
if err != nil {
response.HTML().ServerError(err)
return
}
bookmarkletURL := request.QueryStringParam("uri", "")
response.HTML().Render("add_subscription", args.Merge(tplParams{
"form": &form.SubscriptionForm{URL: bookmarkletURL},
}))
}
// AddSubscription shows the form to add a new feed.
func (c *Controller) AddSubscription(ctx *core.Context, request *core.Request, response *core.Response) {
user := ctx.LoggedUser()
@ -24,6 +41,7 @@ func (c *Controller) AddSubscription(ctx *core.Context, request *core.Request, r
response.HTML().Render("add_subscription", args)
}
// SubmitSubscription try to find a feed from the URL provided by the user.
func (c *Controller) SubmitSubscription(ctx *core.Context, request *core.Request, response *core.Response) {
user := ctx.LoggedUser()
@ -80,6 +98,7 @@ func (c *Controller) SubmitSubscription(ctx *core.Context, request *core.Request
}
}
// ChooseSubscription shows a page to choose a subscription.
func (c *Controller) ChooseSubscription(ctx *core.Context, request *core.Request, response *core.Response) {
user := ctx.LoggedUser()