Hi, Thanks for creating this project :)
I've noticed that there are two remote scripts called, if a graph gets rendered. This is somewhat problematic regarding GDPR-Compliance.
In order to fix this I've created a local cache, which downloads the file in order to serve them locally.
I've added this method to Render::class:
public static function cache($filepath, $source): void {
if (File::exists($filepath) === false) {
if (File::exists(dirname($filepath)) === false) {
File::makeDirectory(dirname($filepath), 677, true);
}
File::put($filepath, file_get_contents($source));
}
}
.. and adjusted Render::html a bit, to use the cache instead:
$jqueryPath = public_path("js/jquery-3.4.1.slim.min.js");
$assetPath = public_path("js/mermaid@{$version}/dist/mermaid.js");
self::cache($jqueryPath, "https://code.jquery.com/jquery-3.4.1.slim.min.js");
self::cache($assetPath, "https://unpkg.com/mermaid@{$version}/dist/mermaid.js");
$html = [
' <script src="' . asset("js/jquery-3.4.1.slim.min.js") . '"></script>',
' <script src="' . asset("js/mermaid@{$version}/dist/mermaid.js") . '"></script>',
...
];
Kind regards & happy coding,
Hi, Thanks for creating this project :)
I've noticed that there are two remote scripts called, if a graph gets rendered. This is somewhat problematic regarding GDPR-Compliance.
In order to fix this I've created a local cache, which downloads the file in order to serve them locally.
I've added this method to
Render::class:.. and adjusted
Render::htmla bit, to use the cache instead:Kind regards & happy coding,