SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.
JavaScript a2aagentic-aiai-agentsdevtoolsmcp-clientn8n-alternativeno-codeopen-sourceorchestrationsmythosvisual-builder
remove public router
Ahmed Essamf6f0fe862fee
diff --git a/packages/app/src/backend/index.ts b/packages/app/src/backend/index.tsindex 0888eb3a..eb1c24ae 100644--- a/packages/app/src/backend/index.ts+++ b/packages/app/src/backend/index.ts@@ -11,7 +11,6 @@ import apiRouter from './routes/api/router';import dbgRouter from './routes/dbg/router';import oauthRouter from './routes/oauth/router';import pagesRouter from './routes/pages/router';-import publicRouter from './routes/public/router';//import { handleAuthRoutes, withLogto } from '@logto/express';import { handleAuthRoutes, withLogto } from './logtoHelper';@@ -113,8 +112,6 @@ app.use('/api', [apiAuth, apiACLCheck], apiRouter);app.use('/dbg', [apiAuth], dbgRouter);app.use('/oauth', oauthRouter);-app.use('/', publicRouter);-app.use([pageAuth, pageACLCheck, includeTeamDetails]);// Set EJS as templating enginediff --git a/packages/app/src/backend/routes/public/api/router.ts b/packages/app/src/backend/routes/public/api/router.tsdeleted file mode 100644index e5bda8c9..00000000--- a/packages/app/src/backend/routes/public/api/router.ts+++ /dev/null@@ -1,9 +0,0 @@-import express from 'express';--import templatesRouter from './templates/router';--const router = express.Router();--router.use('/templates', templatesRouter);--export default router;diff --git a/packages/app/src/backend/routes/public/api/templates/router.ts b/packages/app/src/backend/routes/public/api/templates/router.tsdeleted file mode 100644index 55c075e4..00000000--- a/packages/app/src/backend/routes/public/api/templates/router.ts+++ /dev/null@@ -1,99 +0,0 @@-import express from 'express';--import config from '../../../../config';-import { readAgentTemplates, getIntegrations } from '../../../router.utils';-import { ENTERPRISE_COLLECTION_TEMPLATE_NAMES } from '../../../../../shared/constants/general';--const router = express.Router();--router.get('/agent-templates', async (req, res) => {- try {- const templates = await readAgentTemplates(req);-- const templatesInfo = [];-- for (const [key, value] of Object.entries(templates)) {- const info = (value as Record<string, any>)?.template?.templateInfo;- const templateData = (value as Record<string, any>)?.template;-- if (info?.publish) {- const {- id,- name,- description = '',- icon = '',- imageUrl = '',- docLink = '',- videoLink = '',- valueProposition = '',- } = info;-- const uiServer = new URL(config.env.UI_SERVER);- const url = new URL(`/builder?templateId=${info.id}.smyth`, uiServer).toString();-- let categories = info?.category || [];-- if (categories && typeof categories === 'string') {- categories = categories.split(',');- }-- // here spreading 'info' like {...info} works, but we want to make sure that all properties are present even it's undefined- templatesInfo.push({- id,- name,- description,- icon,- imageUrl,- docLink,- videoLink,- categories,- url,- behavior: templateData?.behavior,- template: templateData, // Include the full template data- file: info?.id,- business_only: ENTERPRISE_COLLECTION_TEMPLATE_NAMES.includes(name),- });- }- }-- return res.send({ success: true, data: templatesInfo });- } catch (error) {- console.error('Error in getting agent-templates:', error);- return res.send({ success: true, data: {} });- }-});--router.get('/component-templates', async (req, res) => {- try {- const integrations = await getIntegrations();-- const templatesInfo = [];-- for (const integration of integrations) {- const { children } = integration;- templatesInfo.push(- ...children- .filter((child) => child?.visible)- .map((child) => {- const id = child.attributes['smt-template-id'];-- // remove the attributes, as we moved it to the id property- delete child.attributes;- delete child.visible; // don't need 'visible' property-- return {- id,- collectionName: integration.name,- ...child,- };- }),- );- }-- return res.send({ success: true, data: templatesInfo });- } catch (error) {- return res.send({ success: true, data: {} });- }-});--export default router;diff --git a/packages/app/src/backend/routes/public/router.ts b/packages/app/src/backend/routes/public/router.tsdeleted file mode 100644index e2d0093f..00000000--- a/packages/app/src/backend/routes/public/router.ts+++ /dev/null@@ -1,49 +0,0 @@-import express from 'express';-import { createProxyMiddleware } from 'http-proxy-middleware';-import config from '../../config';-import apiRouter from './api/router';--const router = express.Router();--// #region PROXY ROUTES-router.post(- '/v1/subscriptions/_external/webhook/stripe',- express.raw({ type: 'application/json' }),- createProxyMiddleware({- target: config.env.SMYTH_API_BASE_URL,- // pathRewrite: {},- changeOrigin: true,- onProxyReq: (proxyReq, req) => {- // Forward the raw body for Stripe signature verification- proxyReq.setHeader('Content-Type', 'application/json');- // @ts-ignore- proxyReq.setHeader('Content-Length', Buffer.byteLength(req.rawBody));- // @ts-ignore- proxyReq.write(req.rawBody);- },- }),-);--router.use(- ['/_sysapi/v1/subscriptions*', '/_sysapi/v1/plans*', '/_sysapi/v1/teams*'],- express.raw({ type: 'application/json' }),- createProxyMiddleware({- target: config.env.SMYTH_API_BASE_URL,- // pathRewrite: {},- changeOrigin: true,- onProxyReq: (proxyReq, req) => {- // Forward the raw body for Stripe signature verification- proxyReq.setHeader('Content-Type', 'application/json');- // @ts-ignore- proxyReq.setHeader('Content-Length', Buffer.byteLength(req.rawBody));- // @ts-ignore- proxyReq.write(req.rawBody);- },- }),-);-// #endregion--// public API-router.use('/public/api/v1', apiRouter);--export default router;