services: null check for ConfigOptions for hackability/yoinkability

This commit is contained in:
end-4 2025-05-19 23:36:17 +02:00
parent cd177a3fcd
commit 26a5dbd91c
6 changed files with 7 additions and 14 deletions

View file

@ -14,7 +14,7 @@ Singleton {
readonly property string interfaceRole: "interface"
readonly property string apiKeyEnvVarName: "API_KEY"
property Component aiMessageComponent: AiMessageData {}
property string systemPrompt: ConfigOptions.ai.systemPrompt ?? ""
property string systemPrompt: ConfigOptions?.ai?.systemPrompt ?? ""
property var messages: []
readonly property var apiKeys: KeyringStorage.keyringData?.apiKeys ?? {}
readonly property var apiKeysLoaded: KeyringStorage.loaded

View file

@ -13,17 +13,10 @@ Singleton {
signal tagSuggestion(string query, var suggestions)
Connections {
target: ConfigOptions.sidebar.booru
function onAllowNsfwChanged() {
root.addSystemMessage(PersistentStates.booru.allowNsfw ? qsTr("Tiddies enabled") : qsTr("No horny"))
}
}
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 int runningRequests: 0
property var defaultUserAgent: ConfigOptions.networking.userAgent
property var defaultUserAgent: ConfigOptions?.networking?.userAgent || "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 providers: {
"system": { "name": "System" },
@ -347,7 +340,7 @@ Singleton {
xhr.setRequestHeader("User-Agent", defaultUserAgent)
}
else if (currentProvider == "zerochan") {
const userAgent = ConfigOptions.sidebar.booru.zerochan.username ? `Desktop sidebar booru viewer - ${ConfigOptions.sidebar.booru.zerochan.username}` : defaultUserAgent
const userAgent = ConfigOptions?.sidebar?.booru?.zerochan?.username ? `Desktop sidebar booru viewer - ${ConfigOptions.sidebar.booru.zerochan.username}` : defaultUserAgent
xhr.setRequestHeader("User-Agent", userAgent)
}
root.runningRequests++;

View file

@ -38,7 +38,7 @@ Singleton {
if (hours > 0) formatted += `${formatted ? ", " : ""}${hours}h`
if (minutes > 0 || !formatted) formatted += `${formatted ? ", " : ""}${minutes}m`
uptime = formatted
interval = ConfigOptions.resources.updateInterval;
interval = ConfigOptions?.resources?.updateInterval ?? 3000
}
}

View file

@ -30,7 +30,7 @@ Singleton {
Timer {
id: delayedFileRead
interval: ConfigOptions.hacks.arbitraryRaceConditionDelay
interval: ConfigOptions?.hacks?.arbitraryRaceConditionDelay ?? 100
repeat: false
running: false
onTriggered: {

View file

@ -72,7 +72,7 @@ Singleton {
Timer {
id: delayedFileRead
interval: ConfigOptions.hacks.arbitraryRaceConditionDelay
interval: ConfigOptions?.hacks?.arbitraryRaceConditionDelay ?? 100
repeat: false
running: false
onTriggered: {

View file

@ -50,7 +50,7 @@ Singleton {
previousCpuStats = { total, idle }
}
interval = ConfigOptions.resources.updateInterval
interval = ConfigOptions?.resources?.updateInterval ?? 3000
}
}