diff --git a/src/routes/app-manager/index.ts b/src/routes/app-manager/index.ts index 8d74b40..ec76989 100644 --- a/src/routes/app-manager/index.ts +++ b/src/routes/app-manager/index.ts @@ -4,4 +4,6 @@ import './user-app.ts'; import './public/index.ts'; import './domain/index.ts'; +import './proxy/index.ts'; + export * from './module/index.ts'; diff --git a/src/routes/app-manager/proxy/index.ts b/src/routes/app-manager/proxy/index.ts new file mode 100644 index 0000000..f7f45b7 --- /dev/null +++ b/src/routes/app-manager/proxy/index.ts @@ -0,0 +1 @@ +import './page-proxy.ts'; diff --git a/src/routes/app-manager/proxy/page-proxy.ts b/src/routes/app-manager/proxy/page-proxy.ts new file mode 100644 index 0000000..75c65a7 --- /dev/null +++ b/src/routes/app-manager/proxy/page-proxy.ts @@ -0,0 +1,29 @@ +import { app, redis } from '@/app.ts'; +app + .route({ + path: 'page-proxy-app', + key: 'status', + }) + .define(async (ctx) => { + // + const { user, app } = ctx.query; + if (!user || !app) { + ctx.body = { + code: 400, + message: 'user and app are required', + }; + return; + } + const key = `user:app:status:${app}:${user}`; + const status = await redis.get(key); + if (!status) { + ctx.throw(404, 'status not found'); + } + try { + const parsedStatus = JSON.parse(status); + ctx.body = parsedStatus; + } catch (e) { + ctx.throw(400, 'status is not a valid json'); + } + }) + .addTo(app); diff --git a/submodules/code-center-module b/submodules/code-center-module index 0c36328..60c5a98 160000 --- a/submodules/code-center-module +++ b/submodules/code-center-module @@ -1 +1 @@ -Subproject commit 0c36328ac3e728e7978cca03bb187fb4e841f6d8 +Subproject commit 60c5a986edd4add11b229b2d3c869dcdf32c0428