Compare commits

...

6 Commits

Author SHA1 Message Date
Nazar Kanaev
4983e18e23 switch to articles feed on click 2024-04-17 22:04:14 +01:00
Nazar Kanaev
e1954e4cba update changelog 2024-04-17 21:45:25 +01:00
Nazar Kanaev
58420ae52b editable link fixes 2024-04-17 21:44:16 +01:00
Adam Szkoda
b01f71de1a Editable feed link 2024-04-17 21:26:09 +01:00
Nazar Kanaev
379aaed39e update changelog 2024-04-17 21:19:04 +01:00
Nazar Kanaev
dc20932060 apply selected theme to the login page 2024-04-17 21:17:04 +01:00
7 changed files with 38 additions and 4 deletions

View File

@ -1,11 +1,13 @@
# upcoming
- (new) Fever API support (thanks to @icefed)
- (new) editable feed link (thanks to @adaszko)
- (fix) duplicate articles caused by the same feed addition (thanks to @adaszko)
- (fix) relative article links (thanks to @adazsko for the report)
- (fix) atom article links stored in id element (thanks to @adazsko for the report)
- (fix) parsing atom feed titles (thanks to @wnh)
- (fix) sorting same-day batch articles (thanks to @lamescholar for the report)
- (fix) showing login page in the selected theme (thanks to @feddiriko for the report)
# v2.4 (2023-08-15)

View File

@ -220,6 +220,10 @@
<span class="icon mr-1">{% inline "edit.svg" %}</span>
Rename
</button>
<button class="dropdown-item" @click="updateFeedLink(current.feed)" v-if="current.feed.feed_link">
<span class="icon mr-1">{% inline "edit.svg" %}</span>
Change Link
</button>
<div class="dropdown-divider"></div>
<header class="dropdown-header">Move to...</header>
<button class="dropdown-item"
@ -338,7 +342,11 @@
<div class="content-wrapper">
<h1><b>{{ itemSelectedDetails.title || 'untitled' }}</b></h1>
<div class="text-muted">
<div>{{ (feedsById[itemSelectedDetails.feed_id] || {}).title }}</div>
<div>
<span class="cursor-pointer" @click="feedSelected = 'feed:'+(feedsById[itemSelectedDetails.feed_id] || {}).id">
{{ (feedsById[itemSelectedDetails.feed_id] || {}).title }}
</span>
</div>
<time>{{ formatDate(itemSelectedDetails.date) }}</time>
</div>
<hr>

View File

@ -523,6 +523,14 @@ var vm = new Vue({
})
}
},
updateFeedLink: function(feed) {
var newLink = prompt('Enter feed link', feed.feed_link)
if (newLink) {
api.feeds.update(feed.id, {feed_link: newLink}).then(function() {
feed.feed_link = newLink
})
}
},
renameFeed: function(feed) {
var newTitle = prompt('Enter new title', feed.title)
if (newTitle) {

View File

@ -22,7 +22,7 @@
}
</style>
</head>
<body>
<body class="theme-{% .settings.theme_name %}">
<form action="" method="post">
<img src="./static/graphicarts/anchor.svg" alt="">
{% if .error %}

View File

@ -6,6 +6,7 @@ import (
"github.com/nkanaev/yarr/src/assets"
"github.com/nkanaev/yarr/src/server/router"
"github.com/nkanaev/yarr/src/storage"
)
type Middleware struct {
@ -13,6 +14,7 @@ type Middleware struct {
Password string
BasePath string
Public []string
DB *storage.Storage
}
func unsafeMethod(method string) bool {
@ -46,12 +48,15 @@ func (m *Middleware) Handler(c *router.Context) {
c.Redirect(rootUrl)
return
} else {
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]string{
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]interface{}{
"username": username,
"error": "Invalid username/password",
"settings": m.DB.GetSettings(),
})
return
}
}
c.HTML(http.StatusOK, assets.Template("login.html"), nil)
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]interface{}{
"settings": m.DB.GetSettings(),
})
}

View File

@ -35,6 +35,7 @@ func (s *Server) handler() http.Handler {
Username: s.Username,
Password: s.Password,
Public: []string{"/static", "/fever"},
DB: s.db,
}
r.Use(a.Handler)
}
@ -293,6 +294,11 @@ func (s *Server) handleFeed(c *router.Context) {
s.db.UpdateFeedFolder(id, &folderId)
}
}
if link, ok := body["feed_link"]; ok {
if reflect.TypeOf(link).Kind() == reflect.String {
s.db.UpdateFeedLink(id, link.(string))
}
}
c.Out.WriteHeader(http.StatusOK)
} else if c.Req.Method == "DELETE" {
s.db.DeleteFeed(id)

View File

@ -71,6 +71,11 @@ func (s *Storage) UpdateFeedFolder(feedId int64, newFolderId *int64) bool {
return err == nil
}
func (s *Storage) UpdateFeedLink(feedId int64, newLink string) bool {
_, err := s.db.Exec(`update feeds set feed_link = ? where id = ?`, newLink, feedId)
return err == nil
}
func (s *Storage) UpdateFeedIcon(feedId int64, icon *[]byte) bool {
_, err := s.db.Exec(`update feeds set icon = ? where id = ?`, icon, feedId)
return err == nil