booru: save preferences, nuke save in folder by tags

save in folder by tags is unnecessary because saved images have proper file names now
This commit is contained in:
end-4
2025-04-06 00:09:35 +02:00
parent e8f01a4461
commit 9fa465bcaf
8 changed files with 14 additions and 27 deletions
+1 -2
View File
@@ -35,8 +35,7 @@
"Powered by yande.re and konachan": "Powered by yande.re and konachan",
"An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.": "An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.",
"Lewds": "Lewds",
"Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}": "Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}",
"Save in folder by tags": "Save in folder by tags",
"Shows naughty stuff when enabled": "Shows naughty stuff when enabled",
"Saves images in folders by their tags": "Saves images in folders by their tags",
"Message Gemini...": "Message Gemini...",
"Enter Google AI API Key...": "Enter Google AI API Key...",
+1 -2
View File
@@ -35,8 +35,7 @@
"Powered by yande.re and konachan": "قدرت گرفته از yande.re و konachan",
"An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.": "یک تصویر بورو. ممکن است محتوای NSFW داشته باشد.\nمواظب باشید.\n\nتوجه: بدون وابستگی به ارائه‌دهنده\nو مسئول هیچ‌یک از محتوای آن نیست.",
"Lewds": "محتوای نامناسب",
"Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}": "محتوای نامناسب را زمانی که فعال باشد نشان می‌دهد.\nآیا از اینها خوشتان می‌آید؟ این را به user_options.js اضافه کنید:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}",
"Save in folder by tags": "نگه‌داری در پوشه بر اساس برچسب‌ها",
"Shows naughty stuff when enabled": "محتوای نامناسب را زمانی که فعال باشد نشان می‌دهد",
"Saves images in folders by their tags": "تصاویر را در پوشه‌ها بر اساس برچسب‌هایشان نگه‌داری می‌کند",
"Message Gemini...": "پیام به Gemini...",
"Enter Google AI API Key...": "کلید API گوگل AI را وارد کنید...",
+1 -2
View File
@@ -35,8 +35,7 @@
"Powered by yande.re and konachan": "Propulsé par yande.re et konachan",
"An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.": "Un booru d'images. Peut contenir du contenu NSFW.\nFais attention.\n\nAvertissement : Pas affilié au fournisseur\net pas responsable de son contenu.",
"Lewds": "Contenu osé",
"Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}": "Affiche du contenu osé lorsqu'il est activé.\nTu aimes ça ? Ajoute ceci dans user_options.js :\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true\n\t}\n}",
"Save in folder by tags": "Enregistrer dans un dossier par tags",
"Shows naughty stuff when enabled": "Affiche du contenu osé lorsqu'il est activé",
"Saves images in folders by their tags": "Enregistre les images dans des dossiers selon leurs tags",
"Message Gemini...": "Envoyer un message à Gemini...",
"Enter Google AI API Key...": "Saisissez la clé API de Google AI...",
+1 -2
View File
@@ -35,8 +35,7 @@
"Powered by yande.re and konachan": "Offerto da yande.re e konachan",
"An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.": "Un booru di immagini. Potrebbe contenere contenuti NSFW.\nFai attenzione.\n\nDisclaimer: Non affiliato al provider\nné responsabile per alcun suo contenuto.",
"Lewds": "Contenuti osé",
"Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}": "Mostra contenuti osé quando abilitato.\nTi piacciono? Aggiungi questo a user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}",
"Save in folder by tags": "Salva in cartella per tag",
"Shows naughty stuff when enabled": "Mostra contenuti osé quando abilitato",
"Saves images in folders by their tags": "Salva le immagini in cartelle in base ai loro tag",
"Message Gemini...": "Messaggia Gemini...",
"Enter Google AI API Key...": "Inserisci la chiave API di Google AI...",
+1 -2
View File
@@ -35,8 +35,7 @@
"Powered by yande.re and konachan": "由 yande.re 和 konachan 提供支持",
"An image booru. May contain NSFW content.\nWatch your back.\n\nDisclaimer: Not affiliated with the provider\nnor responsible for any of its content.": "一个图片图库。可能包含 NSFW 内容。\n小心。\n\n免责声明:与提供商无关联\n也不对它的任何内容负责。",
"Lewds": "不雅内容",
"Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}": "启用时显示不雅内容。\n你喜欢这些?添加到 user_options.js 中:\n'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}",
"Save in folder by tags": "按标签保存到文件夹",
"Shows naughty stuff when enabled": "启用时显示不雅内容",
"Saves images in folders by their tags": "按标签将图片保存到文件夹中",
"Message Gemini...": "向 Gemini 发送消息...",
"Enter Google AI API Key...": "输入 Google AI API 密钥...",
@@ -10,6 +10,7 @@ export const AgsToggle = ({
icon, name, desc = null,
option, resetButton = true, save = true,
extraOnChange = () => { }, extraOnReset = () => { },
...rest
}) => ConfigToggle({
icon: icon,
name: name,
@@ -35,6 +36,7 @@ export const AgsToggle = ({
--file ${AGS_CONFIG_FILE}'`);
extraOnReset(self);
},
...rest
});
export const AgsSpinButton = ({
@@ -103,8 +103,7 @@
"image": {
"columns": 2,
"batchCount": 20,
"allowNsfw": false,
"saveInFolderByTags": false
"allowNsfw": false
},
"pages": {
"order": ["apis", "tools"],
+6 -15
View File
@@ -8,8 +8,8 @@ import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { MarginRevealer } from '../../.widgethacks/advancedrevealers.js';
import { setupCursorHover, setupCursorHoverInfo } from '../../.widgetutils/cursorhover.js';
import BooruService from '../../../services/booru.js';
import { ConfigToggle } from '../../.commonwidgets/configwidgets.js';
import { SystemMessage } from './ai_chatmessage.js';
import { AgsToggle } from '../../.commonwidgets/configwidgets_apps.js';
const IMAGE_REVEAL_DELAY = 13; // Some wait for inits n other weird stuff
const USER_CACHE_DIR = GLib.get_user_cache_dir();
@@ -93,27 +93,18 @@ export const BooruSettings = () => MarginRevealer({
hpack: 'center',
className: 'sidebar-chat-settings-toggles',
children: [
ConfigToggle({
AgsToggle({
icon: 'menstrual_health',
name: getString('Lewds'),
desc: getString("Shows naughty stuff when enabled.\nYa like those? Add this to user_options.js:\n\t'sidebar': {\n\t'image': {\n\t\t'allowNsfw': true,\n\t}\n}"),
initValue: BooruService.nsfw,
onChange: (self, newValue) => {
desc: getString("Shows naughty stuff when enabled"),
option: 'sidebar.image.allowNsfw',
extraOnChange: (self, newValue) => {
BooruService.nsfw = newValue;
},
extraSetup: (self) => self.hook(BooruService, (self) => {
self.attribute.enabled.value = BooruService.nsfw;
}, 'notify::nsfw')
}),
ConfigToggle({
icon: 'sell',
name: getString('Save in folder by tags'),
desc: getString('Saves images in folders by their tags'),
initValue: userOptions.sidebar.image.saveInFolderByTags,
onChange: (self, newValue) => {
userOptions.sidebar.image.saveInFolderByTags = newValue;
},
}),
]
})
]
@@ -228,7 +219,7 @@ const BooruPage = (taglist, serviceName = 'Booru') => {
const currentTags = BooruService.queries.at(-1).realTagList.filter(tag => !tag.includes('rating:'));
const tagDirectory = currentTags.join('+');
const fileName = decodeURIComponent((data.file_url).substring((data.file_url).lastIndexOf('/') + 1));
const saveCommand = `mkdir -p "$(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${userOptions.sidebar.image.saveInFolderByTags ? tagDirectory : ''}" && curl -L -o "$(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${userOptions.sidebar.image.saveInFolderByTags ? (tagDirectory + '/') : ''}${fileName}" '${data.file_url}'`;
const saveCommand = `mkdir -p "$(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}" && curl -L -o "$(xdg-user-dir PICTURES)/homework/${data.is_nsfw ? '🌶️/' : ''}${fileName}" '${data.file_url}'`;
print(saveCommand)
execAsync(['bash', '-c', saveCommand])
.then(() => self.label = 'done')