Minor changes to support better dynamic JS loading

This commit is contained in:
Dane Everitt 2016-09-30 20:53:08 -04:00
parent 332da79b89
commit 71245cb531
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 4 additions and 4 deletions

View file

@ -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');

View file

@ -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', '.*');

View 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 () {