mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
First commit
This commit is contained in:
commit
8ffb773f43
2121 changed files with 1118910 additions and 0 deletions
111
server/template/common.go
Normal file
111
server/template/common.go
Normal file
|
@ -0,0 +1,111 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// 2017-11-19 22:01:21.924938666 -0800 PST m=+0.005771809
|
||||
|
||||
package template
|
||||
|
||||
var templateCommonMap = map[string]string{
|
||||
"entry_pagination": `{{ define "entry_pagination" }}
|
||||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .prevEntry }}
|
||||
<a href="{{ .prevEntryRoute }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Previous" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="pagination-next">
|
||||
{{ if .nextEntry }}
|
||||
<a href="{{ .nextEntryRoute }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "Next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Next" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}`,
|
||||
"layout": `{{ define "base" }}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
{{ if .csrf }}
|
||||
<meta name="X-CSRF-Token" value="{{ .csrf }}">
|
||||
{{ end }}
|
||||
<title>{{template "title" .}} - Miniflux</title>
|
||||
{{ if .user }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .user.Theme }}">
|
||||
{{ else }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "white" }}">
|
||||
{{ end }}
|
||||
<script type="text/javascript" src="{{ route "javascript" }}" defer></script>
|
||||
</head>
|
||||
<body data-entries-status-url="{{ route "updateEntriesStatus" }}">
|
||||
{{ if .user }}
|
||||
<header class="header">
|
||||
<nav>
|
||||
<div class="logo">
|
||||
<a href="{{ route "unread" }}">Mini<span>flux</span></a>
|
||||
</div>
|
||||
<ul>
|
||||
<li {{ if eq .menu "unread" }}class="active"{{ end }}>
|
||||
<a href="{{ route "unread" }}" data-page="unread">{{ t "Unread" }}</a>
|
||||
{{ if gt .countUnread 0 }}
|
||||
<span class="unread-counter" title="Unread articles">({{ .countUnread }})</span>
|
||||
{{ end }}
|
||||
</li>
|
||||
<li {{ if eq .menu "history" }}class="active"{{ end }}>
|
||||
<a href="{{ route "history" }}" data-page="history">{{ t "History" }}</a>
|
||||
</li>
|
||||
<li {{ if eq .menu "feeds" }}class="active"{{ end }}>
|
||||
<a href="{{ route "feeds" }}" data-page="feeds">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li {{ if eq .menu "categories" }}class="active"{{ end }}>
|
||||
<a href="{{ route "categories" }}" data-page="categories">{{ t "Categories" }}</a>
|
||||
</li>
|
||||
<li {{ if eq .menu "settings" }}class="active"{{ end }}>
|
||||
<a href="{{ route "settings" }}" data-page="settings">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "logout" }}" title="Logged as {{ .user.Username }}">{{ t "Logout" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
{{ end }}
|
||||
<section class="main">
|
||||
{{template "content" .}}
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}`,
|
||||
"pagination": `{{ define "pagination" }}
|
||||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .ShowPrev }}
|
||||
<a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ end }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Previous" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="pagination-next">
|
||||
{{ if .ShowNext }}
|
||||
<a href="{{ .Route }}?offset={{ .NextOffset }}" data-page="next">{{ t "Next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Next" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
`,
|
||||
}
|
||||
|
||||
var templateCommonMapChecksums = map[string]string{
|
||||
"entry_pagination": "f1465fa70f585ae8043b200ec9de5bf437ffbb0c19fb7aefc015c3555614ee27",
|
||||
"layout": "8be69cc93fdc99eb36841ae645f58488bd675670507dcdb2de0e593602893178",
|
||||
"pagination": "6ff462c2b2a53bc5448b651da017f40a39f1d4f16cef4b2f09784f0797286924",
|
||||
}
|
21
server/template/helper/LICENSE
Normal file
21
server/template/helper/LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Hervé GOUCHET
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
61
server/template/helper/elapsed.go
Normal file
61
server/template/helper/elapsed.go
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (c) 2017 Hervé Gouchet. All rights reserved.
|
||||
// Use of this source code is governed by the MIT License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package helper
|
||||
|
||||
import (
|
||||
"github.com/miniflux/miniflux2/locale"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Texts to be translated if necessary.
|
||||
var (
|
||||
NotYet = `not yet`
|
||||
JustNow = `just now`
|
||||
LastMinute = `1 minute ago`
|
||||
Minutes = `%d minutes ago`
|
||||
LastHour = `1 hour ago`
|
||||
Hours = `%d hours ago`
|
||||
Yesterday = `yesterday`
|
||||
Days = `%d days ago`
|
||||
Weeks = `%d weeks ago`
|
||||
Months = `%d months ago`
|
||||
Years = `%d years ago`
|
||||
)
|
||||
|
||||
// GetElapsedTime returns in a human readable format the elapsed time
|
||||
// since the given datetime.
|
||||
func GetElapsedTime(translator *locale.Language, t time.Time) string {
|
||||
if t.IsZero() || time.Now().Before(t) {
|
||||
return translator.Get(NotYet)
|
||||
}
|
||||
diff := time.Since(t)
|
||||
// Duration in seconds
|
||||
s := diff.Seconds()
|
||||
// Duration in days
|
||||
d := int(s / 86400)
|
||||
switch {
|
||||
case s < 60:
|
||||
return translator.Get(JustNow)
|
||||
case s < 120:
|
||||
return translator.Get(LastMinute)
|
||||
case s < 3600:
|
||||
return translator.Get(Minutes, int(diff.Minutes()))
|
||||
case s < 7200:
|
||||
return translator.Get(LastHour)
|
||||
case s < 86400:
|
||||
return translator.Get(Hours, int(diff.Hours()))
|
||||
case d == 1:
|
||||
return translator.Get(Yesterday)
|
||||
case d < 7:
|
||||
return translator.Get(Days, d)
|
||||
case d < 31:
|
||||
return translator.Get(Weeks, int(math.Ceil(float64(d)/7)))
|
||||
case d < 365:
|
||||
return translator.Get(Months, int(math.Ceil(float64(d)/30)))
|
||||
default:
|
||||
return translator.Get(Years, int(math.Ceil(float64(d)/365)))
|
||||
}
|
||||
}
|
37
server/template/helper/elapsed_test.go
Normal file
37
server/template/helper/elapsed_test.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) 2017 Hervé Gouchet. All rights reserved.
|
||||
// Use of this source code is governed by the MIT License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package helper
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/miniflux/miniflux2/locale"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestElapsedTime(t *testing.T) {
|
||||
var dt = []struct {
|
||||
in time.Time
|
||||
out string
|
||||
}{
|
||||
{time.Time{}, NotYet},
|
||||
{time.Now().Add(time.Hour), NotYet},
|
||||
{time.Now(), JustNow},
|
||||
{time.Now().Add(-time.Minute), LastMinute},
|
||||
{time.Now().Add(-time.Minute * 40), fmt.Sprintf(Minutes, 40)},
|
||||
{time.Now().Add(-time.Hour), LastHour},
|
||||
{time.Now().Add(-time.Hour * 3), fmt.Sprintf(Hours, 3)},
|
||||
{time.Now().Add(-time.Hour * 32), Yesterday},
|
||||
{time.Now().Add(-time.Hour * 24 * 3), fmt.Sprintf(Days, 3)},
|
||||
{time.Now().Add(-time.Hour * 24 * 14), fmt.Sprintf(Weeks, 2)},
|
||||
{time.Now().Add(-time.Hour * 24 * 60), fmt.Sprintf(Months, 2)},
|
||||
{time.Now().Add(-time.Hour * 24 * 365 * 3), fmt.Sprintf(Years, 3)},
|
||||
}
|
||||
for i, tt := range dt {
|
||||
if out := GetElapsedTime(&locale.Language{}, tt.in); out != tt.out {
|
||||
t.Errorf("%d. content mismatch for %v:exp=%q got=%q", i, tt.in, tt.out, out)
|
||||
}
|
||||
}
|
||||
}
|
37
server/template/html/about.html
Normal file
37
server/template/html/about.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
{{ define "title"}}{{ t "About" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "About" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
{{ if .user.IsAdmin }}
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<div class="panel">
|
||||
<h3>{{ t "Version" }}</h3>
|
||||
<ul>
|
||||
<li><strong>{{ t "Version:" }}</strong> {{ .version }}</li>
|
||||
<li><strong>{{ t "Build Date:" }}</strong> {{ .build_date }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>{{ t "Authors" }}</h3>
|
||||
<ul>
|
||||
<li><strong>{{ t "Author:" }}</strong> Frédéric Guillot</li>
|
||||
<li><strong>{{ t "License:" }}</strong> Apache 2.0</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{{ end }}
|
45
server/template/html/add_subscription.html
Normal file
45
server/template/html/add_subscription.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
{{ define "title"}}{{ t "New Subscription" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New Subscription" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .categories }}
|
||||
<p class="alert alert-error">{{ t "There is no category. You must have at least one category." }}</p>
|
||||
{{ else }}
|
||||
<form action="{{ route "submitSubscription" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-url">{{ t "URL" }}</label>
|
||||
<input type="url" name="url" id="form-url" placeholder="https://domain.tld/" value="{{ .form.URL }}" required autofocus>
|
||||
|
||||
<label for="form-category">{{ t "Category" }}</label>
|
||||
<select id="form-category" name="category_id">
|
||||
{{ range .categories }}
|
||||
<option value="{{ .ID }}">{{ .Title }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Find a subscription" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
50
server/template/html/categories.html
Normal file
50
server/template/html/categories.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{{ define "title"}}{{ t "Categories" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Categories" }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .categories }}
|
||||
<p class="alert alert-error">{{ t "There is no category." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .categories }}
|
||||
<article class="item">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
<a href="{{ route "categoryEntries" "categoryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
{{ if eq .FeedCount 0 }}
|
||||
{{ t "No feed." }}
|
||||
{{ else }}
|
||||
{{ plural "plural.categories.feed_count" .FeedCount .FeedCount }}
|
||||
{{ end }}
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "editCategory" "categoryID" .ID }}">{{ t "Edit" }}</a>
|
||||
</li>
|
||||
{{ if eq .FeedCount 0 }}
|
||||
<li>
|
||||
<a href="{{ route "removeCategory" "categoryID" .ID }}">{{ t "Remove" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
47
server/template/html/category_entries.html
Normal file
47
server/template/html/category_entries.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
{{ define "title"}}{{ .category.Title }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ .category.Title }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert">{{ t "There is no article in this category." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "categoryEntry" "categoryID" .Feed.Category.ID "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
36
server/template/html/choose_subscription.html
Normal file
36
server/template/html/choose_subscription.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{ define "title"}}{{ t "Choose a Subscription" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New Subscription" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "chooseSubscription" }}" method="POST">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
<input type="hidden" name="category_id" value="{{ .categoryID }}">
|
||||
|
||||
<h3>{{ t "Choose a Subscription" }}</h3>
|
||||
|
||||
{{ range .subscriptions }}
|
||||
<div class="radio-group">
|
||||
<label title="{{ .URL }}"><input type="radio" name="url" value="{{ .URL }}"> {{ .Title }}</label> ({{ .Type }})
|
||||
<small title="Type = {{ .Type }}"><a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .URL }}</a></small>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Subscribe" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
19
server/template/html/common/entry_pagination.html
Normal file
19
server/template/html/common/entry_pagination.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{ define "entry_pagination" }}
|
||||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .prevEntry }}
|
||||
<a href="{{ .prevEntryRoute }}" title="{{ .prevEntry.Title }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Previous" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="pagination-next">
|
||||
{{ if .nextEntry }}
|
||||
<a href="{{ .nextEntryRoute }}" title="{{ .nextEntry.Title }}" data-page="next">{{ t "Next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Next" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
59
server/template/html/common/layout.html
Normal file
59
server/template/html/common/layout.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
{{ define "base" }}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
{{ if .csrf }}
|
||||
<meta name="X-CSRF-Token" value="{{ .csrf }}">
|
||||
{{ end }}
|
||||
<title>{{template "title" .}} - Miniflux</title>
|
||||
{{ if .user }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .user.Theme }}">
|
||||
{{ else }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "white" }}">
|
||||
{{ end }}
|
||||
<script type="text/javascript" src="{{ route "javascript" }}" defer></script>
|
||||
</head>
|
||||
<body data-entries-status-url="{{ route "updateEntriesStatus" }}">
|
||||
{{ if .user }}
|
||||
<header class="header">
|
||||
<nav>
|
||||
<div class="logo">
|
||||
<a href="{{ route "unread" }}">Mini<span>flux</span></a>
|
||||
</div>
|
||||
<ul>
|
||||
<li {{ if eq .menu "unread" }}class="active"{{ end }}>
|
||||
<a href="{{ route "unread" }}" data-page="unread">{{ t "Unread" }}</a>
|
||||
{{ if gt .countUnread 0 }}
|
||||
<span class="unread-counter" title="Unread articles">({{ .countUnread }})</span>
|
||||
{{ end }}
|
||||
</li>
|
||||
<li {{ if eq .menu "history" }}class="active"{{ end }}>
|
||||
<a href="{{ route "history" }}" data-page="history">{{ t "History" }}</a>
|
||||
</li>
|
||||
<li {{ if eq .menu "feeds" }}class="active"{{ end }}>
|
||||
<a href="{{ route "feeds" }}" data-page="feeds">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li {{ if eq .menu "categories" }}class="active"{{ end }}>
|
||||
<a href="{{ route "categories" }}" data-page="categories">{{ t "Categories" }}</a>
|
||||
</li>
|
||||
<li {{ if eq .menu "settings" }}class="active"{{ end }}>
|
||||
<a href="{{ route "settings" }}" data-page="settings">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "logout" }}" title="Logged as {{ .user.Username }}">{{ t "Logout" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</header>
|
||||
{{ end }}
|
||||
<section class="main">
|
||||
{{template "content" .}}
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
19
server/template/html/common/pagination.html
Normal file
19
server/template/html/common/pagination.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{ define "pagination" }}
|
||||
<div class="pagination">
|
||||
<div class="pagination-prev">
|
||||
{{ if .ShowPrev }}
|
||||
<a href="{{ .Route }}{{ if gt .PrevOffset 0 }}?offset={{ .PrevOffset }}{{ end }}" data-page="previous">{{ t "Previous" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Previous" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="pagination-next">
|
||||
{{ if .ShowNext }}
|
||||
<a href="{{ .Route }}?offset={{ .NextOffset }}" data-page="next">{{ t "Next" }}</a>
|
||||
{{ else }}
|
||||
{{ t "Next" }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
27
server/template/html/create_category.html
Normal file
27
server/template/html/create_category.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{{ define "title"}}{{ t "New Category" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New Category" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "categories" }}">{{ t "Categories" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "saveCategory" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-title">{{ t "Title" }}</label>
|
||||
<input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
41
server/template/html/create_user.html
Normal file
41
server/template/html/create_user.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{ define "title"}}{{ t "New User" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New User" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "saveUser" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" value="{{ .form.Password }}" required>
|
||||
|
||||
<label for="form-confirmation">{{ t "Confirmation" }}</label>
|
||||
<input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" required>
|
||||
|
||||
<label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked="checked"{{ end }}> {{ t "Administrator" }}</label>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
30
server/template/html/edit_category.html
Normal file
30
server/template/html/edit_category.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{ define "title"}}{{ t "Edit Category: %s" .category.Title }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Edit Category: %s" .category.Title }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "categories" }}">{{ t "Categories" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "updateCategory" "categoryID" .category.ID }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-title">{{ t "Title" }}</label>
|
||||
<input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
61
server/template/html/edit_feed.html
Normal file
61
server/template/html/edit_feed.html
Normal file
|
@ -0,0 +1,61 @@
|
|||
{{ define "title"}}{{ t "Edit Feed: %s" .feed.Title }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ .feed.Title }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .categories }}
|
||||
<p class="alert alert-error">{{ t "There is no category!" }}</p>
|
||||
{{ else }}
|
||||
{{ if ne .feed.ParsingErrorCount 0 }}
|
||||
<div class="alert alert-error">
|
||||
<h3>{{ t "Last Parsing Error" }}</h3>
|
||||
{{ .feed.ParsingErrorMsg }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<form action="{{ route "updateFeed" "feedID" .feed.ID }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-title">{{ t "Title" }}</label>
|
||||
<input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>
|
||||
|
||||
<label for="form-site-url">{{ t "Site URL" }}</label>
|
||||
<input type="url" name="site_url" id="form-site-url" placeholder="https://domain.tld/" value="{{ .form.SiteURL }}" required>
|
||||
|
||||
<label for="form-feed-url">{{ t "Feed URL" }}</label>
|
||||
<input type="url" name="feed_url" id="form-feed-url" placeholder="https://domain.tld/" value="{{ .form.FeedURL }}" required>
|
||||
|
||||
<label for="form-category">{{ t "Category" }}</label>
|
||||
<select id="form-category" name="category_id">
|
||||
{{ range .categories }}
|
||||
<option value="{{ .ID }}" {{ if eq .ID $.form.CategoryID }}selected="selected"{{ end }}>{{ .Title }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "feeds" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
44
server/template/html/edit_user.html
Normal file
44
server/template/html/edit_user.html
Normal file
|
@ -0,0 +1,44 @@
|
|||
{{ define "title"}}{{ t "Edit user: %s" .selected_user.Username }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Edit user %s" .selected_user.Username }}"</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "Add user" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "updateUser" "userID" .selected_user.ID }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" value="{{ .form.Password }}">
|
||||
|
||||
<label for="form-confirmation">{{ t "Confirmation" }}</label>
|
||||
<input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}">
|
||||
|
||||
<label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked="checked"{{ end }}> {{ t "Administrator" }}</label>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
75
server/template/html/entry.html
Normal file
75
server/template/html/entry.html
Normal file
|
@ -0,0 +1,75 @@
|
|||
{{ define "title"}}{{ .entry.Title }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="entry">
|
||||
<header class="entry-header">
|
||||
<h1>
|
||||
<a href="{{ .entry.URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .entry.Title }}</a>
|
||||
</h1>
|
||||
<div class="entry-meta">
|
||||
<span class="entry-website">
|
||||
{{ if ne .entry.Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .entry.Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "feedEntries" "feedID" .entry.Feed.ID }}">{{ .entry.Feed.Title }}</a>
|
||||
</span>
|
||||
{{ if .entry.Author }}
|
||||
<span class="entry-author">
|
||||
{{ if contains .entry.Author "@" }}
|
||||
- <a href="mailto:{{ .entry.Author }}">{{ .entry.Author }}</a>
|
||||
{{ else }}
|
||||
– <em>{{ .entry.Author }}</em>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="category">
|
||||
<a href="{{ route "categoryEntries" "categoryID" .entry.Feed.Category.ID }}">{{ .entry.Feed.Category.Title }}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="entry-date">
|
||||
<time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed .entry.Date }}</time>
|
||||
</div>
|
||||
</header>
|
||||
<div class="pagination-top">
|
||||
{{ template "entry_pagination" . }}
|
||||
</div>
|
||||
<article class="entry-content">
|
||||
{{ noescape (proxyFilter .entry.Content) }}
|
||||
</article>
|
||||
{{ if .entry.Enclosures }}
|
||||
<aside class="entry-enclosures">
|
||||
<h3>{{ t "Attachments" }}</h3>
|
||||
{{ range .entry.Enclosures }}
|
||||
<div class="entry-enclosure">
|
||||
{{ if hasPrefix .MimeType "audio/" }}
|
||||
<div class="enclosure-audio">
|
||||
<audio controls preload="metadata">
|
||||
<source src="{{ .URL }}" type="{{ .MimeType }}">
|
||||
</audio>
|
||||
</div>
|
||||
{{ else if hasPrefix .MimeType "video/" }}
|
||||
<div class="enclosure-video">
|
||||
<video controls preload="metadata">
|
||||
<source src="{{ .URL }}" type="{{ .MimeType }}">
|
||||
</video>
|
||||
</div>
|
||||
{{ else if hasPrefix .MimeType "image/" }}
|
||||
<div class="enclosure-image">
|
||||
<img src="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" alt="{{ .URL }} ({{ .MimeType }})">
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="entry-enclosure-download">
|
||||
<a href="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ t "Download" }}</a>
|
||||
<small>({{ .URL }})</small>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
<div class="pagination-bottom">
|
||||
{{ template "entry_pagination" . }}
|
||||
</div>
|
||||
{{ end }}
|
58
server/template/html/feed_entries.html
Normal file
58
server/template/html/feed_entries.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
{{ define "title"}}{{ .feed.Title }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ .feed.Title }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "refreshFeed" "feedID" .feed.ID }}">{{ t "Refresh" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "editFeed" "feedID" .feed.ID }}">{{ t "Edit" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if ne .feed.ParsingErrorCount 0 }}
|
||||
<div class="alert alert-error">
|
||||
<h3>{{ t "There is a problem with this feed" }}</h3>
|
||||
{{ .feed.ParsingErrorMsg }}
|
||||
</div>
|
||||
{{ else if not .entries }}
|
||||
<p class="alert">{{ t "There is no article for this feed." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "feedEntry" "feedID" .Feed.ID "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
65
server/template/html/feeds.html
Normal file
65
server/template/html/feeds.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
{{ define "title"}}{{ t "Feeds" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Feeds" }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .feeds }}
|
||||
<p class="alert">{{ t "You don't have any subscription." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .feeds }}
|
||||
<article class="item">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "feedEntries" "feedID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category">
|
||||
<a href="{{ route "categoryEntries" "categoryID" .Category.ID }}">{{ .Category.Title }}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ .SiteURL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ domain .SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "Last check:" }} <time datetime="{{ isodate .CheckedAt }}" title="{{ isodate .CheckedAt }}">{{ elapsed .CheckedAt }}</time>
|
||||
</li>
|
||||
{{ if ne .ParsingErrorCount 0 }}
|
||||
<li><strong title="{{ .ParsingErrorMsg }}">{{ plural "plural.feed.error_count" .ParsingErrorCount .ParsingErrorCount }}</strong></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "refreshFeed" "feedID" .ID }}">{{ t "Refresh" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "editFeed" "feedID" .ID }}">{{ t "Edit" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "removeFeed" "feedID" .ID }}">{{ t "Remove" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
42
server/template/html/history.html
Normal file
42
server/template/html/history.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{ define "title"}}{{ t "History" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "History" }} ({{ .total }})</h1>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert alert-info">{{ t "There is no history at the moment." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "readEntry" "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
34
server/template/html/import.html
Normal file
34
server/template/html/import.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{ define "title"}}{{ t "Import" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Import" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "uploadOPML" }}" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-file">{{ t "OPML file" }}</label>
|
||||
<input type="file" name="file" id="form-file">
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Import" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{ end }}
|
23
server/template/html/login.html
Normal file
23
server/template/html/login.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{ define "title"}}{{ t "Sign In" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="login-form">
|
||||
<form action="{{ route "checkLogin" }}" method="post">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" required autofocus>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" required>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Sign in" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
{{ end }}
|
42
server/template/html/sessions.html
Normal file
42
server/template/html/sessions.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{ define "title"}}{{ t "Sessions" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Sessions" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "Add user" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<table class="table-overflow">
|
||||
<tr>
|
||||
<th>{{ t "Date" }}</th>
|
||||
<th>{{ t "IP Address" }}</th>
|
||||
<th>{{ t "User Agent" }}</th>
|
||||
<th>{{ t "Actions" }}</th>
|
||||
</tr>
|
||||
{{ range .sessions }}
|
||||
<tr {{ if eq .Token $.currentSessionToken }}class="row-highlighted"{{ end }}>
|
||||
<td class="column-20" title="{{ isodate .CreatedAt }}">{{ elapsed .CreatedAt }}</td>
|
||||
<td class="column-20" title="{{ .IP }}">{{ .IP }}</td>
|
||||
<td title="{{ .UserAgent }}">{{ .UserAgent }}</td>
|
||||
<td class="column-20">
|
||||
{{ if eq .Token $.currentSessionToken }}
|
||||
{{ t "Current session" }}
|
||||
{{ else }}
|
||||
<a href="{{ route "removeSession" "sessionID" .ID }}">{{ t "Remove" }}</a>
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
|
||||
{{ end }}
|
63
server/template/html/settings.html
Normal file
63
server/template/html/settings.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
{{ define "title"}}{{ t "Settings" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Settings" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
{{ if .user.IsAdmin }}
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li>
|
||||
<a href="{{ route "about" }}">{{ t "About" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form method="post" autocomplete="off" action="{{ route "updateSettings" }}">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" value="{{ .form.Password }}" autocomplete="off">
|
||||
|
||||
<label for="form-confirmation">{{ t "Confirmation" }}</label>
|
||||
<input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" autocomplete="off">
|
||||
|
||||
<label for="form-language">{{ t "Language" }}</label>
|
||||
<select id="form-language" name="language">
|
||||
{{ range $key, $value := .languages }}
|
||||
<option value="{{ $key }}" {{ if eq $key $.form.Language }}selected="selected"{{ end }}>{{ $value }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<label for="form-timezone">{{ t "Timezone" }}</label>
|
||||
<select id="form-timezone" name="timezone">
|
||||
{{ range $key, $value := .timezones }}
|
||||
<option value="{{ $key }}" {{ if eq $key $.form.Timezone }}selected="selected"{{ end }}>{{ $value }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<label for="form-theme">{{ t "Theme" }}</label>
|
||||
<select id="form-theme" name="theme">
|
||||
{{ range $key, $value := .themes }}
|
||||
<option value="{{ $key }}" {{ if eq $key $.form.Theme }}selected="selected"{{ end }}>{{ $value }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{ end }}
|
47
server/template/html/unread.html
Normal file
47
server/template/html/unread.html
Normal file
|
@ -0,0 +1,47 @@
|
|||
{{ define "title"}}{{ t "Unread Items" }} {{ if gt .countUnread 0 }}({{ .countUnread }}){{ end }} {{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Unread" }} ({{ .countUnread }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert">{{ t "There is no unread article." }}</p>
|
||||
{{ else }}
|
||||
<div class="items hide-read-items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "unreadEntry" "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
51
server/template/html/users.html
Normal file
51
server/template/html/users.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
{{ define "title"}}{{ t "Users" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Users" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "Add user" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if eq (len .users) 1 }}
|
||||
<p class="alert">{{ t "You are the only user." }}</p>
|
||||
{{ else }}
|
||||
<table>
|
||||
<tr>
|
||||
<th class="column-20">{{ t "Username" }}</th>
|
||||
<th>{{ t "Administrator" }}</th>
|
||||
<th>{{ t "Last Login" }}</th>
|
||||
<th>{{ t "Actions" }}</th>
|
||||
</tr>
|
||||
{{ range .users }}
|
||||
{{ if ne .ID $.user.ID }}
|
||||
<tr>
|
||||
<td>{{ .Username }}</td>
|
||||
<td>{{ if eq .IsAdmin true }}{{ t "Yes" }}{{ else }}{{ t "No" }}{{ end }}</td>
|
||||
<td>
|
||||
{{ if .LastLoginAt }}
|
||||
<time datetime="{{ isodate .LastLoginAt }}" title="{{ isodate .LastLoginAt }}">{{ elapsed .LastLoginAt }}</time>
|
||||
{{ else }}
|
||||
{{ t "Never" }}
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route "editUser" "userID" .ID }}">{{ t "Edit" }}</a>,
|
||||
<a href="{{ route "removeUser" "userID" .ID }}">{{ t "Remove" }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
117
server/template/template.go
Normal file
117
server/template/template.go
Normal file
|
@ -0,0 +1,117 @@
|
|||
// 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 template
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/miniflux/miniflux2/errors"
|
||||
"github.com/miniflux/miniflux2/locale"
|
||||
"github.com/miniflux/miniflux2/server/route"
|
||||
"github.com/miniflux/miniflux2/server/template/helper"
|
||||
"github.com/miniflux/miniflux2/server/ui/filter"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
type TemplateEngine struct {
|
||||
templates map[string]*template.Template
|
||||
router *mux.Router
|
||||
translator *locale.Translator
|
||||
currentLocale *locale.Language
|
||||
}
|
||||
|
||||
func (t *TemplateEngine) ParseAll() {
|
||||
funcMap := template.FuncMap{
|
||||
"route": func(name string, args ...interface{}) string {
|
||||
return route.GetRoute(t.router, name, args...)
|
||||
},
|
||||
"noescape": func(str string) template.HTML {
|
||||
return template.HTML(str)
|
||||
},
|
||||
"proxyFilter": func(data string) string {
|
||||
return filter.ImageProxyFilter(t.router, data)
|
||||
},
|
||||
"domain": func(websiteURL string) string {
|
||||
parsedURL, err := url.Parse(websiteURL)
|
||||
if err != nil {
|
||||
return websiteURL
|
||||
}
|
||||
|
||||
return parsedURL.Host
|
||||
},
|
||||
"hasPrefix": func(str, prefix string) bool {
|
||||
return strings.HasPrefix(str, prefix)
|
||||
},
|
||||
"contains": func(str, substr string) bool {
|
||||
return strings.Contains(str, substr)
|
||||
},
|
||||
"isodate": func(ts time.Time) string {
|
||||
return ts.Format("2006-01-02 15:04:05")
|
||||
},
|
||||
"elapsed": func(ts time.Time) string {
|
||||
return helper.GetElapsedTime(t.currentLocale, ts)
|
||||
},
|
||||
"t": func(key interface{}, args ...interface{}) string {
|
||||
switch key.(type) {
|
||||
case string, error:
|
||||
return t.currentLocale.Get(key.(string), args...)
|
||||
case errors.LocalizedError:
|
||||
err := key.(errors.LocalizedError)
|
||||
return err.Localize(t.currentLocale)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
},
|
||||
"plural": func(key string, n int, args ...interface{}) string {
|
||||
return t.currentLocale.Plural(key, n, args...)
|
||||
},
|
||||
}
|
||||
|
||||
commonTemplates := ""
|
||||
for _, content := range templateCommonMap {
|
||||
commonTemplates += content
|
||||
}
|
||||
|
||||
for name, content := range templateViewsMap {
|
||||
log.Println("Parsing template:", name)
|
||||
t.templates[name] = template.Must(template.New("main").Funcs(funcMap).Parse(commonTemplates + content))
|
||||
}
|
||||
}
|
||||
|
||||
func (t *TemplateEngine) SetLanguage(language string) {
|
||||
t.currentLocale = t.translator.GetLanguage(language)
|
||||
}
|
||||
|
||||
func (t *TemplateEngine) Execute(w io.Writer, name string, data interface{}) {
|
||||
tpl, ok := t.templates[name]
|
||||
if !ok {
|
||||
log.Fatalf("The template %s does not exists.\n", name)
|
||||
}
|
||||
|
||||
var b bytes.Buffer
|
||||
err := tpl.ExecuteTemplate(&b, "base", data)
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to render template: %v\n", err)
|
||||
}
|
||||
|
||||
b.WriteTo(w)
|
||||
}
|
||||
|
||||
func NewTemplateEngine(router *mux.Router, translator *locale.Translator) *TemplateEngine {
|
||||
tpl := &TemplateEngine{
|
||||
templates: make(map[string]*template.Template),
|
||||
router: router,
|
||||
translator: translator,
|
||||
}
|
||||
|
||||
tpl.ParseAll()
|
||||
return tpl
|
||||
}
|
966
server/template/views.go
Normal file
966
server/template/views.go
Normal file
|
@ -0,0 +1,966 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// 2017-11-19 22:01:21.923713128 -0800 PST m=+0.004546271
|
||||
|
||||
package template
|
||||
|
||||
var templateViewsMap = map[string]string{
|
||||
"about": `{{ define "title"}}{{ t "About" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "About" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
{{ if .user.IsAdmin }}
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<div class="panel">
|
||||
<h3>{{ t "Version" }}</h3>
|
||||
<ul>
|
||||
<li><strong>{{ t "Version:" }}</strong> {{ .version }}</li>
|
||||
<li><strong>{{ t "Build Date:" }}</strong> {{ .build_date }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h3>{{ t "Authors" }}</h3>
|
||||
<ul>
|
||||
<li><strong>{{ t "Author:" }}</strong> Frédéric Guillot</li>
|
||||
<li><strong>{{ t "License:" }}</strong> Apache 2.0</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"add_subscription": `{{ define "title"}}{{ t "New Subscription" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New Subscription" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .categories }}
|
||||
<p class="alert alert-error">{{ t "There is no category. You must have at least one category." }}</p>
|
||||
{{ else }}
|
||||
<form action="{{ route "submitSubscription" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-url">{{ t "URL" }}</label>
|
||||
<input type="url" name="url" id="form-url" placeholder="https://domain.tld/" value="{{ .form.URL }}" required autofocus>
|
||||
|
||||
<label for="form-category">{{ t "Category" }}</label>
|
||||
<select id="form-category" name="category_id">
|
||||
{{ range .categories }}
|
||||
<option value="{{ .ID }}">{{ .Title }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Find a subscription" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"categories": `{{ define "title"}}{{ t "Categories" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Categories" }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .categories }}
|
||||
<p class="alert alert-error">{{ t "There is no category." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .categories }}
|
||||
<article class="item">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
<a href="{{ route "categoryEntries" "categoryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
{{ if eq .FeedCount 0 }}
|
||||
{{ t "No feed." }}
|
||||
{{ else }}
|
||||
{{ plural "plural.categories.feed_count" .FeedCount .FeedCount }}
|
||||
{{ end }}
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "editCategory" "categoryID" .ID }}">{{ t "Edit" }}</a>
|
||||
</li>
|
||||
{{ if eq .FeedCount 0 }}
|
||||
<li>
|
||||
<a href="{{ route "removeCategory" "categoryID" .ID }}">{{ t "Remove" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"category_entries": `{{ define "title"}}{{ .category.Title }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ .category.Title }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert">{{ t "There is no article in this category." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "categoryEntry" "categoryID" .Feed.Category.ID "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"choose_subscription": `{{ define "title"}}{{ t "Choose a Subscription" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New Subscription" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "chooseSubscription" }}" method="POST">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
<input type="hidden" name="category_id" value="{{ .categoryID }}">
|
||||
|
||||
<h3>{{ t "Choose a Subscription" }}</h3>
|
||||
|
||||
{{ range .subscriptions }}
|
||||
<div class="radio-group">
|
||||
<label title="{{ .URL }}"><input type="radio" name="url" value="{{ .URL }}"> {{ .Title }}</label> ({{ .Type }})
|
||||
<small title="Type = {{ .Type }}"><a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .URL }}</a></small>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Subscribe" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"create_category": `{{ define "title"}}{{ t "New Category" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New Category" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "categories" }}">{{ t "Categories" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "saveCategory" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-title">{{ t "Title" }}</label>
|
||||
<input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"create_user": `{{ define "title"}}{{ t "New User" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "New User" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "saveUser" }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" value="{{ .form.Password }}" required>
|
||||
|
||||
<label for="form-confirmation">{{ t "Confirmation" }}</label>
|
||||
<input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" required>
|
||||
|
||||
<label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked="checked"{{ end }}> {{ t "Administrator" }}</label>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Save" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"edit_category": `{{ define "title"}}{{ t "Edit Category: %s" .category.Title }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Edit Category: %s" .category.Title }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "categories" }}">{{ t "Categories" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createCategory" }}">{{ t "Create a category" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "updateCategory" "categoryID" .category.ID }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-title">{{ t "Title" }}</label>
|
||||
<input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "categories" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"edit_feed": `{{ define "title"}}{{ t "Edit Feed: %s" .feed.Title }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ .feed.Title }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .categories }}
|
||||
<p class="alert alert-error">{{ t "There is no category!" }}</p>
|
||||
{{ else }}
|
||||
{{ if ne .feed.ParsingErrorCount 0 }}
|
||||
<div class="alert alert-error">
|
||||
<h3>{{ t "Last Parsing Error" }}</h3>
|
||||
{{ .feed.ParsingErrorMsg }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<form action="{{ route "updateFeed" "feedID" .feed.ID }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-title">{{ t "Title" }}</label>
|
||||
<input type="text" name="title" id="form-title" value="{{ .form.Title }}" required autofocus>
|
||||
|
||||
<label for="form-site-url">{{ t "Site URL" }}</label>
|
||||
<input type="url" name="site_url" id="form-site-url" placeholder="https://domain.tld/" value="{{ .form.SiteURL }}" required>
|
||||
|
||||
<label for="form-feed-url">{{ t "Feed URL" }}</label>
|
||||
<input type="url" name="feed_url" id="form-feed-url" placeholder="https://domain.tld/" value="{{ .form.FeedURL }}" required>
|
||||
|
||||
<label for="form-category">{{ t "Category" }}</label>
|
||||
<select id="form-category" name="category_id">
|
||||
{{ range .categories }}
|
||||
<option value="{{ .ID }}" {{ if eq .ID $.form.CategoryID }}selected="selected"{{ end }}>{{ .Title }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "feeds" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}`,
|
||||
"edit_user": `{{ define "title"}}{{ t "Edit user: %s" .selected_user.Username }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Edit user %s" .selected_user.Username }}"</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "Add user" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "updateUser" "userID" .selected_user.ID }}" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required autofocus>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" value="{{ .form.Password }}">
|
||||
|
||||
<label for="form-confirmation">{{ t "Confirmation" }}</label>
|
||||
<input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}">
|
||||
|
||||
<label><input type="checkbox" name="is_admin" value="1" {{ if .form.IsAdmin }}checked="checked"{{ end }}> {{ t "Administrator" }}</label>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button> {{ t "or" }} <a href="{{ route "users" }}">{{ t "cancel" }}</a>
|
||||
</div>
|
||||
</form>
|
||||
{{ end }}
|
||||
`,
|
||||
"entry": `{{ define "title"}}{{ .entry.Title }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="entry">
|
||||
<header class="entry-header">
|
||||
<h1>
|
||||
<a href="{{ .entry.URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .entry.Title }}</a>
|
||||
</h1>
|
||||
<div class="entry-meta">
|
||||
<span class="entry-website">
|
||||
{{ if ne .entry.Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .entry.Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "feedEntries" "feedID" .entry.Feed.ID }}">{{ .entry.Feed.Title }}</a>
|
||||
</span>
|
||||
{{ if .entry.Author }}
|
||||
<span class="entry-author">
|
||||
{{ if contains .entry.Author "@" }}
|
||||
- <a href="mailto:{{ .entry.Author }}">{{ .entry.Author }}</a>
|
||||
{{ else }}
|
||||
– <em>{{ .entry.Author }}</em>
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
<span class="category">
|
||||
<a href="{{ route "categoryEntries" "categoryID" .entry.Feed.Category.ID }}">{{ .entry.Feed.Category.Title }}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="entry-date">
|
||||
<time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed .entry.Date }}</time>
|
||||
</div>
|
||||
</header>
|
||||
<div class="pagination-top">
|
||||
{{ template "entry_pagination" . }}
|
||||
</div>
|
||||
<article class="entry-content">
|
||||
{{ noescape (proxyFilter .entry.Content) }}
|
||||
</article>
|
||||
{{ if .entry.Enclosures }}
|
||||
<aside class="entry-enclosures">
|
||||
<h3>{{ t "Attachments" }}</h3>
|
||||
{{ range .entry.Enclosures }}
|
||||
<div class="entry-enclosure">
|
||||
{{ if hasPrefix .MimeType "audio/" }}
|
||||
<div class="enclosure-audio">
|
||||
<audio controls preload="metadata">
|
||||
<source src="{{ .URL }}" type="{{ .MimeType }}">
|
||||
</audio>
|
||||
</div>
|
||||
{{ else if hasPrefix .MimeType "video/" }}
|
||||
<div class="enclosure-video">
|
||||
<video controls preload="metadata">
|
||||
<source src="{{ .URL }}" type="{{ .MimeType }}">
|
||||
</video>
|
||||
</div>
|
||||
{{ else if hasPrefix .MimeType "image/" }}
|
||||
<div class="enclosure-image">
|
||||
<img src="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" alt="{{ .URL }} ({{ .MimeType }})">
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
<div class="entry-enclosure-download">
|
||||
<a href="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ t "Download" }}</a>
|
||||
<small>({{ .URL }})</small>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
<div class="pagination-bottom">
|
||||
{{ template "entry_pagination" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
`,
|
||||
"feed_entries": `{{ define "title"}}{{ .feed.Title }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ .feed.Title }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "refreshFeed" "feedID" .feed.ID }}">{{ t "Refresh" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "editFeed" "feedID" .feed.ID }}">{{ t "Edit" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if ne .feed.ParsingErrorCount 0 }}
|
||||
<div class="alert alert-error">
|
||||
<h3>{{ t "There is a problem with this feed" }}</h3>
|
||||
{{ .feed.ParsingErrorMsg }}
|
||||
</div>
|
||||
{{ else if not .entries }}
|
||||
<p class="alert">{{ t "There is no article for this feed." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "feedEntry" "feedID" .Feed.ID "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"feeds": `{{ define "title"}}{{ t "Feeds" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Feeds" }} ({{ .total }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "import" }}">{{ t "Import" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .feeds }}
|
||||
<p class="alert">{{ t "You don't have any subscription." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .feeds }}
|
||||
<article class="item">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "feedEntries" "feedID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category">
|
||||
<a href="{{ route "categoryEntries" "categoryID" .Category.ID }}">{{ .Category.Title }}</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ .SiteURL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ domain .SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ t "Last check:" }} <time datetime="{{ isodate .CheckedAt }}" title="{{ isodate .CheckedAt }}">{{ elapsed .CheckedAt }}</time>
|
||||
</li>
|
||||
{{ if ne .ParsingErrorCount 0 }}
|
||||
<li><strong title="{{ .ParsingErrorMsg }}">{{ plural "plural.feed.error_count" .ParsingErrorCount .ParsingErrorCount }}</strong></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "refreshFeed" "feedID" .ID }}">{{ t "Refresh" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "editFeed" "feedID" .ID }}">{{ t "Edit" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "removeFeed" "feedID" .ID }}">{{ t "Remove" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"history": `{{ define "title"}}{{ t "History" }} ({{ .total }}){{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "History" }} ({{ .total }})</h1>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert alert-info">{{ t "There is no history at the moment." }}</p>
|
||||
{{ else }}
|
||||
<div class="items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "readEntry" "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"import": `{{ define "title"}}{{ t "Import" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Import" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feeds" }}">{{ t "Feeds" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "addSubscription" }}">{{ t "Add subscription" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "export" }}">{{ t "Export" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form action="{{ route "uploadOPML" }}" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-file">{{ t "OPML file" }}</label>
|
||||
<input type="file" name="file" id="form-file">
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Import" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"login": `{{ define "title"}}{{ t "Sign In" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="login-form">
|
||||
<form action="{{ route "checkLogin" }}" method="post">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" required autofocus>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" required>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Sign in" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
{{ end }}
|
||||
`,
|
||||
"sessions": `{{ define "title"}}{{ t "Sessions" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Sessions" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "Add user" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<table class="table-overflow">
|
||||
<tr>
|
||||
<th>{{ t "Date" }}</th>
|
||||
<th>{{ t "IP Address" }}</th>
|
||||
<th>{{ t "User Agent" }}</th>
|
||||
<th>{{ t "Actions" }}</th>
|
||||
</tr>
|
||||
{{ range .sessions }}
|
||||
<tr {{ if eq .Token $.currentSessionToken }}class="row-highlighted"{{ end }}>
|
||||
<td class="column-20" title="{{ isodate .CreatedAt }}">{{ elapsed .CreatedAt }}</td>
|
||||
<td class="column-20" title="{{ .IP }}">{{ .IP }}</td>
|
||||
<td title="{{ .UserAgent }}">{{ .UserAgent }}</td>
|
||||
<td class="column-20">
|
||||
{{ if eq .Token $.currentSessionToken }}
|
||||
{{ t "Current session" }}
|
||||
{{ else }}
|
||||
<a href="{{ route "removeSession" "sessionID" .ID }}">{{ t "Remove" }}</a>
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"settings": `{{ define "title"}}{{ t "Settings" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Settings" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
{{ if .user.IsAdmin }}
|
||||
<li>
|
||||
<a href="{{ route "users" }}">{{ t "Users" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
<li>
|
||||
<a href="{{ route "about" }}">{{ t "About" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<form method="post" autocomplete="off" action="{{ route "updateSettings" }}">
|
||||
<input type="hidden" name="csrf" value="{{ .csrf }}">
|
||||
|
||||
{{ if .errorMessage }}
|
||||
<div class="alert alert-error">{{ t .errorMessage }}</div>
|
||||
{{ end }}
|
||||
|
||||
<label for="form-username">{{ t "Username" }}</label>
|
||||
<input type="text" name="username" id="form-username" value="{{ .form.Username }}" required>
|
||||
|
||||
<label for="form-password">{{ t "Password" }}</label>
|
||||
<input type="password" name="password" id="form-password" value="{{ .form.Password }}" autocomplete="off">
|
||||
|
||||
<label for="form-confirmation">{{ t "Confirmation" }}</label>
|
||||
<input type="password" name="confirmation" id="form-confirmation" value="{{ .form.Confirmation }}" autocomplete="off">
|
||||
|
||||
<label for="form-language">{{ t "Language" }}</label>
|
||||
<select id="form-language" name="language">
|
||||
{{ range $key, $value := .languages }}
|
||||
<option value="{{ $key }}" {{ if eq $key $.form.Language }}selected="selected"{{ end }}>{{ $value }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<label for="form-timezone">{{ t "Timezone" }}</label>
|
||||
<select id="form-timezone" name="timezone">
|
||||
{{ range $key, $value := .timezones }}
|
||||
<option value="{{ $key }}" {{ if eq $key $.form.Timezone }}selected="selected"{{ end }}>{{ $value }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<label for="form-theme">{{ t "Theme" }}</label>
|
||||
<select id="form-theme" name="theme">
|
||||
{{ range $key, $value := .themes }}
|
||||
<option value="{{ $key }}" {{ if eq $key $.form.Theme }}selected="selected"{{ end }}>{{ $value }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "Loading..." }}">{{ t "Update" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
"unread": `{{ define "title"}}{{ t "Unread Items" }} {{ if gt .countUnread 0 }}({{ .countUnread }}){{ end }} {{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Unread" }} ({{ .countUnread }})</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="#" data-on-click="markPageAsRead">{{ t "Mark this page as read" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if not .entries }}
|
||||
<p class="alert">{{ t "There is no unread article." }}</p>
|
||||
{{ else }}
|
||||
<div class="items hide-read-items">
|
||||
{{ range .entries }}
|
||||
<article class="item item-status-{{ .Status }}" data-id="{{ .ID }}">
|
||||
<div class="item-header">
|
||||
<span class="item-title">
|
||||
{{ if ne .Feed.Icon.IconID 0 }}
|
||||
<img src="{{ route "icon" "iconID" .Feed.Icon.IconID }}" width="16" height="16">
|
||||
{{ end }}
|
||||
<a href="{{ route "unreadEntry" "entryID" .ID }}">{{ .Title }}</a>
|
||||
</span>
|
||||
<span class="category"><a href="{{ route "categoryEntries" "categoryID" .Feed.Category.ID }}">{{ .Feed.Category.Title }}</a></span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "feedEntries" "feedID" .Feed.ID }}" title="{{ .Feed.Title }}">{{ domain .Feed.SiteURL }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<time datetime="{{ isodate .Date }}" title="{{ isodate .Date }}">{{ elapsed .Date }}</time>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ .URL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-original-link="true">{{ t "Original" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ template "pagination" .pagination }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}`,
|
||||
"users": `{{ define "title"}}{{ t "Users" }}{{ end }}
|
||||
|
||||
{{ define "content"}}
|
||||
<section class="page-header">
|
||||
<h1>{{ t "Users" }}</h1>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ route "settings" }}">{{ t "Settings" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "sessions" }}">{{ t "Sessions" }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ route "createUser" }}">{{ t "Add user" }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{ if eq (len .users) 1 }}
|
||||
<p class="alert">{{ t "You are the only user." }}</p>
|
||||
{{ else }}
|
||||
<table>
|
||||
<tr>
|
||||
<th class="column-20">{{ t "Username" }}</th>
|
||||
<th>{{ t "Administrator" }}</th>
|
||||
<th>{{ t "Last Login" }}</th>
|
||||
<th>{{ t "Actions" }}</th>
|
||||
</tr>
|
||||
{{ range .users }}
|
||||
{{ if ne .ID $.user.ID }}
|
||||
<tr>
|
||||
<td>{{ .Username }}</td>
|
||||
<td>{{ if eq .IsAdmin true }}{{ t "Yes" }}{{ else }}{{ t "No" }}{{ end }}</td>
|
||||
<td>
|
||||
{{ if .LastLoginAt }}
|
||||
<time datetime="{{ isodate .LastLoginAt }}" title="{{ isodate .LastLoginAt }}">{{ elapsed .LastLoginAt }}</time>
|
||||
{{ else }}
|
||||
{{ t "Never" }}
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route "editUser" "userID" .ID }}">{{ t "Edit" }}</a>,
|
||||
<a href="{{ route "removeUser" "userID" .ID }}">{{ t "Remove" }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
`,
|
||||
}
|
||||
|
||||
var templateViewsMapChecksums = map[string]string{
|
||||
"about": "56f1d45d8b9944306c66be0712320527e739a0ce4fccbd97a4c414c8f9cfab04",
|
||||
"add_subscription": "098ea9e492e18242bd414b22c4d8638006d113f728e5ae78c9186663f60ae3f1",
|
||||
"categories": "721b6bae6aa6461f4e020d667707fabe53c94b399f7d74febef2de5eb9f15071",
|
||||
"category_entries": "0bdcf28ef29b976b78d1add431896a8c56791476abd7a4240998d52c3efe1f35",
|
||||
"choose_subscription": "d37682743d8bbd84738a964e238103db2651f95fa340c6e285ffe2e12548d673",
|
||||
"create_category": "2b82af5d2dcd67898dc5daa57a6461e6ff8121a6089b2a2a1be909f35e4a2275",
|
||||
"create_user": "966b31d0414e0d0a547ef9ada428cbd24a91100bfed491f780c0461892a2489b",
|
||||
"edit_category": "cee720faadcec58289b707ad30af623d2ee66c1ce23a732965463250d7ff41c5",
|
||||
"edit_feed": "c5bc4c22bf7e8348d880395250545595d21fb8c8e723fc5d7cca68e25d250884",
|
||||
"edit_user": "f0f79704983de3ca7858bd8cda7a372c3999f5e4e0cf951fba5fa2c1752f9111",
|
||||
"entry": "32e605edd6d43773ac31329d247ebd81d38d974cd43689d91de79fffec7fe04b",
|
||||
"feed_entries": "9aff923b6c7452dec1514feada7e0d2bbc1ec21c6f5e9f48b2de41d1b731ffe4",
|
||||
"feeds": "ddcf12a47c850e6a1f3b85c9ab6566b4e45adfcd7a3546381a0c3a7a54f2b7d4",
|
||||
"history": "439000d0be8fd716f3b89860af4d721e05baef0c2ccd2325ba020c940d6aa847",
|
||||
"import": "73b5112e20bfd232bf73334544186ea419505936bc237d481517a8622901878f",
|
||||
"login": "568f2f69f248048f3e55e9bbc719077a74ae23fe18f237aa40e3de37e97b7a41",
|
||||
"sessions": "7fcd3bb794d4ad01eb9fa515660f04c8e79e1568970fd541cc7b2de8a76e1542",
|
||||
"settings": "9c89bfd70ff288b4256e5205be78a7645450b364db1df51d10fee3cb915b2c6b",
|
||||
"unread": "b6f9be1a72188947c75a6fdcac6ff7878db7745f9efa46318e0433102892a722",
|
||||
"users": "5bd535de3e46d9b14667d8159a5ec1478d6e028a77bf306c89d7b55813eeb625",
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue