Implement base service file modification through panel

This commit is contained in:
Dane Everitt 2016-11-09 17:58:14 -05:00
parent b8a6a15b08
commit cfd5e0e854
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
19 changed files with 855 additions and 1 deletions

View File

@ -0,0 +1,73 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Console\Commands;
use Carbon;
use Storage;
use Illuminate\Console\Command;
class CleanServiceBackup extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'pterodactyl:cleanservices';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Cleans .bak files assocaited with service backups whene editing files through the panel.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$files = Storage::files('services/.bak');
foreach($files as $file) {
$lastModified = Carbon::createFromTimestamp(Storage::lastModified($file));
if ($lastModified->diffInMinutes(Carbon::now()) > 5) {
$this->info('Deleting ' . $file);
Storage::delete($file);
}
}
}
}

View File

@ -21,6 +21,7 @@ class Kernel extends ConsoleKernel
\Pterodactyl\Console\Commands\ClearTasks::class,
\Pterodactyl\Console\Commands\ClearServices::class,
\Pterodactyl\Console\Commands\UpdateEmailSettings::class,
\Pterodactyl\Console\Commands\CleanServiceBackup::class,
];
/**

View File

@ -27,6 +27,7 @@ use Alert;
use DB;
use Log;
use Validator;
use Storage;
use Pterodactyl\Models;
use Pterodactyl\Repositories\ServiceRepository;
@ -274,4 +275,36 @@ class ServiceController extends Controller
return redirect()->route('admin.services.option', [$service, $option]);
}
public function getConfiguration(Request $request, $serviceId)
{
$service = Models\Service::findOrFail($serviceId);
return view('admin.services.config', [
'service' => $service,
'contents' => [
'json' => Storage::get('services/' . $service->file . '/main.json'),
'index' => Storage::get('services/' . $service->file . '/index.js')
]
]);
}
public function postConfiguration(Request $request, $serviceId)
{
try {
$repo = new ServiceRepository\Service;
$repo->updateFile($serviceId, $request->except([
'_token'
]));
return response('', 204);
} catch (DisplayException $ex) {
return response()->json([
'error' => $ex->getMessage()
], 503);
} catch (\Exception $ex) {
Log::error($ex);
return response()->json([
'error' => 'An error occured while attempting to save the file.'
], 503);
}
}
}

View File

@ -379,6 +379,15 @@ class AdminRoutes {
'uses' => 'Admin\ServiceController@deleteService'
]);
$router->get('/service/{id}/configuration', [
'as' => 'admin.services.service.config',
'uses' => 'Admin\ServiceController@getConfiguration'
]);
$router->post('/service/{id}/configuration', [
'uses' => 'Admin\ServiceController@postConfiguration'
]);
$router->get('/service/{service}/option/new', [
'as' => 'admin.services.option.new',
'uses' => 'Admin\ServiceController@newOption'

54
app/Models/Checksum.php Normal file
View File

@ -0,0 +1,54 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Model;
class Checksum extends Model
{
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'checksums';
/**
* Fields that are not mass assignable.
*
* @var array
*/
protected $guarded = ['id', 'created_at', 'updated_at'];
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'service' => 'integer'
];
}

View File

@ -26,6 +26,7 @@ namespace Pterodactyl\Repositories\ServiceRepository;
use DB;
use Validator;
use Uuid;
use Storage;
use Pterodactyl\Models;
use Pterodactyl\Services\UuidService;
@ -110,4 +111,44 @@ class Service
}
}
public function updateFile($id, array $data)
{
$service = Models\Service::findOrFail($id);
$validator = Validator::make($data, [
'file' => 'required|in:index,main',
'contents' => 'required|string'
]);
if ($validator->fails()) {
throw new DisplayValidationException($validator->errors());
}
$filename = ($data['file'] === 'main') ? 'main.json' : 'index.js';
$filepath = 'services/' . $service->file . '/' . $filename;
$backup = 'services/.bak/' . str_random(12) . '.bak';
DB::beginTransaction();
try {
Storage::move($filepath, $backup);
Storage::put($filepath, $data['contents']);
$checksum = Models\Checksum::firstOrNew([
'service' => $service->id,
'filename' => $filename
]);
$checksum->checksum = sha1_file(storage_path('app/' . $filepath));
$checksum->save();
DB::commit();
} catch(\Exception $ex) {
DB::rollback();
Storage::move($backup, $filepath);
throw $ex;
}
}
}

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddChecksumsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('checksums', function (Blueprint $table) {
$table->increments('id');
$table->integer('service')->unsigned();
$table->string('filename');
$table->char('checksum', 40);
$table->timestamps();
$table->foreign('service')->references('id')->on('services');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('checksums');
}
}

View File

@ -0,0 +1,180 @@
{{-- Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com> --}}
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
{{-- of this software and associated documentation files (the "Software"), to deal --}}
{{-- in the Software without restriction, including without limitation the rights --}}
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
{{-- copies of the Software, and to permit persons to whom the Software is --}}
{{-- furnished to do so, subject to the following conditions: --}}
{{-- The above copyright notice and this permission notice shall be included in all --}}
{{-- copies or substantial portions of the Software. --}}
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
{{-- SOFTWARE. --}}
@extends('layouts.admin')
@section('title')
Manage Service Configuration
@endsection
@section('content')
<div class="col-md-12">
<ul class="breadcrumb">
<li><a href="/admin">Admin Control</a></li>
<li><a href="/admin/services">Services</a></li>
<li><a href="{{ route('admin.services.service', $service->id) }}">{{ $service->name }}</a></li>
<li class="active">Configuration</li>
</ul>
<h3 class="nopad">Service Configuration</h3><hr />
<ul class="nav nav-tabs tabs_with_panel" id="config_tabs">
<li class="active"><a href="#tab_main" data-toggle="tab">main.json</a></li>
<li><a href="#tab_index" data-toggle="tab">index.js</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_main">
<div class="panel panel-default">
<div class="panel-heading"></div>
<div class="panel-body" style="padding-top:0;">
<div class="row" style="border-bottom:1px solid #ccc;">
<div class="col-md-12" style="margin:0; padding:0;">
<div id="editor_json" style="height:500px;">{{ $contents['json'] }}</div>
</div>
</div>
<div class="row" style="margin-top:15px;">
<div class="col-md-12">
<button type="submit" id="save_json" class="btn btn-sm btn-success">Save Configuration</button>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="tab_index">
<div class="panel panel-default">
<div class="panel-heading"></div>
<div class="panel-body" style="padding-top:0;">
<div class="row" style="border-bottom:1px solid #ccc;">
<div class="col-md-12" style="margin:0; padding:0;">
<div id="editor_index" style="height:500px;">{{ $contents['index'] }}</div>
</div>
</div>
<div class="row" style="margin-top:15px;">
<div class="col-md-12">
<button type="submit" id="save_index" class="btn btn-sm btn-success">Save Scripting</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{!! Theme::js('js/vendor/ace/ace.js') !!}
{!! Theme::js('js/vendor/ace/ext-modelist.js') !!}
<script>
$(document).ready(function () {
$('#sidebar_links').find("a[href='/admin/services']").addClass('active');
const JsonEditor = ace.edit('editor_json');
const IndexEditor = ace.edit('editor_index');
const Modelist = ace.require('ace/ext/modelist')
JsonEditor.setTheme('ace/theme/chrome');
JsonEditor.getSession().setMode('ace/mode/json');
JsonEditor.getSession().setUseWrapMode(true);
JsonEditor.setShowPrintMargin(false);
IndexEditor.setTheme('ace/theme/chrome');
IndexEditor.getSession().setMode('ace/mode/javascript');
IndexEditor.getSession().setUseWrapMode(true);
IndexEditor.setShowPrintMargin(false);
JsonEditor.commands.addCommand({
name: 'save',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
saveConfig();
},
readOnly: false
});
IndexEditor.commands.addCommand({
name: 'save',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
saveIndex();
},
readOnly: false
});
$('#save_json').on('click', function (e) {
e.preventDefault();
saveConfig();
});
$('#save_index').on('click', function (e) {
e.preventDefault();
saveIndex();
});
function saveConfig() {
$('#save_json').append(' <i class="fa fa-spinner fa fa-spin"></i>').addClass('disabled');
$.ajax({
type: 'POST',
url: '{{ route('admin.services.service.config', $service->id) }}',
headers: { 'X-CSRF-Token': '{{ csrf_token() }}' },
data: {
file: 'main',
contents: JsonEditor.getValue()
}
}).done(function (data) {
$.notify({
message: 'Service configuration file has been saved successfully.'
}, {
type: 'success'
});
}).fail(function (jqXHR) {
$.notify({
message: jqXHR.responseText
}, {
type: 'danger'
});
}).always(function () {
$('#save_json').html('Save Configuration').removeClass('disabled');
});
}
function saveIndex() {
$('#save_json').append(' <i class="fa fa-spinner fa fa-spin"></i>').addClass('disabled');
$.ajax({
type: 'POST',
url: '{{ route('admin.services.service.config', $service->id) }}',
headers: { 'X-CSRF-Token': '{{ csrf_token() }}' },
data: {
file: 'index',
contents: IndexEditor.getValue()
}
}).done(function (data) {
$.notify({
message: 'Service scripting file has been saved successfully.'
}, {
type: 'success'
});
}).fail(function (jqXHR) {
$.notify({
message: jqXHR.responseText
}, {
type: 'danger'
});
}).always(function () {
$('#save_json').html('Save Scripting').removeClass('disabled');
});
}
});
</script>
@endsection

View File

@ -106,6 +106,7 @@
<div class="col-md-12">
{!! csrf_field() !!}
<input type="submit" class="btn btn-sm btn-primary" value="Save Changes" />
<a href="{{ route('admin.services.service.config', $service->id) }}"><button type="button" class="pull-right btn btn-sm btn-default">Manage Configuration</button></a>
</div>
</div>
</form>

View File

@ -35,6 +35,23 @@
{!! Theme::js('js/vendor/sweetalert/sweetalert.min.js') !!}
{!! Theme::js('js/vendor/fuelux/fuelux.min.js') !!}
{!! Theme::js('js/admin.min.js') !!}
{!! Theme::js('js/bootstrap-notify.min.js') !!}
<script>
$(document).ready(function () {
$.notifyDefaults({
placement: {
from: 'bottom',
align: 'right'
},
newest_on_top: true,
delay: 2000,
animate: {
enter: 'animated fadeInUp',
exit: 'animated fadeOutDown'
}
});
});
</script>
@show
<title>{{ Settings::get('company') }} - @yield('title')</title>
</head>

View File

@ -1,2 +1,4 @@
*
!.gitignore
!.gitignore
!services/*
services/.bak/*

View File

@ -0,0 +1,60 @@
'use strict';
/**
* Pterodactyl - Daemon
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const rfr = require('rfr');
const _ = require('lodash');
const Configuration = rfr('src/services/minecraft/main.json');
const Core = rfr('src/services/index.js');
class Service extends Core {
constructor(server) {
super(server, Configuration);
}
onPreflight(next) {
return super.onPreflight(next);
}
onStart(next) {
return super.onStart(next);
}
onConsole(data) {
// Hide the output spam from Bungeecord getting pinged.
if (_.endsWith(data, '<-> InitialHandler has connected')) return;
return super.onConsole(data);
}
onStop(next) {
return super.onStop(next);
}
doQuery(next) {
return super.doQuery(next);
}
}
module.exports = Service;

View File

@ -0,0 +1,75 @@
{
"latest": {
"tag": "^(latest)$",
"symlink": "vanilla"
},
"vanilla": {
"tag": "^(vanilla){1}(-[\\w\\d.-]+)?$",
"startup": {
"done": ")! For help, type ",
"userInteraction": [
"Go to eula.txt for more info."
]
},
"stop": "stop",
"configs": {
"server.properties": {
"parser": "properties",
"find": {
"server-ip": "0.0.0.0",
"enable-query": "true",
"server-port": "{{ build.default.port }}",
"query.port": "{{ build.default.port }}"
}
}
},
"log": {
"custom": false,
"location": "logs/latest.log"
},
"query": "minecraftping"
},
"spigot": {
"tag": "^(spigot)$",
"symlink": "vanilla",
"configs": {
"spigot.yml": {
"parser": "yaml",
"find": {
"settings.restart-on-crash": "false"
}
}
}
},
"bungeecord": {
"tag": "^(bungeecord)$",
"startup": {
"done": "Listening on "
},
"stop": "end",
"configs": {
"config.yml": {
"parser": "yaml",
"find": {
"listeners[0].query_enabled": true,
"listeners[0].query_port": "{{ build.default.port }}",
"listeners[0].host": "0.0.0.0:{{ build.default.port }}"
}
}
},
"log": {
"custom": false,
"location": "proxy.log.0"
},
"query": "minecraftping"
},
"sponge": {
"tag": "^(sponge)$",
"symlink": "vanilla",
"startup": {
"userInteraction": [
"You need to agree to the EULA"
]
}
}
}

View File

@ -0,0 +1,57 @@
'use strict';
/**
* Pterodactyl - Daemon
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const rfr = require('rfr');
const Configuration = rfr('src/services/srcds/main.json');
const Core = rfr('src/services/index.js');
class Service extends Core {
constructor(server) {
super(server, Configuration);
}
onPreflight(next) {
return super.onPreflight(next);
}
onStart(next) {
return super.onStart(next);
}
onConsole(data) {
return super.onConsole(data);
}
onStop(next) {
return super.onStop(next);
}
doQuery(next) {
return super.doQuery(next);
}
}
module.exports = Service;

View File

@ -0,0 +1,25 @@
{
"srcds": {
"tag": "^(srcds)$",
"startup": {
"done": "Assigned anonymous gameserver Steam ID",
"userInteraction": []
},
"stop": "quit",
"configs": {},
"log": {
"custom": true,
"location": "logs/latest.log"
},
"query": "protocol-valve"
},
"ark": {
"tag": "^(ark)$",
"symlink": "srcds",
"startup": {
"done": "Setting breakpad minidump AppID"
},
"stop": "^C",
"query": "none"
}
}

View File

@ -0,0 +1,57 @@
'use strict';
/**
* Pterodactyl - Daemon
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const rfr = require('rfr');
const Configuration = rfr('src/services/terraria/main.json');
const Core = rfr('src/services/index.js');
class Service extends Core {
constructor(server) {
super(server, Configuration);
}
onPreflight(next) {
return super.onPreflight(next);
}
onStart(next) {
return super.onStart(next);
}
onConsole(data) {
return super.onConsole(data);
}
onStop(next) {
return super.onStop(next);
}
doQuery(next) {
return super.doQuery(next);
}
}
module.exports = Service;

View File

@ -0,0 +1,24 @@
{
"tshock": {
"tag": "^(tshock)$",
"startup": {
"done": "Type 'help' for a list of commands",
"userInteraction": []
},
"stop": "exit",
"configs": {
"tshock/config.json": {
"parser": "json",
"find": {
"ServerPort": "{{ build.default.port }}",
"MaxSlots": "{{ build.env.MAX_SLOTS }}"
}
}
},
"log": {
"custom": false,
"location": "ServerLog.txt"
},
"query": "none"
}
}

View File

@ -0,0 +1,57 @@
'use strict';
/**
* Pterodactyl - Daemon
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
const rfr = require('rfr');
const Configuration = rfr('src/services/voice/main.json');
const Core = rfr('src/services/index.js');
class Service extends Core {
constructor(server) {
super(server, Configuration);
}
onPreflight(next) {
return super.onPreflight(next);
}
onStart(next) {
return super.onStart(next);
}
onConsole(data) {
return super.onConsole(data);
}
onStop(next) {
return super.onStop(next);
}
doQuery(next) {
return super.doQuery(next);
}
}
module.exports = Service;

View File

@ -0,0 +1,52 @@
{
"mumble": {
"tag": "^(mumble)$",
"startup": {
"done": "Server listening on",
"userInteraction": [
"Generating new server certificate"
]
},
"stop": "^C",
"configs": {
"murmur.ini": {
"parser": "ini",
"find": {
"logfile": "murmur.log",
"port": "{{ build.default.port }}",
"host": "0.0.0.0",
"users": "{{ build.env.MAX_USERS }}"
}
}
},
"log": {
"custom": true,
"location": "logs/murmur.log"
},
"query": "mumbleping"
},
"teamspeak": {
"tag": "^(ts3)$",
"startup": {
"done": "listening on 0.0.0.0:",
"userInteraction": []
},
"stop": "^C",
"configs": {
"ts3server.ini": {
"parser": "ini",
"find": {
"default_voice_port": "{{ build.default.port }}",
"voice_ip": "0.0.0.0",
"query_port": "{{ build.default.port }}",
"query_ip": "0.0.0.0"
}
}
},
"log": {
"custom": true,
"location": "logs/ts3.log"
},
"query": "none"
}
}