v3: fixed authorization bug with stale tokens, fixed private dump access bug, various small fixes across the app
Some checks failed
Build and Publish Docker Image / build-and-push (push) Failing after 20s
Some checks failed
Build and Publish Docker Image / build-and-push (push) Failing after 20s
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { Link, useLocation, useNavigate, useParams } from "react-router";
|
||||
import { t } from "@lingui/core/macro";
|
||||
import { Trans } from "@lingui/react/macro";
|
||||
import { dumpUrl } from "../utils/urls.ts";
|
||||
import { dumpThumbnailUrl, dumpUrl } from "../utils/urls.ts";
|
||||
import { AddToPlaylistModal } from "../components/AddToPlaylistModal.tsx";
|
||||
|
||||
import { API_URL, VALIDATION } from "../config/api.ts";
|
||||
@@ -350,7 +350,7 @@ export function Dump() {
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-border"
|
||||
className="form-cancel"
|
||||
onClick={() => setTitleEditing(false)}
|
||||
disabled={titleSaving}
|
||||
>
|
||||
@@ -434,7 +434,7 @@ export function Dump() {
|
||||
<RichContentCard
|
||||
richContent={dump.richContent}
|
||||
thumbnailOverrideUrl={dump.thumbnailMime
|
||||
? `${API_URL}/api/thumbnails/${dump.id}`
|
||||
? dumpThumbnailUrl(dump, token)
|
||||
: undefined}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { Dump, RawDump, UpdateDumpRequest } from "../model.ts";
|
||||
import { deserializeDump, parseAPIResponse } from "../model.ts";
|
||||
import { useRequiredAuth } from "../hooks/useAuth.ts";
|
||||
import { formatBytes } from "../utils/format.ts";
|
||||
import { dumpUrl } from "../utils/urls.ts";
|
||||
import { dumpFileUrl, dumpThumbnailUrl, dumpUrl } from "../utils/urls.ts";
|
||||
import { PageShell } from "../components/PageShell.tsx";
|
||||
import { PageError } from "../components/PageError.tsx";
|
||||
import { friendlyFetchError } from "../utils/apiError.ts";
|
||||
@@ -176,12 +176,12 @@ export function DumpEdit() {
|
||||
const { dump } = state;
|
||||
|
||||
const currentThumbnailSrc = dump.thumbnailMime
|
||||
? `${API_URL}/api/thumbnails/${dump.id}`
|
||||
? dumpThumbnailUrl(dump, token)
|
||||
: dump.kind === "file"
|
||||
? (dump.fileMime?.startsWith("image/")
|
||||
? `${API_URL}/api/files/${dump.id}?v=${dump.fileSize ?? 0}`
|
||||
? dumpFileUrl(dump, token)
|
||||
: dump.fileMime?.startsWith("video/")
|
||||
? `${API_URL}/api/thumbnails/${dump.id}`
|
||||
? dumpThumbnailUrl(dump, token)
|
||||
: null)
|
||||
: dump.richContent?.thumbnailUrl ?? null;
|
||||
|
||||
@@ -286,6 +286,10 @@ function DumpEditForm({
|
||||
},
|
||||
});
|
||||
|
||||
// Metadata-extracted title for URL dumps; the source for "Reset to default".
|
||||
const metaTitle = dump.richContent?.title?.trim() ?? "";
|
||||
const currentTitle = form.watch("title");
|
||||
|
||||
const onSubmit = form.submit(
|
||||
async ({ title, url, comment, isPublic, newFile }) => {
|
||||
const trimmedTitle = title.trim();
|
||||
@@ -356,6 +360,19 @@ function DumpEditForm({
|
||||
<TextField<EditValues>
|
||||
name="title"
|
||||
label={t`Title`}
|
||||
labelAction={metaTitle
|
||||
? (
|
||||
<button
|
||||
type="button"
|
||||
className="form-label-action"
|
||||
onClick={() =>
|
||||
form.setValue("title", metaTitle, { shouldDirty: true })}
|
||||
disabled={currentTitle.trim() === metaTitle}
|
||||
>
|
||||
<Trans>Reset to default</Trans>
|
||||
</button>
|
||||
)
|
||||
: undefined}
|
||||
maxLength={VALIDATION.DUMP_TITLE_MAX}
|
||||
rules={{ required: true }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user