Compare commits
	
		
			4 Commits
		
	
	
		
			79a9568a87
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 02c505c83a | |||
| e59484e3c7 | |||
| 6a4ff85683 | |||
| b3c2587903 | 
							
								
								
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -5,4 +5,9 @@ coverage | |||||||
| .DS_Store | .DS_Store | ||||||
| upload | upload | ||||||
|  |  | ||||||
| app.config.json5 | app.config.json5 | ||||||
|  |  | ||||||
|  | release/* | ||||||
|  | !release/.gitkeep | ||||||
|  |  | ||||||
|  | /*.tgz | ||||||
							
								
								
									
										14
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | |||||||
|  | # page proxy | ||||||
|  |  | ||||||
|  | # 部署方案 | ||||||
|  |  | ||||||
|  | ```sh | ||||||
|  | envision pack -p -u | ||||||
|  | envision pack-deploy 330bc5f8-1ae7-4be5-a44c-0ea0b3da184b page-proxy # key和id是人设置的 | ||||||
|  | # 会复制到对应的文件夹里面了,现在。启动时后台启动 | ||||||
|  | # 需要调用类似,但需要token | ||||||
|  | # token ev token会显示当前登陆的用户的token | ||||||
|  | # https://kevisual.xiongxiao.me/api/router?path=local-apps&key=updateStatus&appKey=page-proxy&status=start&token=****** | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -1,10 +1,12 @@ | |||||||
| { | { | ||||||
|   port: 3005, |  | ||||||
|   api: { |   api: { | ||||||
|     host: 'localhost:4002', // 后台代理 |     host: 'localhost:4002', // 后台代理 | ||||||
|     path: '/api/router', |     path: '/api/router', | ||||||
|   }, |   }, | ||||||
|   allowedOrigins: ['localhost', 'xiongxiao.me', 'zxj.im'], |   proxy: { | ||||||
|   domain: 'kevisual.xiongxiao.me', |     port: 3005, | ||||||
|   resources: 'minio.xiongxiao.me/resources', |     domain: 'kevisual.xiongxiao.me', | ||||||
|  |     resources: 'https://minio.xiongxiao.me/resources', | ||||||
|  |     allowedOrigins: ['localhost', 'xiongxiao.me', 'zxj.im', 'silkyai.cn'], | ||||||
|  |   }, | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								app.config.json5.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								app.config.json5.example
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | |||||||
|  | { | ||||||
|  |   port: 3005, | ||||||
|  |   api: { | ||||||
|  |     host: 'localhost:3000', // 后台代理 | ||||||
|  |     path: '/api/router', | ||||||
|  |   }, | ||||||
|  |   allowedOrigins: ['localhost', 'xiongxiao.me', 'zxj.im'], | ||||||
|  |   domain: 'demo.kevisual.xiongxiao.me', | ||||||
|  |   resources: 'localhost:9000/resources', | ||||||
|  | } | ||||||
							
								
								
									
										
											BIN
										
									
								
								docs/after-pub-deploy.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/after-pub-deploy.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 51 KiB | 
							
								
								
									
										31
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								package.json
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ | |||||||
|   "app": { |   "app": { | ||||||
|     "key": "page-proxy", |     "key": "page-proxy", | ||||||
|     "entry": "dist/app.mjs", |     "entry": "dist/app.mjs", | ||||||
|     "type": "micro-app", |     "type": "pm2-system-app", | ||||||
|     "files": [ |     "files": [ | ||||||
|       "dist" |       "dist" | ||||||
|     ] |     ] | ||||||
| @@ -18,31 +18,32 @@ | |||||||
|   "scripts": { |   "scripts": { | ||||||
|     "dev": "cross-env NODE_ENV=development nodemon --ignore upload --exec tsx src/index.ts", |     "dev": "cross-env NODE_ENV=development nodemon --ignore upload --exec tsx src/index.ts", | ||||||
|     "build": "rimraf dist && rollup -c", |     "build": "rimraf dist && rollup -c", | ||||||
|     "deploy": "rsync -avz dist/ light:~/apps/var-proxy/backend", |     "start": "pm2 start dist/app.mjs --name page-proxy", | ||||||
|     "reload": "ssh light pm2 restart proxy", |     "release": "node ./scripts/release/index.mjs", | ||||||
|     "pub": "npm run build && npm run deploy && npm run reload" |     "deploy": "envision switch root && envision pack -p -u", | ||||||
|  |     "pub": "npm run build && npm run deploy" | ||||||
|   }, |   }, | ||||||
|   "keywords": [], |   "keywords": [], | ||||||
|   "author": "", |   "author": "", | ||||||
|   "license": "ISC", |   "license": "ISC", | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@rollup/plugin-commonjs": "^28.0.1", |     "@rollup/plugin-commonjs": "^28.0.2", | ||||||
|     "@rollup/plugin-json": "^6.1.0", |     "@rollup/plugin-json": "^6.1.0", | ||||||
|     "@rollup/plugin-node-resolve": "^15.3.0", |     "@rollup/plugin-node-resolve": "^16.0.0", | ||||||
|     "@rollup/plugin-typescript": "^12.1.1", |     "@rollup/plugin-typescript": "^12.1.2", | ||||||
|     "@types/http-proxy": "^1.17.15", |     "@types/http-proxy": "^1.17.16", | ||||||
|     "@types/node": "^22.10.1", |     "@types/node": "^22.13.4", | ||||||
|     "cross-env": "^7.0.3", |     "cross-env": "^7.0.3", | ||||||
|     "nodemon": "^3.1.7", |     "nodemon": "^3.1.9", | ||||||
|     "rollup": "^4.28.1", |     "rollup": "^4.34.8", | ||||||
|     "tslib": "^2.8.1", |     "tslib": "^2.8.1", | ||||||
|     "typescript": "^5.7.2" |     "typescript": "^5.7.3" | ||||||
|   }, |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@kevisual/router": "0.0.6-alpha-2", |     "@kevisual/router": "0.0.6-alpha-5", | ||||||
|     "@kevisual/use-config": "^1.0.7", |     "@kevisual/use-config": "^1.0.7", | ||||||
|     "ioredis": "^5.4.1", |     "ioredis": "^5.5.0", | ||||||
|     "nanoid": "^5.0.9" |     "nanoid": "^5.1.0" | ||||||
|   }, |   }, | ||||||
|   "resolutions": { |   "resolutions": { | ||||||
|     "picomatch": "^4.0.2" |     "picomatch": "^4.0.2" | ||||||
|   | |||||||
							
								
								
									
										0
									
								
								release/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								release/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										114
									
								
								scripts/release/index.mjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								scripts/release/index.mjs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,114 @@ | |||||||
|  | import fs from 'fs'; | ||||||
|  | import path from 'path'; | ||||||
|  | import archiver from 'archiver'; | ||||||
|  | import { exec } from 'child_process'; | ||||||
|  | import { nanoid } from 'nanoid'; | ||||||
|  |  | ||||||
|  | const cwd = process.cwd(); | ||||||
|  | const pkgPath = path.join(cwd, 'package.json'); | ||||||
|  |  | ||||||
|  | export const checkFileExistsSync = (filePath) => { | ||||||
|  |   try { | ||||||
|  |     // 使用 F_OK 检查文件或目录是否存在 | ||||||
|  |     fs.accessSync(filePath, fs.constants.F_OK); | ||||||
|  |     return true; | ||||||
|  |   } catch (err) { | ||||||
|  |     return false; | ||||||
|  |   } | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); | ||||||
|  |  | ||||||
|  | const releasePath = path.join(cwd, 'release'); | ||||||
|  |  | ||||||
|  | const distPath = path.join(cwd, 'dist'); | ||||||
|  |  | ||||||
|  | const zip = archiver('zip', { | ||||||
|  |   zlib: { level: 9 }, | ||||||
|  | }); | ||||||
|  | const zipName = `page-proxy-${pkg.version}.zip`; | ||||||
|  | const zipCache = path.join(releasePath, `page-proxy-${pkg.version}.zip`); | ||||||
|  |  | ||||||
|  | const getZip = async () => { | ||||||
|  |   return new Promise((resolve, reject) => { | ||||||
|  |     const output = fs.createWriteStream(zipCache); | ||||||
|  |     const startTime = (new Date().getTime() / 1000).toFixed(0); | ||||||
|  |     // 监听事件 | ||||||
|  |     output.on('close', async () => { | ||||||
|  |       const bytes = zip.pointer(); | ||||||
|  |       const size = bytes < 1024 ? `${bytes} bytes` : `${(bytes / 1024).toFixed(2)} KB`; | ||||||
|  |       console.log(`Zip file has been created successfully. Total size: ${size} bytes.`); | ||||||
|  |       let time = (new Date().getTime() / 1000).toFixed(0); | ||||||
|  |       console.log('time', time - startTime); | ||||||
|  |       resolve(); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     output.on('end', () => { | ||||||
|  |       console.log('Data has been drained.'); // 数据已被耗尽 | ||||||
|  |       throw new CustomError('Data has been drained.'); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     zip.on('warning', (err) => { | ||||||
|  |       if (err.code === 'ENOENT') { | ||||||
|  |         console.warn('File not found:', err); | ||||||
|  |       } else { | ||||||
|  |         throw err; | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     zip.on('error', (err) => { | ||||||
|  |       throw err; | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     // 通过管道将 zip 数据流输出到指定文件 | ||||||
|  |     zip.pipe(output); | ||||||
|  |  | ||||||
|  |     // 添加 sh 字符串作为文件到 zip 中 | ||||||
|  |     const sh = `#!/bin/bash | ||||||
|  |     npm i -g pnpm  | ||||||
|  |     pnpm install --prod | ||||||
|  |     `; | ||||||
|  |     zip.append(sh, { name: 'start.sh' }); | ||||||
|  |     // 把dist目录下的文件添加到zip中 | ||||||
|  |     zip.directory(distPath, 'dist'); | ||||||
|  |     // 把README.md添加到zip中 | ||||||
|  |     zip.file(path.join(cwd, 'README.md'), { name: 'README.md' }); | ||||||
|  |     // 把package.json添加到zip中 | ||||||
|  |     zip.file(pkgPath, { name: 'package.json' }); | ||||||
|  |     const ecosystemContent = `module.exports = { | ||||||
|  |   apps: [ | ||||||
|  |     { | ||||||
|  |       name: 'page-proxy', // 应用名称 | ||||||
|  |       script: './dist/app.mjs', // 入口文件 | ||||||
|  |       // cwd: '.', // 设置当前工作目录 | ||||||
|  |       output: './logs/page-proxy.log', | ||||||
|  |       error: './logs/page-proxy.log', | ||||||
|  |       log_date_format: 'YYYY-MM-DD HH:mm:ss', | ||||||
|  |       // watch: true, // 自动监控文件变化 | ||||||
|  |       watch: ['dist'], // 监控的文件夹 | ||||||
|  |       ignore_watch: ['node_modules', 'logs'], // 忽略的文件夹 | ||||||
|  |     } | ||||||
|  |   ] | ||||||
|  | } | ||||||
|  | `; | ||||||
|  |     zip.append(ecosystemContent, { name: 'ecosystem.config.cjs' }); | ||||||
|  |     const json5Content = fs.readFileSync(path.join(cwd, 'app.config.json5.example'), 'utf8'); | ||||||
|  |     // tokenSecret 是一个随机字符串,用于生成 token | ||||||
|  |     const tokenSecret = 'XX' + nanoid(39); | ||||||
|  |     json5Content.replace('<TOKEN_SECRET>', tokenSecret); | ||||||
|  |     // tokenSecret | ||||||
|  |     //  把app.config.json5.example添加到zip中 | ||||||
|  |     // zip.file(path.join(cwd, 'app.config.json5.example'), { name: 'app.config.json5.example' }); | ||||||
|  |     zip.append(json5Content, { name: 'app.config.json5.example' }); | ||||||
|  |  | ||||||
|  |     // 结束归档(必须调用,否则 zip 文件无法完成) | ||||||
|  |     zip.finalize(); | ||||||
|  |   }); | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | getZip().then(() => { | ||||||
|  |   console.log('zip success'); | ||||||
|  |   console.log(`envision switchOrg system && envision  deploy ./release/${zipName} -v 1.0.0 -k page-proxy -y y -u`); | ||||||
|  |  | ||||||
|  |   console.log(`download zip: https://kevisual.xiongxiao.me/system/page-proxy/${zipName}`); | ||||||
|  | }); | ||||||
| @@ -1,8 +1,8 @@ | |||||||
| import { handleRequest } from './module/index.ts'; | import { handleRequest } from './module/index.ts'; | ||||||
| import { useConfig } from '@kevisual/use-config'; | import { config } from './module/config.ts'; | ||||||
| import { app } from './app.ts'; | import { app } from './app.ts'; | ||||||
| import './route/route.ts' | import './route/route.ts'; | ||||||
| const { port } = useConfig<{ port: number }>(); | const port = config?.proxy?.port || 3005; | ||||||
|  |  | ||||||
| app | app | ||||||
|   .route({ |   .route({ | ||||||
|   | |||||||
							
								
								
									
										33
									
								
								src/module/config.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								src/module/config.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | import { useConfig } from '@kevisual/use-config'; | ||||||
|  | import { useFileStore } from '@kevisual/use-config/file-store'; | ||||||
|  | export const fileStore = useFileStore('proxy-upload'); | ||||||
|  |  | ||||||
|  | type ConfigType = { | ||||||
|  |   api: { | ||||||
|  |     /** | ||||||
|  |      * API host address | ||||||
|  |      */ | ||||||
|  |     host: string; | ||||||
|  |     path?: string; | ||||||
|  |     port?: number; | ||||||
|  |   }; | ||||||
|  |   proxy: { | ||||||
|  |     port?: number; | ||||||
|  |     /** | ||||||
|  |      * self domain kevisual.xiongxiao.me | ||||||
|  |      */ | ||||||
|  |     domain: string; | ||||||
|  |     /** | ||||||
|  |      * resources path | ||||||
|  |      * https://minio.xiongxiao.me/resources | ||||||
|  |      */ | ||||||
|  |     resources: string; | ||||||
|  |     /** | ||||||
|  |      * allow origin xiongxiao.me zxj.im silkyai.cn | ||||||
|  |      * 允许跨域访问的地址 | ||||||
|  |      */ | ||||||
|  |     allowOrigin: string[]; | ||||||
|  |   }; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | export const config = useConfig<ConfigType>(); | ||||||
| @@ -1,7 +1,6 @@ | |||||||
| import path from 'path'; | import path from 'path'; | ||||||
| import { redis, subscriber } from './redis/redis.ts'; | import { redis, subscriber } from './redis/redis.ts'; | ||||||
| import { useFileStore } from '@kevisual/use-config/file-store'; | import { config, fileStore } from '../module/config.ts'; | ||||||
| import { useConfig } from '@kevisual/use-config'; |  | ||||||
| import fs from 'fs'; | import fs from 'fs'; | ||||||
| import crypto from 'crypto'; | import crypto from 'crypto'; | ||||||
| import { nanoid } from 'nanoid'; | import { nanoid } from 'nanoid'; | ||||||
| @@ -10,8 +9,7 @@ import { promisify } from 'util'; | |||||||
| import { fetchApp, fetchDomain, fetchTest } from './query/get-router.ts'; | import { fetchApp, fetchDomain, fetchTest } from './query/get-router.ts'; | ||||||
| const pipelineAsync = promisify(pipeline); | const pipelineAsync = promisify(pipeline); | ||||||
|  |  | ||||||
| const { resources, api } = useConfig<{ resources: string; api: { host: string; path: string } }>(); | const { resources } = config?.proxy || { resources: 'https://minio.xiongxiao.me/resources' }; | ||||||
| const fileStore = useFileStore('upload'); |  | ||||||
| const status: { [key: string]: boolean } = {}; | const status: { [key: string]: boolean } = {}; | ||||||
| const demoData = { | const demoData = { | ||||||
|   user: 'root', |   user: 'root', | ||||||
| @@ -255,7 +253,7 @@ export const downloadUserAppFiles = async (user: string, app: string, data: type | |||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|   if (data.type === 'oss') { |   if (data.type === 'oss') { | ||||||
|     const serverPath = 'https://' + resources + '/'; |     let serverPath = new URL(resources).href + '/'; | ||||||
|     // server download file |     // server download file | ||||||
|     for (let i = 0; i < files.length; i++) { |     for (let i = 0; i < files.length; i++) { | ||||||
|       const file = files[i]; |       const file = files[i]; | ||||||
|   | |||||||
| @@ -1,22 +1,17 @@ | |||||||
| import { getDNS, isLocalhost } from '@/utils/dns.ts'; | import { getDNS, isLocalhost } from '@/utils/dns.ts'; | ||||||
| import http from 'http'; | import http from 'http'; | ||||||
| import { UserApp } from './get-user-app.ts'; | import { UserApp } from './get-user-app.ts'; | ||||||
| import { useFileStore } from '@kevisual/use-config/file-store'; | import { config, fileStore } from '../module/config.ts'; | ||||||
| import path from 'path'; | import path from 'path'; | ||||||
| import fs from 'fs'; | import fs from 'fs'; | ||||||
| import { useConfig } from '@kevisual/use-config'; |  | ||||||
| import { getContentType } from './get-content-type.ts'; | import { getContentType } from './get-content-type.ts'; | ||||||
| import { sleep } from '@/utils/sleep.ts'; | import { sleep } from '@/utils/sleep.ts'; | ||||||
| const { api, domain, allowedOrigins } = useConfig<{ |  | ||||||
|   api: { |  | ||||||
|     host: string; |  | ||||||
|     port?: number; |  | ||||||
|   }; |  | ||||||
|   domain: string; |  | ||||||
|   allowedOrigins: string[]; |  | ||||||
| }>(); |  | ||||||
|  |  | ||||||
| const fileStore = useFileStore('upload'); | const api = config?.api || { host: 'kevisual.xiongxiao.me', path: '/api/router' }; | ||||||
|  | const domain = config?.proxy?.domain || 'kevisual.xiongxiao.me'; | ||||||
|  | const allowedOrigins = config?.proxy?.allowOrigin || []; | ||||||
|  |  | ||||||
|  |  | ||||||
| const noProxyUrl = ['/', '/favicon.ico']; | const noProxyUrl = ['/', '/favicon.ico']; | ||||||
| export const handleRequest = async (req: http.IncomingMessage, res: http.ServerResponse) => { | export const handleRequest = async (req: http.IncomingMessage, res: http.ServerResponse) => { | ||||||
|   if (req.url === '/favicon.ico') { |   if (req.url === '/favicon.ico') { | ||||||
| @@ -24,13 +19,18 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR | |||||||
|     res.write('proxy no favicon.ico\n'); |     res.write('proxy no favicon.ico\n'); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if (req.url.startsWith('/api/router')) { |   if (req.url.startsWith('/api/proxy')) { | ||||||
|  |     return; | ||||||
|  |   } | ||||||
|  |   if (req.url.startsWith('/api')) { | ||||||
|     // 代理到 http://codeflow.xiongxiao.me/api |     // 代理到 http://codeflow.xiongxiao.me/api | ||||||
|     const _u = new URL(req.url, `http://${api.host}`); |     const _u = new URL(req.url, `http://${api.host}`); | ||||||
|     // 设置代理请求的目标 URL 和请求头 |     // 设置代理请求的目标 URL 和请求头 | ||||||
|     let header: any = {}; |     let header: any = {}; | ||||||
|     if (req.headers?.['Authroization']) { |     if (req.headers?.['Authorization']) { | ||||||
|       header.Authorization = req.headers?.['Authroization']; |       header.authorization = req.headers['Authorization']; | ||||||
|  |     } else if (req.headers?.['authorization']) { | ||||||
|  |       header.authorization = req.headers['authorization']; | ||||||
|     } |     } | ||||||
|     if (req.headers?.['Content-Type']) { |     if (req.headers?.['Content-Type']) { | ||||||
|       header['Content-Type'] = req.headers?.['Content-Type']; |       header['Content-Type'] = req.headers?.['Content-Type']; | ||||||
| @@ -64,9 +64,6 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR | |||||||
|     req.pipe(proxyReq, { end: true }); |     req.pipe(proxyReq, { end: true }); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if (req.url.startsWith('/api/proxy')) { |  | ||||||
|     return; |  | ||||||
|   } |  | ||||||
|   if (req.url.startsWith('/api')) { |   if (req.url.startsWith('/api')) { | ||||||
|     res.end('not catch api'); |     res.end('not catch api'); | ||||||
|     return; |     return; | ||||||
|   | |||||||
| @@ -1,11 +1,6 @@ | |||||||
| import { useConfig } from '@kevisual/use-config'; | import { config } from '../config.ts'; | ||||||
|  |  | ||||||
| const { resources, api } = useConfig<{ |  | ||||||
|   resources: string; |  | ||||||
|   api: { host: string; path: string }; |  | ||||||
|   ƒ; |  | ||||||
| }>(); |  | ||||||
|  |  | ||||||
|  | const api = config?.api || { host: 'kevisual.xiongxiao.me', path: '/api/router' }; | ||||||
| const apiPath = api.path || '/api/router'; | const apiPath = api.path || '/api/router'; | ||||||
| export const fetchTest = async (id: string) => { | export const fetchTest = async (id: string) => { | ||||||
|   const fetchUrl = 'http://' + api.host + apiPath; |   const fetchUrl = 'http://' + api.host + apiPath; | ||||||
|   | |||||||
| @@ -2,8 +2,7 @@ import { UserApp } from '@/module/get-user-app.ts'; | |||||||
| import { app } from '../../app.ts'; | import { app } from '../../app.ts'; | ||||||
| import { redis } from '@/module/redis/redis.ts'; | import { redis } from '@/module/redis/redis.ts'; | ||||||
| import fs from 'fs'; | import fs from 'fs'; | ||||||
| import { useFileStore } from '@kevisual/use-config/file-store'; | import { fileStore } from '../../module/config.ts'; | ||||||
| const fileStore = useFileStore('upload'); |  | ||||||
|  |  | ||||||
| app | app | ||||||
|   .route({ |   .route({ | ||||||
|   | |||||||
| @@ -1,8 +1,7 @@ | |||||||
| import { UserApp, clearAllUserApp } from '../module/get-user-app.ts'; | import { UserApp, clearAllUserApp } from '../module/get-user-app.ts'; | ||||||
| import { redis } from '../module/redis/redis.ts'; | import { redis } from '../module/redis/redis.ts'; | ||||||
| import path from 'path'; | import path from 'path'; | ||||||
| import { useFileStore } from '@kevisual/use-config/file-store'; | import { config, fileStore } from '../module/config.ts'; | ||||||
| const filePath = useFileStore('upload'); |  | ||||||
|  |  | ||||||
| const main = async () => { | const main = async () => { | ||||||
|   const userApp = new UserApp({ user: 'root', app: 'codeflow' }); |   const userApp = new UserApp({ user: 'root', app: 'codeflow' }); | ||||||
| @@ -33,7 +32,6 @@ const clearData = async () => { | |||||||
| // clearData(); | // clearData(); | ||||||
| // clearAllUserApp(); | // clearAllUserApp(); | ||||||
|  |  | ||||||
|  |  | ||||||
| const expireData = async () => { | const expireData = async () => { | ||||||
|   await redis.set('user:app:exist:' + 'codeflow:root', 'value', 'EX', 2); |   await redis.set('user:app:exist:' + 'codeflow:root', 'value', 'EX', 2); | ||||||
|   process.exit(0); |   process.exit(0); | ||||||
| @@ -45,5 +43,5 @@ const keysData = async () => { | |||||||
|   const keys = await redis.keys('user:app:exist:*'); |   const keys = await redis.keys('user:app:exist:*'); | ||||||
|   console.log('keys', keys); |   console.log('keys', keys); | ||||||
|   process.exit(0); |   process.exit(0); | ||||||
| } | }; | ||||||
| keysData(); | keysData(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user