-
Notifications
You must be signed in to change notification settings - Fork 0
/
APIThreads.py
111 lines (93 loc) · 3.87 KB
/
APIThreads.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from PyQt5.QtCore import QThread
from .OpenFrpLib.OpenFrpLib import *
from .variables import OFVariables
class LoginThread(QThread):
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("LoginThread")
def run(self):
try:
OFVariables.loginData = login(
user=OFVariables.userName, password=OFVariables.userPassword
)
except Exception:
OFVariables.loginData = ["", "", False, "失败"]
class GetUserInfoThread(QThread):
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("GetUserInfoThread")
def run(self):
try:
OFVariables.userInfo = getUserInfo(
Authorization=OFVariables.userAuthorization,
session=OFVariables.userSessionID,
)
except Exception:
OFVariables.userInfo = [{}, False, "失败"]
class GetNodeListThread(QThread):
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("GetNodeListThread")
def run(self):
try:
OFVariables.nodeListData = getNodeList(
Authorization=OFVariables.userAuthorization,
session=OFVariables.userSessionID,
)
for i in range(1, OFVariables.nodeListData[0]["total"]):
OFVariables.nodeListData[0]["list"][i]["group"] = list(
OFVariables.nodeListData[0]["list"][i]["group"].split(";")
)
except Exception:
OFVariables.nodeListData = [{}, False, "失败"]
class NewProxyThread(QThread):
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("NewProxyThread")
def run(self):
try:
OFVariables.newProxyData = newProxy(
Authorization=OFVariables.userAuthorization,
session=OFVariables.userSessionID,
node_id=OFVariables.configuringNodeID,
type=OFVariables.configuringProxyType,
remote_port=OFVariables.configuringProxyRemotePort,
local_addr=OFVariables.configuringProxyLocalAddr,
local_port=OFVariables.configuringProxyLocalPort,
domain_bind=OFVariables.configuringProxyDomainBind,
host_rewrite=OFVariables.configuringProxyHostRewrite,
request_from=OFVariables.configuringProxyRequestFrom,
custom=OFVariables.configuringProxyCustom,
dataGzip=OFVariables.configuringProxyDataGZip,
dataEncrypt=OFVariables.configuringProxyDataEncrypt,
url_route=OFVariables.configuringProxyURLRoute,
name=OFVariables.configuringProxyName,
request_pass=OFVariables.configuringRequestPass,
)
except Exception:
OFVariables.newProxyData = [None, False, "创建失败"]
class GetUserProxiesThread(QThread):
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("GetUserProxiesThread")
def run(self):
try:
OFVariables.userProxiesData = getUserProxies(
Authorization=OFVariables.userAuthorization,
session=OFVariables.userSessionID,
)
except Exception:
OFVariables.userProxiesData = [0, [], False, "失败"]
class RemoveProxyThread(QThread):
def __init__(self, parent=None):
super().__init__(parent)
self.setObjectName("RemoveProxyThread")
def run(self):
try:
OFVariables.removeProxyData = removeProxy(
Authorization=OFVariables.userAuthorization,
session=OFVariables.userSessionID,
proxy_id=OFVariables.removeProxyID
)
except Exception:
OFVariables.removeProxyData = [None, False, "失败"]