添加public管理
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "@kevisual/code-center", | ||||
|   "version": "0.0.6-alpha.2", | ||||
|   "version": "0.0.6-alpha.3", | ||||
|   "description": "code center", | ||||
|   "type": "module", | ||||
|   "main": "index.js", | ||||
|   | ||||
| @@ -18,6 +18,7 @@ const init = () => { | ||||
|       cors: { | ||||
|         origin: '*', | ||||
|       }, | ||||
|       // httpType: 'https', | ||||
|     }, | ||||
|     io: true, | ||||
|     routerContext: { | ||||
|   | ||||
| @@ -291,7 +291,7 @@ import { User, UserInit, UserServices } from '@kevisual/code-center-module/model | ||||
| export { User, UserInit, UserServices }; | ||||
| UserInit(null, null, { | ||||
|   alter: true, | ||||
|   logging: true, | ||||
|   logging: false, | ||||
| }).catch((e) => { | ||||
|   console.error('User sync', e); | ||||
| }); | ||||
|   | ||||
							
								
								
									
										18
									
								
								src/routes-simple/minio/download.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								src/routes-simple/minio/download.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| import { minioClient } from '@/app.ts'; | ||||
| import { bucketName } from '@/modules/minio.ts'; | ||||
|  | ||||
| import { router } from '../router.ts'; | ||||
|  | ||||
| router.post('/api/minio', async (ctx) => { | ||||
|   let { username, appKey } = { username: '', appKey: '' }; | ||||
|   const path = `${username}/${appKey}`; | ||||
|   const res = await minioClient.listObjects(bucketName, path, true); | ||||
|   const file = res.filter((item) => item.isFile); | ||||
|   const fileList = file.map((item) => { | ||||
|     return { | ||||
|       name: item.name, | ||||
|       size: item.size, | ||||
|     }; | ||||
|   }); | ||||
|   // ctx.body = fileList; | ||||
| }); | ||||
| @@ -1,4 +1,6 @@ | ||||
| import './list.ts'; | ||||
| import './user-app.ts'; | ||||
|  | ||||
| import './public/index.ts'; | ||||
|  | ||||
| export * from './module/index.ts'; | ||||
|   | ||||
| @@ -33,6 +33,7 @@ export class AppModel extends Model { | ||||
|   declare type: string; | ||||
|   declare uid: string; | ||||
|   declare pid: string; | ||||
|   // 是否是history路由代理模式。静态的直接转minio,而不需要缓存下来。 | ||||
|   declare proxy: boolean; | ||||
|   declare user: string; | ||||
|   declare status: string; | ||||
|   | ||||
							
								
								
									
										1
									
								
								src/routes/app-manager/public/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/routes/app-manager/public/index.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| import './list.ts'; | ||||
							
								
								
									
										19
									
								
								src/routes/app-manager/public/list.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/routes/app-manager/public/list.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| import { app } from '@/app.ts'; | ||||
| import { AppModel } from '../module/index.ts'; | ||||
|  | ||||
| // curl http://localhost:4005/api/router?path=app&key=public-list | ||||
| app | ||||
|   .route({ | ||||
|     path: 'app', | ||||
|     key: 'public-list', | ||||
|   }) | ||||
|   .define(async (ctx) => { | ||||
|     const list = await AppModel.findAll({ | ||||
|       where: { | ||||
|         status: 'running', | ||||
|       }, | ||||
|       logging: false, | ||||
|     }); | ||||
|     ctx.body = list; | ||||
|   }) | ||||
|   .addTo(app); | ||||
		Reference in New Issue
	
	Block a user