Private
Public Access
Rebuild the reader UI to match FreshRSS's two-column layout
The previous UI was plain unstyled lists. Rebuilt around what FreshRSS actually looks like (per reference screenshots): a persistent left sidebar (folders/feeds with unread counts, favourites, tags) and a single main column with a date-grouped article list, where clicking a title expands the full article inline in place rather than navigating to a separate page. - apps/core/context_processors.py: feeds the sidebar's folder/feed tree, tags, and starred count to every authenticated page in one shared query set, so base.html can render it without each view wiring it up. - apps/reader/views.py: date-grouped stream (itertools.groupby over the already-ordered queryset), ?feed=/?folder= scoping alongside the existing ?tag=, a bulk mark-all-read endpoint (bulk_create/update, not one UserArticleState per article), and article_inline — the htmx endpoint behind the inline expand, sharing its mark-read logic with the full article_detail view via _load_article_and_mark_read. - templates/reader/_article_inline.html returns the article content plus an out-of-band swap of _article_actions.html, so the row's read/star icons update immediately when an article is expanded and marked read. - static/js/stream.js: the accordion toggle (one article open at a time), calling htmx.ajax() directly rather than hx-* attributes so a second click on an already-open row can collapse it without re-fetching. - static/css/base.css: full FreshRSS-like dark theme (with a light variant under prefers-color-scheme) replacing the previous unstyled pass — sidebar, topbar search, row/icon states, inline-expand styling. Verified end to end against a running dev server: folder/feed/tag scoping, mark-all-read, the inline-expand mark-read side effect and its icon update, and — against config.settings.prod specifically — that no inline <script> crept back in anywhere (would silently break under the CSP added in the previous commit) and the CSP header is still present on every page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c20558525
commit
cfa64b5485
18 files changed
+860
-159
No files matched your search
+459
-89
@@ -1,18 +1,74 @@
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
color-scheme: dark;
|
||||
font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
|
||||
|
||||
--bg: #17181c;
|
||||
--bg-sidebar: #1b1c21;
|
||||
--bg-row-hover: #24262c;
|
||||
--bg-row-selected: #1d3252;
|
||||
--accent: #3b82f6;
|
||||
--accent-dark: #1d4ed8;
|
||||
--star: #f5b400;
|
||||
--text: #e8e8ea;
|
||||
--text-muted: #a3a3a8;
|
||||
--text-dim: #74747a;
|
||||
--border: #2a2b31;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--bg: #ffffff;
|
||||
--bg-sidebar: #f4f5f7;
|
||||
--bg-row-hover: #eef0f3;
|
||||
--bg-row-selected: #e4edfd;
|
||||
--accent: #1a56db;
|
||||
--accent-dark: #163f99;
|
||||
--star: #b7790f;
|
||||
--text: #1a1b1e;
|
||||
--text-muted: #5b5c63;
|
||||
--text-dim: #85868c;
|
||||
--border: #e2e3e7;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 1rem;
|
||||
max-width: 48rem;
|
||||
margin-inline: auto;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
color: var(--text);
|
||||
margin: 0 0 0.5rem;
|
||||
}
|
||||
|
||||
input, textarea, select, button {
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 0.375rem;
|
||||
font-size: 1rem;
|
||||
padding: 0.5rem;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.messages {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
padding: 1rem 1.25rem 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.message {
|
||||
@@ -32,99 +88,413 @@ form p {
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
input, button {
|
||||
font-size: 1rem;
|
||||
padding: 0.5rem;
|
||||
.inline-form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.stream-header {
|
||||
.empty-state {
|
||||
opacity: 0.6;
|
||||
padding: 2rem 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.feed-favicon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 2px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
/* App shell: sidebar + main content, used on every authenticated page */
|
||||
|
||||
.app-shell {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
min-height: 100vh;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.top-nav a {
|
||||
margin-left: 1rem;
|
||||
.sidebar {
|
||||
width: 230px;
|
||||
flex: 0 0 230px;
|
||||
background: var(--bg-sidebar);
|
||||
border-right: 1px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.sidebar-brand {
|
||||
padding: 0.9rem 1rem;
|
||||
font-weight: 600;
|
||||
font-size: 1.1rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sidebar-brand a {
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.sidebar-manage-btn {
|
||||
display: block;
|
||||
margin: 0.75rem 1rem;
|
||||
padding: 0.5rem 0.75rem;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 0.375rem;
|
||||
text-decoration: none;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.sidebar-manage-btn:hover {
|
||||
background: var(--accent-dark);
|
||||
}
|
||||
|
||||
.sidebar-top-nav {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar-top-nav li a {
|
||||
display: block;
|
||||
padding: 0.4rem 0.75rem;
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
border-radius: 0.375rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.sidebar-top-nav li a:hover {
|
||||
background: var(--bg-row-hover);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.sidebar-top-nav li a.active {
|
||||
background: var(--bg-row-selected);
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sidebar-footer-nav {
|
||||
margin-top: auto;
|
||||
border-top: 1px solid var(--border);
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar-section {
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar-section summary {
|
||||
padding: 0.4rem 0.75rem;
|
||||
cursor: pointer;
|
||||
color: var(--text-dim);
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.sidebar-folder-link {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.sidebar-folder-link.active {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.sidebar-item-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 0.5rem 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar-item-list li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.sidebar-feed-link {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
padding: 0.3rem 0.5rem;
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
border-radius: 0.375rem;
|
||||
font-size: 0.85rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sidebar-feed-link span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sidebar-feed-link:hover {
|
||||
background: var(--bg-row-hover);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.sidebar-feed-link.active {
|
||||
background: var(--bg-row-selected);
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.unread-count {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-dim);
|
||||
padding-right: 0.5rem;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.app-topbar {
|
||||
padding: 0.6rem 1rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.topbar-search input[type="search"] {
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
border-radius: 999px;
|
||||
padding: 0.45rem 0.9rem;
|
||||
}
|
||||
|
||||
.app-content {
|
||||
padding: 1rem 1.25rem 2rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.auth-content {
|
||||
max-width: 28rem;
|
||||
margin: 3rem auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
/* Stream toolbar and article list */
|
||||
|
||||
.stream-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.stream-scope-title {
|
||||
font-size: 1.15rem;
|
||||
flex: 0 0 auto;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.filter-tabs {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin: 1rem 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
gap: 0.25rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.filter-tabs a {
|
||||
padding: 0.5rem 0.75rem;
|
||||
padding: 0.3rem 0.65rem;
|
||||
border-radius: 999px;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
border-bottom: 2px solid transparent;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.filter-tabs a:hover {
|
||||
background: var(--bg-row-hover);
|
||||
}
|
||||
|
||||
.filter-tabs a.active {
|
||||
border-bottom-color: currentColor;
|
||||
background: var(--bg-row-selected);
|
||||
color: var(--text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stream-toolbar .inline-form {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.stream-toolbar button[type="submit"] {
|
||||
background: none;
|
||||
font-size: 0.85rem;
|
||||
padding: 0.4rem 0.75rem;
|
||||
}
|
||||
|
||||
.article-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.article-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
flex-wrap: wrap;
|
||||
.date-header {
|
||||
padding: 0.5rem 0.25rem;
|
||||
margin-top: 0.75rem;
|
||||
font-size: 0.78rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--text-dim);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.article-row.is-read .article-title {
|
||||
opacity: 0.55;
|
||||
.article-row {
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.article-row-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.15rem;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
padding: 0.4rem 0.25rem;
|
||||
}
|
||||
|
||||
.article-row-main:hover {
|
||||
background: var(--bg-row-hover);
|
||||
}
|
||||
|
||||
.article-row.is-expanded .article-row-main {
|
||||
background: var(--bg-row-selected);
|
||||
box-shadow: inset 3px 0 0 var(--accent);
|
||||
}
|
||||
|
||||
.article-feed-name {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-dim);
|
||||
flex: 0 0 auto;
|
||||
max-width: 140px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.article-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
font-size: 0.85rem;
|
||||
opacity: 0.65;
|
||||
.article-row.is-read .article-title {
|
||||
font-weight: 400;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.article-time {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-dim);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.article-actions {
|
||||
display: flex;
|
||||
gap: 0.35rem;
|
||||
flex-wrap: nowrap;
|
||||
gap: 0.15rem;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
background: none;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 0.375rem;
|
||||
cursor: pointer;
|
||||
padding: 0.35rem 0.6rem;
|
||||
font-size: 0.9rem;
|
||||
border: none;
|
||||
padding: 0.25rem;
|
||||
color: var(--text-dim);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.icon-btn.active {
|
||||
background: #fde68a;
|
||||
border-color: #f59e0b;
|
||||
.icon-btn:hover {
|
||||
background: var(--bg-row-hover);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.icon-btn svg {
|
||||
fill: none;
|
||||
stroke: currentColor;
|
||||
stroke-width: 1.6;
|
||||
}
|
||||
|
||||
.icon-btn-read.is-unread {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.icon-btn-read.is-unread svg {
|
||||
fill: var(--accent);
|
||||
}
|
||||
|
||||
.icon-btn-star.active {
|
||||
color: var(--star);
|
||||
}
|
||||
|
||||
.icon-btn-star.active svg {
|
||||
fill: var(--star);
|
||||
}
|
||||
|
||||
.icon-btn-saved.active {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.icon-btn-saved.active svg {
|
||||
fill: var(--accent);
|
||||
}
|
||||
|
||||
.article-inline-body {
|
||||
padding: 0.75rem 1rem 1.5rem 2.1rem;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.article-content-header {
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.article-content-title {
|
||||
font-size: 1.3rem;
|
||||
margin: 0 0 0.3rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.article-meta .feed-favicon {
|
||||
vertical-align: -2px;
|
||||
margin-right: 0.3rem;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
line-height: 1.6;
|
||||
margin-top: 1rem;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.article-content a {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.article-content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
@@ -133,11 +503,7 @@ input, button {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
opacity: 0.6;
|
||||
padding: 2rem 0;
|
||||
text-align: center;
|
||||
}
|
||||
/* Tags */
|
||||
|
||||
.tag-tabs {
|
||||
display: flex;
|
||||
@@ -147,7 +513,7 @@ input, button {
|
||||
}
|
||||
|
||||
.tag-pill {
|
||||
--tag-color: #6b7280;
|
||||
--tag-color: var(--accent);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
@@ -161,7 +527,7 @@ input, button {
|
||||
|
||||
.tag-pill.active {
|
||||
background: var(--tag-color);
|
||||
color: #111;
|
||||
color: var(--bg);
|
||||
}
|
||||
|
||||
.tag-remove {
|
||||
@@ -203,12 +569,10 @@ input, button {
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.5rem 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.inline-form {
|
||||
display: inline;
|
||||
}
|
||||
/* Rules */
|
||||
|
||||
.rule-list {
|
||||
list-style: none;
|
||||
@@ -221,7 +585,7 @@ input, button {
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 0.75rem 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@@ -239,12 +603,20 @@ input, button {
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
/* Search */
|
||||
|
||||
.search-form {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.search-form input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* Subscriptions */
|
||||
|
||||
.subscription-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
@@ -256,34 +628,10 @@ input, button {
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 0.5rem 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.search-form input {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.article-content {
|
||||
line-height: 1.6;
|
||||
margin-top: 1rem;
|
||||
overflow-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.article-content a {
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.article-content img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.article-row {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
/* Dashboard */
|
||||
|
||||
.dashboard-stats {
|
||||
list-style: none;
|
||||
@@ -304,6 +652,28 @@ input, button {
|
||||
.feed-error-table td {
|
||||
text-align: left;
|
||||
padding: 0.5rem;
|
||||
border-bottom: 1px solid currentColor;
|
||||
border-bottom: 1px solid var(--border);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.app-shell {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
flex: 0 0 auto;
|
||||
max-height: 40vh;
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.article-feed-name {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.stream-toolbar .inline-form {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
function toggleArticle(event, id) {
|
||||
event.preventDefault();
|
||||
var link = event.currentTarget;
|
||||
var row = link.closest("li.article-row");
|
||||
var body = document.getElementById("article-body-" + id);
|
||||
var wasOpen = row.classList.contains("is-expanded");
|
||||
|
||||
document.querySelectorAll("li.article-row.is-expanded").forEach(function (openRow) {
|
||||
openRow.classList.remove("is-expanded");
|
||||
var openBody = openRow.querySelector(".article-inline-body");
|
||||
if (openBody) {
|
||||
openBody.hidden = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (!wasOpen) {
|
||||
row.classList.add("is-expanded");
|
||||
body.hidden = false;
|
||||
if (!body.dataset.loaded) {
|
||||
body.dataset.loaded = "1";
|
||||
htmx.ajax("GET", link.dataset.inlineUrl, { target: body, swap: "innerHTML" }).then(
|
||||
function () {
|
||||
row.classList.add("is-read");
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user