🚀 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;
public enum SettingKey {
uniqueOnly(Convert::toBool, false),
uniqueOnly(Convert::toBool, true),
needToLoadImages(Convert::toBool, false),
imageLoadSize,
alwaysHide(Convert::toBool, false),
showSensitiveContent(Convert::toBool, false),
autoDownload(value -> new JsonObject(value).mapTo(SettingAutoRecords.class)),
/**

View file

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

View file

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

View file

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