mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
A new "shareCode" field is generated for each entry, and allows unlogged users to access the entry through the /shared endpoint. This feature is particularly useful to share articles from miniflux to third-party users without having them to visit the original source. The image proxy is disabled and special cache headers are proposed in the shared page to avoid denial of service.
158 lines
7.7 KiB
HTML
158 lines
7.7 KiB
HTML
{{ define "title"}}{{ .entry.Title }}{{ end }}
|
||
|
||
{{ define "content"}}
|
||
<section class="entry" data-id="{{ .entry.ID }}">
|
||
<header class="entry-header">
|
||
<h1>
|
||
<a href="{{ .entry.URL | safeURL }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .entry.Title }}</a>
|
||
</h1>
|
||
{{ if .user }}
|
||
<div class="entry-actions">
|
||
<ul>
|
||
<li>
|
||
<a href="#"
|
||
title="{{ t "entry.status.title" }}"
|
||
data-toggle-status="true"
|
||
data-label-read="✔︎ {{ t "entry.status.read" }}"
|
||
data-label-unread="✘ {{ t "entry.status.unread" }}"
|
||
data-toast-read="✔︎ {{ t "entry.status.toast.read" }}"
|
||
data-toast-unread="✘ {{ t "entry.status.toast.unread" }}"
|
||
data-value="{{ if eq .entry.Status "read" }}read{{ else }}unread{{ end }}"
|
||
>{{ if eq .entry.Status "read" }}✘ {{ t "entry.status.unread" }}{{ else }}✔︎ {{ t "entry.status.read" }}{{ end }}</a>
|
||
</li>
|
||
<li>
|
||
<a href="#"
|
||
data-toggle-bookmark="true"
|
||
data-bookmark-url="{{ route "toggleBookmark" "entryID" .entry.ID }}"
|
||
data-label-loading="{{ t "entry.state.saving" }}"
|
||
data-label-star="☆ {{ t "entry.bookmark.toggle.on" }}"
|
||
data-label-unstar="★ {{ t "entry.bookmark.toggle.off" }}"
|
||
data-toast-star="★ {{ t "entry.bookmark.toast.on" }}"
|
||
data-toast-unstar="☆ {{ t "entry.bookmark.toast.off" }}"
|
||
data-value="{{ if .entry.Starred }}star{{ else }}unstar{{ end }}"
|
||
>{{ if .entry.Starred }}★ {{ t "entry.bookmark.toggle.off" }}{{ else }}☆ {{ t "entry.bookmark.toggle.on" }}{{ end }}</a>
|
||
</li>
|
||
{{ if .hasSaveEntry }}
|
||
<li>
|
||
<a href="#"
|
||
title="{{ t "entry.save.title" }}"
|
||
data-save-entry="true"
|
||
data-save-url="{{ route "saveEntry" "entryID" .entry.ID }}"
|
||
data-label-loading="{{ t "entry.state.saving" }}"
|
||
data-label-done="{{ t "entry.save.completed" }}"
|
||
data-toast-done="{{ t "entry.save.toast.completed" }}"
|
||
>{{ t "entry.save.title" }}</a>
|
||
</li>
|
||
{{ end }}
|
||
<li>
|
||
<a href="{{ route "shareGenerate" "entryID" .entry.ID }}"
|
||
title="{{ t "entry.share.title" }}"
|
||
target="_blank"
|
||
>{{ t "entry.share.label" }}</a>
|
||
</li>
|
||
<li>
|
||
<a href="#"
|
||
title="{{ t "entry.scraper.title" }}"
|
||
data-fetch-content-entry="true"
|
||
data-fetch-content-url="{{ route "fetchContent" "entryID" .entry.ID }}"
|
||
data-label-loading="{{ t "entry.state.loading" }}"
|
||
data-label-done="{{ t "entry.scraper.completed" }}"
|
||
>{{ t "entry.scraper.label" }}</a>
|
||
</li>
|
||
{{ if .entry.CommentsURL }}
|
||
<li>
|
||
<a href="{{ .entry.CommentsURL | safeURL }}" title="{{ t "entry.comments.title" }}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" data-comments-link="true">{{ t "entry.comments.label" }}</a>
|
||
</li>
|
||
{{ end }}
|
||
</ul>
|
||
</div>
|
||
{{ end }}
|
||
<div class="entry-meta">
|
||
<span class="entry-website">
|
||
{{ if and .user (ne .entry.Feed.Icon.IconID 0) }}
|
||
<img src="{{ route "icon" "iconID" .entry.Feed.Icon.IconID }}" width="16" height="16" loading="lazy" alt="{{ .entry.Feed.Title }}">
|
||
{{ end }}
|
||
<a href="{{ route "feedEntries" "feedID" .entry.Feed.ID }}">{{ .entry.Feed.Title }}</a>
|
||
</span>
|
||
{{ if .entry.Author }}
|
||
<span class="entry-author">
|
||
{{ if isEmail .entry.Author }}
|
||
- <a href="mailto:{{ .entry.Author }}">{{ .entry.Author }}</a>
|
||
{{ else }}
|
||
– <em>{{ .entry.Author }}</em>
|
||
{{ end }}
|
||
</span>
|
||
{{ end }}
|
||
{{ if .user }}
|
||
<span class="category">
|
||
<a href="{{ route "categoryEntries" "categoryID" .entry.Feed.Category.ID }}">{{ .entry.Feed.Category.Title }}</a>
|
||
</span>
|
||
{{ end }}
|
||
</div>
|
||
<div class="entry-date">
|
||
{{ if .user }}
|
||
<time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed $.user.Timezone .entry.Date }}</time>
|
||
{{ else }}
|
||
<time datetime="{{ isodate .entry.Date }}" title="{{ isodate .entry.Date }}">{{ elapsed "UTC" .entry.Date }}</time>
|
||
{{ end }}
|
||
</div>
|
||
</header>
|
||
{{ if gt (len .entry.Content) 120 }}
|
||
{{ if .user }}
|
||
<div class="pagination-top">
|
||
{{ template "entry_pagination" . }}
|
||
</div>
|
||
{{ end }}
|
||
{{ end }}
|
||
<article class="entry-content">
|
||
{{ if .user }}
|
||
{{ noescape (proxyFilter .entry.Content) }}
|
||
{{ else }}
|
||
{{ noescape .entry.Content }}
|
||
{{ end }}
|
||
</article>
|
||
{{ if .entry.Enclosures }}
|
||
<details class="entry-enclosures">
|
||
<summary>{{ t "page.entry.attachments" }} ({{ len .entry.Enclosures }})</summary>
|
||
{{ range .entry.Enclosures }}
|
||
{{ if ne .URL "" }}
|
||
<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">
|
||
{{ if .user }}
|
||
<img src="{{ proxyURL .URL }}" title="{{ .URL }} ({{ .MimeType }})" loading="lazy" alt="{{ .URL }} ({{ .MimeType }})">
|
||
{{ else }}
|
||
<img src="{{ .URL }}" title="{{ .URL }} ({{ .MimeType }})" loading="lazy" alt="{{ .URL }} ({{ .MimeType }})">
|
||
{{ end }}
|
||
</div>
|
||
{{ end }}
|
||
|
||
<div class="entry-enclosure-download">
|
||
<a href="{{ .URL | safeURL }}" title="{{ t "action.download" }}{{ if gt .Size 0 }} - {{ formatFileSize .Size }}{{ end }} ({{ .MimeType }})" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer">{{ .URL | safeURL }}</a>
|
||
<small>{{ if gt .Size 0 }} - <strong>{{ formatFileSize .Size }}</strong>{{ end }}</small>
|
||
</div>
|
||
</div>
|
||
{{ end }}
|
||
{{ end }}
|
||
</details>
|
||
{{ end }}
|
||
</section>
|
||
|
||
{{ if .user }}
|
||
<div class="pagination-bottom">
|
||
{{ template "entry_pagination" . }}
|
||
</div>
|
||
{{ end }}
|
||
{{ end }}
|