From 694f9a37a5b67c0bee922fc1a545282b6928cd90 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 17 Nov 2024 13:26:53 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E9=A2=84=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .prefetch | 134 ++++++++++++++---- app/Http/Controllers/Api/SystemController.php | 23 ++- app/Http/Controllers/IndexController.php | 2 +- 3 files changed, 128 insertions(+), 31 deletions(-) diff --git a/.prefetch b/.prefetch index 5516e7674..16622f4ec 100644 --- a/.prefetch +++ b/.prefetch @@ -1,34 +1,110 @@ office/web-apps/apps/api/documents/api.js?hash={version} -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/cell/css/main.css -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/apps/spreadsheeteditor/main/resources/css/app.css -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/vendor/requirejs/require.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/apps/spreadsheeteditor/main/app.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/common/AllFonts.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/vendor/xregexp/xregexp-all-min.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/vendor/socketio/socket.io.min.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/cell/sdk-all-min.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/cell/sdk-all.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/common/libfont/engine/fonts.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/common/Charts/ChartStyles.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/common/libfont/engine/fonts.wasm -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/apps/presentationeditor/main/resources/css/app.css -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/apps/presentationeditor/main/app.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/slide/sdk-all-min.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/slide/sdk-all.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/slide/themes//themes.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/apps/documenteditor/main/resources/css/app.css -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/web-apps/apps/documenteditor/main/app.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/word/sdk-all-min.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/sdkjs/word/sdk-all.js -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/fonts/081 -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/fonts/059 -office/8.2.0-ee166620e87db663ac1ba15af1e7df5f/fonts/066 -office/8.2.0-58599567ff0a70072c4b597cda94c770/fonts/052 -office/8.2.0-58599567ff0a70072c4b597cda94c770/fonts/217 -office/8.2.0-58599567ff0a70072c4b597cda94c770/fonts/200 -office/8.2.0-58599567ff0a70072c4b597cda94c770/fonts/183 + +office/{path}/fonts/000 +office/{path}/fonts/020 +office/{path}/fonts/020 +office/{path}/fonts/020 +office/{path}/fonts/022 +office/{path}/fonts/022 +office/{path}/fonts/022 +office/{path}/fonts/023 +office/{path}/fonts/023 +office/{path}/fonts/023 +office/{path}/fonts/024 +office/{path}/fonts/024 +office/{path}/fonts/024 +office/{path}/fonts/027 +office/{path}/fonts/027 +office/{path}/fonts/028 +office/{path}/fonts/028 +office/{path}/fonts/029 +office/{path}/fonts/029 +office/{path}/fonts/030 +office/{path}/fonts/030 +office/{path}/fonts/036 +office/{path}/fonts/036 +office/{path}/fonts/037 +office/{path}/fonts/037 +office/{path}/fonts/038 +office/{path}/fonts/038 +office/{path}/fonts/039 +office/{path}/fonts/039 +office/{path}/fonts/058 +office/{path}/fonts/058 +office/{path}/fonts/058 +office/{path}/fonts/059 +office/{path}/fonts/059 +office/{path}/fonts/059 +office/{path}/fonts/060 +office/{path}/fonts/060 +office/{path}/fonts/060 +office/{path}/fonts/061 +office/{path}/fonts/061 +office/{path}/fonts/061 +office/{path}/fonts/063 +office/{path}/fonts/065 +office/{path}/fonts/066 +office/{path}/fonts/081 +office/{path}/fonts/081 +office/{path}/fonts/081 +office/{path}/fonts/138 +office/{path}/fonts/184 +office/{path}/fonts/184 +office/{path}/sdkjs/cell/sdk-all-min.js +office/{path}/sdkjs/cell/sdk-all.js +office/{path}/sdkjs/common/AllFonts.js +office/{path}/sdkjs/common/AllFonts.js +office/{path}/sdkjs/common/AllFonts.js +office/{path}/sdkjs/common/Charts/ChartStyles.js +office/{path}/sdkjs/common/Charts/ChartStyles.js +office/{path}/sdkjs/common/Charts/ChartStyles.js +office/{path}/sdkjs/common/Images/fonts_thumbnail_ea@2x.png.bin +office/{path}/sdkjs/common/Images/fonts_thumbnail_ea@2x.png.bin +office/{path}/sdkjs/common/Images/fonts_thumbnail_ea@2x.png.bin +office/{path}/sdkjs/common/libfont/engine/fonts.js +office/{path}/sdkjs/common/libfont/engine/fonts.js +office/{path}/sdkjs/common/libfont/engine/fonts.js +office/{path}/sdkjs/common/libfont/engine/fonts.wasm +office/{path}/sdkjs/common/libfont/engine/fonts.wasm +office/{path}/sdkjs/common/libfont/engine/fonts.wasm +office/{path}/sdkjs/slide/sdk-all-min.js +office/{path}/sdkjs/slide/sdk-all.js +office/{path}/sdkjs/word/sdk-all-min.js +office/{path}/sdkjs/word/sdk-all.js +office/{path}/web-apps/apps/documenteditor/main/app.js +office/{path}/web-apps/apps/documenteditor/main/code.js +office/{path}/web-apps/apps/documenteditor/main/locale/zh.json +office/{path}/web-apps/apps/documenteditor/main/resources/css/app.css +office/{path}/web-apps/apps/documenteditor/main/resources/img/iconssmall@2.5x.svg +office/{path}/web-apps/apps/presentationeditor/main/app.js +office/{path}/web-apps/apps/presentationeditor/main/code.js +office/{path}/web-apps/apps/presentationeditor/main/locale/zh.json +office/{path}/web-apps/apps/presentationeditor/main/resources/css/app.css +office/{path}/web-apps/apps/presentationeditor/main/resources/img/iconsbig@2.5x.svg +office/{path}/web-apps/apps/presentationeditor/main/resources/img/iconsbig@2x.png +office/{path}/web-apps/apps/presentationeditor/main/resources/img/iconssmall@2.5x.svg +office/{path}/web-apps/apps/spreadsheeteditor/main/app.js +office/{path}/web-apps/apps/spreadsheeteditor/main/code.js +office/{path}/web-apps/apps/spreadsheeteditor/main/locale/zh.json +office/{path}/web-apps/apps/spreadsheeteditor/main/resources/css/app.css +office/{path}/web-apps/apps/spreadsheeteditor/main/resources/formula-lang/zh_desc.json +office/{path}/web-apps/apps/spreadsheeteditor/main/resources/img/iconssmall@2.5x.svg +office/{path}/web-apps/apps/spreadsheeteditor/main/resources/img/iconssmall@2x.png +office/{path}/web-apps/vendor/xregexp/xregexp-all-min.js +office/{path}/web-apps/vendor/xregexp/xregexp-all-min.js +office/{path}/web-apps/vendor/xregexp/xregexp-all-min.js + drawio/webapp/js/app.min.js -drawio/webapp/js/stencils.min.js drawio/webapp/js/extensions.min.js drawio/webapp/js/shapes-14-6-5.min.js +drawio/webapp/js/stencils.min.js +drawio/webapp/math/es5/core.js +drawio/webapp/math/es5/input/asciimath.js +drawio/webapp/math/es5/input/tex.js +drawio/webapp/math/es5/output/svg.js drawio/webapp/math/es5/output/svg/fonts/tex.js +drawio/webapp/styles/grapheditor.css + +minder/css/chunk-vendors.fe9c56c6.css +minder/js/app.aa385de3.js +minder/js/chunk-vendors.cc7455b8.js \ No newline at end of file diff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php index d668bff41..5c56c5d71 100755 --- a/app/Http/Controllers/Api/SystemController.php +++ b/app/Http/Controllers/Api/SystemController.php @@ -1429,7 +1429,7 @@ class SystemController extends AbstractController $path = 'js/build/'; $list = Base::recursiveFiles(public_path($path), false); foreach ($list as $item) { - if (is_file($item) && filesize($item) > 50 * 1024) { + if (is_file($item) && filesize($item) > 50 * 1024) { // 50KB $array[] = $path . basename($item); } } @@ -1442,6 +1442,27 @@ class SystemController extends AbstractController $items = explode("\n", $content); $array = array_merge($array, $items); } + // 添加office资源 + $officePath = ''; + $officeApi = 'http://' . env('APP_IPPR') . '.6/web-apps/apps/api/documents/api.js'; + $content = @file_get_contents($officeApi); + if ($content) { + if (preg_match("/const\s+ver\s*=\s*'\/*([^']+)'/", $content, $matches)) { + $officePath = $matches[1]; + } + } + if ($officePath) { + $array = array_map(function($item) use ($officePath) { + if (str_starts_with($item, 'office/{path}/')) { + return preg_replace("/office\/{path}\//", '/office/' . $officePath . '/', $item); + } + return $item; + }, $array); + } else { + $array = array_filter($array, function($item) { + return !str_starts_with($item, 'office/{path}/'); + }); + } } return array_map(function($item) use ($version) { diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 677e7cebb..5b23f7eb7 100755 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -345,7 +345,7 @@ class IndexController extends InvokeController $lists = Base::recursiveFiles($dirPath, false); $files = []; foreach ($lists as $file) { - if (str_ends_with($file, '.yml') || str_ends_with($file, '.yaml') || str_ends_with($file, '.blockmap')) { + if (preg_match('/\.(zip|yml|yaml|blockmap)$/i', $file) || str_ends_with($file, '-win.exe')) { continue; } $fileName = basename($file, $dirPath);