phanterpwa 13.30.1__py3-none-any.whl → 14.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phanterpwa/__init__.py +1 -1
- phanterpwa/backend/pydal/auth.py +3 -3
- phanterpwa/backend/pydal/credentials.py +6 -5
- phanterpwa/backend/request_handlers/credentials.py +19 -22
- phanterpwa/server.py +68 -27
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/METADATA +1 -1
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/RECORD +12 -12
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/LICENSE +0 -0
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/WHEEL +0 -0
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/dependency_links.txt +0 -0
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/entry_points.txt +0 -0
- {phanterpwa-13.30.1.dist-info → phanterpwa-14.0.1.dist-info}/top_level.txt +0 -0
phanterpwa/__init__.py
CHANGED
phanterpwa/backend/pydal/auth.py
CHANGED
|
@@ -27,12 +27,12 @@ class AuthTables():
|
|
|
27
27
|
'group': 'group1',
|
|
28
28
|
'_class': 'p-col w1p100 w4p70 e-float_right'
|
|
29
29
|
}),
|
|
30
|
-
Field('email', 'string', notnull=True, unique=True, phanterpwa={
|
|
30
|
+
Field('email', 'string', notnull=True, unique=True, index=True, phanterpwa={
|
|
31
31
|
'group': 'group1',
|
|
32
32
|
'_class': 'p-col w1p100 w4p70 e-float_right'
|
|
33
33
|
}),
|
|
34
34
|
Field('date_created', 'datetime', default=datetime.now(), requires=IS_EMPTY_OR(IS_DATETIME())),
|
|
35
|
-
Field('email_activated', 'boolean', default=False),
|
|
35
|
+
Field('email_activated', 'boolean', index=True, default=False),
|
|
36
36
|
Field('fone_number', 'string', phanterpwa={
|
|
37
37
|
'out_of_form': True
|
|
38
38
|
}),
|
|
@@ -170,7 +170,7 @@ class AuthActivityNoRelationalTable():
|
|
|
170
170
|
self.DALDatabase = DALDatabase
|
|
171
171
|
|
|
172
172
|
self.DALDatabase.define_table('auth_activity_no_relational',
|
|
173
|
-
Field('id_user', 'integer'),
|
|
173
|
+
Field('id_user', 'integer', index=True),
|
|
174
174
|
Field('request', 'text'),
|
|
175
175
|
Field('activity', 'string'),
|
|
176
176
|
Field('date_activity', 'datetime', default=datetime.now()))
|
|
@@ -12,17 +12,18 @@ class CredentialsTables():
|
|
|
12
12
|
self.DALDatabase = DALDatabase
|
|
13
13
|
self.logger_api = logger_api
|
|
14
14
|
self.DALDatabase.define_table('client',
|
|
15
|
-
Field('token', 'text'),
|
|
15
|
+
Field('token', 'text', index=True),
|
|
16
16
|
Field('auth_user', 'reference auth_user', requires=IS_EMPTY_OR(
|
|
17
17
|
IS_IN_DB(self.DALDatabase, self.DALDatabase.auth_user))),
|
|
18
18
|
Field('date_created', 'datetime', default=datetime.now(), requires=IS_EMPTY_OR(IS_DATETIME())),
|
|
19
19
|
Field('last_resign', 'datetime', default=datetime.now()),
|
|
20
20
|
Field('remember_me', 'boolean', default=False),
|
|
21
|
-
Field('locked', 'boolean', default=False)
|
|
21
|
+
Field('locked', 'boolean', default=False),
|
|
22
|
+
indexes=["token"]
|
|
22
23
|
)
|
|
23
24
|
|
|
24
25
|
self.DALDatabase.define_table('captcha',
|
|
25
|
-
Field('token', 'text'),
|
|
26
|
+
Field('token', 'text', index=True),
|
|
26
27
|
Field('form_identify', 'string'),
|
|
27
28
|
Field('user_agent', 'string'),
|
|
28
29
|
Field('ip', 'string'),
|
|
@@ -32,7 +33,7 @@ class CredentialsTables():
|
|
|
32
33
|
)
|
|
33
34
|
|
|
34
35
|
self.DALDatabase.define_table('google_captcha',
|
|
35
|
-
Field('token', 'text'),
|
|
36
|
+
Field('token', 'text', index=True),
|
|
36
37
|
Field('form_identify', 'string'),
|
|
37
38
|
Field('user_agent', 'string'),
|
|
38
39
|
Field('ip', 'string'),
|
|
@@ -42,7 +43,7 @@ class CredentialsTables():
|
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
self.DALDatabase.define_table('csrf',
|
|
45
|
-
Field('token', 'text'),
|
|
46
|
+
Field('token', 'text', index=True),
|
|
46
47
|
Field('form_identify', 'string'),
|
|
47
48
|
Field('user_agent', 'string'),
|
|
48
49
|
Field('ip', 'string'),
|
|
@@ -93,7 +93,23 @@ class SignClient(web.RequestHandler):
|
|
|
93
93
|
|
|
94
94
|
@check_application()
|
|
95
95
|
async def get(self, *args, **kargs):
|
|
96
|
-
|
|
96
|
+
expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_client_token_expire'])
|
|
97
|
+
anonymous_expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_csrf_token_expire'])
|
|
98
|
+
deactived_user_expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_user_token_expire_remember_me'])
|
|
99
|
+
str_expire_date = expire_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
100
|
+
str_anonymous_expire_date = anonymous_expire_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
101
|
+
self.DALDatabase(
|
|
102
|
+
(self.DALDatabase.client.date_created < str_expire_date)
|
|
103
|
+
).delete()
|
|
104
|
+
self.DALDatabase(
|
|
105
|
+
(self.DALDatabase.client.auth_user == None)
|
|
106
|
+
& (self.DALDatabase.client.date_created < str_anonymous_expire_date)
|
|
107
|
+
).delete()
|
|
108
|
+
self.DALDatabase(
|
|
109
|
+
(self.DALDatabase.auth_user.activated == False)
|
|
110
|
+
& ((self.DALDatabase.auth_user.date_created < deactived_user_expire_date) | (self.DALDatabase.auth_user.date_created == None))
|
|
111
|
+
).delete()
|
|
112
|
+
|
|
97
113
|
self.phanterpwa_client_token = self.request.headers.get('phanterpwa-client-token')
|
|
98
114
|
self.phanterpwa_authorization = self.request.headers.get('phanterpwa-authorization')
|
|
99
115
|
t_client = Serialize(
|
|
@@ -378,27 +394,8 @@ class SignClient(web.RequestHandler):
|
|
|
378
394
|
self.set_status(200)
|
|
379
395
|
return self.write({"status": "OK"})
|
|
380
396
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
global CLEANUP_TIME
|
|
384
|
-
expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_client_token_expire'])
|
|
385
|
-
anonymous_expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_csrf_token_expire'])
|
|
386
|
-
deactived_user_expire_date = datetime.now() - timedelta(seconds=self.projectConfig['BACKEND'][self.app_name]['default_time_user_token_expire_remember_me'])
|
|
387
|
-
str_expire_date = expire_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
388
|
-
str_anonymous_expire_date = anonymous_expire_date.strftime('%Y-%m-%d %H:%M:%S')
|
|
389
|
-
if CLEANUP_TIME is None or CLEANUP_TIME > (datetime.now() - timedelta(60 * 60 * 12)):
|
|
390
|
-
self.DALDatabase(
|
|
391
|
-
(self.DALDatabase.client.date_created < str_expire_date)
|
|
392
|
-
).delete()
|
|
393
|
-
self.DALDatabase(
|
|
394
|
-
(self.DALDatabase.client.auth_user == None)
|
|
395
|
-
& (self.DALDatabase.client.date_created < str_anonymous_expire_date)
|
|
396
|
-
).delete()
|
|
397
|
-
self.DALDatabase(
|
|
398
|
-
(self.DALDatabase.auth_user.activated == False)
|
|
399
|
-
& ((self.DALDatabase.auth_user.date_created < deactived_user_expire_date) | (self.DALDatabase.auth_user.date_created == None))
|
|
400
|
-
).delete()
|
|
401
|
-
CLEANUP_TIME = datetime.now()
|
|
397
|
+
|
|
398
|
+
|
|
402
399
|
|
|
403
400
|
|
|
404
401
|
class SignForms(web.RequestHandler):
|
phanterpwa/server.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import asyncio
|
|
2
3
|
import sys
|
|
3
4
|
import re
|
|
5
|
+
import time
|
|
4
6
|
import importlib
|
|
5
7
|
import subprocess
|
|
6
8
|
import threading
|
|
@@ -91,35 +93,31 @@ class PhanterPWATornado(object):
|
|
|
91
93
|
current_port = self.projectConfig['FRONTEND'][x]['port']
|
|
92
94
|
socket = netutil.bind_sockets(current_port)
|
|
93
95
|
socs[f'front_{x}'] = socket
|
|
94
|
-
|
|
96
|
+
time.sleep(2)
|
|
95
97
|
process.fork_processes(self.cpu_number)
|
|
98
|
+
time.sleep(2 * (os.getpid() % self.cpu_number))
|
|
96
99
|
print(f"After fork - PID: {os.getpid()}")
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
app
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
else:
|
|
119
|
-
app = handlers_app.HANDLER
|
|
120
|
-
|
|
121
|
-
app_http_server = httpserver.HTTPServer(app)
|
|
122
|
-
app_http_server.add_sockets(socs[f'front_{x}'])
|
|
101
|
+
# ADIÇÃO: Função com delay para inicialização de apps
|
|
102
|
+
async def initialize_apps_with_delay():
|
|
103
|
+
delay_between_apps = 1.5 # 200ms entre cada app
|
|
104
|
+
|
|
105
|
+
# Inicializar BACKEND apps com delay
|
|
106
|
+
backend_apps = list(self.projectConfig['BACKEND'].keys())
|
|
107
|
+
for i, x in enumerate(backend_apps):
|
|
108
|
+
await asyncio.sleep(i * delay_between_apps)
|
|
109
|
+
self._initialize_backend_app(x, socs[f'back_{x}'])
|
|
110
|
+
print(f"Backend app {x} initialized with delay")
|
|
111
|
+
|
|
112
|
+
# Inicializar FRONTEND apps com delay
|
|
113
|
+
frontend_apps = list(self.projectConfig['FRONTEND'].keys())
|
|
114
|
+
for i, x in enumerate(frontend_apps):
|
|
115
|
+
await asyncio.sleep(i * delay_between_apps)
|
|
116
|
+
self._initialize_frontend_app(x, socs[f'front_{x}'])
|
|
117
|
+
print(f"Frontend app {x} initialized with delay")
|
|
118
|
+
|
|
119
|
+
# Executar inicialização com delays
|
|
120
|
+
ioloop.IOLoop.current().add_callback(initialize_apps_with_delay)
|
|
123
121
|
else:
|
|
124
122
|
for x in self.projectConfig['BACKEND']:
|
|
125
123
|
current_port = self.projectConfig['BACKEND'][x]['port']
|
|
@@ -151,13 +149,56 @@ class PhanterPWATornado(object):
|
|
|
151
149
|
app_http_server.listen(current_port)
|
|
152
150
|
print(id(app_http_server))
|
|
153
151
|
|
|
154
|
-
|
|
155
152
|
autoreload.watch(os.path.join(self.projectPath, "config.json"))
|
|
156
153
|
ioloop.IOLoop.current().start()
|
|
157
154
|
print("start stopped")
|
|
158
155
|
ioloop.IOLoop.current().add_callback(lambda: ioloop.IOLoop.current().close(True))
|
|
159
156
|
print("close? Don't know")
|
|
160
157
|
|
|
158
|
+
def _initialize_backend_app(self, app_name, socket):
|
|
159
|
+
"""Inicializa uma aplicação backend com tratamento de erro"""
|
|
160
|
+
try:
|
|
161
|
+
time.sleep(0.5)
|
|
162
|
+
handlers_app = importlib.import_module("backapps.{0}.handlers".format(app_name))
|
|
163
|
+
time.sleep(0.3)
|
|
164
|
+
if isinstance(handlers_app.HANDLER, (list, tuple)):
|
|
165
|
+
app = web.Application(
|
|
166
|
+
handlers_app.HANDLER,
|
|
167
|
+
**handlers_app.SETTINGS
|
|
168
|
+
)
|
|
169
|
+
else:
|
|
170
|
+
app = handlers_app.HANDLER
|
|
171
|
+
time.sleep(0.3)
|
|
172
|
+
app_http_server = httpserver.HTTPServer(app)
|
|
173
|
+
app_http_server.add_sockets(socket)
|
|
174
|
+
time.sleep(0.2)
|
|
175
|
+
return True
|
|
176
|
+
except Exception as e:
|
|
177
|
+
print(f"Error initializing backend app {app_name}: {e}")
|
|
178
|
+
return False
|
|
179
|
+
|
|
180
|
+
def _initialize_frontend_app(self, app_name, socket):
|
|
181
|
+
"""Inicializa uma aplicação frontend com tratamento de erro"""
|
|
182
|
+
try:
|
|
183
|
+
time.sleep(0.5)
|
|
184
|
+
handlers_app = importlib.import_module("frontapps.{0}.handlers".format(app_name))
|
|
185
|
+
time.sleep(0.3)
|
|
186
|
+
if isinstance(handlers_app.HANDLER, (list, tuple)):
|
|
187
|
+
app = web.Application(
|
|
188
|
+
handlers_app.HANDLER,
|
|
189
|
+
**handlers_app.SETTINGS
|
|
190
|
+
)
|
|
191
|
+
else:
|
|
192
|
+
app = handlers_app.HANDLER
|
|
193
|
+
time.sleep(0.5)
|
|
194
|
+
app_http_server = httpserver.HTTPServer(app)
|
|
195
|
+
app_http_server.add_sockets(socket)
|
|
196
|
+
time.sleep(0.2)
|
|
197
|
+
return True
|
|
198
|
+
except Exception as e:
|
|
199
|
+
print(f"Error initializing frontend app {app_name}: {e}")
|
|
200
|
+
return False
|
|
201
|
+
|
|
161
202
|
def stop(self):
|
|
162
203
|
ioloop.IOLoop.current().add_callback(
|
|
163
204
|
lambda: (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
phanterpwa/__init__.py,sha256=
|
|
1
|
+
phanterpwa/__init__.py,sha256=sr-3NYqP1iw4Z3E9dad5yot7SgWyQ2fze6WQCXsihWE,396
|
|
2
2
|
phanterpwa/__main__.py,sha256=1vSHtv6-sgAgpZiklf9bwarXX1b-fmKx1rjwJw4h78o,4017
|
|
3
3
|
phanterpwa/compiler.py,sha256=Je3qtVO_cZ69_PPWcXKyBgnRfQ-Ev-zkZ3UTN-ddOTQ,47478
|
|
4
4
|
phanterpwa/configer.py,sha256=PFO_nVy9r6yt5iDso1amDIR0Ge2UYYK3h-ae9M0Ezyk,26359
|
|
5
5
|
phanterpwa/helpers.py,sha256=gUoSd6OeMtA08jwFMrOCsuou58nwech-aGdiPSCX9GI,12138
|
|
6
6
|
phanterpwa/mail.py,sha256=YrsiIQY_SpqySIc7mi6MfyY881DIsoYAJ5dPAz8vorE,5741
|
|
7
7
|
phanterpwa/reversexml.py,sha256=YJeI8VuzEPw0D2z0Cz-HLt2n27WyJawZh6HRNZX5Ujg,10764
|
|
8
|
-
phanterpwa/server.py,sha256=
|
|
8
|
+
phanterpwa/server.py,sha256=RmpH06AxK8OeNWrsjm30IBZCw7-h8ajwIkbVad0UXFU,15169
|
|
9
9
|
phanterpwa/sms.py,sha256=XUULyDSk5gPjBqupchIcaGv-C6kX66XxrXpmzfnSp_A,1313
|
|
10
10
|
phanterpwa/tools.py,sha256=SKwqx_suix-b1DP72a7z98jlnSWDmtGNWgCQq_ogB1I,46173
|
|
11
11
|
phanterpwa/xmlconstructor.py,sha256=DMtc9BXI2NMGGmLszZXh2A63Iv0D1qgoWtn0aKyrmoo,162695
|
|
@@ -14,9 +14,9 @@ phanterpwa/backend/dataforms.py,sha256=HwR8D-4vBNXdN5MSpZmjelo-Az92lVvOTIzpbHnPp
|
|
|
14
14
|
phanterpwa/backend/decorators.py,sha256=gPqFjUe8BCci59hBv72j2wvKZB3L5HLZIE-3ESA2wLU,56094
|
|
15
15
|
phanterpwa/backend/security.py,sha256=USPky7nqTKASAN60yYs7-NnoR82LMZlf9aGlfz1QbXM,1300
|
|
16
16
|
phanterpwa/backend/pydal/__init__.py,sha256=lpPDHcS9anJ5ceRSW9fBVuAgKK5qtjSoMsVjp3_nCdw,55
|
|
17
|
-
phanterpwa/backend/pydal/auth.py,sha256=
|
|
17
|
+
phanterpwa/backend/pydal/auth.py,sha256=LRJF_gBYP57_aw0paHYEasxqwPx-R8Gj4u1V8qqPRN0,8594
|
|
18
18
|
phanterpwa/backend/pydal/cas.py,sha256=PJvHZdXu4JQM0BAEkYSMTw-_Zc8zrlXR200GTA869kg,1581
|
|
19
|
-
phanterpwa/backend/pydal/credentials.py,sha256=
|
|
19
|
+
phanterpwa/backend/pydal/credentials.py,sha256=vtqEbmcOQ9r9K7nWTMLNcr9aefxCTuw7hEvtIcfxjDM,2313
|
|
20
20
|
phanterpwa/backend/pydal/extra_validations.py,sha256=1FlOZhUuYg4aybL4EwSzH3zWUXbGtOwxxfVxK-qjHkM,1919
|
|
21
21
|
phanterpwa/backend/pydal/gallery.py,sha256=nETfQ2Dv-0N94Ypq14uGiDKeGlWgxDHLjY4s1zFrnWs,870
|
|
22
22
|
phanterpwa/backend/pydal/internal_messages.py,sha256=DYDNWpjrvAM0Nn4m5fGkJXJsMVQjwuJgcMaRzOEzmE4,1379
|
|
@@ -24,7 +24,7 @@ phanterpwa/backend/request_handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQ
|
|
|
24
24
|
phanterpwa/backend/request_handlers/admin.py,sha256=QnpoCTMRBuviSCdB84G0pUb13kIg6ky8Wv4DEVB7tRQ,63978
|
|
25
25
|
phanterpwa/backend/request_handlers/auth.py,sha256=epJ2ura3u6YDKNRmvyYGR7FzF1nrgwTpneibP0z9zzw,177284
|
|
26
26
|
phanterpwa/backend/request_handlers/cas.py,sha256=TeeQaodcHVkhu-cUqesh9NeAuo0oXylzcPXpQ9wG6H4,24996
|
|
27
|
-
phanterpwa/backend/request_handlers/credentials.py,sha256=
|
|
27
|
+
phanterpwa/backend/request_handlers/credentials.py,sha256=OvLnVHixJSwBYUj-GRLEmeO21Z-sG1T4htRzlsQmk3s,51366
|
|
28
28
|
phanterpwa/backend/request_handlers/errors.py,sha256=x3SMdpkO4mxaSRZZQQxtH1zUFh47C06kssfI4CoPokc,4472
|
|
29
29
|
phanterpwa/backend/request_handlers/i18n_server.py,sha256=p3LQxOdcLHIjgaFs4wO1V2_7gKpfcDT7pDPa7m0-UbQ,3205
|
|
30
30
|
phanterpwa/backend/request_handlers/internal_messages.py,sha256=w_u3NYw0KZfuCIS8tHJhV12tj_UA0_aBekk22nR3oCc,17382
|
|
@@ -435,10 +435,10 @@ phanterpwa/usual_sass/preloaders/indefined_text.sass,sha256=z4JuUtBrzoqH3HuNFXvN
|
|
|
435
435
|
phanterpwa/usual_sass/preloaders/run_points.sass,sha256=EYl93ljfgAc-ZLJ0VScrCoIlHP7Nr6NLdxj1zk2wm_E,3367
|
|
436
436
|
phanterpwa/usual_sass/preloaders/square.sass,sha256=TOsh9muP4zkYLUJcw4i1LeRs60NrtgRWBk_1oMt2_58,1348
|
|
437
437
|
phanterpwa/usual_sass/preloaders/squares.sass,sha256=kH1I89qEfmbvYxCtKFVNcxP5bWIjnqbheXVnyGF0VNo,3862
|
|
438
|
-
phanterpwa-
|
|
439
|
-
phanterpwa-
|
|
440
|
-
phanterpwa-
|
|
441
|
-
phanterpwa-
|
|
442
|
-
phanterpwa-
|
|
443
|
-
phanterpwa-
|
|
444
|
-
phanterpwa-
|
|
438
|
+
phanterpwa-14.0.1.dist-info/LICENSE,sha256=lGEW1PRSZOkug2-d0IJgryCjqt6zhxN5x9pFgy3lx2E,1087
|
|
439
|
+
phanterpwa-14.0.1.dist-info/METADATA,sha256=ilOt8cLQgCVL7nx8_21-ptsVfifdj6BDJNejvGTGH_w,1938
|
|
440
|
+
phanterpwa-14.0.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
|
|
441
|
+
phanterpwa-14.0.1.dist-info/dependency_links.txt,sha256=Pslekmz-4l1SpBO0x2aYkYZPCScmbrB9HUq1YvXYUzM,40
|
|
442
|
+
phanterpwa-14.0.1.dist-info/entry_points.txt,sha256=siJH2lFXIdsUBDRgcXV4blOb2_iku1vcbqxJ-trIQrw,56
|
|
443
|
+
phanterpwa-14.0.1.dist-info/top_level.txt,sha256=nF1WJ8AByxBv3bLKp3xySR2l2Twrj5n5n7C404lULSk,5319
|
|
444
|
+
phanterpwa-14.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|