Skip to content

Commit 880a730

Browse files
authored
Merge pull request #10 from infinitel8p/Update-v1.5
Update v1.5
2 parents 289093a + a5f813c commit 880a730

15 files changed

+1065
-205
lines changed

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1+
# Unnecessary folders
12
__pycache__/
2-
.vscode
3+
.vscode
4+
output
5+
6+
# Certificates
7+
*.pfx
8+
*.cer
9+
10+
# .rc and manifest files
11+
*.rc
12+
*.manifest

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Quickly activate or deactivate your proxy without having to search in the windows settings.
44
Change the Proxy Server Address in a matter of seconds.
5+
Connect, Disconnect and add new WiFi networks directly from the application.
56

67
## How to setup:
78

@@ -11,18 +12,18 @@ Change the Proxy Server Address in a matter of seconds.
1112

1213
## How to use Mobile VPN on PC:
1314

14-
| Steps | Description | Screenshots |
15-
| :---: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------: |
16-
| 1. | Activate the VPN service on you mobile phone<br>(in my case it's Kaspersky VPN) | ![Screenshot_20230125_115504_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552712-a21064e1-9cb1-46a7-b01c-84d92492b7ed.png) |
17-
| 2. | Create a mobile hotspot in your mobile phones settings<br> (If you get a request to deactivate the VPN click on skip) | ![Screenshot_20230125_115945_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552724-2ad81e1c-1938-48a4-af53-ac12de42b175.png) |
18-
| 3. | Open `Every Proxy` (install it here: [https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy](https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy&gl=US&pli=1)) | ![Screenshot_20230125_122114_Google Play Store](https://user-images.githubusercontent.com/50703696/214552728-af2b56ed-8353-43d8-af88-30a316832d84.png) |
19-
| 4. | Click on the 3 dots in the top right corner and open the settings | ![Screenshot_20230125_122351_Every Proxy](https://user-images.githubusercontent.com/50703696/214552723-bf7f1f59-3c6c-4d68-8dc7-2cb36e0b6ac9.png) |
20-
| 5. | Under HTTP/S Proxy click on IP Address and select your IP (usually it's the one at the bottom) | ![Screenshot_20230125_122412_Every Proxy](https://user-images.githubusercontent.com/50703696/214552717-f235daa0-5004-40dd-b3f8-6aab3c724060.png) |
21-
| 6. | Exit the settings and enable the Switch for HTTP/HTTPS | ![Screenshot_20230125_122419_Every Proxy](https://user-images.githubusercontent.com/50703696/214552720-0fdad48e-ae6c-499f-9549-3adefcf21af1.png) |
22-
| 7. | Connect to your mobile hotspot with your PC | ![image](https://user-images.githubusercontent.com/50703696/214553649-e2a3e1fb-f8fd-42bb-ac46-0f255d496492.png) |
23-
| 8. | Start `Proxy Settings.exe` | ![image](https://user-images.githubusercontent.com/50703696/214554089-615c637f-d5da-4031-b24a-377b03bc9e33.png) |
24-
| 9. | Type in the IP Address you selected in step 5 and click on apply | ![image](https://user-images.githubusercontent.com/50703696/214554255-774545e0-3efc-44c4-b36d-3b3a5cb57091.png) |
25-
| 10. | Turn on the Proxy and that's it! | ![image](https://user-images.githubusercontent.com/50703696/214554402-5c27aceb-fdaa-48e1-b63a-2f7ce4351b81.png) |
15+
| Steps | Description | Screenshots |
16+
| :---: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------: |
17+
| 1. | Activate the VPN service on you mobile phone<br>(in my case it's Kaspersky VPN) | ![Screenshot_20230125_115504_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552712-a21064e1-9cb1-46a7-b01c-84d92492b7ed.png) |
18+
| 2. | Create a mobile hotspot in your mobile phones settings<br> (If you get a request to deactivate the VPN click on skip) | ![Screenshot_20230125_115945_KasperskyVPN Secure Connection](https://user-images.githubusercontent.com/50703696/214552724-2ad81e1c-1938-48a4-af53-ac12de42b175.png) |
19+
| 3. | Open `Every Proxy` (install it from here: [https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy](https://play.google.com/store/apps/details?id=com.gorillasoftware.everyproxy&gl=US&pli=1)) | ![Screenshot_20230125_122114_Google Play Store](https://user-images.githubusercontent.com/50703696/214552728-af2b56ed-8353-43d8-af88-30a316832d84.png) |
20+
| 4. | Click on the 3 dots in the top right corner and open the settings | ![Screenshot_20230125_122351_Every Proxy](https://user-images.githubusercontent.com/50703696/214552723-bf7f1f59-3c6c-4d68-8dc7-2cb36e0b6ac9.png) |
21+
| 5. | Under HTTP/S Proxy click on IP Address and select your IP (usually it's the one at the bottom) | ![Screenshot_20230125_122412_Every Proxy](https://user-images.githubusercontent.com/50703696/214552717-f235daa0-5004-40dd-b3f8-6aab3c724060.png) |
22+
| 6. | Exit the settings and enable the Switch for HTTP/HTTPS | ![Screenshot_20230125_122419_Every Proxy](https://user-images.githubusercontent.com/50703696/214552720-0fdad48e-ae6c-499f-9549-3adefcf21af1.png) |
23+
| 7. | Connect to your mobile hotspot with your PC | ![image](https://user-images.githubusercontent.com/50703696/214553649-e2a3e1fb-f8fd-42bb-ac46-0f255d496492.png) |
24+
| 8. | Start `Proxy Settings.exe` | ![image](https://user-images.githubusercontent.com/50703696/214554089-615c637f-d5da-4031-b24a-377b03bc9e33.png) |
25+
| 9. | Type in the IP Address you selected in step 5 and click on apply | ![image](https://user-images.githubusercontent.com/50703696/214554255-774545e0-3efc-44c4-b36d-3b3a5cb57091.png) |
26+
| 10. | Turn on the Proxy and that's it! | ![image](https://user-images.githubusercontent.com/50703696/214554402-5c27aceb-fdaa-48e1-b63a-2f7ce4351b81.png) |
2627

2728
## Screenshots:
2829

build/Proxy Settings.exe

-35.5 MB
Binary file not shown.

config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
"optionDest": "disable_windowed_traceback",
4646
"value": false
4747
},
48+
{
49+
"optionDest": "version_file",
50+
"value": "C:/Users/Ludo/Desktop/proxy-settings/version.rc"
51+
},
4852
{
4953
"optionDest": "embed_manifest",
5054
"value": true

main.pyw

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from packaging.version import Version
22
from modules.UpdateUi import UpdateUi
3-
from modules.WifiUi import WifiUi
43
from modules.ProxyUi import ProxyUi
4+
from modules.SettingsUi import SettingsUi
5+
import platform
56
import customtkinter
67
import requests
78
import logging
89
import json
910
import os
1011

11-
version = "1.4"
12+
version = "1.5"
1213

1314
# set image path
1415
image_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "images")
@@ -39,12 +40,23 @@ class RootApp(customtkinter.CTk):
3940
self.tabview.pack(fill="both", expand=True)
4041
self.tabview.add("Proxy Settings")
4142
self.tabview.add("Wifi Settings")
43+
self.tabview.add("Settings")
4244

4345
self.proxy_ui = ProxyUi(self.tabview.tab("Proxy Settings"), version)
4446
self.proxy_ui.pack(fill="both", expand=True)
4547

46-
self.wifi_ui = WifiUi(self.tabview.tab("Wifi Settings"))
47-
self.wifi_ui.pack(fill="both", expand=True)
48+
if platform.system() == "Windows":
49+
from modules.WifiUi import WifiUi
50+
self.wifi_ui = WifiUi(self.tabview.tab("Wifi Settings"))
51+
self.wifi_ui.pack(fill="both", expand=True)
52+
else:
53+
# display label if not on windows
54+
label = customtkinter.CTkLabel(
55+
self.tabview.tab("Wifi Settings"), text="This feature is only available on Windows for now.")
56+
label.pack(fill="both", expand=True)
57+
58+
self.settings_ui = SettingsUi(self.tabview.tab("Settings"), version)
59+
self.settings_ui.pack(fill="both", expand=True)
4860

4961
# check for software update
5062
self.check_update()

modules/ProxyUi.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import customtkinter
22
import logging
3-
from modules import proxy
3+
import platform
44
from modules.loggingHandler import TkinterHandler
55

6+
if platform.system() == "Darwin":
7+
import modules.proxy_macOS as proxy
8+
elif platform.system() == "Windows":
9+
import modules.proxy as proxy
10+
611

712
class ProxyUi(customtkinter.CTkFrame):
813
def __init__(self, parent, version):
@@ -61,6 +66,7 @@ def __init__(self, parent, version):
6166
master=self.frame, text="Disabled", text_color="red")
6267
self.label.grid(row=1, column=0, sticky="e", padx=15, pady=(10, 0))
6368

69+
# Version Label
6470
self.version_label = customtkinter.CTkLabel(
6571
self, text=f"version {version}", text_color="grey", font=("Arial", 10))
6672
self.version_label.pack(side=customtkinter.BOTTOM)

modules/SettingsUi.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import os
2+
import json
3+
import logging
4+
import tempfile
5+
import customtkinter
6+
7+
8+
class SettingsUi(customtkinter.CTkFrame):
9+
def __init__(self, parent, version):
10+
11+
# Main Frame
12+
super().__init__(master=parent)
13+
self.configure(fg_color="transparent")
14+
self.root = parent
15+
16+
# set log folder path or create it if it does not exist
17+
temp_dir = tempfile.gettempdir()
18+
self.log_path = os.path.join(os.path.join(
19+
os.path.dirname(temp_dir), 'Proxy Settings'), "logs")
20+
if not os.path.exists(self.log_path):
21+
os.makedirs(self.log_path)
22+
23+
# default settings
24+
settings_json = {"log_path": ""}
25+
26+
# open the settings.json and if FileNotFoundError then create it
27+
try:
28+
with open(os.path.join(self.log_path, "settings.json"), "r") as infile:
29+
json_object = json.load(infile)
30+
except FileNotFoundError:
31+
with open(os.path.join(self.log_path, "settings.json"), "w+") as outfile:
32+
json.dump(settings_json, outfile)
33+
with open(os.path.join(self.log_path, "settings.json"), "r") as infile:
34+
json_object = json.load(infile)
35+
36+
# Save Button
37+
self.save_button = customtkinter.CTkButton(
38+
self, text="Save", command=lambda: self.save_settings("log_path"))
39+
self.save_button.pack()
40+
41+
# Version Label
42+
self.version_label = customtkinter.CTkLabel(
43+
self, text=f"version {version}", text_color="grey", font=("Arial", 10))
44+
self.version_label.pack(side=customtkinter.BOTTOM)
45+
46+
def save_settings(self, new_value):
47+
"""
48+
Dumps changes into the `settings.json` file, located in os.path.join(log_path, "settings.json").
49+
50+
Args:
51+
new_value (_type_): Specific value to save into the json file. This value represents the configuration, preference or setting that the user has selected or modified and should be saved.
52+
"""
53+
54+
# create settings string
55+
settings_json = {
56+
"log_path": f"{self.log_path}",
57+
}
58+
59+
# write settings to file
60+
with open(os.path.join(self.log_path, "settings.json"), "r") as infile:
61+
settings_data = json.load(infile)
62+
# add missing key
63+
settings_data[new_value] = settings_json[new_value]
64+
with open(os.path.join(self.log_path, "settings.json"), "w") as outfile:
65+
json.dump(settings_data, outfile)
66+
67+
logging.info(
68+
f"Settings updated → {new_value} = {settings_json[new_value]}")

0 commit comments

Comments
 (0)