- Upload a profile picture on web and mobile. The API square-crops it to 512px WebP, strips metadata (phone photos carry GPS), stores it in Postgres and serves it with immutable caching. Avatar URLs are stored as paths, so they survive moving the API. Arbitrary avatar URLs are no longer accepted (they'd let a profile track its viewers). - New accounts get the username as typed as their display name; existing accounts are backfilled, and clearing it falls back to the username. - Service names in Settings get a brand-coloured badge and larger type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzFywujuH9TiuXbr9vjoX8
This commit is contained in:
@@ -26,6 +26,16 @@ export async function api<T = unknown>(path: string, init: { method?: string; bo
|
||||
return data as T;
|
||||
}
|
||||
|
||||
/** Uploads one file as multipart form data (e.g. the profile picture). */
|
||||
export async function uploadFile<T = unknown>(path: string, file: File): Promise<T> {
|
||||
const form = new FormData();
|
||||
form.append('file', file);
|
||||
const res = await fetch(API_URL + path, { method: 'POST', credentials: 'include', body: form });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
if (!res.ok) throw new ApiError(res.status, (data as { error?: string }).error ?? res.statusText);
|
||||
return data as T;
|
||||
}
|
||||
|
||||
export const fetcher = <T,>(path: string) => api<T>(path);
|
||||
|
||||
export function useMe() {
|
||||
|
||||
Reference in New Issue
Block a user