Skip to content

Commit cac3cf3

Browse files
committed
Added app files [v1.2]
1 parent b2315ee commit cac3cf3

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

CHANGELOG.log

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[30.08.2021 - version 1.0] Big update today we added the check for updates option check it out!
2-
[04.09.2021 - version 1.1] Small changes in source code
2+
[04.09.2021 - version 1.1] Small changes in source code
3+
[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!

SimpleWebsiteBlocker.exe

344 Bytes
Binary file not shown.

licenses/license.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
--------------------- SimpleWebsiteBlocker LICENSE ---------------------
2+
13
SimpleWebsiteBlocker all rights reversed (C)
24

35
Project name: SimpleWebsiteBlocker
@@ -17,4 +19,6 @@ What you cant do with that project:
1719
3. Copying the logo of the project
1820
4. Sharing the software to the internet without the github tag
1921

20-
REMEMBER IF YOU USE THAT APP YOU ACCEPT THAT LICENSE
22+
REMEMBER IF YOU USE THAT APP YOU ACCEPT THAT LICENSE
23+
24+
------------------------------------------------------------------------

main.py

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,48 @@
22
from datetime import date
33
import pyfiglet
44
import requests
5+
import logging
56
import os.path
67
import time
78
import sys
89
import os
910

11+
logging.basicConfig(level=logging.INFO,format='%(asctime)s : %(levelname)s : %(message)s')
12+
1013
user_choice = -1
1114
user_choice_block_website = ""
1215
user_choice_unlock_website = ""
1316
user_confirm_choice = ""
1417

15-
current_version = "1.1"
18+
current_version = "1.2"
1619

1720
version_url = "https://raw.githubusercontent.com/Rabixx/updater/main/version.txt"
1821

1922
win_path = "C:\\Windows\\System32\\drivers\\etc\\hosts"
2023

21-
if os.path.exists("start.tmp"):
22-
23-
notification = Notify()
24-
25-
notification.application_name = "SimpleWebsiteBlocker"
26-
notification.title = "First time?"
27-
notification.message = "we hope you will enjoy our app!"
28-
notification.icon = "assets/icons/simple_website_blocker_icon.png"
29-
30-
notification.send()
31-
32-
m = open(win_path,"w")
33-
m.truncate(0)
34-
m.close()
35-
36-
os.remove("start.tmp")
24+
def on_start():
25+
if os.path.exists("start.tmp"):
26+
try:
27+
notification = Notify()
28+
29+
notification.application_name = "SimpleWebsiteBlocker"
30+
notification.title = "First time?"
31+
notification.message = "we hope you will enjoy our app!"
32+
notification.icon = "assets/icons/simple_website_blocker_icon.png"
33+
34+
notification.send()
35+
36+
m = open(win_path,"w")
37+
m.truncate(0)
38+
m.close()
39+
40+
os.remove("start.tmp")
41+
except PermissionError:
42+
logging.warning("Access denied please run SimpleWebsiteBlocker with admin permissions!")
43+
os.system('pause')
44+
sys.exit()
45+
else:
46+
pass
3747

3848
def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_path,version_url,current_version,user_confirm_choice):
3949
while user_choice != 7:
@@ -148,6 +158,8 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
148158
print(f"[ERROR] {ex_5}")
149159
time.sleep(2)
150160
os.system('cls')
161+
except KeyboardInterrupt:
162+
os.system('cls')
151163

152164
if user_choice == 6:
153165
os.system('cls')
@@ -166,4 +178,10 @@ def main(user_choice,user_choice_block_website,user_choice_unlock_website,win_pa
166178
user_choice = int(input(">>: "))
167179

168180
if __name__ == "__main__":
169-
main(user_choice,user_choice_block_website,user_choice_unlock_website,win_path,version_url,current_version,user_confirm_choice)
181+
if sys.platform.startswith("win"):
182+
on_start()
183+
main(user_choice,user_choice_block_website,user_choice_unlock_website,win_path,version_url,current_version,user_confirm_choice)
184+
else:
185+
logging.warning("SimpleWebsiteBlocker works only on Windows operating system!")
186+
os.system('pause')
187+
sys.exit()

0 commit comments

Comments
 (0)