Skip to content

Commit 280e504

Browse files
committed
Treewide: Adapt some sources
1 parent 4f7f076 commit 280e504

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

Diff for: app/Http/Controllers/proc/convertController.php

+21-15
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function convert(Request $request) {
134134
env('ASPOSE_CLOUD_CLIENT_ID'),
135135
env('ASPOSE_CLOUD_TOKEN'),
136136
"xlsx",
137-
$file,
137+
$newFilePath,
138138
$newFileNameWithoutExtension.".xlsx"
139139
],
140140
null,
@@ -171,10 +171,10 @@ public function convert(Request $request) {
171171
DB::table('appLogs')
172172
->where('processId', '=', $Nuuid)
173173
->update([
174-
'errReason' => 'Symfony runtime running out of time !',
174+
'errReason' => 'Symfony runtime process out of time exception !',
175175
'errApiReason' => $message->getMessage(),
176176
]);
177-
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Symfony runtime running out of time !', $message->getMessage());
177+
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Symfony runtime process out of time exception !', $message->getMessage());
178178
return response()->json([
179179
'status' => 400,
180180
'message' => 'HANA PDF process timeout !',
@@ -252,10 +252,10 @@ public function convert(Request $request) {
252252
}
253253
}
254254
if (!$asposeAPI->isSuccessful()) {
255-
if (AppHelper::instance()->getFtpResponse(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xslx'), $newFileNameWithoutExtension.".xlsx") == true) {
255+
if (AppHelper::instance()->getFtpResponse(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xlsx'), $newFileNameWithoutExtension.".xlsx") == true) {
256256
$end = Carbon::parse(AppHelper::instance()->getCurrentTimeZone());
257257
$duration = $end->diff($startProc);
258-
$fileProcSize = filesize(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xslx'));
258+
$fileProcSize = filesize(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xlsx'));
259259
$newFileProcSize = AppHelper::instance()->convert($fileProcSize, "MB");
260260
$procFile += 1;
261261
try {
@@ -277,6 +277,12 @@ public function convert(Request $request) {
277277
'procEndAt' => AppHelper::instance()->getCurrentTimeZone(),
278278
'procDuration' => $duration->s.' seconds'
279279
]);
280+
DB::table('appLogs')
281+
->where('processId', '=', $Nuuid)
282+
->update([
283+
'errReason' => null,
284+
'errApiReason' => null
285+
]);
280286
} catch (QueryException $ex) {
281287
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileProcSize, $Nuuid, 'FAIL', 'Database connection error !', $ex->getMessage());
282288
return response()->json([
@@ -326,7 +332,7 @@ public function convert(Request $request) {
326332
return response()->json([
327333
'status' => 400,
328334
'message' => 'PDF Conversion failed !',
329-
'error' => $asposeAPI->getMessage(),
335+
'error' => null,
330336
'processId' => $Nuuid
331337
], 400);
332338
} catch (QueryException $ex) {
@@ -351,7 +357,7 @@ public function convert(Request $request) {
351357
if (AppHelper::instance()->getFtpResponse(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xlsx'), $newFileNameWithoutExtension.".xlsx") == true) {
352358
$end = Carbon::parse(AppHelper::instance()->getCurrentTimeZone());
353359
$duration = $end->diff($startProc);
354-
$fileProcSize = filesize(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xslx'));
360+
$fileProcSize = filesize(Storage::disk('local')->path('public/'.$pdfDownload_Location.'/'.$newFileNameWithoutExtension.'.xlsx'));
355361
$newFileProcSize = AppHelper::instance()->convert($fileProcSize, "MB");
356362
$procFile += 1;
357363
try {
@@ -422,13 +428,13 @@ public function convert(Request $request) {
422428
->where('processId', '=', $Nuuid)
423429
->update([
424430
'errReason' => 'Converted file not found on the server !',
425-
'errApiReason' => $asposeAPI->getOutput()
431+
'errApiReason' => $asposeAPI->getOutput(),
426432
]);
427433
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Converted file not found on the server !', $asposeAPI->getOutput());
428434
return response()->json([
429435
'status' => 400,
430436
'message' => 'PDF Conversion failed !',
431-
'error' => $asposeAPI->getMessage(),
437+
'error' => null,
432438
'processId' => $Nuuid
433439
], 400);
434440
} catch (QueryException $ex) {
@@ -457,7 +463,7 @@ public function convert(Request $request) {
457463
env('ASPOSE_CLOUD_CLIENT_ID'),
458464
env('ASPOSE_CLOUD_TOKEN'),
459465
"pptx",
460-
$file,
466+
$newFilePath,
461467
$newFileNameWithoutExtension.".pptx"
462468
],
463469
null,
@@ -479,7 +485,7 @@ public function convert(Request $request) {
479485
'errApiReason' => null
480486
]);
481487
DB::table('pdfConvert')->insert([
482-
'fileName' => $newFileNameWithoutExtension.'.pptx',
488+
'fileName' => $currentFileName,
483489
'fileSize' => $newFileSize,
484490
'container' => $convertType,
485491
'imgExtract' => false,
@@ -651,11 +657,11 @@ public function convert(Request $request) {
651657
'errReason' => 'Converted file not found on the server !',
652658
'errApiReason' => $asposeAPI->getOutput(),
653659
]);
654-
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Converted file not found on the server !', null);
660+
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Converted file not found on the server !', $asposeAPI->getOutput());
655661
return response()->json([
656662
'status' => 400,
657663
'message' => 'PDF Conversion failed !',
658-
'error' => null,
664+
'error' => $asposeAPI->getOutput(),
659665
'processId' => $Nuuid
660666
], 400);
661667
} catch (QueryException $ex) {
@@ -751,9 +757,9 @@ public function convert(Request $request) {
751757
->where('processId', '=', $Nuuid)
752758
->update([
753759
'errReason' => 'Converted file not found on the server !',
754-
'errApiReason' => null,
760+
'errApiReason' => $asposeAPI->getOutput(),
755761
]);
756-
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Converted file not found on the server !', null);
762+
NotificationHelper::Instance()->sendErrNotify($currentFileName, $newFileSize, $Nuuid, 'FAIL', 'Converted file not found on the server !', $asposeAPI->getOutput());
757763
return response()->json([
758764
'status' => 400,
759765
'message' => 'PDF Conversion failed !',

Diff for: public/ext-python/asposeAPI.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
asposeContainer=str(sys.argv[3])
1313
asposeFile=str(sys.argv[4])
1414
asposeOut=str(sys.argv[5])
15-
asposeFileDirFix = asposeFile.replace("/upload/","/app/public/upload/")
16-
linuxSemanticDir = r"/var/www/html/hanaci-pdf"+asposeFileDirFix
1715

1816
def getAsposeToken():
1917
asposeCloudAPI = http.client.HTTPSConnection("api.aspose.cloud")
@@ -44,18 +42,18 @@ def convAsposeAPI(token, container):
4442
params = {
4543
'outPath': asposeOut,
4644
}
47-
if os.path.isfile(linuxSemanticDir):
48-
with open(linuxSemanticDir, 'rb') as f:
45+
if os.path.isfile(asposeFile):
46+
with open(asposeFile, 'rb') as f:
4947
data = f.read()
5048
if len(container) != 0:
5149
try:
5250
asposeResponse = requests.put('https://api.aspose.cloud/v3.0/pdf/convert/'+container, params=params, headers=headers, data=data, timeout=(85,90))
5351
values = asposeResponse.status_code
5452
if values == 200:
55-
print('File conversion success!')
53+
print('File conversion success! ')
5654
return True
5755
else:
58-
print('File conversion failed!')
56+
print('File conversion failed! ')
5957
return False
6058
except Timeout:
6159
print("Request time out!")
@@ -69,7 +67,7 @@ def convAsposeAPI(token, container):
6967
print("Invalid Container")
7068
return False
7169
else:
72-
print('File source not found! :'+linuxSemanticDir)
70+
print('File source not found! :'+asposeFile)
7371
return False
7472

7573
getAsposeToken()

Diff for: vite.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export default defineConfig({
1515
}),
1616
],
1717
server: {
18-
host: true
19-
}
18+
host: true,
19+
hmr: {
20+
host: '192.168.0.2'
21+
},
22+
},
2023
});

0 commit comments

Comments
 (0)