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

Add page to list and remove shared entries

This commit is contained in:
Frédéric Guillot 2020-03-22 18:48:14 -07:00
parent 84229f1af9
commit 9871e4f5d0
25 changed files with 457 additions and 51 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Copyright 2020 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.
@ -17,18 +17,28 @@ import (
"miniflux.app/ui/view"
)
func (h *handler) shareGenerate(w http.ResponseWriter, r *http.Request) {
func (h *handler) createSharedEntry(w http.ResponseWriter, r *http.Request) {
entryID := request.RouteInt64Param(r, "entryID")
shareCode, err := h.store.GetEntryShareCode(request.UserID(r), entryID)
shareCode, err := h.store.EntryShareCode(request.UserID(r), entryID)
if err != nil {
html.ServerError(w, r, err)
return
}
html.Redirect(w, r, route.Path(h.router, "share", "shareCode", shareCode))
html.Redirect(w, r, route.Path(h.router, "sharedEntry", "shareCode", shareCode))
}
func (h *handler) sharePage(w http.ResponseWriter, r *http.Request) {
func (h *handler) unshareEntry(w http.ResponseWriter, r *http.Request) {
entryID := request.RouteInt64Param(r, "entryID")
if err := h.store.UnshareEntry(request.UserID(r), entryID); err != nil {
html.ServerError(w, r, err)
return
}
html.Redirect(w, r, route.Path(h.router, "sharedEntries"))
}
func (h *handler) sharedEntry(w http.ResponseWriter, r *http.Request) {
shareCode := request.RouteStringParam(r, "shareCode")
if shareCode == "" {
html.NotFound(w, r)