v4.0.0 — Route publique /p/<slug>, correctifs publish/share UI
- Ajout route /p/<slug> qui sert les pages publiées (no auth, rendu HTML blocks)
- Template public_page.html — design épuré Notion-style
- Fix publishPage()/unpublishPage(): vérifient d.is_published au lieu de d.status==='ok'
- Fix shareInvite(): vérifie d.status==='shared'
- Fix removeShare(): vérifie d.status==='removed'
- ROADMAP.md: toutes les sections 4.0a-4.0e cochées ✅ (déjà implémentées)
- Version bump 2.5.0 → 4.0.0
This commit is contained in:
@@ -734,8 +734,13 @@ page_title %}{{ page.title }}{% endblock %} {% block topbar %}
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrf ? csrf[1] : '' }
|
||||
}).then(function(r){ return r.json(); }).then(function(d){
|
||||
if (d.status === 'ok') { self.pagePublished = true; self.publishedUrl = d.url || self.publishedUrl; self.showToast('Published to web'); }
|
||||
else { self.showToast(d.detail || 'Publish failed'); }
|
||||
if (d.is_published) {
|
||||
self.pagePublished = true;
|
||||
self.publishedUrl = window.location.origin + '/p/' + d.publish_slug;
|
||||
self.showToast('Published to web — ' + self.publishedUrl);
|
||||
} else {
|
||||
self.showToast(d.detail || 'Publish failed');
|
||||
}
|
||||
}).catch(function(){ self.showToast('Publish failed'); });
|
||||
},
|
||||
unpublishPage() {
|
||||
@@ -745,8 +750,13 @@ page_title %}{{ page.title }}{% endblock %} {% block topbar %}
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRF-Token': csrf ? csrf[1] : '' }
|
||||
}).then(function(r){ return r.json(); }).then(function(d){
|
||||
if (d.status === 'ok') { self.pagePublished = false; self.publishedUrl = ''; self.showToast('Unpublished'); }
|
||||
else { self.showToast(d.detail || 'Unpublish failed'); }
|
||||
if (!d.is_published) {
|
||||
self.pagePublished = false;
|
||||
self.publishedUrl = '';
|
||||
self.showToast('Unpublished');
|
||||
} else {
|
||||
self.showToast(d.detail || 'Unpublish failed');
|
||||
}
|
||||
}).catch(function(){ self.showToast('Unpublish failed'); });
|
||||
},
|
||||
shareInvite() {
|
||||
@@ -758,7 +768,7 @@ page_title %}{{ page.title }}{% endblock %} {% block topbar %}
|
||||
headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrf ? csrf[1] : '' },
|
||||
body: JSON.stringify({ email: this.inviteEmail.trim(), permission: this.invitePermission })
|
||||
}).then(function(r){ return r.json(); }).then(function(d){
|
||||
if (d.status === 'ok') { self.inviteEmail = ''; self.showToast('Invitation sent'); self.loadShares(); }
|
||||
if (d.status === 'shared') { self.inviteEmail = ''; self.showToast('Invitation sent'); self.loadShares(); }
|
||||
else { self.showToast(d.detail || 'Share failed'); }
|
||||
}).catch(function(){ self.showToast('Share failed'); });
|
||||
},
|
||||
@@ -775,7 +785,7 @@ page_title %}{{ page.title }}{% endblock %} {% block topbar %}
|
||||
method: 'DELETE',
|
||||
headers: { 'X-CSRF-Token': csrf ? csrf[1] : '' }
|
||||
}).then(function(r){ return r.json(); }).then(function(d){
|
||||
if (d.status === 'ok') { self.showToast('Share removed'); self.loadShares(); }
|
||||
if (d.status === 'removed') { self.showToast('Share removed'); self.loadShares(); }
|
||||
else { self.showToast(d.detail || 'Remove failed'); }
|
||||
}).catch(function(){ self.showToast('Remove failed'); });
|
||||
},
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ title }} — FlowDeck</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
|
||||
<style>
|
||||
:root {
|
||||
--bg: #191919;
|
||||
--bg-card: #1e1e1e;
|
||||
--text: #e0e0e0;
|
||||
--text-dim: #999;
|
||||
--accent: #4c9aff;
|
||||
--radius: 12px;
|
||||
}
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
line-height: 1.7;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.pub-header {
|
||||
border-bottom: 1px solid rgba(255,255,255,.06);
|
||||
padding: 14px 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
background: rgba(255,255,255,.01);
|
||||
backdrop-filter: blur(10px);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
.pub-brand {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.pub-brand span { font-size: 18px; }
|
||||
.pub-badge {
|
||||
font-size: 11px;
|
||||
padding: 3px 10px;
|
||||
background: rgba(76,154,255,.12);
|
||||
color: var(--accent);
|
||||
border-radius: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.pub-container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 40px 24px 80px;
|
||||
}
|
||||
.pub-title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 800;
|
||||
margin-bottom: 8px;
|
||||
letter-spacing: -.5px;
|
||||
}
|
||||
.pub-meta {
|
||||
font-size: 13px;
|
||||
color: var(--text-dim);
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
.pub-content {
|
||||
font-size: 16px;
|
||||
color: var(--text);
|
||||
}
|
||||
.pub-content p {
|
||||
margin: 4px 0;
|
||||
line-height: 1.7;
|
||||
}
|
||||
.pub-content h1, .pub-content h2, .pub-content h3, .pub-content h4 {
|
||||
color: var(--text);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.pub-content pre {
|
||||
background: rgba(255,255,255,.05);
|
||||
padding: 16px 20px;
|
||||
border-radius: 8px;
|
||||
overflow-x: auto;
|
||||
margin: 12px 0;
|
||||
}
|
||||
.pub-content code {
|
||||
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
|
||||
font-size: 14px;
|
||||
}
|
||||
.pub-content blockquote {
|
||||
border-left: 3px solid var(--accent);
|
||||
margin: 12px 0;
|
||||
padding: 4px 16px;
|
||||
opacity: .85;
|
||||
}
|
||||
.pub-content img {
|
||||
max-width: 100%;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.pub-content hr {
|
||||
border: none;
|
||||
border-top: 1px solid rgba(255,255,255,.08);
|
||||
margin: 16px 0;
|
||||
}
|
||||
.pub-content details {
|
||||
margin: 8px 0;
|
||||
}
|
||||
.pub-content summary {
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
}
|
||||
.pub-footer {
|
||||
text-align: center;
|
||||
padding: 24px;
|
||||
border-top: 1px solid rgba(255,255,255,.06);
|
||||
font-size: 12px;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
.pub-footer a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="pub-header">
|
||||
<a href="/" class="pub-brand">
|
||||
<span>📚</span> FlowDeck
|
||||
</a>
|
||||
<span class="pub-badge">🌐 Published</span>
|
||||
</header>
|
||||
|
||||
<main class="pub-container">
|
||||
<h1 class="pub-title">{{ title }}</h1>
|
||||
{% if updated_at %}
|
||||
<div class="pub-meta">Last updated: {{ updated_at[:10] }}</div>
|
||||
{% endif %}
|
||||
<div class="pub-content">
|
||||
{{ content_html | safe }}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="pub-footer">
|
||||
Made with <a href="/">FlowDeck</a> — a Notion-style workspace
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user