Minor changes to support better dynamic JS loading
This commit is contained in:
parent
332da79b89
commit
71245cb531
3 changed files with 4 additions and 4 deletions
|
@ -51,10 +51,10 @@ class ServerController extends Controller
|
|||
//
|
||||
}
|
||||
|
||||
public function getJavascript(Request $request, $uuid, $file)
|
||||
public function getJavascript(Request $request, $uuid, $folder, $file)
|
||||
{
|
||||
$server = Models\Server::getByUUID($uuid);
|
||||
return response()->view('server.js.' . $server->a_serviceFile . '.' . basename($file, '.js'), [
|
||||
return response()->view('server.js.' . $folder . '.' . basename($file, '.js'), [
|
||||
'server' => $server,
|
||||
'node' => Models\Node::find($server->node)
|
||||
])->header('Content-Type', 'application/javascript');
|
||||
|
|
|
@ -167,7 +167,7 @@ class ServerRoutes {
|
|||
// Assorted AJAX Routes
|
||||
$router->group(['prefix' => 'js'], function ($server) use ($router) {
|
||||
// Returns Server Status
|
||||
$router->get('{file}', [
|
||||
$router->get('{folder}/{file}', [
|
||||
'as' => 'server.js',
|
||||
'uses' => 'Server\ServerController@getJavascript'
|
||||
])->where('file', '.*');
|
||||
|
|
|
@ -154,7 +154,7 @@
|
|||
</div>
|
||||
</div>
|
||||
@if($server->a_serviceFile === 'minecraft')
|
||||
<script src="{{ route('server.js', [$server->uuidShort, 'minecraft/eula.js']) }}"></script>
|
||||
<script src="{{ route('server.js', [$server->uuidShort, 'minecraft', 'eula.js']) }}"></script>
|
||||
@endif
|
||||
<script>
|
||||
$(window).load(function () {
|
||||
|
|
Loading…
Reference in a new issue