Fix container build for sharp, slug lookup and select fields
- build the runtime image so libvips lands next to the sharp binary - GET /api/v1/posts/:slug finds drafts by slug for write clients - media upload documented with project slug instead of a project id - own select control instead of the browser default - quieter sidebar footer, project name leads to its entries
This commit is contained in:
@@ -262,7 +262,7 @@ export default async function AdminApiPage() {
|
||||
path="/api/v1/media"
|
||||
auth="write"
|
||||
summary="Lädt ein Bild hoch und erzeugt WebP-Varianten. Nur Bildformate, höchstens 15 MB."
|
||||
example={'curl -s -X POST -H "Authorization: Bearer $TOKEN" \\\n -F "file=@screenshot.png" \\\n -F "projectId=<projekt-id>" \\\n -F "alt=Spaltenmenü mit den neuen Einträgen" \\\n http://localhost:4700/api/v1/media'}
|
||||
example={'curl -s -X POST -H "Authorization: Bearer $TOKEN" \\\n -F "file=@screenshot.png" \\\n -F "project=trakk" \\\n -F "alt=Spaltenmenü mit den neuen Einträgen" \\\n http://localhost:4700/api/v1/media'}
|
||||
/>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -16,13 +16,14 @@ import {
|
||||
adminClientsPath,
|
||||
adminNewEntryPath,
|
||||
adminNewProjectPath,
|
||||
adminProjectEntriesPath,
|
||||
adminProjectPath,
|
||||
adminProjectsPath,
|
||||
adminUsersPath,
|
||||
} from '~/lib/admin-routes'
|
||||
import { isAdmin } from '~/lib/auth-access'
|
||||
import { requireAdminArea } from '~/lib/auth-guards'
|
||||
import { adminMediaPath, adminMediaProjectPath } from '~/lib/auth-routes'
|
||||
import { adminMediaPath } from '~/lib/auth-routes'
|
||||
|
||||
export default async function AdminPage() {
|
||||
const viewer = await requireAdminArea()
|
||||
@@ -116,7 +117,7 @@ export default async function AdminPage() {
|
||||
className={`size-2.5 shrink-0 ${projectSurface}`}
|
||||
/>
|
||||
<Link
|
||||
href={adminMediaProjectPath(project.slug)}
|
||||
href={adminProjectEntriesPath(project.slug)}
|
||||
className="flex items-center gap-2 font-display text-base font-semibold text-ink no-underline hover:text-signal"
|
||||
>
|
||||
{project.name}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from 'zod'
|
||||
import { findPost } from '~/data/repositories/posts'
|
||||
import { findPost, findPostIdBySlug } from '~/data/repositories/posts'
|
||||
import { resolveClient } from '~/lib/api-auth'
|
||||
import { apiDeleteEntry, apiReadEntry, apiUpdateEntry } from '~/lib/api-entries'
|
||||
import { entryProblem } from '~/lib/api-problem'
|
||||
@@ -33,11 +33,19 @@ export async function GET(request: Request, context: { params: Promise<{ slug: s
|
||||
|
||||
const post = await findPost(slug, client.scope, client.projectId ?? undefined)
|
||||
|
||||
if (!post) {
|
||||
if (post) {
|
||||
return Response.json(post)
|
||||
}
|
||||
|
||||
const id = await findPostIdBySlug(slug)
|
||||
|
||||
if (!id) {
|
||||
return problem(404, 'post_not_found')
|
||||
}
|
||||
|
||||
return Response.json(post)
|
||||
const result = await apiReadEntry(client, id)
|
||||
|
||||
return result.ok ? Response.json(result.value) : entryProblem(result.error)
|
||||
}
|
||||
|
||||
export async function PATCH(request: Request, context: { params: Promise<{ slug: string }> }) {
|
||||
|
||||
Reference in New Issue
Block a user