forked from Shinonome/dots-hyprland
services: null check for ConfigOptions for hackability/yoinkability
This commit is contained in:
@@ -14,7 +14,7 @@ Singleton {
|
|||||||
readonly property string interfaceRole: "interface"
|
readonly property string interfaceRole: "interface"
|
||||||
readonly property string apiKeyEnvVarName: "API_KEY"
|
readonly property string apiKeyEnvVarName: "API_KEY"
|
||||||
property Component aiMessageComponent: AiMessageData {}
|
property Component aiMessageComponent: AiMessageData {}
|
||||||
property string systemPrompt: ConfigOptions.ai.systemPrompt ?? ""
|
property string systemPrompt: ConfigOptions?.ai?.systemPrompt ?? ""
|
||||||
property var messages: []
|
property var messages: []
|
||||||
readonly property var apiKeys: KeyringStorage.keyringData?.apiKeys ?? {}
|
readonly property var apiKeys: KeyringStorage.keyringData?.apiKeys ?? {}
|
||||||
readonly property var apiKeysLoaded: KeyringStorage.loaded
|
readonly property var apiKeysLoaded: KeyringStorage.loaded
|
||||||
|
|||||||
@@ -13,17 +13,10 @@ Singleton {
|
|||||||
|
|
||||||
signal tagSuggestion(string query, var suggestions)
|
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 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 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 providerList: ["yandere", "konachan", "zerochan", "danbooru", "gelbooru", "waifu.im"]
|
||||||
property var providers: {
|
property var providers: {
|
||||||
"system": { "name": "System" },
|
"system": { "name": "System" },
|
||||||
@@ -347,7 +340,7 @@ Singleton {
|
|||||||
xhr.setRequestHeader("User-Agent", defaultUserAgent)
|
xhr.setRequestHeader("User-Agent", defaultUserAgent)
|
||||||
}
|
}
|
||||||
else if (currentProvider == "zerochan") {
|
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)
|
xhr.setRequestHeader("User-Agent", userAgent)
|
||||||
}
|
}
|
||||||
root.runningRequests++;
|
root.runningRequests++;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Singleton {
|
|||||||
if (hours > 0) formatted += `${formatted ? ", " : ""}${hours}h`
|
if (hours > 0) formatted += `${formatted ? ", " : ""}${hours}h`
|
||||||
if (minutes > 0 || !formatted) formatted += `${formatted ? ", " : ""}${minutes}m`
|
if (minutes > 0 || !formatted) formatted += `${formatted ? ", " : ""}${minutes}m`
|
||||||
uptime = formatted
|
uptime = formatted
|
||||||
interval = ConfigOptions.resources.updateInterval;
|
interval = ConfigOptions?.resources?.updateInterval ?? 3000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ Singleton {
|
|||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: delayedFileRead
|
id: delayedFileRead
|
||||||
interval: ConfigOptions.hacks.arbitraryRaceConditionDelay
|
interval: ConfigOptions?.hacks?.arbitraryRaceConditionDelay ?? 100
|
||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Singleton {
|
|||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: delayedFileRead
|
id: delayedFileRead
|
||||||
interval: ConfigOptions.hacks.arbitraryRaceConditionDelay
|
interval: ConfigOptions?.hacks?.arbitraryRaceConditionDelay ?? 100
|
||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Singleton {
|
|||||||
|
|
||||||
previousCpuStats = { total, idle }
|
previousCpuStats = { total, idle }
|
||||||
}
|
}
|
||||||
interval = ConfigOptions.resources.updateInterval
|
interval = ConfigOptions?.resources?.updateInterval ?? 3000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user