Skip to content
This repository was archived by the owner on Mar 8, 2026. It is now read-only.

Commit 9db5e19

Browse files
committed
uses str instead of def everything😭
1 parent dffb0cc commit 9db5e19

4 files changed

Lines changed: 15 additions & 47 deletions

File tree

src/back/api/sendingFile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def catbox(file_path):
2525
if response.status_code == 200:
2626
result = response.text.strip()
2727
if result:
28-
if Settings().readSet._history():
28+
if Settings().getSetting("history"):
2929
his().storeHistory("catbox", os.path.basename(file_path), result, "")
3030
return result
3131
return "Error: Server returned empty response."
@@ -45,7 +45,7 @@ def litterbox(file_path, duration="1h"):
4545
if response.status_code == 200:
4646
result = response.text.strip()
4747
if result:
48-
if Settings().readSet._history():
48+
if Settings().getSetting("history"):
4949
his().storeHistory("litterbox", os.path.basename(file_path), result, duration)
5050
return result
5151
return "Error: Server returned empty response."
@@ -64,7 +64,7 @@ def buzzheavier(file_path):
6464
data = response.json()
6565
fileID = data.get("data", {}).get("id")
6666
if fileID:
67-
if Settings().readSet._history():
67+
if Settings().getSetting("history"):
6868
his().storeHistory("buzzheavier", filename, f"https://buzzheavier.com/{fileID}", "")
6969
return f"https://buzzheavier.com/{fileID}"
7070
return "Error: Could not find file ID in response."

src/back/system/contact.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def pickFile(self):
2222
def uploadTo(self, path, platform, duration="1h"):
2323
filename = os.path.basename(path)
2424

25-
if Settings().readSet._notifyYou():
25+
if Settings().getSetting("notifyYou"):
2626
notify("Upload Started", f"Sending {filename} to {platform}...")
2727

2828
result = ""
@@ -36,16 +36,16 @@ def uploadTo(self, path, platform, duration="1h"):
3636
result = "Unknown platform"
3737

3838
if result.startswith("http"):
39-
if Settings().readSet._notifyYou():
39+
if Settings().getSetting("notifyYou"):
4040
notify("Upload Success!", f"Link: {result}")
4141
else:
42-
if Settings().readSet._notifyYou():
42+
if Settings().getSetting("notifyYou"):
4343
notify("Upload Failed", f"Problem with {platform}: {result}")
4444

4545
return result
4646

4747
def checkForUpdates(self):
48-
if not Settings().readSet._checkForUpdates():
48+
if not Settings().getSetting("checkForUpdates"):
4949
print.debug("Updates disabled by user.")
5050
return {"status": "disabled"}
5151

src/back/system/settings.py

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,11 @@ def __init__(self):
3232
self.defaultSettingsPath = os.path.join(os.path.dirname(__file__), "extra", "settings.json")
3333

3434
if not os.path.exists(self.defaultSettingsPath):
35-
# Fallback for running from root
3635
self.defaultSettingsPath = os.path.abspath(os.path.join("src", "back", "extra", "settings.json"))
3736

3837
self.defaultSettings = {}
3938
self.settings = {}
4039

41-
# passing through
42-
self.readSet = self.ReadSettings(self.settingsPath)
43-
4440
def checkFolder(self):
4541
if os.path.exists(self.configPath):
4642
print.success(f"Config path found at: {self.configPath}")
@@ -107,37 +103,9 @@ def updateSetting(self, key, value):
107103
print.error(f"Error updating setting: {e}")
108104
return False
109105

110-
class ReadSettings:
111-
def __init__(self, path):
112-
self.settingPath = path
113-
114-
def _checkForUpdates(self):
115-
try:
116-
with open(self.settingPath, "r") as f:
117-
return json.load(f).get("checkForUpdates", True)
118-
except Exception:
119-
pass
120-
121-
def _history(self):
122-
try:
123-
with open(self.settingPath, "r") as f:
124-
return json.load(f).get("history", True)
125-
except Exception:
126-
pass
127-
return True
128-
129-
def _minimizeToTray(self):
130-
try:
131-
with open(self.settingPath, "r") as f:
132-
return json.load(f).get("minimizeToTray", True)
133-
except Exception:
134-
pass
135-
return True
136-
137-
def _notifyYou(self):
138-
try:
139-
with open(self.settingPath, "r") as f:
140-
return json.load(f).get("notifyYou", True)
141-
except Exception:
142-
pass
143-
return True
106+
def getSetting(self, key):
107+
try:
108+
with open(self.settingsPath, "r") as f:
109+
return json.load(f).get(key, True)
110+
except Exception:
111+
pass

src/front/window.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def createWindow(self):
4545
height=600,
4646
)
4747

48-
if Settings().readSet._minimizeToTray():
48+
if Settings().getSetting("minimizeToTray"):
4949
self.window.events.closing += self.onWindowClosing
5050

5151
def onWindowClosing(self):
@@ -88,7 +88,7 @@ def start(self, debugMode):
8888
if self.debugMode:
8989
print.success("Debug mode is active.")
9090

91-
if Settings().readSet._minimizeToTray():
91+
if Settings().getSetting("minimizeToTray"):
9292
trayThread = threading.Thread(target=self.setupTray, daemon=True)
9393
trayThread.start()
9494

0 commit comments

Comments
 (0)