File tree Expand file tree Collapse file tree 5 files changed +40
-6
lines changed
Expand file tree Collapse file tree 5 files changed +40
-6
lines changed Original file line number Diff line number Diff line change 6666 "mime-types" : " ^2.1.35" ,
6767 "mitt" : " ^3.0.0" ,
6868 "nodejs-file-downloader" : " ^4.12.1" ,
69- "piclist" : " ^0.7.4 " ,
69+ "piclist" : " ^0.7.6 " ,
7070 "pinia" : " ^2.1.4" ,
7171 "pinia-plugin-persistedstate" : " ^3.1.0" ,
7272 "qiniu" : " ^7.8.0" ,
Original file line number Diff line number Diff line change 1+ import http from 'http'
2+ import fs from 'fs-extra'
3+ import path from 'path'
4+ import picgo from '@core/picgo'
5+ import logger from '../apis/core/picgo/logger'
6+
7+ export const imgFilePath = path . join ( picgo . baseDir , 'imgTemp' )
8+ fs . ensureDirSync ( imgFilePath )
9+
10+ const serverPort = 36699
11+
12+ export function startFileServer ( ) {
13+ const server = http . createServer ( ( req , res ) => {
14+ const requestPath = req . url ?. split ( '?' ) [ 0 ]
15+ const filePath = path . join ( imgFilePath , requestPath ! )
16+
17+ fs . readFile ( filePath , ( err , data ) => {
18+ if ( err ) {
19+ res . writeHead ( 404 )
20+ res . end ( '404 Not Found' )
21+ } else {
22+ res . end ( data )
23+ }
24+ } )
25+ } )
26+
27+ server . listen ( serverPort , ( ) => {
28+ logger . info ( `File server is running, http://localhost:${ serverPort } ` )
29+ } ) . on ( 'error' , ( err ) => {
30+ logger . error ( err )
31+ } )
32+ }
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ import clipboardPoll from '../utils/clipboardPoll'
4747import path from 'path'
4848import { CLIPBOARD_IMAGE_FOLDER } from '~/universal/utils/static'
4949import fs from 'fs-extra'
50+ import { startFileServer } from '../fileServer'
5051const isDevelopment = process . env . NODE_ENV !== 'production'
5152
5253const handleStartUpFiles = ( argv : string [ ] , cwd : string ) => {
@@ -158,6 +159,7 @@ class LifeCycle {
158159 shortKeyHandler . init ( )
159160 } )
160161 server . startup ( )
162+ startFileServer ( )
161163 if ( process . env . NODE_ENV !== 'development' ) {
162164 handleStartUpFiles ( process . argv , process . cwd ( ) )
163165 }
Original file line number Diff line number Diff line change 242242 @click =" zoomImage(index)"
243243 >
244244 <img
245- v-lazy =" item.imgUrl"
245+ v-lazy =" item.galleryPath || item. imgUrl"
246246 class =" gallery-list__item-img"
247247 >
248248 </div >
Original file line number Diff line number Diff line change @@ -11054,10 +11054,10 @@ performance-now@^2.1.0:
1105411054 resolved "https://registry.npmmirror.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
1105511055 integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==
1105611056
11057- piclist@^0.7.4 :
11058- version "0.7.4 "
11059- resolved "https://registry.npmjs.org/piclist/-/piclist-0.7.4 .tgz#125c9f337e2d7375ae0c5c17fafaf924134fd65f "
11060- integrity sha512-PxE6S93uWP7sQNyMi6R7ZEs57oOXgm/nD14Moi0k0dbAlvtm1kWdrc4CboW/6e7hPVgeqT7pGi0+y0SF8iTxOA ==
11057+ piclist@^0.7.6 :
11058+ version "0.7.6 "
11059+ resolved "https://registry.npmjs.org/piclist/-/piclist-0.7.6 .tgz#93ac36f2f3fa067d014b4ff1e808bd6304fa29e3 "
11060+ integrity sha512-aLoVhvl8A/Ez2I3T3rmqQ5MCBw6txTQ+5H0zGvgybEpHGpuTHct9MBplfJVj2eIyqwbbcWT24t5bkvaByma2gw ==
1106111061 dependencies:
1106211062 "@picgo/i18n" "^1.0.0"
1106311063 "@picgo/store" "^2.0.4"
You can’t perform that action at this time.
0 commit comments