🚀 feat: Added "Always Hide" settings option for enhanced content privacy control.

This commit is contained in:
jarvis2f 2024-12-23 11:38:09 +08:00
parent f37d38d4e2
commit b74761f58a
4 changed files with 32 additions and 10 deletions

View file

@ -6,9 +6,10 @@ import io.vertx.core.json.JsonObject;
import java.util.function.Function; import java.util.function.Function;
public enum SettingKey { public enum SettingKey {
uniqueOnly(Convert::toBool, false), uniqueOnly(Convert::toBool, true),
needToLoadImages(Convert::toBool, false), needToLoadImages(Convert::toBool, false),
imageLoadSize, imageLoadSize,
alwaysHide(Convert::toBool, false),
showSensitiveContent(Convert::toBool, false), showSensitiveContent(Convert::toBool, false),
autoDownload(value -> new JsonObject(value).mapTo(SettingAutoRecords.class)), autoDownload(value -> new JsonObject(value).mapTo(SettingAutoRecords.class)),
/** /**

View file

@ -100,21 +100,38 @@ export default function SettingsForm() {
</div> </div>
<div className="flex w-full flex-col space-y-4 rounded-md border p-4 shadow"> <div className="flex w-full flex-col space-y-4 rounded-md border p-4 shadow">
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<Label htmlFor="show-sensitive-content"> <Label htmlFor="always-hide">Always Hide</Label>
Show Sensitive Content
</Label>
<Checkbox <Checkbox
id="show-sensitive-content" id="always-hide"
checked={settings?.showSensitiveContent === "true"} checked={settings?.alwaysHide === "true"}
onCheckedChange={(checked) => onCheckedChange={(checked) =>
void setSetting("showSensitiveContent", String(checked)) void setSetting("alwaysHide", String(checked))
} }
/> />
</div> </div>
<p className="text-xs text-muted-foreground"> <p className="text-xs text-muted-foreground">
Show sensitive content in the table, Will use a spoiler to hide Always hide content and extra info in the table.
sensitive content if disabled.
</p> </p>
{settings?.alwaysHide === "false" && (
<>
<div className="flex items-center space-x-2">
<Label htmlFor="show-sensitive-content">
Show Sensitive Content
</Label>
<Checkbox
id="show-sensitive-content"
checked={settings?.showSensitiveContent === "true"}
onCheckedChange={(checked) =>
void setSetting("showSensitiveContent", String(checked))
}
/>
</div>
<p className="text-xs text-muted-foreground">
Show sensitive content in the table, Will use a spoiler to hide
sensitive content if disabled.
</p>
</>
)}
</div> </div>
<div className="flex w-full flex-col space-y-4 rounded-md border p-4 shadow"> <div className="flex w-full flex-col space-y-4 rounded-md border p-4 shadow">
<Label>Auto Download Settings</Label> <Label>Auto Download Settings</Label>

View file

@ -16,7 +16,10 @@ export default function SpoiledWrapper({
[settings?.showSensitiveContent], [settings?.showSensitiveContent],
); );
if (hasSensitiveContent && !showSensitiveContent) { if (
settings?.alwaysHide === "true" ||
(hasSensitiveContent && !showSensitiveContent)
) {
return ( return (
<Spoiler hidden={hidden} className="pointer-events-none"> <Spoiler hidden={hidden} className="pointer-events-none">
{children} {children}

View file

@ -84,6 +84,7 @@ export const SettingKeys = [
"uniqueOnly", "uniqueOnly",
"needToLoadImages", "needToLoadImages",
"imageLoadSize", "imageLoadSize",
"alwaysHide",
"showSensitiveContent", "showSensitiveContent",
"autoDownloadLimit", "autoDownloadLimit",
"proxys", "proxys",