Update app.py
Browse files
app.py
CHANGED
@@ -1,130 +1,44 @@
|
|
1 |
-
|
2 |
-
from
|
3 |
-
import subprocess
|
4 |
-
import IP2Location
|
5 |
import zipfile
|
6 |
import os
|
7 |
-
import
|
8 |
|
|
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
10 |
|
|
|
|
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
#
|
21 |
-
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
|
|
|
27 |
|
28 |
-
|
29 |
-
@app.route('/')
|
30 |
-
def home():
|
31 |
-
return ""
|
32 |
-
|
33 |
-
# Define ECPM values for different countries based on timezones
|
34 |
-
ECPM_VALUES = {
|
35 |
-
"America/New_York": 60, # USA (Eastern)
|
36 |
-
"America/Chicago": 58, # USA (Central)
|
37 |
-
"America/Denver": 55, # USA (Mountain)
|
38 |
-
"America/Los_Angeles": 52, # USA (Pacific)
|
39 |
-
"Europe/London": 70, # UK
|
40 |
-
"Europe/Paris": 65, # France
|
41 |
-
"Europe/Berlin": 67, # Germany
|
42 |
-
"Europe/Zurich": 66, # Switzerland
|
43 |
-
"Europe/Copenhagen": 64, # Denmark
|
44 |
-
"Europe/Madrid": 63, # Spain
|
45 |
-
"Europe/Rome": 62, # Italy
|
46 |
-
"Europe/Stockholm": 68, # Sweden
|
47 |
-
"Europe/Oslo": 69, # Norway
|
48 |
-
"America/Sao_Paulo": 45, # Brazil
|
49 |
-
"Australia/Sydney": 75, # Australia
|
50 |
-
"Europe/Chisinau": 55, # Moldova
|
51 |
-
"Europe/Amsterdam": 66, # Netherlands
|
52 |
-
"Europe/Lisbon": 61, # Portugal
|
53 |
-
"Europe/Brussels": 64, # Belgium
|
54 |
-
"Pacific/Auckland": 80 # New Zealand
|
55 |
-
}
|
56 |
-
|
57 |
-
@app.route('/get_ecpm_player', methods=['GET'])
|
58 |
-
def get_ecpm():
|
59 |
-
# Get timezone from request
|
60 |
-
user_timezone = request.args.get('timezone', 'Unknown')
|
61 |
-
|
62 |
-
# Get corresponding ECPM value
|
63 |
-
ecpm_value = ECPM_VALUES.get(user_timezone, 50) # Default to 50 if not found
|
64 |
-
|
65 |
-
return jsonify({"ecpm": ecpm_value, "timezone": user_timezone})
|
66 |
-
|
67 |
-
#def check_proxy(ip):
|
68 |
-
# try:
|
69 |
-
# db = db_ipv6 if ":" in ip else db_ipv4 # Use correct database
|
70 |
-
# record = db.get_all(ip)
|
71 |
-
|
72 |
-
# proxy_type = record.proxy_type
|
73 |
-
# return proxy_type not in ["", "-"] # Proxy detected if type is not empty
|
74 |
-
#except Exception as e:
|
75 |
-
# print(f"Error checking IP: {e}")
|
76 |
-
# return False
|
77 |
-
|
78 |
-
#@app.route("/check-ip", methods=["GET"])
|
79 |
-
#def check_ip():
|
80 |
-
# user_ip = request.headers.get("X-Forwarded-For", request.remote_addr) # Get real IP
|
81 |
-
# is_proxy = check_proxy(user_ip)
|
82 |
-
|
83 |
-
# return jsonify({
|
84 |
-
# "ip": user_ip,
|
85 |
-
# "proxy_detected": is_proxy
|
86 |
-
#})
|
87 |
-
|
88 |
-
|
89 |
-
for zip_file in zip_files:
|
90 |
-
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
|
91 |
-
zip_ref.extractall(extract_to)
|
92 |
-
print(f"β
Extracted: {zip_file}")
|
93 |
-
|
94 |
-
|
95 |
-
@app.route('/get_latest_version', methods=['GET'])
|
96 |
-
def get_latest_version():
|
97 |
-
latest_version = "31.0" # Use snake_case for internal Python variables
|
98 |
-
return jsonify({'latestVersion': latest_version}) # Use camelCase in JSON response
|
99 |
-
|
100 |
-
@app.route('/get_latest_version2', methods=['GET'])
|
101 |
-
def get_latest_version2():
|
102 |
-
latest_version = "7.0" # Use snake_case for internal Python variables
|
103 |
-
return jsonify({'latestVersion': latest_version}) # Use camelCase in JSON response
|
104 |
-
|
105 |
-
|
106 |
-
# API endpoint returning hardcoded features
|
107 |
-
@app.route('/api/features')
|
108 |
-
def get_features():
|
109 |
-
features = [
|
110 |
-
# {"name": "π Fast", "description": "Quick response time with optimized performance."}
|
111 |
-
|
112 |
-
|
113 |
-
]
|
114 |
-
return jsonify(features)
|
115 |
-
|
116 |
-
# API endpoint returning hardcoded features
|
117 |
-
@app.route('/api/features2')
|
118 |
-
def get_features2():
|
119 |
-
features = [
|
120 |
-
# {"name": "π Fast", "description": "Quick response time with optimized performance."}
|
121 |
-
|
122 |
-
|
123 |
-
]
|
124 |
-
return jsonify(features)
|
125 |
-
|
126 |
-
|
127 |
-
if __name__ == '__main__':
|
128 |
-
subprocess.Popen(["python", "wk.py"]) # Start awake.py
|
129 |
-
|
130 |
-
app.run(host='0.0.0.0', port=7860)
|
|
|
1 |
+
import tkinter as tk
|
2 |
+
from tkinter import filedialog, messagebox, ttk
|
|
|
|
|
3 |
import zipfile
|
4 |
import os
|
5 |
+
import threading
|
6 |
|
7 |
+
def extract_zip():
|
8 |
+
zip_file = filedialog.askopenfilename(filetypes=[("ZIP Files", "*.zip")])
|
9 |
+
if not zip_file:
|
10 |
+
return
|
11 |
|
12 |
+
extract_to = filedialog.askdirectory(title="Select Extract Folder")
|
13 |
+
if not extract_to:
|
14 |
+
return
|
15 |
|
16 |
+
progress["value"] = 0 # Reset progress bar
|
17 |
+
threading.Thread(target=extract_zip_thread, args=(zip_file, extract_to)).start()
|
18 |
|
19 |
+
def extract_zip_thread(zip_file, extract_to):
|
20 |
+
try:
|
21 |
+
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
|
22 |
+
files = zip_ref.namelist()
|
23 |
+
total_files = len(files)
|
24 |
|
25 |
+
for i, file in enumerate(files):
|
26 |
+
zip_ref.extract(file, extract_to)
|
27 |
+
progress["value"] = ((i + 1) / total_files) * 100
|
28 |
+
root.update_idletasks()
|
29 |
|
30 |
+
messagebox.showinfo("Success", f"β
Extracted to: {extract_to}")
|
31 |
+
except Exception as e:
|
32 |
+
messagebox.showerror("Error", f"β Error: {e}")
|
33 |
|
34 |
+
# GUI Setup
|
35 |
+
root = tk.Tk()
|
36 |
+
root.title("ZIP Extractor")
|
37 |
|
38 |
+
button = tk.Button(root, text="Select ZIP & Extract", command=extract_zip)
|
39 |
+
button.pack(pady=10)
|
40 |
|
41 |
+
progress = ttk.Progressbar(root, orient="horizontal", length=300, mode="determinate")
|
42 |
+
progress.pack(pady=10)
|
43 |
|
44 |
+
root.mainloop()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|