fastled 1.2.82__py3-none-any.whl → 1.2.83__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.
- fastled/__init__.py +1 -1
- fastled/server_flask.py +66 -11
- {fastled-1.2.82.dist-info → fastled-1.2.83.dist-info}/METADATA +1 -1
- {fastled-1.2.82.dist-info → fastled-1.2.83.dist-info}/RECORD +8 -8
- {fastled-1.2.82.dist-info → fastled-1.2.83.dist-info}/WHEEL +0 -0
- {fastled-1.2.82.dist-info → fastled-1.2.83.dist-info}/entry_points.txt +0 -0
- {fastled-1.2.82.dist-info → fastled-1.2.83.dist-info}/licenses/LICENSE +0 -0
- {fastled-1.2.82.dist-info → fastled-1.2.83.dist-info}/top_level.txt +0 -0
fastled/__init__.py
CHANGED
@@ -14,7 +14,7 @@ from .types import BuildMode, CompileResult, CompileServerError, FileResponse
|
|
14
14
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
15
15
|
# that has any other change in the repo. Please bump the version as the
|
16
16
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
17
|
-
__version__ = "1.2.
|
17
|
+
__version__ = "1.2.83"
|
18
18
|
|
19
19
|
|
20
20
|
class Api:
|
fastled/server_flask.py
CHANGED
@@ -5,6 +5,8 @@ from pathlib import Path
|
|
5
5
|
import requests
|
6
6
|
from livereload import Server
|
7
7
|
|
8
|
+
_DRAWF_SOURCE_PREFIX = "drawfsource/js/fastled/src/"
|
9
|
+
|
8
10
|
|
9
11
|
def _run_flask_server(
|
10
12
|
fastled_js: Path,
|
@@ -22,7 +24,7 @@ def _run_flask_server(
|
|
22
24
|
keyfile: Path to the SSL key file
|
23
25
|
"""
|
24
26
|
try:
|
25
|
-
from flask import Flask, send_from_directory
|
27
|
+
from flask import Flask, Response, send_from_directory
|
26
28
|
|
27
29
|
app = Flask(__name__)
|
28
30
|
|
@@ -35,13 +37,13 @@ def _run_flask_server(
|
|
35
37
|
def serve_index():
|
36
38
|
return send_from_directory(fastled_js, "index.html")
|
37
39
|
|
38
|
-
@app.route("/
|
39
|
-
def
|
40
|
-
"""Proxy requests to /
|
41
|
-
from flask import
|
40
|
+
@app.route("/sourcefiles/<path:path>")
|
41
|
+
def serve_source_files(path):
|
42
|
+
"""Proxy requests to /sourcefiles/* to the compile server"""
|
43
|
+
from flask import request
|
42
44
|
|
43
45
|
# Forward the request to the compile server
|
44
|
-
target_url = f"http://localhost:{compile_server_port}/
|
46
|
+
target_url = f"http://localhost:{compile_server_port}/sourcefiles/{path}"
|
45
47
|
|
46
48
|
# Forward the request with the same method, headers, and body
|
47
49
|
resp = requests.request(
|
@@ -61,11 +63,50 @@ def _run_flask_server(
|
|
61
63
|
|
62
64
|
return response
|
63
65
|
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
def handle_dwarfsource(path: str) -> Response:
|
67
|
+
"""Handle requests to /drawfsource/js/fastled/src/"""
|
68
|
+
from flask import request
|
69
|
+
|
70
|
+
print("\n##################################")
|
71
|
+
print(f"# Serving source file /drawfsource/ {path}")
|
72
|
+
print("##################################\n")
|
73
|
+
|
74
|
+
if not path.startswith(_DRAWF_SOURCE_PREFIX):
|
75
|
+
# unexpected
|
76
|
+
print(f"Unexpected path: {path}")
|
77
|
+
return Response("Malformed path", status=400)
|
78
|
+
|
79
|
+
path = path.replace("drawfsource/js/fastled/src/", "")
|
80
|
+
|
81
|
+
# Forward the request to the compile server
|
82
|
+
target_url = f"http://localhost:{compile_server_port}/sourcefiles/{path}"
|
83
|
+
|
84
|
+
# Forward the request with the same method, headers, and body
|
85
|
+
resp = requests.request(
|
86
|
+
method=request.method,
|
87
|
+
url=target_url,
|
88
|
+
headers={key: value for key, value in request.headers if key != "Host"},
|
89
|
+
data=request.get_data(),
|
90
|
+
cookies=request.cookies,
|
91
|
+
allow_redirects=True,
|
92
|
+
stream=False,
|
93
|
+
)
|
94
|
+
|
95
|
+
# Create a Flask Response object from the requests response
|
96
|
+
response = Response(
|
97
|
+
resp.raw.read(), status=resp.status_code, headers=dict(resp.headers)
|
98
|
+
)
|
99
|
+
|
100
|
+
return response
|
101
|
+
|
102
|
+
def handle_sourcefile(path: str) -> Response:
|
103
|
+
"""Handle requests to /sourcefiles/*"""
|
67
104
|
from flask import Response, request
|
68
105
|
|
106
|
+
print("\n##################################")
|
107
|
+
print(f"# Serving source file /sourcefiles/ {path}")
|
108
|
+
print("##################################\n")
|
109
|
+
|
69
110
|
# Forward the request to the compile server
|
70
111
|
target_url = f"http://localhost:{compile_server_port}/sourcefiles/{path}"
|
71
112
|
|
@@ -87,8 +128,12 @@ def _run_flask_server(
|
|
87
128
|
|
88
129
|
return response
|
89
130
|
|
90
|
-
|
91
|
-
|
131
|
+
def handle_local_file_fetch(path: str) -> Response:
|
132
|
+
|
133
|
+
print("\n##################################")
|
134
|
+
print(f"# Servering generic file {path}")
|
135
|
+
print("##################################\n")
|
136
|
+
|
92
137
|
response = send_from_directory(fastled_js, path)
|
93
138
|
# Some servers don't set the Content-Type header for a bunch of files.
|
94
139
|
if path.endswith(".js"):
|
@@ -120,6 +165,16 @@ def _run_flask_server(
|
|
120
165
|
response.headers["Expires"] = "0"
|
121
166
|
return response
|
122
167
|
|
168
|
+
@app.route("/<path:path>")
|
169
|
+
def serve_files(path: str):
|
170
|
+
|
171
|
+
if path.startswith("drawfsource/"):
|
172
|
+
return handle_dwarfsource(path)
|
173
|
+
elif path.startswith("sourcefiles/"):
|
174
|
+
return handle_sourcefile(path)
|
175
|
+
else:
|
176
|
+
return handle_local_file_fetch(path)
|
177
|
+
|
123
178
|
server = Server(app.wsgi_app)
|
124
179
|
# Watch index.html for changes
|
125
180
|
server.watch(str(fastled_js / "index.html"))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=GFW1WwdYsAv_gygWIQ047oPRT6sjzh7WgDAYVNyInSo,7044
|
2
2
|
fastled/app.py,sha256=0W8Mbplo5UCRzj7nMVgkmCBddQGufsUQjkUUT4pMp74,4611
|
3
3
|
fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
|
4
4
|
fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
|
@@ -17,7 +17,7 @@ fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
|
|
17
17
|
fastled/print_filter.py,sha256=ZpebuqfWEraSBD3Dm0PVZhQVBnU_NSILniwBHwjC1qM,2342
|
18
18
|
fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
|
19
19
|
fastled/select_sketch_directory.py,sha256=-eudwCns3AKj4HuHtSkZAFwbnf005SNL07pOzs9VxnE,1383
|
20
|
-
fastled/server_flask.py,sha256=
|
20
|
+
fastled/server_flask.py,sha256=qPY72qJ4qOI3Llj3VG0CGvEnJ0ibMcprykAG6o9Sexk,9050
|
21
21
|
fastled/server_start.py,sha256=W9yKStkRlRNuXeV6j_6O7HjjFPyVLBHMcF9Uy2QjDWQ,479
|
22
22
|
fastled/settings.py,sha256=oezRvRUJWwauO-kpC4LDbKg6Q-ij4d09UtR2vkjSAPU,575
|
23
23
|
fastled/sketch.py,sha256=tHckjDj8P6BI_LWzUFM071a9qcqPs-r-qFWIe50P5Xw,3391
|
@@ -33,9 +33,9 @@ fastled/site/build.py,sha256=2YKU_UWKlJdGnjdbAbaL0co6kceFMSTVYwH1KCmgPZA,13987
|
|
33
33
|
fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
|
34
34
|
fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
|
35
35
|
fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
|
36
|
-
fastled-1.2.
|
37
|
-
fastled-1.2.
|
38
|
-
fastled-1.2.
|
39
|
-
fastled-1.2.
|
40
|
-
fastled-1.2.
|
41
|
-
fastled-1.2.
|
36
|
+
fastled-1.2.83.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
37
|
+
fastled-1.2.83.dist-info/METADATA,sha256=XPce-fPL-Jl0e7rpYRuf-JHiyIJZe44nZiARcxX4S8c,21940
|
38
|
+
fastled-1.2.83.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
39
|
+
fastled-1.2.83.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
40
|
+
fastled-1.2.83.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
|
41
|
+
fastled-1.2.83.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|