Compare commits

..
Author SHA1 Message Date
Typosaurus 63366bb240 ticket #93 attempt 1 2026-07-23 02:03:12 +00:00
Typosaurus a55d12696a ticket #93 attempt 1 2026-07-23 01:33:37 +00:00
9 changed files with 4 additions and 83 deletions
File diff suppressed because one or more lines are too long
-1
View File
@@ -42,7 +42,6 @@ def init_db():
_index(db, "posts", "idx_posts_created_at", ["created_at"]) _index(db, "posts", "idx_posts_created_at", ["created_at"])
_index(db, "posts", "idx_posts_topic", ["topic"]) _index(db, "posts", "idx_posts_topic", ["topic"])
_index(db, "posts", "idx_posts_slug", ["slug"]) _index(db, "posts", "idx_posts_slug", ["slug"])
_index(db, "posts", "idx_posts_project_uid", ["project_uid"])
if "posts" in tables: if "posts" in tables:
posts_table = get_table("posts") posts_table = get_table("posts")
if not posts_table.has_column("tags"): if not posts_table.has_column("tags"):
-5
View File
@@ -12,7 +12,6 @@ from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse, RedirectResponse from fastapi.responses import HTMLResponse, RedirectResponse
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from fastapi.exceptions import RequestValidationError from fastapi.exceptions import RequestValidationError
from starlette.middleware.gzip import GZipMiddleware
from devplacepy.config import ( from devplacepy.config import (
STATIC_DIR, STATIC_DIR,
STATIC_VERSION, STATIC_VERSION,
@@ -610,10 +609,6 @@ async def response_timing(request: Request, call_next):
response.headers["X-Response-Time"] = f"{(time.perf_counter() - start) * 1000:.1f}ms" response.headers["X-Response-Time"] = f"{(time.perf_counter() - start) * 1000:.1f}ms"
return response return response
app.add_middleware(GZipMiddleware, minimum_size=512, compresslevel=5)
_home_cache = TTLCache(ttl=int(os.environ.get("DEVPLACE_HOME_CACHE_TTL", "60")), max_size=4) _home_cache = TTLCache(ttl=int(os.environ.get("DEVPLACE_HOME_CACHE_TTL", "60")), max_size=4)
-10
View File
@@ -216,15 +216,6 @@ async def project_detail(request: Request, project_slug: str):
if parent if parent
else None else None
) )
posts_table = get_table("posts")
project_posts = list(
posts_table.find(
project_uid=project["uid"],
deleted_at=None,
order_by=["-created_at"],
)
)
return respond( return respond(
request, request,
"project_detail.html", "project_detail.html",
@@ -244,7 +235,6 @@ async def project_detail(request: Request, project_slug: str):
"forked_from": forked_from, "forked_from": forked_from,
"fork_count": count_forks(project["uid"]), "fork_count": count_forks(project["uid"]),
"file_count": count_files(project["uid"]), "file_count": count_files(project["uid"]),
"project_posts": project_posts,
}, },
), ),
model=ProjectDetailOut, model=ProjectDetailOut,
-1
View File
@@ -163,7 +163,6 @@ class ProjectDetailOut(_Out):
forked_from: Optional[dict] = None forked_from: Optional[dict] = None
fork_count: int = 0 fork_count: int = 0
file_count: int = 0 file_count: int = 0
project_posts: list[PostOut] = []
class GistsOut(_Out): class GistsOut(_Out):
-47
View File
@@ -313,50 +313,3 @@
color: var(--text-muted); color: var(--text-muted);
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.project-devlog {
margin-top: 2rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
}
.devlog-list {
list-style: none;
padding: 0;
margin: 0;
}
.devlog-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.5rem 0;
border-bottom: 1px solid var(--border);
gap: 1rem;
}
.devlog-item:last-child {
border-bottom: none;
}
.devlog-link {
color: var(--text-primary);
text-decoration: none;
font-weight: 500;
}
.devlog-link:hover {
color: var(--accent);
}
.devlog-date {
font-size: 0.8125rem;
color: var(--text-muted);
white-space: nowrap;
flex-shrink: 0;
}
.devlog-empty {
color: var(--text-muted);
font-size: 0.875rem;
}
@@ -11,7 +11,7 @@ How a request flows through middleware to a router, how the database layer is bu
## Middleware ## Middleware
Seven HTTP middlewares run as a stack around every request, listed outermost first. `response_timing` is the outermost, `refresh_db_snapshot` the innermost, and a `GZipMiddleware` (responses over 512 bytes) wraps the whole stack on top: Six HTTP middlewares run as a stack around every request, listed outermost first. `response_timing` is the outermost and `refresh_db_snapshot` the innermost. Compression is handled by nginx in production; the Python application does not compress responses itself.
| Middleware (outermost first) | Responsibility | | Middleware (outermost first) | Responsibility |
|------------|----------------| |------------|----------------|
-16
View File
@@ -170,22 +170,6 @@
{% endcall %} {% endcall %}
{% endif %} {% endif %}
<div class="project-devlog">
<h2 class="project-section-label">Devlog</h2>
{% if project_posts %}
<ul class="devlog-list">
{% for post in project_posts %}
<li class="devlog-item">
<a href="/posts/{{ post['slug'] }}" class="devlog-link">{{ render_title(post['title']) }}</a>
<span class="devlog-date">{{ local_dt(post['created_at'], 'date') }}</span>
</li>
{% endfor %}
</ul>
{% else %}
<p class="devlog-empty">No posts yet for this project.</p>
{% endif %}
</div>
{% with target_uid=project['uid'], target_type="project" %} {% with target_uid=project['uid'], target_type="project" %}
{% include "_comment_section.html" %} {% include "_comment_section.html" %}
{% endwith %} {% endwith %}
+2 -1
View File
@@ -4,7 +4,8 @@ version = "1.0.0"
description = "DevPlace - The Developer Social Network" description = "DevPlace - The Developer Social Network"
requires-python = ">=3.12" requires-python = ">=3.12"
dependencies = [ dependencies = [
"fastapi", "fastapi>=0.110.0",
"starlette>=0.37.0",
"uvicorn[standard]", "uvicorn[standard]",
"jinja2", "jinja2",
"python-multipart", "python-multipart",