style(frontend): apply ultracite 7.12 formatting and lint rules

This commit is contained in:
hh committed 2026-09-19 00:21:07 +02:00
1 parent fc4758aa0b
commit c8e5cff871
109 files changed
+845 -817

No files matched your search

+5 -5
View File
@@ -63,7 +63,7 @@ async function handleError(response: Response): Promise<never> {
try {
const data = await response.json();
if (data && typeof data.detail === "string") {
detail = data.detail;
({ detail } = data);
}
} catch {
detail = response.statusText;
@@ -81,9 +81,9 @@ export async function request<T>(
headers["Content-Type"] = "application/json";
}
const response = await fetch(`${BASE}${path}${buildQuery(query, account)}`, {
method,
headers,
body: body === undefined ? undefined : JSON.stringify(body),
headers,
method,
});
if (!response.ok) {
return handleError(response);
@@ -114,9 +114,9 @@ export async function requestMedia(mediaId: number): Promise<MediaResult> {
}
const blob = await response.blob();
return {
mime: response.headers.get("Content-Type"),
state: "ready",
url: URL.createObjectURL(blob),
mime: response.headers.get("Content-Type"),
};
}
@@ -134,8 +134,8 @@ export async function requestMediaVersion(
}
const blob = await response.blob();
return {
mime: response.headers.get("Content-Type"),
state: "ready",
url: URL.createObjectURL(blob),
mime: response.headers.get("Content-Type"),
};
}
+1 -1
View File
@@ -50,7 +50,7 @@ async function fetchEmoji(
const response = await fetch(url, { headers: authHeaders() });
if (response.ok) {
const blob = await response.blob();
const asset = { url: URL.createObjectURL(blob), mime: blob.type };
const asset = { mime: blob.type, url: URL.createObjectURL(blob) };
remember(key, asset);
return asset;
}
+19 -19
View File
@@ -49,8 +49,8 @@ export function listAccounts(): Promise<Account[]> {
export function startLogin(phone: string): Promise<LoginState> {
return request<LoginState>("/accounts/login", {
method: "POST",
body: { phone },
method: "POST",
});
}
@@ -67,8 +67,8 @@ export function submitLoginCode(
code: string
): Promise<LoginState> {
return request<LoginState>(`/accounts/login/${loginId}/code`, {
method: "POST",
body: { code },
method: "POST",
});
}
@@ -77,8 +77,8 @@ export function submitLoginPassword(
password: string
): Promise<LoginState> {
return request<LoginState>(`/accounts/login/${loginId}/password`, {
method: "POST",
body: { password },
method: "POST",
});
}
@@ -91,8 +91,8 @@ export function renameAccountDevice(
deviceModel: string
): Promise<Account> {
return request<Account>(`/accounts/${accountId}/device`, {
method: "PATCH",
body: { device_model: deviceModel },
method: "PATCH",
});
}
@@ -123,8 +123,8 @@ export function listPolicies(): Promise<PolicyRecord[]> {
export function createPolicy(body: PolicyCreate): Promise<PolicyRecord> {
return request<PolicyRecord>("/policy", {
method: "POST",
body: { ...body, account_id: accounts.selectedId },
method: "POST",
});
}
@@ -133,9 +133,9 @@ export function updatePolicy(
toggles: CaptureToggles
): Promise<PolicyRecord> {
return request<PolicyRecord>(`/policy/${id}`, {
method: "PUT",
account: true,
body: toggles,
method: "PUT",
});
}
@@ -353,8 +353,8 @@ export function getChatsBatch(ids: number[]): Promise<Chat[]> {
export function enrichChat(chatId: number): Promise<{ job_id: number }> {
return request<{ job_id: number }>(`/chats/${chatId}/enrich`, {
method: "POST",
body: { account_id: accounts.selectedId },
method: "POST",
});
}
@@ -379,8 +379,8 @@ export function enqueueBackfill(
full = false
): Promise<{ job_id: number }> {
return request<{ job_id: number }>("/backfill", {
body: { account_id: accounts.selectedId, chat_id: chatId, full, media },
method: "POST",
body: { account_id: accounts.selectedId, chat_id: chatId, media, full },
});
}
@@ -388,8 +388,8 @@ export function enqueueStoriesBackfill(
peerId: number
): Promise<{ job_id: number }> {
return request<{ job_id: number }>("/stories/backfill", {
method: "POST",
body: { account_id: accounts.selectedId, peer_id: peerId },
method: "POST",
});
}
@@ -412,22 +412,22 @@ export function trackChat(
backfill = true
): Promise<DiscoverItem> {
return request<DiscoverItem>(`/chats/${chatId}/track`, {
method: "POST",
body: { account_id: accounts.selectedId, backfill },
method: "POST",
});
}
export function syncContacts(): Promise<{ job_id: number }> {
return request<{ job_id: number }>("/contacts/sync", {
method: "POST",
body: { account_id: accounts.selectedId },
method: "POST",
});
}
export function syncDialogs(): Promise<{ job_id: number }> {
return request<{ job_id: number }>("/dialogs/sync", {
method: "POST",
body: { account_id: accounts.selectedId },
method: "POST",
});
}
@@ -468,12 +468,12 @@ export function fetchMedia(
messageId: number
): Promise<{ job_id: number }> {
return request<{ job_id: number }>("/media/fetch", {
method: "POST",
body: {
account_id: accounts.selectedId,
chat_id: chatId,
message_id: messageId,
},
method: "POST",
});
}
@@ -482,12 +482,12 @@ export function transcribeMedia(
messageId: number
): Promise<{ job_id: number }> {
return request<{ job_id: number }>("/media/transcribe", {
method: "POST",
body: {
account_id: accounts.selectedId,
chat_id: chatId,
message_id: messageId,
},
method: "POST",
});
}
@@ -501,8 +501,8 @@ export function createWatch(
enabled: boolean
): Promise<Watch> {
return request<Watch>("/watches", {
body: { account_id: accounts.selectedId, enabled, kind, params },
method: "POST",
body: { account_id: accounts.selectedId, kind, params, enabled },
});
}
@@ -512,8 +512,8 @@ export function updateWatch(
enabled: boolean
): Promise<Watch> {
return request<Watch>(`/watches/${id}`, {
body: { enabled, params },
method: "PUT",
body: { params, enabled },
});
}
@@ -546,13 +546,13 @@ export function createAnnotation(
text: string
): Promise<Annotation> {
return request<Annotation>("/annotations", {
method: "POST",
body: {
account_id: accounts.selectedId,
chat_id: chatId,
message_id: messageId,
text,
},
method: "POST",
});
}
@@ -561,8 +561,8 @@ export function updateAnnotation(
text: string
): Promise<Annotation> {
return request<Annotation>(`/annotations/${id}`, {
method: "PUT",
body: { text },
method: "PUT",
});
}
@@ -575,7 +575,7 @@ export function listWatchedBots(): Promise<WatchedBot[]> {
}
export function addWatchedBot(token: string): Promise<WatchedBot> {
return request<WatchedBot>("/bots", { method: "POST", body: { token } });
return request<WatchedBot>("/bots", { body: { token }, method: "POST" });
}
export function removeWatchedBot(botId: number): Promise<void> {
+20 -19
View File
@@ -35,23 +35,23 @@ export function viewerItemsFrom(
if (media.length === 0) {
return [
{
messageId,
mediaId: null,
kind: "",
downloaded: false,
fileName: null,
fileSize: null,
kind: "",
mediaId: null,
messageId,
mime: null,
},
];
}
return media.map((item) => ({
messageId: item.message_id,
mediaId: item.id,
kind: item.kind,
downloaded: item.downloaded,
fileName: item.file_name,
fileSize: item.file_size,
kind: item.kind,
mediaId: item.id,
messageId: item.message_id,
mime: item.mime,
}));
}
@@ -141,21 +141,21 @@ async function resolve(
return { state: "missing" };
}
if (!meta.downloaded) {
return { state: "not-downloaded", mediaId: meta.id, kind: meta.kind };
return { kind: meta.kind, mediaId: meta.id, state: "not-downloaded" };
}
const blob = await requestMedia(meta.id);
if (blob.state === "ready") {
return {
state: "ready",
mediaId: meta.id,
kind: meta.kind,
mediaId: meta.id,
mime: blob.mime,
url: blob.url,
state: "ready",
transcript: meta.extracted_text,
url: blob.url,
};
}
if (blob.state === "not-downloaded") {
return { state: "not-downloaded", mediaId: meta.id, kind: meta.kind };
return { kind: meta.kind, mediaId: meta.id, state: "not-downloaded" };
}
return { state: "missing" };
}
@@ -168,21 +168,21 @@ async function resolveById(media: MediaRef): Promise<InlineMedia> {
return { state: "missing" };
}
if (!media.downloaded) {
return { state: "not-downloaded", mediaId: media.id, kind: media.kind };
return { kind: media.kind, mediaId: media.id, state: "not-downloaded" };
}
const blob = await requestMedia(media.id);
if (blob.state === "ready") {
return {
state: "ready",
mediaId: media.id,
kind: media.kind,
mediaId: media.id,
mime: blob.mime,
url: blob.url,
state: "ready",
transcript: null,
url: blob.url,
};
}
if (blob.state === "not-downloaded") {
return { state: "not-downloaded", mediaId: media.id, kind: media.kind };
return { kind: media.kind, mediaId: media.id, state: "not-downloaded" };
}
return { state: "missing" };
}
@@ -235,9 +235,10 @@ export async function requestTranscription(
messageId: number
): Promise<string | null> {
await transcribeMedia(chatId, messageId);
for (let i = 0; i < TRANSCRIBE_TRIES; i++) {
await new Promise((resolve) => {
setTimeout(resolve, TRANSCRIBE_DELAY);
for (let i = 0; i < TRANSCRIBE_TRIES; i += 1) {
// biome-ignore lint/performance/noAwaitInLoops: polling waits between tries on purpose
await new Promise((done) => {
setTimeout(done, TRANSCRIBE_DELAY);
});
try {
const meta = await getMessageMedia(chatId, messageId);
+5 -5
View File
@@ -44,17 +44,17 @@ export function createShare(
settings: ShareSettings
): Promise<FileShare> {
return request<FileShare>("/shares", {
method: "POST",
body: {
account_id: accounts.selectedId,
expires_in_seconds: settings.expiresInSeconds,
kind: subject.kind,
max_downloads: settings.maxDownloads,
media_id: subject.mediaId ?? null,
version_id: subject.versionId ?? null,
peer_id: subject.peerId ?? null,
story_id: subject.storyId ?? null,
expires_in_seconds: settings.expiresInSeconds,
max_downloads: settings.maxDownloads,
version_id: subject.versionId ?? null,
},
method: "POST",
});
}
@@ -63,12 +63,12 @@ export function updateShare(
settings: ShareSettings
): Promise<FileShare> {
return request<FileShare>(`/shares/${id}`, {
method: "PATCH",
body: {
expires_in_seconds: settings.expiresInSeconds,
keep_expiry: settings.keepExpiry ?? false,
max_downloads: settings.maxDownloads,
},
method: "PATCH",
});
}