share hashcode implementation

This commit is contained in:
Yeicor
2024-02-24 11:00:34 +01:00
parent 69b1da711e
commit 872d8e5e03
2 changed files with 17 additions and 11 deletions

View File

@@ -162,7 +162,7 @@ class Server:
"""Publishes any single-file GLTF object to the server (GLB format recommended)."""
start = time.time()
# Precompute the info and send it to the client as if it was a CAD object
precomputed_info = self._show_common(name, hashlib.md5(gltf).hexdigest(), start)
precomputed_info = self._show_common(name, _hashcode(gltf, **kwargs), start)
# Also pre-populate the GLTF data for the object API
publish_to = BufferedPubSub[bytes]()
publish_to.publish_nowait(gltf)
@@ -191,7 +191,7 @@ class Server:
# Convert Z-up (OCCT convention) to Y-up (GLTF convention)
obj = Shape(obj).rotate(Axis.X, -90).wrapped
self._show_common(name, _hashcode(obj), start, obj)
self._show_common(name, _hashcode(obj, **kwargs), start, obj)
async def _api_object(self, request: web.Request) -> web.Response:
"""Returns the object file with the matching name, building it if necessary."""