MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / actionUiMedia

Method actionUiMedia

plugins/UiConfig/UiConfigPlugin.py:34–51  ·  view source on GitHub ↗
(self, path, *args, **kwargs)

Source from the content-addressed store, hash-verified

32 )])
33
34 def actionUiMedia(self, path, *args, **kwargs):
35 if path.startswith("/uimedia/plugins/uiconfig/"):
36 file_path = path.replace("/uimedia/plugins/uiconfig/", plugin_dir + "/media/")
37 if config.debug and (file_path.endswith("all.js") or file_path.endswith("all.css")):
38 # If debugging merge *.css to all.css and *.js to all.js
39 from Debug import DebugMedia
40 DebugMedia.merge(file_path)
41
42 if file_path.endswith("js"):
43 data = _.translateData(open(file_path).read(), mode="js").encode("utf8")
44 elif file_path.endswith("html"):
45 data = _.translateData(open(file_path).read(), mode="html").encode("utf8")
46 else:
47 data = open(file_path, "rb").read()
48
49 return self.actionFile(file_path, file_obj=io.BytesIO(data), file_size=len(data))
50 else:
51 return super(UiRequestPlugin, self).actionUiMedia(path)
52
53
54@PluginManager.registerTo("UiWebsocket")

Callers

nothing calls this directly

Calls 3

actionFileMethod · 0.95
translateDataMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected