Skip to content

Commit 99dd555

Browse files
author
SenkaWolf
committed
Exporting ShareX Settings Fix
Exporting ShareX settings now work for the latest version of ShareX 16.1.0. "unsupported custom uploader" Error Fix
1 parent 7a880be commit 99dd555

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

app/Controllers/ClientController.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,38 @@ class ClientController extends Controller
2121
public function getShareXConfig(Request $request, Response $response, int $id): Response
2222
{
2323
$user = make(UserRepository::class)->get($request, $id, true);
24-
24+
2525
if (!$user->token) {
2626
$this->session->alert(lang('no_upload_token'), 'danger');
27-
27+
2828
return redirect($response, $request->getHeaderLine('Referer'));
2929
}
30-
30+
31+
$fileBaseName = $user->username . '-ShareX'; // Base file name without extension
32+
$fileName = $fileBaseName . '.sxcu'; // Full file name with extension
33+
3134
$json = [
35+
'Version' => '16.1.0',
36+
'Name' => $fileBaseName,
3237
'DestinationType' => 'ImageUploader, TextUploader, FileUploader',
38+
'RequestMethod' => 'POST',
3339
'RequestURL' => route('upload'),
34-
'FileFormName' => 'upload',
40+
'Body' => 'MultipartFormData',
3541
'Arguments' => [
36-
'file' => '$filename$',
37-
'text' => '$input$',
42+
'file' => '{filename}',
43+
'text' => '{input}',
3844
'token' => $user->token,
3945
],
40-
'URL' => '$json:url$',
41-
'ThumbnailURL' => '$json:url$/raw',
42-
'DeletionURL' => '$json:url$/delete/'.$user->token,
46+
'FileFormName' => 'upload',
47+
'URL' => '{json:url}',
48+
'ThumbnailURL' => '{json:url}/raw',
49+
'DeletionURL' => '{json:url}/delete/' . $user->token,
4350
];
44-
51+
4552
return json($response, $json, 200, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)
46-
->withHeader('Content-Disposition', 'attachment;filename="'.$user->username.'-ShareX.sxcu"');
53+
->withHeader('Content-Disposition', 'attachment;filename="' . $fileName . '"');
4754
}
55+
4856

4957
/**
5058
* @param Request $request

0 commit comments

Comments
 (0)