Support folders within folders for JS path
This commit is contained in:
parent
24d49be150
commit
77198b48df
|
@ -8,3 +8,6 @@ composer.lock
|
||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
Vagrantfile
|
Vagrantfile
|
||||||
Vagrantfile
|
Vagrantfile
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
.babelrc
|
|
@ -38,6 +38,8 @@ use Pterodactyl\Repositories\ServerRepository;
|
||||||
use Pterodactyl\Http\Controllers\Controller;
|
use Pterodactyl\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
|
|
||||||
class ServerController extends Controller
|
class ServerController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -54,10 +56,19 @@ class ServerController extends Controller
|
||||||
public function getJavascript(Request $request, $uuid, $folder, $file)
|
public function getJavascript(Request $request, $uuid, $folder, $file)
|
||||||
{
|
{
|
||||||
$server = Models\Server::getByUUID($uuid);
|
$server = Models\Server::getByUUID($uuid);
|
||||||
return response()->view('server.js.' . $folder . '.' . basename($file, '.js'), [
|
|
||||||
'server' => $server,
|
$info = pathinfo($file);
|
||||||
'node' => Models\Node::find($server->node)
|
$routeFile = str_replace('/', '.', $info['dirname']) . '.' . $info['filename'];
|
||||||
])->header('Content-Type', 'application/javascript');
|
try {
|
||||||
|
return response()->view('server.js.' . $folder . '.' . $routeFile, [
|
||||||
|
'server' => $server,
|
||||||
|
'node' => Models\Node::find($server->node)
|
||||||
|
])->header('Content-Type', 'application/javascript');
|
||||||
|
} catch (InvalidArgumentException $ex) {
|
||||||
|
return abort(404);
|
||||||
|
} catch (\Exception $ex) {
|
||||||
|
throw $ex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue