File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 9
9
use Baraja \Cms \Context ;
10
10
use Baraja \Cms \Helpers ;
11
11
use Baraja \Plugin \Plugin ;
12
+ use Baraja \Url \Url ;
12
13
13
14
/**
14
15
* Smart proxy service for render all plugin components to single javascript.
@@ -36,6 +37,23 @@ public function __construct(
36
37
}
37
38
38
39
40
+ public static function getUrl (string $ file ): string
41
+ {
42
+ if (str_contains ($ file , '.. ' )) {
43
+ throw new \LogicException ('File path " ' . $ file . '" is not safe. ' );
44
+ }
45
+ $ diskPath = __DIR__ . '/../../template/assets/ ' . $ file ;
46
+ if (is_file ($ diskPath ) === false ) {
47
+ throw new \InvalidArgumentException (
48
+ 'Static file " ' . $ file . '" does not exist. '
49
+ . 'Path " ' . $ diskPath . '" given. ' ,
50
+ );
51
+ }
52
+
53
+ return Url::get ()->getBaseUrl () . '/admin/assets/ ' . $ file ;
54
+ }
55
+
56
+
39
57
/**
40
58
* Render dynamic Vue components to requested file.
41
59
*/
You can’t perform that action at this time.
0 commit comments