fastled 1.2.61__tar.gz → 1.2.64__tar.gz
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-1.2.61 → fastled-1.2.64}/PKG-INFO +5 -2
- {fastled-1.2.61 → fastled-1.2.64}/README.md +3 -2
- fastled-1.2.64/compiler/extra/mp3upload.html +38 -0
- {fastled-1.2.61 → fastled-1.2.64}/pyproject.toml +2 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/__init__.py +1 -1
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/keyz.py +8 -7
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/open_browser.py +6 -5
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/server_fastapi_cli.py +1 -1
- fastled-1.2.64/src/fastled/server_flask.py +152 -0
- fastled-1.2.61/src/fastled/open_browser2.py → fastled-1.2.64/src/fastled/server_start.py +63 -12
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled.egg-info/PKG-INFO +5 -2
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled.egg-info/SOURCES.txt +3 -1
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled.egg-info/requires.txt +2 -0
- {fastled-1.2.61 → fastled-1.2.64}/.aiderignore +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.dockerignore +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/lint.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.github/workflows/test_win.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.gitignore +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.pylintrc +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.vscode/launch.json +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.vscode/settings.json +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/.vscode/tasks.json +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/Dockerfile +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/LICENSE +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/MANIFEST.in +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/RELEASE.md +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/TODO.md +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/build_exe.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/build_site.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/clean +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/CMakeLists.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/__init__.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/arduino-pre-process.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/build.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/build_archive.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/build_fast.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/code_sync.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/compile.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/compile_lock.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/entrypoint.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/extra/100dots.html +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/extra/demo_threejs.html +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/extra/micdemo.html +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/final_prewarm.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/init_runtime.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/install-arduino-cli.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/libcompile/CMakeLists.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/paths.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/pre-process.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/prewarm.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/process-ino.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/process_extended.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/pyproject.toml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/run.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/server.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/sketch_hasher.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/compiler/wasm_compiler_flags.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/docker-compose.yml +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/install +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/install_linux.sh +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/lint +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/requirements.testing.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/setup.cfg +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/setup.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/app.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/assets/example.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/cli.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/cli_test.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/client_server.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/compile_server.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/docker_manager.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/filewatcher.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/interactive_srcs.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/keyboard.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/live_client.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/parse_args.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/paths.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/project_init.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/server_fastapi.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/settings.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/site/build.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/site/examples.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/sketch.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/spinner.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/string_diff.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/test/examples.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/types.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/util.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled/web_compile.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/test +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/integration/test_examples.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/html/index.html +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_api.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_bad_ino.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_cli.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_http_server.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_ino/bad/bad.ino +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_project_init.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.2.61 → fastled-1.2.64}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.64
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -23,6 +23,8 @@ Requires-Dist: fastapi>=0.115.12
|
|
23
23
|
Requires-Dist: uvicorn>=0.34.2
|
24
24
|
Requires-Dist: pywebview>=5.4
|
25
25
|
Requires-Dist: watchfiles>=1.0.5
|
26
|
+
Requires-Dist: Flask>=3.0.0
|
27
|
+
Requires-Dist: livereload
|
26
28
|
Dynamic: home-page
|
27
29
|
Dynamic: license-file
|
28
30
|
Dynamic: maintainer
|
@@ -41,7 +43,7 @@ Dynamic: maintainer
|
|
41
43
|
|
42
44
|
|
43
45
|
|
44
|
-
## Compile your FastLED sketch and run it on the Browser
|
46
|
+
## Compile your FastLED sketch and run it on the Browser!!
|
45
47
|
|
46
48
|

|
47
49
|
|
@@ -298,6 +300,7 @@ Q: How can I get the compiled size of my FastLED sketch smaller?
|
|
298
300
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
299
301
|
|
300
302
|
|
303
|
+
|
301
304
|
# Revisions
|
302
305
|
* 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
|
303
306
|
* 1.2.22 - Prefer to use `live-server` from npm. If npm exists on the system then do a background install of `live-server` for next run.
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
## Compile your FastLED sketch and run it on the Browser
|
15
|
+
## Compile your FastLED sketch and run it on the Browser!!
|
16
16
|
|
17
17
|

|
18
18
|
|
@@ -269,6 +269,7 @@ Q: How can I get the compiled size of my FastLED sketch smaller?
|
|
269
269
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
270
270
|
|
271
271
|
|
272
|
+
|
272
273
|
# Revisions
|
273
274
|
* 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
|
274
275
|
* 1.2.22 - Prefer to use `live-server` from npm. If npm exists on the system then do a background install of `live-server` for next run.
|
@@ -366,4 +367,4 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
|
|
366
367
|
live-server --https --port=8416 --host=localhost . --cert=C:/Users/niteris/dev/fastled-wasm/src/fastled/assets/localhost-key.pem --key=C:/Users/niteris/dev/fastled-wasm/src/fastled/assets/localhost.pem --no-browser
|
367
368
|
|
368
369
|
|
369
|
-
live-server --https --cert=src/fastled/assets/localhost.pem --key=src/fastled/assets/localhost-key.pem --port=5500
|
370
|
+
live-server --https --cert=src/fastled/assets/localhost.pem --key=src/fastled/assets/localhost-key.pem --port=5500
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>MP3 Upload & Play Demo</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<!-- Button that triggers the hidden file input -->
|
9
|
+
<button id="upload_mp3">upload_mp3</button>
|
10
|
+
<!-- Hidden file input, restricted to MP3 files -->
|
11
|
+
<input type="file" id="file_input" accept="audio/mpeg" style="display:none" />
|
12
|
+
<!-- Audio element, shown once a file is loaded -->
|
13
|
+
<audio id="player" controls style="display:none; margin-top:1em;"></audio>
|
14
|
+
|
15
|
+
<script>
|
16
|
+
const uploadBtn = document.getElementById('upload_mp3');
|
17
|
+
const fileInput = document.getElementById('file_input');
|
18
|
+
const player = document.getElementById('player');
|
19
|
+
|
20
|
+
// When our button is clicked, open the file picker
|
21
|
+
uploadBtn.addEventListener('click', () => {
|
22
|
+
fileInput.click();
|
23
|
+
});
|
24
|
+
|
25
|
+
// When a file is selected...
|
26
|
+
fileInput.addEventListener('change', (e) => {
|
27
|
+
const file = e.target.files[0];
|
28
|
+
if (!file) return;
|
29
|
+
|
30
|
+
// Create a temporary URL & set it on the audio element
|
31
|
+
const url = URL.createObjectURL(file);
|
32
|
+
player.src = url;
|
33
|
+
player.style.display = 'block'; // show the player
|
34
|
+
player.play(); // start playback
|
35
|
+
});
|
36
|
+
</script>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -13,7 +13,7 @@ from .types import BuildMode, CompileResult, CompileServerError
|
|
13
13
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
14
14
|
# that has any other change in the repo. Please bump the version as the
|
15
15
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
16
|
-
__version__ = "1.2.
|
16
|
+
__version__ = "1.2.64"
|
17
17
|
|
18
18
|
DOCKER_FILE = (
|
19
19
|
"https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
|
@@ -20,11 +20,12 @@ def get_asset_path(filename: str) -> Path | None:
|
|
20
20
|
return None
|
21
21
|
|
22
22
|
|
23
|
-
def get_ssl_config() -> SslConfig:
|
23
|
+
def get_ssl_config() -> SslConfig | None:
|
24
24
|
"""Get the keys for the server"""
|
25
|
-
certfile = get_asset_path("localhost-key.pem")
|
26
|
-
keyfile = get_asset_path("localhost.pem")
|
27
|
-
if certfile is None or keyfile is None:
|
28
|
-
|
29
|
-
# return certfile, keyfile
|
30
|
-
return SslConfig(certfile=certfile, keyfile=keyfile)
|
25
|
+
# certfile = get_asset_path("localhost-key.pem")
|
26
|
+
# keyfile = get_asset_path("localhost.pem")
|
27
|
+
# if certfile is None or keyfile is None:
|
28
|
+
# raise ValueError("Could not find keys for server")
|
29
|
+
# # return certfile, keyfile
|
30
|
+
# return SslConfig(certfile=certfile, keyfile=keyfile)
|
31
|
+
return None
|
@@ -26,13 +26,13 @@ def _open_http_server_subprocess(
|
|
26
26
|
cmd = [
|
27
27
|
PYTHON_EXE,
|
28
28
|
"-m",
|
29
|
-
"fastled.
|
29
|
+
"fastled.server_start",
|
30
30
|
str(fastled_js),
|
31
31
|
"--port",
|
32
32
|
str(port),
|
33
33
|
]
|
34
34
|
# Pass SSL flags if available
|
35
|
-
if SSL_CONFIG.certfile and SSL_CONFIG.keyfile:
|
35
|
+
if SSL_CONFIG and SSL_CONFIG.certfile and SSL_CONFIG.keyfile:
|
36
36
|
cmd.extend(
|
37
37
|
[
|
38
38
|
"--cert",
|
@@ -41,9 +41,10 @@ def _open_http_server_subprocess(
|
|
41
41
|
str(SSL_CONFIG.keyfile),
|
42
42
|
]
|
43
43
|
)
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
print(
|
45
|
+
f"Running server on port {port} with certs: {SSL_CONFIG.certfile}, {SSL_CONFIG.keyfile}"
|
46
|
+
)
|
47
|
+
print(f"Running server on port {port}.")
|
47
48
|
print(f"Command: {subprocess.list2cmdline(cmd)}")
|
48
49
|
# Suppress output
|
49
50
|
subprocess.run(
|
@@ -0,0 +1,152 @@
|
|
1
|
+
import argparse
|
2
|
+
from multiprocessing import Process
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
from livereload import Server
|
6
|
+
|
7
|
+
|
8
|
+
def _run_flask_server(
|
9
|
+
fastled_js: Path,
|
10
|
+
port: int,
|
11
|
+
certfile: Path | None = None,
|
12
|
+
keyfile: Path | None = None,
|
13
|
+
) -> None:
|
14
|
+
"""Run Flask server with live reload in a subprocess
|
15
|
+
|
16
|
+
Args:
|
17
|
+
fastled_js: Path to the fastled_js directory
|
18
|
+
port: Port to run the server on
|
19
|
+
certfile: Path to the SSL certificate file
|
20
|
+
keyfile: Path to the SSL key file
|
21
|
+
"""
|
22
|
+
try:
|
23
|
+
from flask import Flask, send_from_directory
|
24
|
+
|
25
|
+
app = Flask(__name__)
|
26
|
+
|
27
|
+
# Must be a full path or flask will fail to find the file.
|
28
|
+
fastled_js = fastled_js.resolve()
|
29
|
+
|
30
|
+
@app.route("/")
|
31
|
+
def serve_index():
|
32
|
+
return send_from_directory(fastled_js, "index.html")
|
33
|
+
|
34
|
+
@app.route("/<path:path>")
|
35
|
+
def serve_files(path):
|
36
|
+
response = send_from_directory(fastled_js, path)
|
37
|
+
# Some servers don't set the Content-Type header for a bunch of files.
|
38
|
+
if path.endswith(".js"):
|
39
|
+
response.headers["Content-Type"] = "application/javascript"
|
40
|
+
if path.endswith(".css"):
|
41
|
+
response.headers["Content-Type"] = "text/css"
|
42
|
+
if path.endswith(".wasm"):
|
43
|
+
response.headers["Content-Type"] = "application/wasm"
|
44
|
+
if path.endswith(".json"):
|
45
|
+
response.headers["Content-Type"] = "application/json"
|
46
|
+
if path.endswith(".png"):
|
47
|
+
response.headers["Content-Type"] = "image/png"
|
48
|
+
if path.endswith(".jpg"):
|
49
|
+
response.headers["Content-Type"] = "image/jpeg"
|
50
|
+
if path.endswith(".jpeg"):
|
51
|
+
response.headers["Content-Type"] = "image/jpeg"
|
52
|
+
if path.endswith(".gif"):
|
53
|
+
response.headers["Content-Type"] = "image/gif"
|
54
|
+
if path.endswith(".svg"):
|
55
|
+
response.headers["Content-Type"] = "image/svg+xml"
|
56
|
+
if path.endswith(".ico"):
|
57
|
+
response.headers["Content-Type"] = "image/x-icon"
|
58
|
+
if path.endswith(".html"):
|
59
|
+
response.headers["Content-Type"] = "text/html"
|
60
|
+
|
61
|
+
# now also add headers to force no caching
|
62
|
+
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
63
|
+
response.headers["Pragma"] = "no-cache"
|
64
|
+
response.headers["Expires"] = "0"
|
65
|
+
return response
|
66
|
+
|
67
|
+
server = Server(app.wsgi_app)
|
68
|
+
# Watch index.html for changes
|
69
|
+
server.watch(str(fastled_js / "index.html"))
|
70
|
+
# server.watch(str(fastled_js / "index.js"))
|
71
|
+
# server.watch(str(fastled_js / "index.css"))
|
72
|
+
# Start the server
|
73
|
+
server.serve(port=port, debug=True)
|
74
|
+
except KeyboardInterrupt:
|
75
|
+
import _thread
|
76
|
+
|
77
|
+
_thread.interrupt_main()
|
78
|
+
except Exception as e:
|
79
|
+
print(f"Failed to run Flask server: {e}")
|
80
|
+
import _thread
|
81
|
+
|
82
|
+
_thread.interrupt_main()
|
83
|
+
|
84
|
+
|
85
|
+
def run(
|
86
|
+
port: int, cwd: Path, certfile: Path | None = None, keyfile: Path | None = None
|
87
|
+
) -> None:
|
88
|
+
"""Run the Flask server."""
|
89
|
+
try:
|
90
|
+
_run_flask_server(cwd, port, certfile, keyfile)
|
91
|
+
import warnings
|
92
|
+
|
93
|
+
warnings.warn("Flask server has stopped")
|
94
|
+
except KeyboardInterrupt:
|
95
|
+
import _thread
|
96
|
+
|
97
|
+
_thread.interrupt_main()
|
98
|
+
pass
|
99
|
+
|
100
|
+
|
101
|
+
def parse_args() -> argparse.Namespace:
|
102
|
+
"""Parse the command line arguments."""
|
103
|
+
parser = argparse.ArgumentParser(
|
104
|
+
description="Open a browser to the fastled_js directory"
|
105
|
+
)
|
106
|
+
parser.add_argument(
|
107
|
+
"fastled_js", type=Path, help="Path to the fastled_js directory"
|
108
|
+
)
|
109
|
+
parser.add_argument(
|
110
|
+
"--port",
|
111
|
+
"-p",
|
112
|
+
type=int,
|
113
|
+
required=True,
|
114
|
+
help="Port to run the server on (default: %(default)s)",
|
115
|
+
)
|
116
|
+
parser.add_argument(
|
117
|
+
"--certfile",
|
118
|
+
type=Path,
|
119
|
+
help="Path to the SSL certificate file for HTTPS",
|
120
|
+
)
|
121
|
+
parser.add_argument(
|
122
|
+
"--keyfile",
|
123
|
+
type=Path,
|
124
|
+
help="Path to the SSL key file for HTTPS",
|
125
|
+
)
|
126
|
+
return parser.parse_args()
|
127
|
+
|
128
|
+
|
129
|
+
def run_flask_server_process(
|
130
|
+
port: int,
|
131
|
+
cwd: Path | None = None,
|
132
|
+
certfile: Path | None = None,
|
133
|
+
keyfile: Path | None = None,
|
134
|
+
) -> Process:
|
135
|
+
"""Run the Flask server in a separate process."""
|
136
|
+
cwd = cwd or Path(".")
|
137
|
+
process = Process(
|
138
|
+
target=run,
|
139
|
+
args=(port, cwd, certfile, keyfile),
|
140
|
+
)
|
141
|
+
process.start()
|
142
|
+
return process
|
143
|
+
|
144
|
+
|
145
|
+
def main() -> None:
|
146
|
+
"""Main function."""
|
147
|
+
args = parse_args()
|
148
|
+
run(args.port, args.fastled_js, args.certfile, args.keyfile)
|
149
|
+
|
150
|
+
|
151
|
+
if __name__ == "__main__":
|
152
|
+
main()
|
@@ -1,8 +1,34 @@
|
|
1
1
|
import argparse
|
2
2
|
import importlib.resources as pkg_resources
|
3
|
+
from dataclasses import dataclass
|
4
|
+
from multiprocessing import Process
|
3
5
|
from pathlib import Path
|
4
6
|
|
5
7
|
from fastled.server_fastapi_cli import run_fastapi_server_process
|
8
|
+
from fastled.server_flask import run_flask_server_process
|
9
|
+
|
10
|
+
|
11
|
+
def run_server_process(
|
12
|
+
port: int, cwd: Path, certfile: Path | None = None, keyfile: Path | None = None
|
13
|
+
) -> Process:
|
14
|
+
"""Run the server in a separate process."""
|
15
|
+
if True:
|
16
|
+
# Use Flask server
|
17
|
+
process = run_flask_server_process(
|
18
|
+
port=port,
|
19
|
+
cwd=cwd,
|
20
|
+
certfile=certfile,
|
21
|
+
keyfile=keyfile,
|
22
|
+
)
|
23
|
+
else:
|
24
|
+
# Use FastAPI server
|
25
|
+
process = run_fastapi_server_process(
|
26
|
+
port=port,
|
27
|
+
cwd=cwd,
|
28
|
+
certfile=certfile,
|
29
|
+
keyfile=keyfile,
|
30
|
+
)
|
31
|
+
return process
|
6
32
|
|
7
33
|
|
8
34
|
def get_asset_path(filename: str) -> Path | None:
|
@@ -16,12 +42,12 @@ def get_asset_path(filename: str) -> Path | None:
|
|
16
42
|
return None
|
17
43
|
|
18
44
|
|
19
|
-
def
|
45
|
+
def start_process(
|
20
46
|
path: Path,
|
21
47
|
port: int,
|
22
48
|
certfile: Path | None = None,
|
23
49
|
keyfile: Path | None = None,
|
24
|
-
) ->
|
50
|
+
) -> Process:
|
25
51
|
"""Run the server, using package assets if explicit paths are not provided"""
|
26
52
|
# Use package resources if no explicit path
|
27
53
|
if certfile is None:
|
@@ -31,16 +57,25 @@ def run(
|
|
31
57
|
|
32
58
|
# _run_flask_server(path, port, certfile, keyfile)
|
33
59
|
# run_fastapi_server_process(port=port, path=path, certfile=certfile, keyfile=keyfile)
|
34
|
-
proc =
|
35
|
-
try:
|
36
|
-
|
37
|
-
except KeyboardInterrupt:
|
38
|
-
|
60
|
+
proc = run_server_process(port=port, cwd=path)
|
61
|
+
# try:
|
62
|
+
# proc.join()
|
63
|
+
# except KeyboardInterrupt:
|
64
|
+
# import _thread
|
65
|
+
|
66
|
+
# _thread.interrupt_main()
|
67
|
+
return proc
|
39
68
|
|
40
|
-
_thread.interrupt_main()
|
41
69
|
|
70
|
+
@dataclass
|
71
|
+
class Args:
|
72
|
+
fastled_js: Path
|
73
|
+
port: int
|
74
|
+
cert: Path | None
|
75
|
+
key: Path | None
|
42
76
|
|
43
|
-
|
77
|
+
|
78
|
+
def parse_args() -> Args:
|
44
79
|
parser = argparse.ArgumentParser(
|
45
80
|
description="Open a browser to the fastled_js directory"
|
46
81
|
)
|
@@ -60,21 +95,37 @@ def parse_args() -> argparse.Namespace:
|
|
60
95
|
parser.add_argument(
|
61
96
|
"--key", type=Path, help="(Optional) Path to SSL private key (PEM format)"
|
62
97
|
)
|
63
|
-
|
98
|
+
args = parser.parse_args()
|
99
|
+
out: Args = Args(
|
100
|
+
fastled_js=args.fastled_js,
|
101
|
+
port=args.port,
|
102
|
+
cert=args.cert,
|
103
|
+
key=args.key,
|
104
|
+
)
|
105
|
+
if args.fastled_js is None:
|
106
|
+
raise ValueError("fastled_js directory is required")
|
107
|
+
return out
|
64
108
|
|
65
109
|
|
66
110
|
def main() -> None:
|
67
|
-
args = parse_args()
|
111
|
+
args: Args = parse_args()
|
68
112
|
fastled_js: Path = args.fastled_js
|
69
113
|
port: int = args.port
|
70
114
|
cert: Path | None = args.cert
|
71
115
|
key: Path | None = args.key
|
72
|
-
|
116
|
+
proc = start_process(
|
73
117
|
path=fastled_js,
|
74
118
|
port=port,
|
75
119
|
certfile=cert,
|
76
120
|
keyfile=key,
|
77
121
|
)
|
122
|
+
try:
|
123
|
+
proc.join()
|
124
|
+
except KeyboardInterrupt:
|
125
|
+
import _thread
|
126
|
+
|
127
|
+
_thread.interrupt_main()
|
128
|
+
pass
|
78
129
|
|
79
130
|
|
80
131
|
if __name__ == "__main__":
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.64
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -23,6 +23,8 @@ Requires-Dist: fastapi>=0.115.12
|
|
23
23
|
Requires-Dist: uvicorn>=0.34.2
|
24
24
|
Requires-Dist: pywebview>=5.4
|
25
25
|
Requires-Dist: watchfiles>=1.0.5
|
26
|
+
Requires-Dist: Flask>=3.0.0
|
27
|
+
Requires-Dist: livereload
|
26
28
|
Dynamic: home-page
|
27
29
|
Dynamic: license-file
|
28
30
|
Dynamic: maintainer
|
@@ -41,7 +43,7 @@ Dynamic: maintainer
|
|
41
43
|
|
42
44
|
|
43
45
|
|
44
|
-
## Compile your FastLED sketch and run it on the Browser
|
46
|
+
## Compile your FastLED sketch and run it on the Browser!!
|
45
47
|
|
46
48
|

|
47
49
|
|
@@ -298,6 +300,7 @@ Q: How can I get the compiled size of my FastLED sketch smaller?
|
|
298
300
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
299
301
|
|
300
302
|
|
303
|
+
|
301
304
|
# Revisions
|
302
305
|
* 1.2.31 - Bunch of fixes and ease of use while compiling code in the repo.
|
303
306
|
* 1.2.22 - Prefer to use `live-server` from npm. If npm exists on the system then do a background install of `live-server` for next run.
|
@@ -58,6 +58,7 @@ compiler/wasm_compiler_flags.py
|
|
58
58
|
compiler/extra/100dots.html
|
59
59
|
compiler/extra/demo_threejs.html
|
60
60
|
compiler/extra/micdemo.html
|
61
|
+
compiler/extra/mp3upload.html
|
61
62
|
compiler/extra/webgl_postprocessing_unreal_bloom.html
|
62
63
|
compiler/libcompile/CMakeLists.txt
|
63
64
|
src/fastled/__init__.py
|
@@ -74,13 +75,14 @@ src/fastled/keyboard.py
|
|
74
75
|
src/fastled/keyz.py
|
75
76
|
src/fastled/live_client.py
|
76
77
|
src/fastled/open_browser.py
|
77
|
-
src/fastled/open_browser2.py
|
78
78
|
src/fastled/parse_args.py
|
79
79
|
src/fastled/paths.py
|
80
80
|
src/fastled/project_init.py
|
81
81
|
src/fastled/select_sketch_directory.py
|
82
82
|
src/fastled/server_fastapi.py
|
83
83
|
src/fastled/server_fastapi_cli.py
|
84
|
+
src/fastled/server_flask.py
|
85
|
+
src/fastled/server_start.py
|
84
86
|
src/fastled/settings.py
|
85
87
|
src/fastled/sketch.py
|
86
88
|
src/fastled/spinner.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|