sidebar: booru: option to disable nsfw by default

This commit is contained in:
end-4
2024-03-24 11:26:05 +07:00
parent 408f042f05
commit 8dac6795ee
3 changed files with 36 additions and 2 deletions
@@ -39,6 +39,7 @@ let configOptions = {
'sidebar': {
'imageColumns': 2,
'imageBooruCount': 20,
'imageAllowNsfw': false,
},
'search': {
'engineBaseUrl': "https://www.google.com/search?q=",
@@ -12,6 +12,7 @@ import { MarginRevealer } from '../../.widgethacks/advancedrevealers.js';
import { setupCursorHover, setupCursorHoverInfo } from '../../.widgetutils/cursorhover.js';
import BooruService from '../../../services/booru.js';
import { chatEntry } from '../apiwidgets.js';
import { ConfigToggle } from '../../.commonwidgets/configwidgets.js';
const Grid = Widget.subclass(Gtk.Grid, "AgsGrid");
async function getImageViewerApp(preferredApp) {
@@ -85,6 +86,33 @@ const BooruInfo = () => {
});
}
export const BooruSettings = () => MarginRevealer({
transition: 'slide_down',
revealChild: true,
child: Box({
vertical: true,
className: 'sidebar-chat-settings',
children: [
Box({
vertical: true,
hpack: 'fill',
className: 'sidebar-chat-settings-toggles',
children: [
ConfigToggle({
icon: 'menstrual_health',
name: 'Lewds',
desc: 'Shows naughty stuff when enabled',
initValue: BooruService.nsfw,
onChange: (self, newValue) => {
BooruService.nsfw = newValue;
},
}),
]
})
]
})
});
const booruWelcome = Box({
vexpand: true,
homogeneous: true,
@@ -94,6 +122,7 @@ const booruWelcome = Box({
vertical: true,
children: [
BooruInfo(),
BooruSettings(),
]
})
});