v3: fixed linter error, code format
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s

This commit is contained in:
khannurien
2026-06-22 17:31:21 +00:00
parent a1b71ad0c8
commit 26f5abfa4e
12 changed files with 31 additions and 39 deletions

View File

@@ -1,8 +1,4 @@
import { import { APIErrorCode, APIException, type User } from "../model/interfaces.ts";
APIErrorCode,
APIException,
type User,
} from "../model/interfaces.ts";
import { db, isUserRow, userRowToApi } from "../model/db.ts"; import { db, isUserRow, userRowToApi } from "../model/db.ts";
import { notifyCommentOwnerLike } from "./notification-service.ts"; import { notifyCommentOwnerLike } from "./notification-service.ts";

View File

@@ -94,17 +94,14 @@ export async function fetchWithTimeout(
url: string, url: string,
timeoutMs = 5000, timeoutMs = 5000,
): Promise<Response> { ): Promise<Response> {
async function attempt( async function attempt(): Promise<Response> {
extraInit?: Record<string, unknown>,
): Promise<Response> {
const controller = new AbortController(); const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeoutMs); const timer = setTimeout(() => controller.abort(), timeoutMs);
try { try {
return await fetch(url, { return await fetch(url, {
signal: controller.signal, signal: controller.signal,
headers: FETCH_HEADERS, headers: FETCH_HEADERS,
...extraInit, });
} as RequestInit);
} finally { } finally {
clearTimeout(timer); clearTimeout(timer);
} }
@@ -117,18 +114,10 @@ export async function fetchWithTimeout(
throw err; throw err;
} }
// Retry 1: allowInsecureCertificates handles expired / self-signed certs. // Deno/rustls rejected the server's TLS certificate (expired, self-signed,
const client = Deno.createHttpClient({ allowInsecureCertificates: true }); // or an unsupported signature algorithm) and offers no way to override
try { // verification programmatically. Fall back to a `curl --insecure`
return await attempt({ client }); // subprocess, which uses its own TLS stack.
} catch {
/* UnsupportedSignatureAlgorithm etc. — rustls can't help */
} finally {
client.close();
}
// Retry 2: curl uses its own TLS stack and supports a wider set of
// certificate algorithms that Deno/rustls rejects.
const curlRes = await fetchViaCurl(url, timeoutMs); const curlRes = await fetchViaCurl(url, timeoutMs);
if (curlRes) return curlRes; if (curlRes) return curlRes;

View File

@@ -1,8 +1,4 @@
import { import { APIErrorCode, APIException, type User } from "../model/interfaces.ts";
APIErrorCode,
APIException,
type User,
} from "../model/interfaces.ts";
import { db, isUserRow, userRowToApi } from "../model/db.ts"; import { db, isUserRow, userRowToApi } from "../model/db.ts";
import { notifyDumpOwnerUpvote } from "./notification-service.ts"; import { notifyDumpOwnerUpvote } from "./notification-service.ts";

View File

@@ -77,8 +77,7 @@ function CommentNode({
const replyEditorRef = useRef<TextEditorHandle>(null); const replyEditorRef = useRef<TextEditorHandle>(null);
const editEditorRef = useRef<TextEditorHandle>(null); const editEditorRef = useRef<TextEditorHandle>(null);
const { likeCounts, myLikes, castCommentLike, removeCommentLike } = const { likeCounts, myLikes, castCommentLike, removeCommentLike } = useWS();
useWS();
const children = tree.get(comment.id) ?? []; const children = tree.get(comment.id) ?? [];

View File

@@ -1,6 +1,6 @@
import { Trans } from "@lingui/react/macro"; import { Trans } from "@lingui/react/macro";
import { useAuth } from "../hooks/useAuth.ts"; import { useAuth } from "../hooks/useAuth.ts";
import { type FeedTab, FEED_TABS } from "../config/feedTabs.ts"; import { FEED_TABS, type FeedTab } from "../config/feedTabs.ts";
import { useTabParam } from "../hooks/useTabParam.ts"; import { useTabParam } from "../hooks/useTabParam.ts";
import { TabBar } from "./TabBar.tsx"; import { TabBar } from "./TabBar.tsx";

View File

@@ -30,8 +30,7 @@ export function LikeButton(
aria-label={liked ? t`Remove like` : t`Like`} aria-label={liked ? t`Remove like` : t`Like`}
title={disabled ? t`Log in to like` : undefined} title={disabled ? t`Log in to like` : undefined}
> >
{" "} {count > 0
{count > 0
? ( ? (
<span <span
ref={countRef} ref={countRef}

View File

@@ -28,8 +28,7 @@ export function VoteButton(
aria-label={voted ? t`Remove vote` : t`Upvote`} aria-label={voted ? t`Remove vote` : t`Upvote`}
title={disabled ? t`Log in to vote` : undefined} title={disabled ? t`Log in to vote` : undefined}
> >
{" "} {count > 0
{count > 0
? ( ? (
<span <span
ref={countRef} ref={countRef}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -344,7 +344,9 @@ export function Dump() {
onClick={handleTitleSave} onClick={handleTitleSave}
disabled={titleSaving || !titleDraft.trim()} disabled={titleSaving || !titleDraft.trim()}
> >
{titleSaving ? <Trans>Saving</Trans> : <Trans>Save</Trans>} {titleSaving
? <Trans>Saving</Trans>
: <Trans>Save</Trans>}
</button> </button>
<button <button
type="button" type="button"

View File

@@ -94,7 +94,11 @@ export function DumpEdit() {
comment: comment.trim() || undefined, comment: comment.trim() || undefined,
isPrivate, isPrivate,
} }
: { title: trimmedTitle, comment: comment.trim() || undefined, isPrivate }; : {
title: trimmedTitle,
comment: comment.trim() || undefined,
isPrivate,
};
res = await authFetch(`${API_URL}/api/dumps/${state.dump.id}`, { res = await authFetch(`${API_URL}/api/dumps/${state.dump.id}`, {
method: "PUT", method: "PUT",
body: JSON.stringify(body), body: JSON.stringify(body),

View File

@@ -11,7 +11,7 @@ import { useLocation } from "react-router";
import { AppHeader } from "../components/AppHeader.tsx"; import { AppHeader } from "../components/AppHeader.tsx";
import { PresenceRow } from "../components/PresenceRow.tsx"; import { PresenceRow } from "../components/PresenceRow.tsx";
import { FeedTabBar } from "../components/FeedTabBar.tsx"; import { FeedTabBar } from "../components/FeedTabBar.tsx";
import { type FeedTab, FEED_TABS } from "../config/feedTabs.ts"; import { FEED_TABS, type FeedTab } from "../config/feedTabs.ts";
import { useTabParam } from "../hooks/useTabParam.ts"; import { useTabParam } from "../hooks/useTabParam.ts";
import { API_URL, DEFAULT_PAGE_SIZE } from "../config/api.ts"; import { API_URL, DEFAULT_PAGE_SIZE } from "../config/api.ts";