1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

Expose next_check_at in the web ui and API

This commit is contained in:
Frédéric Guillot 2023-10-17 17:56:17 -07:00
parent 5dc44453ba
commit 23d2cfe0f9
22 changed files with 48 additions and 1 deletions

View file

@ -107,7 +107,8 @@ func (f *funcMap) Map() template.FuncMap {
"nonce": func() string {
return crypto.GenerateRandomStringHex(16)
},
"deRef": func(i *int) int { return *i },
"deRef": func(i *int) int { return *i },
"duration": duration,
// These functions are overrode at runtime after the parsing.
"elapsed": func(timezone string, t time.Time) string {
@ -160,6 +161,21 @@ func isEmail(str string) bool {
return err == nil
}
// Returns the duration in human readable format (hours and minutes).
func duration(t time.Time) string {
if t.IsZero() {
return ""
}
diff := time.Until(t)
if diff < 0 {
return ""
}
return diff.String()
}
func elapsedTime(printer *locale.Printer, tz string, t time.Time) string {
if t.IsZero() {
return printer.Printf("time_elapsed.not_yet")

View file

@ -25,6 +25,12 @@
<li class="item-meta-info-checked-at">
{{ t "page.feeds.last_check" }} <time datetime="{{ isodate .CheckedAt }}" title="{{ isodate .CheckedAt }}">{{ elapsed $.user.Timezone .CheckedAt }}</time>
</li>
{{ $nextCheckDuration := duration .NextCheckAt }}
{{ if ne $nextCheckDuration "" }}
<li class="item-meta-info-next-check-at">
{{ t "page.feeds.next_check" }} <time datetime="{{ isodate .NextCheckAt }}" title="{{ isodate .NextCheckAt }}">{{ $nextCheckDuration }}</time>
</li>
{{ end }}
</ul>
<ul class="item-meta-icons">
<li class="item-meta-icons-refresh">

View file

@ -187,6 +187,10 @@
<div class="panel">
<ul>
<li><strong>{{ t "page.edit_feed.last_check" }} </strong><time datetime="{{ isodate .feed.CheckedAt }}" title="{{ isodate .feed.CheckedAt }}">{{ elapsed $.user.Timezone .feed.CheckedAt }}</time></li>
{{ $nextCheckDuration := duration .feed.NextCheckAt }}
{{ if ne $nextCheckDuration "" }}
<li><strong>{{ t "page.feeds.next_check" }}</strong> <time datetime="{{ isodate .feed.NextCheckAt }}" title="{{ isodate .feed.NextCheckAt }}">{{ $nextCheckDuration }}</time></li>
{{ end }}
<li><strong>{{ t "page.edit_feed.etag_header" }} </strong>{{ if .feed.EtagHeader }}{{ .feed.EtagHeader }}{{ else }}{{ t "page.edit_feed.no_header" }}{{ end }}</li>
<li><strong>{{ t "page.edit_feed.last_modified_header" }} </strong>{{ if .feed.LastModifiedHeader }}{{ .feed.LastModifiedHeader }}{{ else }}{{ t "page.edit_feed.no_header" }}{{ end }}</li>
</ul>