Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c51cf726b0 | ||
|
|
2616ef5060 |
No files matched your search
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [2.3.2] - 2026-10-31
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Header link reads "Admin" (was "Dashboard") when logged in
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Public pages never knew you were logged in (only `/admin` routes checked the session), so the header always said "Log in"
|
||||||
|
|
||||||
|
## [2.3.1] - 2026-10-31
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- "Log in" is back in the header nav (2.3.0 had moved it to the footer, where it was easy to miss)
|
||||||
|
|
||||||
## [2.3.0] - 2026-10-31
|
## [2.3.0] - 2026-10-31
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
+16
-1
@@ -280,6 +280,21 @@ def create_app(config=None):
|
|||||||
"""Add correlation ID to request context for tracing"""
|
"""Add correlation ID to request context for tracing"""
|
||||||
add_correlation_id()
|
add_correlation_id()
|
||||||
|
|
||||||
|
# Know who is logged in on every page, not just /admin (v2.3.2), so
|
||||||
|
# the header can say "Admin" instead of "Log in". Only requests that
|
||||||
|
# carry a session cookie touch the database.
|
||||||
|
from flask import g, request
|
||||||
|
token = request.cookies.get("starpunk_session")
|
||||||
|
if token:
|
||||||
|
from starpunk.auth import verify_session
|
||||||
|
try:
|
||||||
|
info = verify_session(token)
|
||||||
|
except Exception:
|
||||||
|
info = None
|
||||||
|
if info:
|
||||||
|
g.user = info
|
||||||
|
g.me = info["me"]
|
||||||
|
|
||||||
# Response middleware - Add webmention Link header (v1.6.0)
|
# Response middleware - Add webmention Link header (v1.6.0)
|
||||||
@app.after_request
|
@app.after_request
|
||||||
def add_webmention_headers(response):
|
def add_webmention_headers(response):
|
||||||
@@ -449,5 +464,5 @@ def create_app(config=None):
|
|||||||
|
|
||||||
# Package version (Semantic Versioning 2.0.0)
|
# Package version (Semantic Versioning 2.0.0)
|
||||||
# See docs/standards/versioning-strategy.md for details
|
# See docs/standards/versioning-strategy.md for details
|
||||||
__version__ = "2.3.0"
|
__version__ = "2.3.2"
|
||||||
__version_info__ = (2, 1, 0)
|
__version_info__ = (2, 1, 0)
|
||||||
+3
-2
@@ -40,7 +40,9 @@
|
|||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
<a href="{{ url_for('public.feed') }}">RSS</a>
|
<a href="{{ url_for('public.feed') }}">RSS</a>
|
||||||
{% if g.me %}
|
{% if g.me %}
|
||||||
<a href="{{ url_for('admin.dashboard') }}">Dashboard</a>
|
<a href="{{ url_for('admin.dashboard') }}">Admin</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{{ url_for('auth.login_form') }}">Log in</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<form class="site-search" action="/search" method="get" role="search">
|
<form class="site-search" action="/search" method="get" role="search">
|
||||||
<input type="search" name="q" placeholder="Search" aria-label="Search"
|
<input type="search" name="q" placeholder="Search" aria-label="Search"
|
||||||
@@ -65,7 +67,6 @@
|
|||||||
<footer class="site-footer">
|
<footer class="site-footer">
|
||||||
<p>
|
<p>
|
||||||
Powered by <a href="https://git.thesatelliteoflove.com/phil/StarPunk">StarPunk</a> v{{ config.get('VERSION', '0.5.0') }}
|
Powered by <a href="https://git.thesatelliteoflove.com/phil/StarPunk">StarPunk</a> v{{ config.get('VERSION', '0.5.0') }}
|
||||||
{% if not g.me %}· <a href="{{ url_for('auth.login_form') }}">Log in</a>{% endif %}
|
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ def test_home_shows_full_notes_and_site_name(app):
|
|||||||
# Notes' metadata is not styled as the page footer
|
# Notes' metadata is not styled as the page footer
|
||||||
assert html.count('<footer class="site-footer">') == 1
|
assert html.count('<footer class="site-footer">') == 1
|
||||||
assert '<footer class="note-meta">' in html
|
assert '<footer class="note-meta">' in html
|
||||||
|
nav = html.split('class="site-nav"', 1)[1].split("</nav>", 1)[0]
|
||||||
|
assert 'href="/auth/login"' in nav # login is in the top bar
|
||||||
|
|
||||||
|
|
||||||
def test_note_page_meta_line(app):
|
def test_note_page_meta_line(app):
|
||||||
@@ -55,3 +57,13 @@ def test_note_page_meta_line(app):
|
|||||||
html = app.test_client().get(f"/note/{note.slug}").data.decode()
|
html = app.test_client().get(f"/note/{note.slug}").data.decode()
|
||||||
assert "<title>Hello · My Notes</title>" in html
|
assert "<title>Hello · My Notes</title>" in html
|
||||||
assert 'class="u-url u-uid"' in html
|
assert 'class="u-url u-uid"' in html
|
||||||
|
|
||||||
|
|
||||||
|
def test_nav_shows_admin_when_logged_in(app):
|
||||||
|
from starpunk.auth import create_session
|
||||||
|
client = app.test_client()
|
||||||
|
with app.test_request_context():
|
||||||
|
client.set_cookie("starpunk_session", create_session("https://example.com"))
|
||||||
|
nav = client.get("/").data.decode().split('class="site-nav"', 1)[1].split("</nav>", 1)[0]
|
||||||
|
assert ">Admin</a>" in nav
|
||||||
|
assert "/auth/login" not in nav
|
||||||
Reference in new issue
Block a user