diff --git a/internal/http/routes/bookmark.go b/internal/http/routes/bookmark.go index aaff02b09..6db6a5ba2 100644 --- a/internal/http/routes/bookmark.go +++ b/internal/http/routes/bookmark.go @@ -27,42 +27,42 @@ func (r *BookmarkRoutes) Setup(group *gin.RouterGroup) model.Routes { return r } -func (r *BookmarkRoutes) bookmarkContentHandler(c *gin.Context) { - ctx := context.NewContextFromGin(c) - - bookmarkIDParam, present := c.Params.Get("id") - if !present { - response.SendError(c, 400, "Invalid bookmark ID") - return - } - - bookmarkID, err := strconv.Atoi(bookmarkIDParam) - if err != nil { - r.logger.WithError(err).Error("error parsing bookmark ID parameter") - response.SendInternalServerError(c) - return - } - - if bookmarkID == 0 { - response.SendError(c, 404, nil) - return - } - - bookmark, found, err := r.deps.Database.GetBookmark(c, bookmarkID, "") - if err != nil || !found { - response.SendError(c, 404, nil) - return - } - - if bookmark.Public != 1 && !ctx.UserIsLogged() { - response.SendError(c, http.StatusForbidden, nil) - return - } - - response.Send(c, 200, bookmark.Content) -} - -func (r *BookmarkRoutes) bookmarkArchiveHandler(c *gin.Context) {} +// func (r *BookmarkRoutes) bookmarkContentHandler(c *gin.Context) { +// ctx := context.NewContextFromGin(c) + +// bookmarkIDParam, present := c.Params.Get("id") +// if !present { +// response.SendError(c, 400, "Invalid bookmark ID") +// return +// } + +// bookmarkID, err := strconv.Atoi(bookmarkIDParam) +// if err != nil { +// r.logger.WithError(err).Error("error parsing bookmark ID parameter") +// response.SendInternalServerError(c) +// return +// } + +// if bookmarkID == 0 { +// response.SendError(c, 404, nil) +// return +// } + +// bookmark, found, err := r.deps.Database.GetBookmark(c, bookmarkID, "") +// if err != nil || !found { +// response.SendError(c, 404, nil) +// return +// } + +// if bookmark.Public != 1 && !ctx.UserIsLogged() { +// response.SendError(c, http.StatusForbidden, nil) +// return +// } + +// response.Send(c, 200, bookmark.Content) +// } + +// func (r *BookmarkRoutes) bookmarkArchiveHandler(c *gin.Context) {} func NewBookmarkRoutes(logger *logrus.Logger, deps *config.Dependencies) *BookmarkRoutes { return &BookmarkRoutes{