-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
Gmail.py
52 lines (39 loc) · 1.69 KB
/
Gmail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import eel
# Initialize Eel
eel.init('web')
@eel.expose
def update_message(new_message):
eel.updateMessage("message", new_message)
@eel.expose
def replace_values(gmail, app_password, buffer_send_size):
update_message("Replacing values in XML and Java files...")
# Replace values in XML files
if os.path.exists("app/src/main/res/values"):
for root, dirs, files in os.walk("app/src/main/res/values"):
for file in files:
if file.endswith(".xml"):
file_path = os.path.join(root, file)
with open(file_path, "r") as f:
content = f.read()
content = content.replace("[email protected]", gmail)
content = content.replace("[email protected]", gmail)
content = content.replace("APP-PASSWORD", app_password)
with open(file_path, "w") as f:
f.write(content)
update_message("Updated placeholders in XML files.")
else:
update_message("Error: 'app/src/main/res/values' directory not found.")
# Replace value in Java file
java_file_path = "app/src/main/java/com/MyAccessibilityService.java"
if os.path.exists(java_file_path):
with open(java_file_path, "r") as f:
content = f.read()
content = content.replace("Buffer-Send-Size-UpdateME", buffer_send_size)
with open(java_file_path, "w") as f:
f.write(content)
update_message("Updated placeholder in Java file.")
else:
update_message("Error: Java file not found.")
# Start the Eel application
eel.start('Gmail.html', size=(600, 400), port=9995)