v3: fixed linter error, code format
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
APIErrorCode,
|
||||
APIException,
|
||||
type User,
|
||||
} from "../model/interfaces.ts";
|
||||
import { APIErrorCode, APIException, type User } from "../model/interfaces.ts";
|
||||
import { db, isUserRow, userRowToApi } from "../model/db.ts";
|
||||
import { notifyCommentOwnerLike } from "./notification-service.ts";
|
||||
|
||||
|
||||
@@ -94,17 +94,14 @@ export async function fetchWithTimeout(
|
||||
url: string,
|
||||
timeoutMs = 5000,
|
||||
): Promise<Response> {
|
||||
async function attempt(
|
||||
extraInit?: Record<string, unknown>,
|
||||
): Promise<Response> {
|
||||
async function attempt(): Promise<Response> {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
||||
try {
|
||||
return await fetch(url, {
|
||||
signal: controller.signal,
|
||||
headers: FETCH_HEADERS,
|
||||
...extraInit,
|
||||
} as RequestInit);
|
||||
});
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
@@ -117,18 +114,10 @@ export async function fetchWithTimeout(
|
||||
throw err;
|
||||
}
|
||||
|
||||
// Retry 1: allowInsecureCertificates handles expired / self-signed certs.
|
||||
const client = Deno.createHttpClient({ allowInsecureCertificates: true });
|
||||
try {
|
||||
return await attempt({ client });
|
||||
} 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.
|
||||
// Deno/rustls rejected the server's TLS certificate (expired, self-signed,
|
||||
// or an unsupported signature algorithm) and offers no way to override
|
||||
// verification programmatically. Fall back to a `curl --insecure`
|
||||
// subprocess, which uses its own TLS stack.
|
||||
const curlRes = await fetchViaCurl(url, timeoutMs);
|
||||
if (curlRes) return curlRes;
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
APIErrorCode,
|
||||
APIException,
|
||||
type User,
|
||||
} from "../model/interfaces.ts";
|
||||
import { APIErrorCode, APIException, type User } from "../model/interfaces.ts";
|
||||
import { db, isUserRow, userRowToApi } from "../model/db.ts";
|
||||
import { notifyDumpOwnerUpvote } from "./notification-service.ts";
|
||||
|
||||
|
||||
@@ -77,8 +77,7 @@ function CommentNode({
|
||||
const replyEditorRef = useRef<TextEditorHandle>(null);
|
||||
const editEditorRef = useRef<TextEditorHandle>(null);
|
||||
|
||||
const { likeCounts, myLikes, castCommentLike, removeCommentLike } =
|
||||
useWS();
|
||||
const { likeCounts, myLikes, castCommentLike, removeCommentLike } = useWS();
|
||||
|
||||
const children = tree.get(comment.id) ?? [];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Trans } from "@lingui/react/macro";
|
||||
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 { TabBar } from "./TabBar.tsx";
|
||||
|
||||
|
||||
@@ -30,8 +30,7 @@ export function LikeButton(
|
||||
aria-label={liked ? t`Remove like` : t`Like`}
|
||||
title={disabled ? t`Log in to like` : undefined}
|
||||
>
|
||||
♥{" "}
|
||||
{count > 0
|
||||
♥ {count > 0
|
||||
? (
|
||||
<span
|
||||
ref={countRef}
|
||||
|
||||
@@ -28,8 +28,7 @@ export function VoteButton(
|
||||
aria-label={voted ? t`Remove vote` : t`Upvote`}
|
||||
title={disabled ? t`Log in to vote` : undefined}
|
||||
>
|
||||
▲{" "}
|
||||
{count > 0
|
||||
▲ {count > 0
|
||||
? (
|
||||
<span
|
||||
ref={countRef}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -344,7 +344,9 @@ export function Dump() {
|
||||
onClick={handleTitleSave}
|
||||
disabled={titleSaving || !titleDraft.trim()}
|
||||
>
|
||||
{titleSaving ? <Trans>Saving…</Trans> : <Trans>Save</Trans>}
|
||||
{titleSaving
|
||||
? <Trans>Saving…</Trans>
|
||||
: <Trans>Save</Trans>}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -94,7 +94,11 @@ export function DumpEdit() {
|
||||
comment: comment.trim() || undefined,
|
||||
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}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(body),
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useLocation } from "react-router";
|
||||
import { AppHeader } from "../components/AppHeader.tsx";
|
||||
import { PresenceRow } from "../components/PresenceRow.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 { API_URL, DEFAULT_PAGE_SIZE } from "../config/api.ts";
|
||||
|
||||
Reference in New Issue
Block a user