Dung Diego

up

...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
3 namespace App\Http\Controllers; 3 namespace App\Http\Controllers;
4 use Illuminate\Http\Request; 4 use Illuminate\Http\Request;
5 use Carbon\Carbon; 5 use Carbon\Carbon;
6 +use Exception;
6 use Illuminate\Support\Facades\Storage; 7 use Illuminate\Support\Facades\Storage;
7 use Illuminate\Support\Facades\Log; 8 use Illuminate\Support\Facades\Log;
8 9
......
...@@ -10,7 +10,8 @@ ...@@ -10,7 +10,8 @@
10 "guzzlehttp/guzzle": "^7.2", 10 "guzzlehttp/guzzle": "^7.2",
11 "laravel/framework": "^9.0", 11 "laravel/framework": "^9.0",
12 "laravel/sanctum": "^2.14", 12 "laravel/sanctum": "^2.14",
13 - "laravel/tinker": "^2.7" 13 + "laravel/tinker": "^2.7",
14 + "league/flysystem-sftp-v3": "^3.33"
14 }, 15 },
15 "require-dev": { 16 "require-dev": {
16 "fakerphp/faker": "^1.9.1", 17 "fakerphp/faker": "^1.9.1",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 "This file is @generated automatically" 5 "This file is @generated automatically"
6 ], 6 ],
7 - "content-hash": "65e85f9f959c0b087110331754d451cf", 7 + "content-hash": "469523dcc88868eb313d5f0888141437",
8 "packages": [ 8 "packages": [
9 { 9 {
10 "name": "asm89/stack-cors", 10 "name": "asm89/stack-cors",
...@@ -1901,6 +1901,55 @@ ...@@ -1901,6 +1901,55 @@
1901 "time": "2026-01-23T15:30:45+00:00" 1901 "time": "2026-01-23T15:30:45+00:00"
1902 }, 1902 },
1903 { 1903 {
1904 + "name": "league/flysystem-sftp-v3",
1905 + "version": "3.33.0",
1906 + "source": {
1907 + "type": "git",
1908 + "url": "https://github.com/thephpleague/flysystem-sftp-v3.git",
1909 + "reference": "34ff5ef0f841add92e2b902c1005f72135b03646"
1910 + },
1911 + "dist": {
1912 + "type": "zip",
1913 + "url": "https://api.github.com/repos/thephpleague/flysystem-sftp-v3/zipball/34ff5ef0f841add92e2b902c1005f72135b03646",
1914 + "reference": "34ff5ef0f841add92e2b902c1005f72135b03646",
1915 + "shasum": ""
1916 + },
1917 + "require": {
1918 + "league/flysystem": "^3.0.14",
1919 + "league/mime-type-detection": "^1.0.0",
1920 + "php": "^8.0.2",
1921 + "phpseclib/phpseclib": "^3.0"
1922 + },
1923 + "type": "library",
1924 + "autoload": {
1925 + "psr-4": {
1926 + "League\\Flysystem\\PhpseclibV3\\": ""
1927 + }
1928 + },
1929 + "notification-url": "https://packagist.org/downloads/",
1930 + "license": [
1931 + "MIT"
1932 + ],
1933 + "authors": [
1934 + {
1935 + "name": "Frank de Jonge",
1936 + "email": "info@frankdejonge.nl"
1937 + }
1938 + ],
1939 + "description": "SFTP filesystem adapter for Flysystem.",
1940 + "keywords": [
1941 + "Flysystem",
1942 + "file",
1943 + "files",
1944 + "filesystem",
1945 + "sftp"
1946 + ],
1947 + "support": {
1948 + "source": "https://github.com/thephpleague/flysystem-sftp-v3/tree/3.33.0"
1949 + },
1950 + "time": "2026-03-20T13:22:31+00:00"
1951 + },
1952 + {
1904 "name": "league/mime-type-detection", 1953 "name": "league/mime-type-detection",
1905 "version": "1.16.0", 1954 "version": "1.16.0",
1906 "source": { 1955 "source": {
...@@ -2464,6 +2513,125 @@ ...@@ -2464,6 +2513,125 @@
2464 "time": "2024-11-21T10:36:35+00:00" 2513 "time": "2024-11-21T10:36:35+00:00"
2465 }, 2514 },
2466 { 2515 {
2516 + "name": "paragonie/constant_time_encoding",
2517 + "version": "v3.1.3",
2518 + "source": {
2519 + "type": "git",
2520 + "url": "https://github.com/paragonie/constant_time_encoding.git",
2521 + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77"
2522 + },
2523 + "dist": {
2524 + "type": "zip",
2525 + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77",
2526 + "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77",
2527 + "shasum": ""
2528 + },
2529 + "require": {
2530 + "php": "^8"
2531 + },
2532 + "require-dev": {
2533 + "infection/infection": "^0",
2534 + "nikic/php-fuzzer": "^0",
2535 + "phpunit/phpunit": "^9|^10|^11",
2536 + "vimeo/psalm": "^4|^5|^6"
2537 + },
2538 + "type": "library",
2539 + "autoload": {
2540 + "psr-4": {
2541 + "ParagonIE\\ConstantTime\\": "src/"
2542 + }
2543 + },
2544 + "notification-url": "https://packagist.org/downloads/",
2545 + "license": [
2546 + "MIT"
2547 + ],
2548 + "authors": [
2549 + {
2550 + "name": "Paragon Initiative Enterprises",
2551 + "email": "security@paragonie.com",
2552 + "homepage": "https://paragonie.com",
2553 + "role": "Maintainer"
2554 + },
2555 + {
2556 + "name": "Steve 'Sc00bz' Thomas",
2557 + "email": "steve@tobtu.com",
2558 + "homepage": "https://www.tobtu.com",
2559 + "role": "Original Developer"
2560 + }
2561 + ],
2562 + "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)",
2563 + "keywords": [
2564 + "base16",
2565 + "base32",
2566 + "base32_decode",
2567 + "base32_encode",
2568 + "base64",
2569 + "base64_decode",
2570 + "base64_encode",
2571 + "bin2hex",
2572 + "encoding",
2573 + "hex",
2574 + "hex2bin",
2575 + "rfc4648"
2576 + ],
2577 + "support": {
2578 + "email": "info@paragonie.com",
2579 + "issues": "https://github.com/paragonie/constant_time_encoding/issues",
2580 + "source": "https://github.com/paragonie/constant_time_encoding"
2581 + },
2582 + "time": "2025-09-24T15:06:41+00:00"
2583 + },
2584 + {
2585 + "name": "paragonie/random_compat",
2586 + "version": "v9.99.100",
2587 + "source": {
2588 + "type": "git",
2589 + "url": "https://github.com/paragonie/random_compat.git",
2590 + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
2591 + },
2592 + "dist": {
2593 + "type": "zip",
2594 + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
2595 + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
2596 + "shasum": ""
2597 + },
2598 + "require": {
2599 + "php": ">= 7"
2600 + },
2601 + "require-dev": {
2602 + "phpunit/phpunit": "4.*|5.*",
2603 + "vimeo/psalm": "^1"
2604 + },
2605 + "suggest": {
2606 + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
2607 + },
2608 + "type": "library",
2609 + "notification-url": "https://packagist.org/downloads/",
2610 + "license": [
2611 + "MIT"
2612 + ],
2613 + "authors": [
2614 + {
2615 + "name": "Paragon Initiative Enterprises",
2616 + "email": "security@paragonie.com",
2617 + "homepage": "https://paragonie.com"
2618 + }
2619 + ],
2620 + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
2621 + "keywords": [
2622 + "csprng",
2623 + "polyfill",
2624 + "pseudorandom",
2625 + "random"
2626 + ],
2627 + "support": {
2628 + "email": "info@paragonie.com",
2629 + "issues": "https://github.com/paragonie/random_compat/issues",
2630 + "source": "https://github.com/paragonie/random_compat"
2631 + },
2632 + "time": "2020-10-15T08:29:30+00:00"
2633 + },
2634 + {
2467 "name": "phpoption/phpoption", 2635 "name": "phpoption/phpoption",
2468 "version": "1.9.5", 2636 "version": "1.9.5",
2469 "source": { 2637 "source": {
...@@ -2539,6 +2707,116 @@ ...@@ -2539,6 +2707,116 @@
2539 "time": "2025-12-27T19:41:33+00:00" 2707 "time": "2025-12-27T19:41:33+00:00"
2540 }, 2708 },
2541 { 2709 {
2710 + "name": "phpseclib/phpseclib",
2711 + "version": "3.0.55",
2712 + "source": {
2713 + "type": "git",
2714 + "url": "https://github.com/phpseclib/phpseclib.git",
2715 + "reference": "db9744e6d47e742b1f974e965ad49bdd041105af"
2716 + },
2717 + "dist": {
2718 + "type": "zip",
2719 + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db9744e6d47e742b1f974e965ad49bdd041105af",
2720 + "reference": "db9744e6d47e742b1f974e965ad49bdd041105af",
2721 + "shasum": ""
2722 + },
2723 + "require": {
2724 + "paragonie/constant_time_encoding": "^1|^2|^3",
2725 + "paragonie/random_compat": "^1.4|^2.0|^9.99.99",
2726 + "php": ">=5.6.1"
2727 + },
2728 + "require-dev": {
2729 + "phpunit/phpunit": "*"
2730 + },
2731 + "suggest": {
2732 + "ext-dom": "Install the DOM extension to load XML formatted public keys.",
2733 + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
2734 + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
2735 + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
2736 + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
2737 + },
2738 + "type": "library",
2739 + "autoload": {
2740 + "files": [
2741 + "phpseclib/bootstrap.php"
2742 + ],
2743 + "psr-4": {
2744 + "phpseclib3\\": "phpseclib/"
2745 + }
2746 + },
2747 + "notification-url": "https://packagist.org/downloads/",
2748 + "license": [
2749 + "MIT"
2750 + ],
2751 + "authors": [
2752 + {
2753 + "name": "Jim Wigginton",
2754 + "email": "terrafrost@php.net",
2755 + "role": "Lead Developer"
2756 + },
2757 + {
2758 + "name": "Patrick Monnerat",
2759 + "email": "pm@datasphere.ch",
2760 + "role": "Developer"
2761 + },
2762 + {
2763 + "name": "Andreas Fischer",
2764 + "email": "bantu@phpbb.com",
2765 + "role": "Developer"
2766 + },
2767 + {
2768 + "name": "Hans-Jürgen Petrich",
2769 + "email": "petrich@tronic-media.com",
2770 + "role": "Developer"
2771 + },
2772 + {
2773 + "name": "Graham Campbell",
2774 + "email": "graham@alt-three.com",
2775 + "role": "Developer"
2776 + }
2777 + ],
2778 + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
2779 + "homepage": "http://phpseclib.sourceforge.net",
2780 + "keywords": [
2781 + "BigInteger",
2782 + "aes",
2783 + "asn.1",
2784 + "asn1",
2785 + "blowfish",
2786 + "crypto",
2787 + "cryptography",
2788 + "encryption",
2789 + "rsa",
2790 + "security",
2791 + "sftp",
2792 + "signature",
2793 + "signing",
2794 + "ssh",
2795 + "twofish",
2796 + "x.509",
2797 + "x509"
2798 + ],
2799 + "support": {
2800 + "issues": "https://github.com/phpseclib/phpseclib/issues",
2801 + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.55"
2802 + },
2803 + "funding": [
2804 + {
2805 + "url": "https://github.com/terrafrost",
2806 + "type": "github"
2807 + },
2808 + {
2809 + "url": "https://www.patreon.com/phpseclib",
2810 + "type": "patreon"
2811 + },
2812 + {
2813 + "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib",
2814 + "type": "tidelift"
2815 + }
2816 + ],
2817 + "time": "2026-06-14T23:24:10+00:00"
2818 + },
2819 + {
2542 "name": "psr/clock", 2820 "name": "psr/clock",
2543 "version": "1.0.0", 2821 "version": "1.0.0",
2544 "source": { 2822 "source": {
......
...@@ -57,7 +57,16 @@ ...@@ -57,7 +57,16 @@
57 'driver' => 'local', 57 'driver' => 'local',
58 'root' => storage_path('ocr'), 58 'root' => storage_path('ocr'),
59 ], 59 ],
60 - 60 + 'ocr_results_sftp' => [
61 + 'driver' => 'sftp',
62 + 'host' => env('OCR_HOST','172.30.4.104'),
63 + 'username' => env('OCR_USERNAME','ubuntu'),
64 + 'port' => 22,
65 + 'root' => env('OCR_ROOT', '/home/ubuntu/iwa'),
66 + 'timeout' => 30,
67 + 'privateKey' => env('OCR_KEY'),
68 + 'passphrase' => env('OCR_PASSPHRASE', null),
69 + ],
61 ], 70 ],
62 71
63 /* 72 /*
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 | 17 |
18 */ 18 */
19 19
20 - 'default' => env('LOG_CHANNEL', 'stack'), 20 + 'default' => env('LOG_CHANNEL', 'daily'),
21 21
22 /* 22 /*
23 |-------------------------------------------------------------------------- 23 |--------------------------------------------------------------------------
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
46 if(!file) return; 46 if(!file) return;
47 47
48 let formData = new FormData(); 48 let formData = new FormData();
49 - formData.append('file', file); 49 + formData.append('attached_file', file);
50 50
51 axios.post("{{route('import_pdf')}}", formData, { 51 axios.post("{{route('import_pdf')}}", formData, {
52 headers:{ 52 headers:{
......
...@@ -15,4 +15,19 @@ ...@@ -15,4 +15,19 @@
15 */ 15 */
16 16
17 Route::get('/', [OcrController::class,'index']); 17 Route::get('/', [OcrController::class,'index']);
18 +Route::get('/test', function () {
19 + $file = 'D:\\key\\id_rsa_oms_base_test.pem';
20 +
21 + return response()->json([
22 + 'php_sapi' => PHP_SAPI,
23 + 'current_user' => get_current_user(),
24 + 'script_owner' => getmyuid(),
25 + 'cwd' => getcwd(),
26 + 'file_exists' => file_exists($file),
27 + 'is_readable' => is_readable($file),
28 + 'realpath' => realpath($file),
29 + 'file_get_contents'=> @file_get_contents($file) !== false ? 'OK' : error_get_last(),
30 + ]);
31 +});
32 +
18 Route::post('/import-pdf', [OcrController::class,'import_pdf'])->name('import_pdf'); 33 Route::post('/import-pdf', [OcrController::class,'import_pdf'])->name('import_pdf');
......