mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 06:13:45 +02:00
Implement base service file modification through panel
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user