This commit is contained in:
maurice committed 2026-11-16 14:47:10 +01:00
1 parent 3d9777d81a
commit 084f78c60e
17 files changed
+253 -237

No files matched your search

Generated
+1 -1
View File
@@ -1036,7 +1036,7 @@ dependencies = [
]
[[package]]
name = "pastable"
name = "pastabble"
version = "0.1.0"
dependencies = [
"argon2",
+1 -1
View File
@@ -1,5 +1,5 @@
[package]
name = "pastable"
name = "pastabble"
version = "0.1.0"
edition = "2024"
+2 -2
View File
@@ -8,9 +8,9 @@ RUN cargo build --release --locked
FROM docker.io/library/alpine:latest
WORKDIR /app
COPY --from=build /app/target/release/pastable /usr/local/bin/pastable
COPY --from=build /app/target/release/pastabble /usr/local/bin/pastabble
COPY static ./static
ENV DATABASE_URL=sqlite:///data/pastable.db
VOLUME ["/data"]
EXPOSE 3000
CMD ["pastable"]
CMD ["pastabble"]
+10 -8
View File
@@ -1,6 +1,6 @@
# Pastable
# Pastabble
Pastable is a free and open-source Plabble initiative for sharing text, code, short links, and one-time secrets.
Pastabble is a free and open-source Plabble initiative for sharing text, code, short links, and one-time secrets.
## Run locally
@@ -24,11 +24,11 @@ Route handlers can access the shared database pool with the `State(pool): State<
## Browser app
Open `/gui` for the browser workspace. Create text pastes, one-time secrets, and short links; choose custom IDs, languages, expiry, and view limits. After saving, a dialog prominently displays the returned link for copying or opening. Opening a share navigates directly to its page or redirect.
Open `/` for the browser workspace. Create text pastes, one-time secrets, and short links; choose custom IDs, languages, expiry, and view limits. After saving, a dialog prominently displays the returned link for copying or opening. Opening a share navigates directly to its page or redirect.
The language dropdown is populated from irosashi's supported grammars. The home page renders this README as HTML and shares the browser app's logo, navigation, and styling.
The language dropdown is populated from irosashi's supported grammars. The documentation page at `/docs` renders this README as HTML and shares the browser app's logo, navigation, and styling.
Sign in with HTTP Basic credentials to browse, filter, edit, and delete your own shares. A new username creates an account. Credentials stay in page memory and are cleared on sign-out or reload. Creating and managing shares uses the existing API without page reloads.
Sign in with HTTP Basic credentials to browse, filter, edit, and delete your own shares. A new username creates an account. Credentials are stored in localStorage to keep you signed in across page reloads and browser restarts. Signing out removes the saved credentials. Creating and managing shares uses the existing API without page reloads.
Opening a paste or following a short link counts as a view. Listing records and loading them into the editor do not. Updates preserve omitted options and view counters.
@@ -66,7 +66,7 @@ All paths are relative to the server URL. `{id}` is a path parameter containing
**Returns:** the assigned ID as plain text. This is an ID, not a full URL. Always use the returned ID, since a requested custom ID may already be taken.
Generated IDs contain exactly 8 alphanumeric characters, generated in Rust with `rand`. Confusing characters (`0`, `1`, `I`, `L`, `O`, `i`, `l`, `o`) are excluded. IDs are shared by pastes and short links. Reserved route names (`gui`, `list`, `once`, `to`, and `static`) and IDs containing `/` are unavailable as custom IDs; these also receive a generated ID.
Generated IDs contain exactly 8 alphanumeric characters, generated in Rust with `rand`. Confusing characters (`0`, `1`, `I`, `L`, `O`, `i`, `l`, `o`) are excluded. IDs are shared by pastes and short links. Reserved route names (`docs`, `list`, `once`, `to`, and `static`) and IDs containing `/` are unavailable as custom IDs; these also receive a generated ID.
Create a paste from raw text:
@@ -106,7 +106,7 @@ curl --request POST 'http://localhost:3000/once/my-secret' \
HTML paste pages show the view counter, including the current read, and the maximum when set. HTML and plain-text responses include `X-Paste-Views` and, when limited, `X-Paste-Max-Views` response headers, so displaying the counter does not require another read.
The HTML page includes a **Copy raw code** button that preserves the original content and whitespace without another request or view. If clipboard access is unavailable, the raw text is selected for manual copying.
The HTML page includes a **Copy** button that preserves the original content and whitespace without another request or view. If clipboard access is unavailable, the raw text is selected for manual copying.
Each successful read increments `views`. The final permitted read returns the content and deletes the paste. Missing, expired, and exhausted pastes return `404`. Expired and exhausted records are also cleaned up in the background every minute.
@@ -198,4 +198,6 @@ curl --user 'alice:example-password' 'http://localhost:3000/list'
### Home page
`GET /` returns the home page.
`GET /` returns a plain-text welcome message with a link to `/docs` by default, including via curl. With `Accept: text/html`, it returns the browser workspace.
`GET /docs` returns the README as Markdown by default, including via curl. With `Accept: text/html`, it returns the documentation page as HTML.
+2 -2
View File
@@ -13,7 +13,7 @@ mod db;
mod paste;
mod routes;
use crate::routes::{
delete_note, get_note, get_redirect, gui_page, home_page, list_notes, post_note, post_once,
delete_note, docs_page, get_note, get_redirect, home_page, list_notes, post_note, post_once,
post_redirect, put_note, put_redirect,
};
@@ -26,7 +26,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let app = Router::new()
.route("/", get(home_page).post(post_note))
.route("/gui", get(gui_page))
.route("/docs", get(docs_page))
.route("/once", post(post_once))
.route("/once/{id}", post(post_once))
.route("/to", post(post_redirect))
+2 -2
View File
@@ -2,9 +2,9 @@ use axum::http::{HeaderMap, header::ACCEPT};
mod create;
mod delete_note;
mod docs;
mod get_note;
mod get_redirect;
mod gui;
mod home;
mod input;
mod list_notes;
@@ -17,9 +17,9 @@ mod put_redirect;
mod update;
pub use delete_note::delete_note;
pub use docs::docs_page;
pub use get_note::get_note;
pub use get_redirect::get_redirect;
pub use gui::gui_page;
pub use home::home_page;
pub use list_notes::list_notes;
pub use post_note::post_note;
+1 -1
View File
@@ -14,7 +14,7 @@ pub async fn create(
paste_type: PasteType,
) -> Result<String, StatusCode> {
let mut id = id.map(|Path(id)| id).filter(|id| {
!matches!(id.as_str(), "gui" | "list" | "once" | "to" | "static") && !id.contains('/')
!matches!(id.as_str(), "docs" | "list" | "once" | "to" | "static") && !id.contains('/')
});
if matches!(paste_type, PasteType::TextV1) && input.language.is_none() {
+40
View File
@@ -0,0 +1,40 @@
use std::sync::LazyLock;
use askama::Template;
use askama_web::WebTemplate;
use axum::{
http::{HeaderMap, header::CONTENT_TYPE},
response::{IntoResponse, Response},
};
use pulldown_cmark::{Options, Parser, html};
use super::return_html;
static README_MD: &str = include_str!("../../README.md");
static README_HTML: LazyLock<String> = LazyLock::new(|| {
let parser = Parser::new_ext(
README_MD,
Options::ENABLE_TABLES | Options::ENABLE_STRIKETHROUGH | Options::ENABLE_TASKLISTS,
);
let mut rendered = String::new();
html::push_html(&mut rendered, parser);
rendered
});
#[derive(Template, WebTemplate)]
#[template(path = "docs.html")]
pub struct DocsPage {
readme: &'static str,
}
pub async fn docs_page(headers: HeaderMap) -> Response {
if return_html(&headers) {
DocsPage {
readme: &README_HTML,
}
.into_response()
} else {
([(CONTENT_TYPE, "text/markdown; charset=utf-8")], README_MD).into_response()
}
}
-17
View File
@@ -1,17 +0,0 @@
use askama::Template;
use askama_web::WebTemplate;
use axum::http::StatusCode;
use irosashi::Highlighter;
#[derive(Template, WebTemplate)]
#[template(path = "gui.html")]
pub struct GuiPage {
languages: Vec<String>,
}
pub async fn gui_page() -> Result<GuiPage, StatusCode> {
let highlighter = Highlighter::new().map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
Ok(GuiPage {
languages: highlighter.languages(),
})
}
+17 -39
View File
@@ -1,50 +1,28 @@
use std::sync::LazyLock;
use askama::Template;
use askama_web::WebTemplate;
use pulldown_cmark::{Event, Options, Parser, Tag, html};
use axum::{
http::{HeaderMap, StatusCode},
response::{IntoResponse, Response},
};
use irosashi::Highlighter;
static README_HTML: LazyLock<String> = LazyLock::new(|| {
let events: Vec<_> = Parser::new_ext(
include_str!("../../README.md"),
Options::ENABLE_TABLES | Options::ENABLE_STRIKETHROUGH | Options::ENABLE_TASKLISTS,
)
.collect();
let anchored = events.iter().enumerate().map(|(index, event)| {
if let Event::Start(Tag::Heading(level, None, _)) = event {
let title: String = events[index + 1..]
.iter()
.take_while(|event| !matches!(event, Event::End(Tag::Heading(..))))
.filter_map(|event| match event {
Event::Text(text) | Event::Code(text) => Some(text.as_ref()),
_ => None,
})
.collect();
let slug: String = title
.to_lowercase()
.chars()
.filter(|character| {
character.is_alphanumeric() || *character == '-' || character.is_whitespace()
})
.collect();
let slug = slug.split_whitespace().collect::<Vec<_>>().join("-");
return Event::Html(format!("<{level} id=\"{slug}\">").into());
}
event.clone()
});
let mut rendered = String::new();
html::push_html(&mut rendered, anchored);
rendered
});
use super::return_html;
#[derive(Template, WebTemplate)]
#[template(path = "home.html")]
pub struct HomePage {
readme: &'static str,
languages: Vec<String>,
}
pub async fn home_page() -> HomePage {
HomePage {
readme: &README_HTML,
pub async fn home_page(headers: HeaderMap) -> Result<Response, StatusCode> {
if !return_html(&headers) {
return Ok("Welcome @ Pastabble!\n\nShare text, code, short links, and one-time secrets.\nDocumentation: /docs\n".into_response());
}
let highlighter = Highlighter::new().map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
Ok(HomePage {
languages: highlighter.languages(),
}
.into_response())
}
+28 -16
View File
@@ -192,16 +192,27 @@ function reference(value, url) {
let id = value.trim();
if (/^(https?:\/\/|\/)/i.test(id)) {
const parsed = new URL(id, location.origin);
if (parsed.origin !== location.origin) throw new Error("Use an ID or a link from this Pastable server.");
if (parsed.origin !== location.origin) throw new Error("Use an ID or a link from this Pastabble server.");
url = parsed.pathname.startsWith("/to/");
id = decodeURIComponent(parsed.pathname.slice(url ? 4 : 1));
}
if (!id || id.includes("/") || ["gui", "list", "once", "to", "static"].includes(id)) {
throw new Error("Enter a valid share ID or a full Pastable share URL.");
if (!id || id.includes("/") || ["docs", "list", "once", "to", "static"].includes(id)) {
throw new Error("Enter a valid share ID or a full Pastabble share URL.");
}
return { id, url };
}
function setSession(username, auth, result = []) {
if (authorization !== auth) resetEditor();
authorization = auth;
notes = result;
$("username").value = username;
$("session-label").textContent = username || "Anonymous";
$("logout").hidden = !auth;
renderNotes();
updateEditor();
}
$("login-form").addEventListener("submit", event => {
event.preventDefault();
busy(event.submitter, async () => {
@@ -209,27 +220,18 @@ $("login-form").addEventListener("submit", event => {
const credentials = new TextEncoder().encode(`${username}:${$("password").value}`);
const auth = `Basic ${btoa(Array.from(credentials, byte => String.fromCharCode(byte)).join(""))}`;
const result = await api("/list", { accept: "application/json" }, auth);
if (authorization && authorization !== auth) resetEditor();
authorization = auth;
notes = result;
localStorage.setItem("pastable.session", JSON.stringify({ username, authorization: auth }));
setSession(username, auth, result);
$("password").value = "";
$("session-label").textContent = username;
$("logout").hidden = false;
$("account").open = false;
renderNotes();
updateEditor();
notify(`Signed in as ${username}. New shares will belong to your account.`);
});
});
$("logout").addEventListener("click", () => {
authorization = null;
notes = [];
localStorage.removeItem("pastable.session");
$("login-form").reset();
$("logout").hidden = true;
$("session-label").textContent = "Anonymous";
resetEditor();
renderNotes();
setSession("", null);
notify("Signed out.");
});
@@ -305,3 +307,13 @@ window.addEventListener("hashchange", () => showPanel(location.hash.slice(1)));
showPanel(location.hash.slice(1));
renderNotes();
updateEditor();
try {
const session = JSON.parse(localStorage.getItem("pastable.session"));
if (session && typeof session.username === "string" && typeof session.authorization === "string") {
setSession(session.username, session.authorization);
loadNotes().catch(error => notify(error.message, true));
}
} catch {
notify("Could not restore your saved sign-in. Please sign in again.", true);
}
+6 -6
View File
@@ -3,23 +3,23 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Pastable">
<title>{% block title %}Pastable{% endblock %}</title>
<meta name="description" content="Pastabble">
<title>{% block title %}Pastabble{% endblock %}</title>
<link rel="stylesheet" href="/static/app.css">
{% block head %}{% endblock %}
</head>
<body>
<header class="site-header">
<a class="brand" href="/" aria-label="Pastable home">
<a class="brand" href="/" aria-label="Pastabble home">
<svg width="30" height="34" viewBox="0 0 30 34" fill="none" aria-hidden="true">
<rect x="2" y="2" width="26" height="30" rx="6" fill="currentColor"/>
<path d="M9 11h12M9 17h12M9 23h7" stroke="white" stroke-width="2" stroke-linecap="round"/>
</svg>
<span>Pastable</span>
<span>Pastabble</span>
</a>
<nav aria-label="Main navigation">
<a href="/" {% block home_nav %}{% endblock %}>Documentation</a>
<a href="/gui" {% block gui_nav %}{% endblock %}>Browser app <span aria-hidden="true">↗</span></a>
<a href="/" {% block home_nav %}{% endblock %}>Browser app</a>
<a href="/docs" {% block docs_nav %}{% endblock %}>Documentation</a>
</nav>
</header>
<main>
+8
View File
@@ -0,0 +1,8 @@
{% extends "base.html" %}
{% block title %}Documentation · Pastabble{% endblock %}
{% block docs_nav %}aria-current="page"{% endblock %}
{% block content %}
<article class="card readme">
{{ readme|safe }}
</article>
{% endblock %}
-136
View File
@@ -1,136 +0,0 @@
{% extends "base.html" %}
{% block title %}Browser app · Pastable{% endblock %}
{% block gui_nav %}aria-current="page"{% endblock %}
{% block content %}
<div class="workspace-heading">
<div>
<p class="eyebrow">YOUR SHARING WORKSPACE</p>
<h1>Pastes, links &amp; secrets.</h1>
<p class="muted">A little space for things you want to pass along.</p>
</div>
<span id="session-label" class="badge">Anonymous</span>
</div>
<details id="account" class="card account">
<summary>Account <span class="muted">· optional</span></summary>
<form id="login-form">
<p class="muted">Sign in to manage your shares. A new username creates an account.</p>
<div class="form-grid">
<label>Username<input id="username" autocomplete="username" required pattern="[^:]+" maxlength="128"></label>
<label>Password<input id="password" type="password" autocomplete="current-password" required></label>
</div>
<div class="actions">
<button type="submit">Sign in / create account</button>
<button id="logout" type="button" class="secondary" hidden>Sign out</button>
</div>
<p class="hint">Your credentials stay in memory for this page only.</p>
</form>
</details>
<p id="status" class="status" role="status" aria-live="polite" tabindex="-1" hidden></p>
<nav class="workspace-tabs" aria-label="Workspace">
<a href="#compose" data-panel="compose" aria-current="page">Create a share</a>
<a href="#collection" data-panel="collection">My collection <span id="note-count" class="count">0</span></a>
<a href="#open" data-panel="open">Open a share</a>
</nav>
<section id="compose" class="panel" aria-labelledby="editor-title">
<div class="editor-layout">
<div class="card">
<div class="section-heading">
<h2 id="editor-title">Create a share</h2>
<button id="new-note" type="button" class="secondary" hidden>Cancel editing</button>
</div>
<form id="editor-form">
<div class="form-grid">
<label>What are you sharing?
<select id="kind"><option value="note">Text or code</option><option value="url">Short link</option></select>
</label>
<label>Custom ID <span class="muted">· optional</span>
<input id="custom-id" placeholder="Generate one for me" pattern="[^/]+" autocomplete="off">
</label>
</div>
<label><span id="content-label">Your text or code</span>
<textarea id="content" rows="15" spellcheck="false" placeholder="Paste something worth sharing…" required></textarea>
</label>
<div id="language-field">
<label>Language <span class="muted">· optional</span>
<select id="language">
<option value="">Auto detect</option>
<option value="text">Plain text</option>
{% for language in languages %}
<option value="{{ language }}">{{ language }}</option>
{% endfor %}
</select>
</label>
</div>
<p id="edit-hint" class="hint" hidden></p>
<div class="actions editor-actions">
<button id="save" type="submit">Create share</button>
<span id="ownership-hint" class="hint">Shared anonymously.</span>
</div>
</form>
</div>
<aside class="card options" aria-labelledby="options-title">
<p class="eyebrow">MAKE IT YOURS</p>
<h2 id="options-title">Share settings</h2>
<label>Expires after <span class="muted">· seconds</span>
<input id="expires" form="editor-form" type="number" min="0" step="1" placeholder="Never">
</label>
<label>Maximum views
<input id="max-views" form="editor-form" type="number" min="1" step="1" placeholder="Unlimited">
</label>
<label id="once-field" class="check-label">
<input id="once" form="editor-form" type="checkbox"> One-time secret
</label>
<p class="hint">One-time shares disappear after their first read. A link's views count its redirects.</p>
<hr>
<p class="hint">If a custom ID is taken, you'll get a fresh one. Always use the link returned after saving.</p>
</aside>
</div>
</section>
<section id="collection" class="panel card" aria-labelledby="collection-title" hidden>
<div class="section-heading">
<div><h2 id="collection-title">My collection</h2><p class="hint">Editing here does not count as a view.</p></div>
<button id="refresh" type="button" class="secondary">Refresh</button>
</div>
<label class="search-label">Filter shares<input id="search" type="search" placeholder="Find by ID, content or language…"></label>
<div id="collection-empty" class="empty-state">Sign in to see and manage your shares.</div>
<div id="collection-table" class="table-scroll" hidden>
<table>
<thead><tr><th scope="col">Share</th><th scope="col">Content</th><th scope="col">Views</th><th scope="col">Created</th><th scope="col">Updated</th><th scope="col">Expires</th><th scope="col">Actions</th></tr></thead>
<tbody id="note-rows"></tbody>
</table>
</div>
</section>
<section id="open" class="panel card" aria-labelledby="open-title" hidden>
<h2 id="open-title">Open a share</h2>
<p class="muted">Have an ID or a Pastable link? Open it here.</p>
<form id="open-form">
<label>ID or share URL<input id="open-id" placeholder="my-paste or a full share URL" required autocomplete="off"></label>
<label>Type<select id="open-kind"><option value="note">Text or code</option><option value="url">Short link</option></select></label>
<button type="submit">Open share</button>
<p class="hint">Opening a share navigates to it and counts as a view.</p>
</form>
</section>
<dialog id="share-result" class="card result" aria-labelledby="result-title" aria-describedby="result-feedback">
<p class="eyebrow">READY TO SHARE</p>
<h2 id="result-title">Your share is ready</h2>
<p id="result-feedback" class="hint" role="status" aria-live="polite"></p>
<label for="share-url">Share link</label>
<div class="copy-row">
<input id="share-url" readonly autofocus>
<button id="copy-url" type="button">Copy link</button>
</div>
<div class="actions result-actions">
<a id="share-link">Open share ↗</a>
<form method="dialog"><button class="secondary">Done</button></form>
</div>
<p class="hint">Opening counts as a view. Copying the link does not.</p>
</dialog>
<noscript><p class="status">Enable JavaScript to use the browser app. The HTTP API remains available.</p></noscript>
<script src="/static/gui.js" defer></script>
{% endblock %}
+132 -3
View File
@@ -1,7 +1,136 @@
{% extends "base.html" %}
{% block title %}Browser app · Pastabble{% endblock %}
{% block home_nav %}aria-current="page"{% endblock %}
{% block content %}
<article class="card readme">
{{ readme|safe }}
</article>
<div class="workspace-heading">
<div>
<p class="eyebrow">YOUR SHARING WORKSPACE</p>
<h1>Pastes, links &amp; secrets.</h1>
<p class="muted">A little space for things you want to pass along.</p>
</div>
<span id="session-label" class="badge">Anonymous</span>
</div>
<details id="account" class="card account">
<summary>Account <span class="muted">· optional</span></summary>
<form id="login-form">
<p class="muted">Sign in to manage your shares. A new username creates an account.</p>
<div class="form-grid">
<label>Username<input id="username" autocomplete="username" required pattern="[^:]+" maxlength="128"></label>
<label>Password<input id="password" type="password" autocomplete="current-password" required></label>
</div>
<div class="actions">
<button type="submit">Sign in / create account</button>
<button id="logout" type="button" class="secondary" hidden>Sign out</button>
</div>
<p class="hint">You stay signed in on this browser until you sign out.</p>
</form>
</details>
<p id="status" class="status" role="status" aria-live="polite" tabindex="-1" hidden></p>
<nav class="workspace-tabs" aria-label="Workspace">
<a href="#compose" data-panel="compose" aria-current="page">Create a share</a>
<a href="#collection" data-panel="collection">My collection <span id="note-count" class="count">0</span></a>
<a href="#open" data-panel="open">Open a share</a>
</nav>
<section id="compose" class="panel" aria-labelledby="editor-title">
<div class="editor-layout">
<div class="card">
<div class="section-heading">
<h2 id="editor-title">Create a share</h2>
<button id="new-note" type="button" class="secondary" hidden>Cancel editing</button>
</div>
<form id="editor-form">
<div class="form-grid">
<label>What are you sharing?
<select id="kind"><option value="note">Text or code</option><option value="url">Short link</option></select>
</label>
<label>Custom ID <span class="muted">· optional</span>
<input id="custom-id" placeholder="Generate one for me" pattern="[^/]+" autocomplete="off">
</label>
</div>
<label><span id="content-label">Your text or code</span>
<textarea id="content" rows="15" spellcheck="false" placeholder="Paste something worth sharing…" required></textarea>
</label>
<div id="language-field">
<label>Language <span class="muted">· optional</span>
<select id="language">
<option value="">Auto detect</option>
<option value="text">Plain text</option>
{% for language in languages %}
<option value="{{ language }}">{{ language }}</option>
{% endfor %}
</select>
</label>
</div>
<p id="edit-hint" class="hint" hidden></p>
<div class="actions editor-actions">
<button id="save" type="submit">Create share</button>
<span id="ownership-hint" class="hint">Shared anonymously.</span>
</div>
</form>
</div>
<aside class="card options" aria-labelledby="options-title">
<p class="eyebrow">MAKE IT YOURS</p>
<h2 id="options-title">Share settings</h2>
<label>Expires after <span class="muted">· seconds</span>
<input id="expires" form="editor-form" type="number" min="0" step="1" placeholder="Never">
</label>
<label>Maximum views
<input id="max-views" form="editor-form" type="number" min="1" step="1" placeholder="Unlimited">
</label>
<label id="once-field" class="check-label">
<input id="once" form="editor-form" type="checkbox"> One-time secret
</label>
<p class="hint">One-time shares disappear after their first read. A link's views count its redirects.</p>
<hr>
<p class="hint">If a custom ID is taken, you'll get a fresh one. Always use the link returned after saving.</p>
</aside>
</div>
</section>
<section id="collection" class="panel card" aria-labelledby="collection-title" hidden>
<div class="section-heading">
<div><h2 id="collection-title">My collection</h2><p class="hint">Editing here does not count as a view.</p></div>
<button id="refresh" type="button" class="secondary">Refresh</button>
</div>
<label class="search-label">Filter shares<input id="search" type="search" placeholder="Find by ID, content or language…"></label>
<div id="collection-empty" class="empty-state">Sign in to see and manage your shares.</div>
<div id="collection-table" class="table-scroll" hidden>
<table>
<thead><tr><th scope="col">Share</th><th scope="col">Content</th><th scope="col">Views</th><th scope="col">Created</th><th scope="col">Updated</th><th scope="col">Expires</th><th scope="col">Actions</th></tr></thead>
<tbody id="note-rows"></tbody>
</table>
</div>
</section>
<section id="open" class="panel card" aria-labelledby="open-title" hidden>
<h2 id="open-title">Open a share</h2>
<p class="muted">Have an ID or a Pastabble link? Open it here.</p>
<form id="open-form">
<label>ID or share URL<input id="open-id" placeholder="my-paste or a full share URL" required autocomplete="off"></label>
<label>Type<select id="open-kind"><option value="note">Text or code</option><option value="url">Short link</option></select></label>
<button type="submit">Open share</button>
<p class="hint">Opening a share navigates to it and counts as a view.</p>
</form>
</section>
<dialog id="share-result" class="card result" aria-labelledby="result-title" aria-describedby="result-feedback">
<p class="eyebrow">READY TO SHARE</p>
<h2 id="result-title">Your share is ready</h2>
<p id="result-feedback" class="hint" role="status" aria-live="polite"></p>
<label for="share-url">Share link</label>
<div class="copy-row">
<input id="share-url" readonly autofocus>
<button id="copy-url" type="button">Copy link</button>
</div>
<div class="actions result-actions">
<a id="share-link">Open share ↗</a>
<form method="dialog"><button class="secondary">Done</button></form>
</div>
<p class="hint">Opening counts as a view. Copying the link does not.</p>
</dialog>
<noscript><p class="status">Enable JavaScript to use the browser app. The HTTP API remains available.</p></noscript>
<script src="/static/workspace.js" defer></script>
{% endblock %}
+1 -1
View File
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{% block title %}Your pastes · Pastable{% endblock %}
{% block title %}Your pastes · Pastabble{% endblock %}
{% block content %}
<h1>Your pastes and short links</h1>
<div class="table-scroll">
+2 -2
View File
@@ -1,12 +1,12 @@
{% extends "base.html" %}
{% block title %}{{ paste.id }} · Pastable{% endblock %}
{% block title %}{{ paste.id }} · Pastabble{% endblock %}
{% block content %}
<article class="card paste-view">
<div class="section-heading">
<div><p class="eyebrow">SHARED PASTE</p><h1>{{ paste.id }}</h1></div>
<div class="actions">
<p class="badge view-counter">Views: {{ paste.views }} / {% match paste.max_views %}{% when Some with (max) %}{{ max }}{% when None %}∞{% endmatch %}</p>
<button id="copy-code" class="secondary" type="button" data-raw="{{ raw_code }}">Copy raw code</button>
<button id="copy-code" class="secondary" type="button" data-raw="{{ raw_code }}">Copy</button>
</div>
</div>
{{ code|safe }}