booru: allow provider description to be translated

This commit is contained in:
end-4
2025-05-05 01:10:46 +02:00
parent 84ae535756
commit e02875890b
+13 -14
View File
@@ -23,13 +23,6 @@ Singleton {
property string failMessage: qsTr("That didn't work. Tips:\n- Check your tags and NSFW settings\n- If you don't have a tag in mind, type a page number") property string failMessage: qsTr("That didn't work. Tips:\n- Check your tags and NSFW settings\n- If you don't have a tag in mind, type a page number")
property var responses: [] property var responses: []
property int runningRequests: 0 property int runningRequests: 0
property var getWorkingImageSource: (url) => {
if (url.includes('pximg.net')) {
return `https://www.pixiv.net/en/artworks/${url.substring(url.lastIndexOf('/') + 1).replace(/_p\d+\.(png|jpg|jpeg|gif)$/, '')}`;
}
return url;
}
property var defaultUserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" property var defaultUserAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
property var providerList: ["yandere", "konachan", "zerochan", "danbooru", "gelbooru", "waifu.im"] property var providerList: ["yandere", "konachan", "zerochan", "danbooru", "gelbooru", "waifu.im"]
property var providers: { property var providers: {
@@ -38,7 +31,7 @@ Singleton {
"name": "yande.re", "name": "yande.re",
"url": "https://yande.re", "url": "https://yande.re",
"api": "https://yande.re/post.json", "api": "https://yande.re/post.json",
"description": "All-rounder | Good quality, decent quantity", "description": qsTr("All-rounder | Good quality, decent quantity"),
"mapFunc": (response) => { "mapFunc": (response) => {
return response.map(item => { return response.map(item => {
return { return {
@@ -72,7 +65,7 @@ Singleton {
"name": "Konachan", "name": "Konachan",
"url": "https://konachan.com", "url": "https://konachan.com",
"api": "https://konachan.com/post.json", "api": "https://konachan.com/post.json",
"description": "For desktop wallpapers | Good quality", "description": qsTr("For desktop wallpapers | Good quality"),
"mapFunc": (response) => { "mapFunc": (response) => {
return response.map(item => { return response.map(item => {
return { return {
@@ -106,7 +99,7 @@ Singleton {
"name": "Zerochan", "name": "Zerochan",
"url": "https://www.zerochan.net", "url": "https://www.zerochan.net",
"api": "https://www.zerochan.net/?json", "api": "https://www.zerochan.net/?json",
"description": "Clean stuff | Excellent quality, no NSFW", "description": qsTr("Clean stuff | Excellent quality, no NSFW"),
"mapFunc": (response) => { "mapFunc": (response) => {
response = response.items response = response.items
return response.map(item => { return response.map(item => {
@@ -133,7 +126,7 @@ Singleton {
"name": "Danbooru", "name": "Danbooru",
"url": "https://danbooru.donmai.us", "url": "https://danbooru.donmai.us",
"api": "https://danbooru.donmai.us/posts.json", "api": "https://danbooru.donmai.us/posts.json",
"description": "The popular one | Best quantity, but quality can vary wildly", "description": qsTr("The popular one | Best quantity, but quality can vary wildly"),
"mapFunc": (response) => { "mapFunc": (response) => {
return response.map(item => { return response.map(item => {
return { return {
@@ -168,7 +161,7 @@ Singleton {
"name": "Gelbooru", "name": "Gelbooru",
"url": "https://gelbooru.com", "url": "https://gelbooru.com",
"api": "https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1", "api": "https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1",
"description": "The hentai one | Great quantity, a lot of NSFW, quality varies wildly", "description": qsTr("The hentai one | Great quantity, a lot of NSFW, quality varies wildly"),
"mapFunc": (response) => { "mapFunc": (response) => {
response = response.post response = response.post
return response.map(item => { return response.map(item => {
@@ -203,7 +196,7 @@ Singleton {
"name": "waifu.im", "name": "waifu.im",
"url": "https://waifu.im", "url": "https://waifu.im",
"api": "https://api.waifu.im/search", "api": "https://api.waifu.im/search",
"description": "Waifus only | Excellent quality, limited quantity", "description": qsTr("Waifus only | Excellent quality, limited quantity"),
"mapFunc": (response) => { "mapFunc": (response) => {
response = response.images response = response.images
return response.map(item => { return response.map(item => {
@@ -231,8 +224,14 @@ Singleton {
} }
}, },
} }
property var currentProvider: ConfigOptions.sidebar.booru.defaultProvider property var currentProvider: ConfigOptions.sidebar.booru.defaultProvider
function getWorkingImageSource(url) {
if (url.includes('pximg.net')) {
return `https://www.pixiv.net/en/artworks/${url.substring(url.lastIndexOf('/') + 1).replace(/_p\d+\.(png|jpg|jpeg|gif)$/, '')}`;
}
return url;
}
function setProvider(provider) { function setProvider(provider) {
provider = provider.toLowerCase() provider = provider.toLowerCase()