Add EULA acceptance popup when starting server
This commit is contained in:
parent
4b40fa65d4
commit
2160613163
7 changed files with 80 additions and 10 deletions
|
@ -69,7 +69,7 @@ $(document).ready(function () {
|
|||
$('#save_file').append(' <i class="fa fa-spinner fa fa-spin"></i>').addClass('disabled');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/server/{{ $server->uuidShort }}/ajax/files/save',
|
||||
url: '{{ route('server.files.save', $server->uuidShort) }}',
|
||||
headers: { 'X-CSRF-Token': '{{ csrf_token() }}' },
|
||||
data: {
|
||||
file: fileName,
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/server/{{ $server->uuidShort }}/ajax/files/directory-list',
|
||||
url: '{{ route('server.files.directory-list', $server->uuidShort) }}',
|
||||
headers: { 'X-CSRF-Token': '{{ csrf_token() }}' },
|
||||
data: { directory: urlDirectory }
|
||||
}).done(function (data) {
|
||||
|
|
|
@ -112,6 +112,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if($server->a_serviceFile === 'minecraft')
|
||||
<script src="{{ route('server.js', [$server->uuidShort, 'minecraft/eula.js']) }}"></script>
|
||||
@endif
|
||||
<script>
|
||||
$(window).load(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
|
|
42
resources/views/server/js/minecraft/eula.blade.php
Normal file
42
resources/views/server/js/minecraft/eula.blade.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
$(window).load(function () {
|
||||
socket.on('console', function (data) {
|
||||
if (data.line.indexOf('You need to agree to the EULA in order to run the server') > -1) {
|
||||
swal({
|
||||
title: 'EULA Acceptance',
|
||||
text: 'By pressing \'I Accept\' below you are indicating your agreement to the <a href="https://account.mojang.com/documents/minecraft_eula" target="_blank">Mojang EULA</a>.',
|
||||
type: 'info',
|
||||
html: true,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: true,
|
||||
cancelButtonText: 'I do not Accept',
|
||||
confirmButtonText: 'I Accept',
|
||||
closeOnConfirm: false,
|
||||
showLoaderOnConfirm: true
|
||||
}, function () {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '{{ route('server.files.save', $server->uuidShort) }}',
|
||||
headers: { 'X-CSRF-Token': '{{ csrf_token() }}' },
|
||||
data: {
|
||||
file: 'eula.txt',
|
||||
contents: 'eula=true'
|
||||
}
|
||||
}).done(function (data) {
|
||||
$('[data-attr="power"][data-action="start"]').trigger('click');
|
||||
swal({
|
||||
type: 'success',
|
||||
title: '',
|
||||
text: 'The EULA for this server has been accepted, restarting server now.',
|
||||
});
|
||||
}).fail(function (jqXHR) {
|
||||
console.error(jqXHR);
|
||||
swal({
|
||||
title: 'Whoops!',
|
||||
text: 'An error occured while attempting to set the EULA as accepted: ' . jqXHR.responseJSON.error,
|
||||
type: 'error'
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue