Skip to content

Commit 70db461

Browse files
committed
Start push of service changes.
Changes the way service files are stored and allows for much easier updates in the future that won’t affect custom services. Also stores more configurations in the database to make life easier for everyone.
1 parent a5577f0 commit 70db461

19 files changed

+1457
-596
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Http\Controllers\Admin;
26+
27+
use Log;
28+
use Alert;
29+
use Storage;
30+
use Pterodactyl\Models;
31+
use Illuminate\Http\Request;
32+
use Pterodactyl\Exceptions\DisplayException;
33+
use Pterodactyl\Http\Controllers\Controller;
34+
use Pterodactyl\Repositories\OptionRepository;
35+
use Pterodactyl\Exceptions\DisplayValidationException;
36+
37+
class OptionController extends Controller
38+
{
39+
/**
40+
* Display option overview page.
41+
*
42+
* @param Request $request
43+
* @param int $id
44+
* @return \Illuminate\View\View
45+
*/
46+
public function viewConfiguration(Request $request, $id)
47+
{
48+
return view('admin.services.options.view', ['option' => Models\ServiceOption::findOrFail($id)]);
49+
}
50+
51+
public function editConfiguration(Request $request, $id)
52+
{
53+
$repo = new OptionRepository;
54+
55+
try {
56+
$repo->update($id, $request->intersect([
57+
'name', 'description', 'tag', 'docker_image', 'startup',
58+
'config_from', 'config_stop', 'config_logs', 'config_files', 'config_startup',
59+
]));
60+
61+
Alert::success('Service option configuration has been successfully updated.')->flash();
62+
} catch (DisplayValidationException $ex) {
63+
return redirect()->route('admin.services.option.view', $id)->withErrors(json_decode($ex->getMessage()));
64+
} catch (\Exception $ex) {
65+
Log::error($ex);
66+
Alert::danger('An unhandled exception occurred while attempting to update this service option. This error has been logged.')->flash();
67+
}
68+
69+
return redirect()->route('admin.services.option.view', $id);
70+
}
71+
}

0 commit comments

Comments
 (0)