feat(profile): avatar presets, upload, nickname editing
- FastAPI: preset assets 01–08, GET list/static, PUT /me/avatar/preset, safer uploaded-avatar path validation, preset_avatars + HTTP tests. - Expo: personal-info (library + presets), profile tab avatar, resolveApiMediaUrl, auth hooks cache sync, Web multipart helper, partial-save messaging + profile i18n. - Includes existing edits to conversation screen and voice use-player. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
14
app-expo/src/core/api/media-url.ts
Normal file
14
app-expo/src/core/api/media-url.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { config } from '@/core/config';
|
||||
|
||||
/** 将 API 返回的相对路径(如 `/api/auth/avatars/x.jpg`)转为可请求的绝对 URL。 */
|
||||
export function resolveApiMediaUrl(
|
||||
pathOrUrl: string | null | undefined,
|
||||
): string | null {
|
||||
if (pathOrUrl == null || pathOrUrl === '') return null;
|
||||
if (/^https?:\/\//i.test(pathOrUrl)) return pathOrUrl;
|
||||
if (pathOrUrl.startsWith('/')) {
|
||||
const base = config.apiBaseUrl.replace(/\/$/, '');
|
||||
return `${base}${pathOrUrl}`;
|
||||
}
|
||||
return pathOrUrl;
|
||||
}
|
||||
Reference in New Issue
Block a user