Skip to content

Commit abcc67d

Browse files
committed
Added app files [v1.5]
1 parent d03c379 commit abcc67d

File tree

434 files changed

+46
-459908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

434 files changed

+46
-459908
lines changed

SimpleWebsiteBlocker.exe

-10.2 KB
Binary file not shown.

assets/CHANGELOG.log

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
[04.09.2021 - version 1.1] Small changes in source code
33
[10.09.2021 - version 1.2] Small changes in source code now it looks cleaner and some bugs were fixed also checking the operating system before running the app was added!
44
[19.09.2021 - version 1.3] Huuuge update today! we improved the source code to be faster also we added customizing color of the app in settings section check it out!
5-
[26.09.2021 - version 1.4] Added inject option to block websites faster!
5+
[26.09.2021 - version 1.4] Added inject option to block websites faster!
6+
[05.10.2021 - version 1.5] Added auto update now app download all files from github and extract them to app folder also config extension was changed to ini

assets/config.env

Lines changed: 0 additions & 9 deletions
This file was deleted.

assets/config.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[settings]
2+
color = WHITE
3+

assets/version.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
version = 1.5

main.py

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from configparser import ConfigParser
12
from datetime import datetime
23
from notifypy import Notify
34
from colorama import Fore
@@ -6,7 +7,6 @@
67
import requests
78
import logging
89
import os.path
9-
import dotenv
1010
import time
1111
import sys
1212
import os
@@ -15,10 +15,12 @@
1515

1616
logging.basicConfig(level=logging.INFO,format='%(asctime)s : %(levelname)s : %(message)s')
1717

18-
config_path = "assets/config.env"
19-
dotenv.load_dotenv(config_path)
18+
config_path = "assets/config.ini"
2019

21-
COLOR = os.environ.get("COLOR")
20+
cfg = ConfigParser()
21+
cfg.read(config_path)
22+
23+
COLOR = cfg["settings"]["color"]
2224

2325
user_choice = -1
2426
user_choice_block_website = ""
@@ -29,7 +31,7 @@
2931
user_choice_settings_confirm_clear = -1
3032
user_choice_settings_choice_list = ""
3133

32-
current_version = "1.4"
34+
current_version = "1.5"
3335

3436
version_url = "https://raw.githubusercontent.com/Rabixx/updater/main/version.txt"
3537

@@ -152,8 +154,8 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
152154
user_confirm_choice = str(input("(yes,no): "))
153155

154156
if user_confirm_choice == "yes":
155-
os.system('start https://cutt.ly/wWoOWvb')
156-
os.system('cls')
157+
os.system('start ../update/updater.exe')
158+
sys.exit()
157159
elif user_confirm_choice == "no":
158160
os.system('cls')
159161
else:
@@ -201,9 +203,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
201203
if user_choice_settings_confirm_color == 1:
202204
os.system('cls')
203205

204-
os.environ["COLOR"] = "RED"
206+
cfg.set('settings','color','RED')
205207

206-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
208+
with open(config_path,"w") as clr_1:
209+
cfg.write(clr_1)
207210

208211
print("Changed color to red!")
209212
print()
@@ -214,9 +217,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
214217
elif user_choice_settings_confirm_color == 2:
215218
os.system('cls')
216219

217-
os.environ["COLOR"] = "GREEN"
220+
cfg.set('settings','color','GREEN')
218221

219-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
222+
with open(config_path,"w") as clr_2:
223+
cfg.write(clr_2)
220224

221225
print("Changed color to green!")
222226
print()
@@ -227,9 +231,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
227231
elif user_choice_settings_confirm_color == 3:
228232
os.system('cls')
229233

230-
os.environ["COLOR"] = "YELLOW"
234+
cfg.set('settings','color','YELLOW')
231235

232-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
236+
with open(config_path,"w") as clr_3:
237+
cfg.write(clr_3)
233238

234239
print("Changed color to yellow!")
235240
print()
@@ -240,9 +245,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
240245
elif user_choice_settings_confirm_color == 4:
241246
os.system('cls')
242247

243-
os.environ["COLOR"] = "BLUE"
248+
cfg.set('settings','color','BLUE')
244249

245-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
250+
with open(config_path,"w") as clr_4:
251+
cfg.write(clr_4)
246252

247253
print("Changed color to blue!")
248254
print()
@@ -253,9 +259,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
253259
elif user_choice_settings_confirm_color == 5:
254260
os.system('cls')
255261

256-
os.environ["COLOR"] = "MAGENTA"
262+
cfg.set('settings','color','MAGENTA')
257263

258-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
264+
with open(config_path,"w") as clr_5:
265+
cfg.write(clr_5)
259266

260267
print("Changed color to magenta!")
261268
print()
@@ -266,9 +273,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
266273
elif user_choice_settings_confirm_color == 6:
267274
os.system('cls')
268275

269-
os.environ["COLOR"] = "CYAN"
276+
cfg.set('settings','color','CYAN')
270277

271-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
278+
with open(config_path,"w") as clr_6:
279+
cfg.write(clr_6)
272280

273281
print("Changed color to cyan!")
274282
print()
@@ -279,9 +287,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
279287
elif user_choice_settings_confirm_color == 7:
280288
os.system('cls')
281289

282-
os.environ["COLOR"] = "WHITE"
290+
cfg.set('settings','color','WHITE')
283291

284-
dotenv.set_key(config_path,"COLOR",os.environ["COLOR"])
292+
with open(config_path,"w") as clr_7:
293+
cfg.write(clr_7)
285294

286295
print("Changed color to deafult!")
287296
print()
@@ -373,9 +382,15 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
373382

374383
if __name__ == "__main__":
375384
if sys.platform.startswith("win"):
376-
on_start()
377-
load_config()
378-
main(user_choice,user_choice_block_website,user_choice_unlock_website,win_path,version_url,current_version,user_confirm_choice,user_choice_settings,user_choice_settings_confirm_clear,user_choice_settings_confirm_color,config_path,COLOR,user_choice_settings_choice_list)
385+
try:
386+
on_start()
387+
load_config()
388+
main(user_choice,user_choice_block_website,user_choice_unlock_website,win_path,version_url,current_version,user_confirm_choice,user_choice_settings,user_choice_settings_confirm_clear,user_choice_settings_confirm_color,config_path,COLOR,user_choice_settings_choice_list)
389+
except Exception as ex_6:
390+
os.system('cls')
391+
print(f"[ERROR] {ex_6}")
392+
time.sleep(2)
393+
os.system('cls')
379394
else:
380395
logging.warning("SimpleWebsiteBlocker works only on Windows operating system!")
381396
os.system('pause')

0 commit comments

Comments
 (0)