flet-web 0.70.0.dev5073__py3-none-any.whl → 0.70.0.dev5103__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.
Potentially problematic release.
This version of flet-web might be problematic. Click here for more details.
- flet_web/fastapi/flet_app.py +34 -10
- flet_web/fastapi/flet_app_manager.py +2 -0
- flet_web/fastapi/flet_oauth.py +23 -10
- flet_web/fastapi/oauth_state.py +5 -2
- flet_web/fastapi/serve_fastapi_web_app.py +3 -1
- flet_web/version.py +1 -1
- flet_web/web/flutter_bootstrap.js +1 -1
- flet_web/web/flutter_service_worker.js +4 -4
- flet_web/web/main.dart.js +42772 -42805
- flet_web/web/main.dart.mjs +8 -9
- flet_web/web/main.dart.wasm +0 -0
- flet_web/web/pyodide/micropip-0.8.0-py3-none-any.whl +2 -2
- {flet_web-0.70.0.dev5073.dist-info → flet_web-0.70.0.dev5103.dist-info}/METADATA +3 -3
- {flet_web-0.70.0.dev5073.dist-info → flet_web-0.70.0.dev5103.dist-info}/RECORD +16 -16
- {flet_web-0.70.0.dev5073.dist-info → flet_web-0.70.0.dev5103.dist-info}/WHEEL +0 -0
- {flet_web-0.70.0.dev5073.dist-info → flet_web-0.70.0.dev5103.dist-info}/top_level.txt +0 -0
flet_web/fastapi/flet_app.py
CHANGED
|
@@ -108,10 +108,9 @@ class FletApp(Connection):
|
|
|
108
108
|
"""
|
|
109
109
|
self.__websocket = websocket
|
|
110
110
|
|
|
111
|
-
self.client_ip =
|
|
112
|
-
self.__websocket.client.host if self.__websocket.client else ""
|
|
113
|
-
).split(":")[0]
|
|
111
|
+
self.client_ip = self.__websocket.client.host if self.__websocket.client else ""
|
|
114
112
|
self.client_user_agent = self.__websocket.headers.get("user-agent", "")
|
|
113
|
+
self.__oauth_state_id = self.__websocket.cookies.get("flet_oauth_state")
|
|
115
114
|
|
|
116
115
|
self.pubsubhub = app_manager.get_pubsubhub(self.__main, loop=self.loop)
|
|
117
116
|
self.page_url = str(websocket.url).rsplit("/", 1)[0]
|
|
@@ -165,16 +164,20 @@ class FletApp(Connection):
|
|
|
165
164
|
f"{self.__session.id}"
|
|
166
165
|
)
|
|
167
166
|
except BrokenPipeError:
|
|
168
|
-
logger.info(
|
|
167
|
+
logger.info(
|
|
168
|
+
"Session handler terminated: "
|
|
169
|
+
f"{self.__session.id if self.__session else ''}"
|
|
170
|
+
)
|
|
169
171
|
except Exception as e:
|
|
170
172
|
print(
|
|
171
|
-
|
|
173
|
+
"Unhandled error processing page session: "
|
|
174
|
+
f"{self.__session.id if self.__session else ''}",
|
|
172
175
|
traceback.format_exc(),
|
|
173
176
|
)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
if self.__session:
|
|
178
|
+
self.__session.error(
|
|
179
|
+
f"There was an error while processing your request: {e}"
|
|
180
|
+
)
|
|
178
181
|
|
|
179
182
|
async def __send_loop(self):
|
|
180
183
|
assert self.__websocket
|
|
@@ -224,6 +227,14 @@ class FletApp(Connection):
|
|
|
224
227
|
self.__get_unique_session_id(req.session_id)
|
|
225
228
|
)
|
|
226
229
|
|
|
230
|
+
oauth_state = None
|
|
231
|
+
if self.__oauth_state_id:
|
|
232
|
+
oauth_state = app_manager.retrieve_state(self.__oauth_state_id)
|
|
233
|
+
if oauth_state:
|
|
234
|
+
self.__session = await app_manager.get_session(
|
|
235
|
+
oauth_state.session_id
|
|
236
|
+
)
|
|
237
|
+
|
|
227
238
|
# re-create session
|
|
228
239
|
if self.__session is None:
|
|
229
240
|
new_session = True
|
|
@@ -274,6 +285,16 @@ class FletApp(Connection):
|
|
|
274
285
|
):
|
|
275
286
|
self.__session.page.go(self.__session.page.route)
|
|
276
287
|
|
|
288
|
+
if oauth_state:
|
|
289
|
+
await self.__session.page._authorize_callback_async(
|
|
290
|
+
{
|
|
291
|
+
"state": self.__oauth_state_id,
|
|
292
|
+
"code": oauth_state.code,
|
|
293
|
+
"error": oauth_state.error,
|
|
294
|
+
"error_description": oauth_state.error_description,
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
|
|
277
298
|
elif action == ClientAction.CONTROL_EVENT:
|
|
278
299
|
req = ControlEventBody(**body)
|
|
279
300
|
task = asyncio.create_task(
|
|
@@ -329,7 +350,10 @@ class FletApp(Connection):
|
|
|
329
350
|
app_manager.store_state(state_id, state)
|
|
330
351
|
|
|
331
352
|
def __get_unique_session_id(self, session_id: str):
|
|
332
|
-
|
|
353
|
+
ip = self.client_ip
|
|
354
|
+
if ip in ["127.0.0.1", "::1"]:
|
|
355
|
+
ip = ""
|
|
356
|
+
client_hash = sha1(f"{ip}{self.client_user_agent}")
|
|
333
357
|
return f"{self.page_name}_{session_id}_{client_hash}"
|
|
334
358
|
|
|
335
359
|
def dispose(self):
|
|
@@ -83,6 +83,8 @@ class FletAppManager:
|
|
|
83
83
|
if session_id in self.__sessions:
|
|
84
84
|
session = self.__sessions[session_id]
|
|
85
85
|
await session.connect(conn)
|
|
86
|
+
else:
|
|
87
|
+
raise Exception(f"Session has expired or not found: {session_id}")
|
|
86
88
|
|
|
87
89
|
async def disconnect_session(self, session_id: str, session_timeout_seconds: int):
|
|
88
90
|
logger.info(f"Session disconnected: {session_id}")
|
flet_web/fastapi/flet_oauth.py
CHANGED
|
@@ -34,22 +34,35 @@ class FletOAuth:
|
|
|
34
34
|
if not session:
|
|
35
35
|
raise HTTPException(status_code=500, detail="Session not found")
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"code": request.query_params.get("code"),
|
|
41
|
-
"error": request.query_params.get("error"),
|
|
42
|
-
"error_description": request.query_params.get("error_description"),
|
|
43
|
-
}
|
|
44
|
-
)
|
|
37
|
+
state.code = request.query_params.get("code")
|
|
38
|
+
state.error = request.query_params.get("error")
|
|
39
|
+
state.error_description = request.query_params.get("error_description")
|
|
45
40
|
|
|
46
41
|
if state.complete_page_url:
|
|
47
|
-
|
|
42
|
+
app_manager.store_state(state_id, state)
|
|
43
|
+
response = RedirectResponse(state.complete_page_url)
|
|
44
|
+
response.set_cookie(
|
|
45
|
+
"flet_oauth_state",
|
|
46
|
+
state_id,
|
|
47
|
+
max_age=300,
|
|
48
|
+
httponly=True,
|
|
49
|
+
secure=False,
|
|
50
|
+
samesite="strict",
|
|
51
|
+
)
|
|
52
|
+
return response
|
|
48
53
|
else:
|
|
54
|
+
await session.page._authorize_callback_async(
|
|
55
|
+
{
|
|
56
|
+
"state": state_id,
|
|
57
|
+
"code": state.code,
|
|
58
|
+
"error": state.error,
|
|
59
|
+
"error_description": state.error_description,
|
|
60
|
+
}
|
|
61
|
+
)
|
|
49
62
|
html_content = (
|
|
50
63
|
state.complete_page_html
|
|
51
64
|
if state.complete_page_html
|
|
52
|
-
else
|
|
65
|
+
else """
|
|
53
66
|
<!DOCTYPE html>
|
|
54
67
|
<html>
|
|
55
68
|
<head>
|
flet_web/fastapi/oauth_state.py
CHANGED
|
@@ -7,5 +7,8 @@ from typing import Optional
|
|
|
7
7
|
class OAuthState:
|
|
8
8
|
session_id: str
|
|
9
9
|
expires_at: datetime
|
|
10
|
-
complete_page_url: Optional[str] =
|
|
11
|
-
complete_page_html: Optional[str] =
|
|
10
|
+
complete_page_url: Optional[str] = None
|
|
11
|
+
complete_page_html: Optional[str] = None
|
|
12
|
+
code: Optional[str] = None
|
|
13
|
+
error: Optional[str] = None
|
|
14
|
+
error_description: Optional[str] = None
|
|
@@ -86,7 +86,9 @@ async def serve_fastapi_web_app(
|
|
|
86
86
|
no_cdn=no_cdn,
|
|
87
87
|
),
|
|
88
88
|
)
|
|
89
|
-
config = uvicorn.Config(
|
|
89
|
+
config = uvicorn.Config(
|
|
90
|
+
app, host=host, port=port, log_level=log_level, ws="websockets-sansio"
|
|
91
|
+
)
|
|
90
92
|
server = uvicorn.Server(config)
|
|
91
93
|
|
|
92
94
|
if blocking:
|
flet_web/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
version = "0.70.0.
|
|
1
|
+
version = "0.70.0.dev5103"
|
|
@@ -54,7 +54,7 @@ if (flet.noCdn) {
|
|
|
54
54
|
_flutter.loader.load({
|
|
55
55
|
config: flutterConfig,
|
|
56
56
|
serviceWorkerSettings: {
|
|
57
|
-
serviceWorkerVersion: "
|
|
57
|
+
serviceWorkerVersion: "994449865",
|
|
58
58
|
},
|
|
59
59
|
onEntrypointLoaded: async function (engineInitializer) {
|
|
60
60
|
loading.classList.add('main_done');
|
|
@@ -3,7 +3,7 @@ const MANIFEST = 'flutter-app-manifest';
|
|
|
3
3
|
const TEMP = 'flutter-temp-cache';
|
|
4
4
|
const CACHE_NAME = 'flutter-app-cache';
|
|
5
5
|
|
|
6
|
-
const RESOURCES = {"main.dart.js": "
|
|
6
|
+
const RESOURCES = {"main.dart.js": "fb992f35a5981ffb83bdfcd54ac46de6",
|
|
7
7
|
"manifest.json": "58765f937ba0d0c40a3a714c5c1adb87",
|
|
8
8
|
"python-worker.js": "26eb131f3acb5ce232fea72da957e8ce",
|
|
9
9
|
"canvaskit/skwasm.wasm": "39dd80367a4e71582d234948adc521c0",
|
|
@@ -15,8 +15,8 @@ const RESOURCES = {"main.dart.js": "799e2ed6593526c548340d3c9530aef8",
|
|
|
15
15
|
"canvaskit/skwasm.js.symbols": "e72c79950c8a8483d826a7f0560573a1",
|
|
16
16
|
"canvaskit/canvaskit.js": "728b2d477d9b8c14593d4f9b82b484f3",
|
|
17
17
|
"canvaskit/canvaskit.wasm": "7a3f4ae7d65fc1de6a6e7ddd3224bc93",
|
|
18
|
-
"flutter_bootstrap.js": "
|
|
19
|
-
"main.dart.wasm": "
|
|
18
|
+
"flutter_bootstrap.js": "48940264e5a3a73f0e8d6ae7499e5dbd",
|
|
19
|
+
"main.dart.wasm": "83590ca576a8e8db2afb0935bebdccb0",
|
|
20
20
|
"favicon.png": "302ac04c14db027d016d1fe74c6a80a0",
|
|
21
21
|
"flutter.js": "83d881c1dbb6d6bcd6b42e274605b69c",
|
|
22
22
|
"index.html": "55e4a5140b3c5f98b694331a15299630",
|
|
@@ -41,7 +41,7 @@ const RESOURCES = {"main.dart.js": "799e2ed6593526c548340d3c9530aef8",
|
|
|
41
41
|
"icons/icon-maskable-192.png": "c1c2210feeb444cf800a5ce0d06eff16",
|
|
42
42
|
"icons/loading-animation.png": "41a96047dbd2463a50c46ad3bf6ff158",
|
|
43
43
|
"icons/icon-maskable-512.png": "aa798e6d780ff109da17c3a98d5f2619",
|
|
44
|
-
"main.dart.mjs": "
|
|
44
|
+
"main.dart.mjs": "62f3b36ccda8945e684f8f6eea86b238",
|
|
45
45
|
"python.js": "352c5261eadd3cc73ac082984266c0fc",
|
|
46
46
|
"version.json": "3fea9d9c7b4ca6955aa03e762e0d2e13"};
|
|
47
47
|
// The application shell files that are downloaded before a service worker can
|