From 26a5dbd91c356c489daadb83495e6376db590bcb Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 19 May 2025 23:36:17 +0200 Subject: [PATCH] services: null check for ConfigOptions for hackability/yoinkability --- .config/quickshell/services/Ai.qml | 2 +- .config/quickshell/services/Booru.qml | 11 ++--------- .config/quickshell/services/DateTime.qml | 2 +- .config/quickshell/services/MaterialThemeLoader.qml | 2 +- .../quickshell/services/PersistentStateManager.qml | 2 +- .config/quickshell/services/ResourceUsage.qml | 2 +- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.config/quickshell/services/Ai.qml b/.config/quickshell/services/Ai.qml index f47718f9..04d2dbc8 100644 --- a/.config/quickshell/services/Ai.qml +++ b/.config/quickshell/services/Ai.qml @@ -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 diff --git a/.config/quickshell/services/Booru.qml b/.config/quickshell/services/Booru.qml index d0c5dceb..8f0cb3f5 100644 --- a/.config/quickshell/services/Booru.qml +++ b/.config/quickshell/services/Booru.qml @@ -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++; diff --git a/.config/quickshell/services/DateTime.qml b/.config/quickshell/services/DateTime.qml index 32b89ff9..ee5cf4b4 100644 --- a/.config/quickshell/services/DateTime.qml +++ b/.config/quickshell/services/DateTime.qml @@ -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 } } diff --git a/.config/quickshell/services/MaterialThemeLoader.qml b/.config/quickshell/services/MaterialThemeLoader.qml index 7eb974b1..339a0d77 100644 --- a/.config/quickshell/services/MaterialThemeLoader.qml +++ b/.config/quickshell/services/MaterialThemeLoader.qml @@ -30,7 +30,7 @@ Singleton { Timer { id: delayedFileRead - interval: ConfigOptions.hacks.arbitraryRaceConditionDelay + interval: ConfigOptions?.hacks?.arbitraryRaceConditionDelay ?? 100 repeat: false running: false onTriggered: { diff --git a/.config/quickshell/services/PersistentStateManager.qml b/.config/quickshell/services/PersistentStateManager.qml index d961b41b..7c3fec73 100644 --- a/.config/quickshell/services/PersistentStateManager.qml +++ b/.config/quickshell/services/PersistentStateManager.qml @@ -72,7 +72,7 @@ Singleton { Timer { id: delayedFileRead - interval: ConfigOptions.hacks.arbitraryRaceConditionDelay + interval: ConfigOptions?.hacks?.arbitraryRaceConditionDelay ?? 100 repeat: false running: false onTriggered: { diff --git a/.config/quickshell/services/ResourceUsage.qml b/.config/quickshell/services/ResourceUsage.qml index e30b36c8..39078fbd 100644 --- a/.config/quickshell/services/ResourceUsage.qml +++ b/.config/quickshell/services/ResourceUsage.qml @@ -50,7 +50,7 @@ Singleton { previousCpuStats = { total, idle } } - interval = ConfigOptions.resources.updateInterval + interval = ConfigOptions?.resources?.updateInterval ?? 3000 } }