nsfw images

This commit is contained in:
2025-11-02 19:51:33 +08:00
parent a7f1bcb365
commit 853647edbc
6 changed files with 91 additions and 9 deletions

View File

@@ -28,6 +28,7 @@ export default function PublishPage() {
const [images, setImages] = useState<number[]>([]);
const [links, setLinks] = useState<{ label: string; url: string }[]>([]);
const [galleryImages, setGalleryImages] = useState<number[]>([]);
const [galleryNsfw, setGalleryNsfw] = useState<number[]>([]);
const [error, setError] = useState<string | null>(null);
const [isSubmitting, setSubmitting] = useState(false);
@@ -108,6 +109,7 @@ export default function PublishPage() {
images: images,
links: links,
gallery: galleryImages,
gallery_nsfw: galleryNsfw,
});
if (res.success) {
localStorage.removeItem("publish_data");
@@ -332,6 +334,7 @@ export default function PublishPage() {
<td>{t("Preview")}</td>
<td>{"Markdown"}</td>
<td>{"Gallery"}</td>
<td>{"Nsfw"}</td>
<td>{t("Action")}</td>
</tr>
</thead>
@@ -375,6 +378,22 @@ export default function PublishPage() {
}}
/>
</td>
<td>
<input
type="checkbox"
className="checkbox checkbox-accent"
checked={galleryNsfw.includes(image)}
onChange={(e) => {
if (e.target.checked) {
setGalleryNsfw((prev) => [...prev, image]);
} else {
setGalleryNsfw((prev) =>
prev.filter((id) => id !== image),
);
}
}}
/>
</td>
<td>
<button
className={"btn btn-square"}