Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# the authenticated flow to this host.
BASE_URL=https://share.beckham.ai

# Source-repository link shown in the signed-in workspace sidebar. Leave blank to hide.
SOURCE_URL=https://github.com/dabeckham/beckham-share

# Session cookie signing key + database password — random, set by generate-secrets.sh.
SECRET_KEY=CHANGE_ME
DB_PASSWORD=CHANGE_ME
Expand Down
2 changes: 2 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Settings(BaseSettings):
brand_domain: str = "beckham.ai"
# Public origin the app is served from (used to build absolute share links).
base_url: str = "https://share.beckham.ai"
# Source-repository link surfaced in the signed-in workspace. Set empty to hide.
source_url: str = "https://github.com/dabeckham/beckham-share"

# Signs the session cookie. MUST be set to a long random value in prod.
secret_key: str = "dev-insecure-change-me"
Expand Down
1 change: 1 addition & 0 deletions app/static/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ body {
.side-link:hover { background: #f1f4f9; color: var(--ink); }
.side-link.active { background: #eaf1ff; color: var(--blue); }
.usage { margin-top: auto; color: var(--muted); font-size: 13px; padding: 12px; }
.source-link { font-size: 13px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }

.filespane { padding: 28px 32px; }
.filespane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
Expand Down
5 changes: 5 additions & 0 deletions app/templates/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
All files</a>
</nav>
<div class="usage">Storage used: <strong>{{ usage }}</strong></div>
{% if settings.source_url %}
<a class="side-link source-link" href="{{ settings.source_url }}" target="_blank" rel="noopener noreferrer">
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
View source</a>
{% endif %}
</aside>

<section class="filespane">
Expand Down
9 changes: 9 additions & 0 deletions tests/backend/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ def test_member_reaches_app(client, member):
assert client.get("/app").status_code == 200


def test_member_sees_source_link(client, member):
from app.config import settings

r = client.get("/app")
assert r.status_code == 200
assert settings.source_url
assert settings.source_url in r.text


def test_api_upload_forbidden_for_anonymous(client):
r = client.post("/api/files", files={"file": ("x.txt", b"x", "text/plain")}, data={"expiry_hours": "24"})
assert r.status_code == 403
Expand Down
Loading