@backstage/plugin-app-backend 0.5.19-next.0 → 0.5.19-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/service/router.cjs.js +24 -10
- package/dist/service/router.cjs.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @backstage/plugin-app-backend
|
|
2
2
|
|
|
3
|
+
## 0.5.19-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c55505e: Fix protected app sign-in returning a 404 when an authenticated browser repeats the sign-in handoff for the same user.
|
|
8
|
+
|
|
9
|
+
## 0.5.19-next.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @backstage/backend-plugin-api@1.11.0-next.1
|
|
15
|
+
- @backstage/plugin-app-node@0.1.50-next.1
|
|
16
|
+
- @backstage/plugin-auth-node@0.7.7-next.1
|
|
17
|
+
|
|
3
18
|
## 0.5.19-next.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -70,33 +70,39 @@ async function createRouter(options) {
|
|
|
70
70
|
`App is running in protected mode, serving public content from ${publicDistDir}`
|
|
71
71
|
);
|
|
72
72
|
const publicRouter = Router__default.default();
|
|
73
|
-
|
|
73
|
+
const getRequestCredentials = async (req, res) => {
|
|
74
74
|
try {
|
|
75
|
-
|
|
75
|
+
return await httpAuth.credentials(req, {
|
|
76
76
|
allow: ["user", "service", "none"],
|
|
77
77
|
allowLimitedAccess: true
|
|
78
78
|
});
|
|
79
|
-
if (credentials.principal.type === "none") {
|
|
80
|
-
next();
|
|
81
|
-
} else {
|
|
82
|
-
next("router");
|
|
83
|
-
}
|
|
84
79
|
} catch {
|
|
80
|
+
const credentials = await auth.getNoneCredentials();
|
|
85
81
|
await httpAuth.issueUserCookie(res, {
|
|
86
|
-
credentials
|
|
82
|
+
credentials
|
|
87
83
|
});
|
|
88
|
-
|
|
84
|
+
return credentials;
|
|
89
85
|
}
|
|
90
|
-
}
|
|
86
|
+
};
|
|
91
87
|
publicRouter.post(
|
|
92
88
|
"*",
|
|
93
89
|
express__default.default.urlencoded({ extended: true }),
|
|
94
90
|
async (req, res, next) => {
|
|
95
91
|
if (req.body.type === "sign-in") {
|
|
92
|
+
const existingCredentials = await getRequestCredentials(req, res);
|
|
93
|
+
if (auth.isPrincipal(existingCredentials, "service")) {
|
|
94
|
+
next("router");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
96
97
|
const credentials = await auth.authenticate(req.body.token);
|
|
97
98
|
if (!auth.isPrincipal(credentials, "user")) {
|
|
98
99
|
throw new errors.AuthenticationError("Invalid token, not a user");
|
|
99
100
|
}
|
|
101
|
+
if (auth.isPrincipal(existingCredentials, "user") && existingCredentials.principal.userEntityRef !== credentials.principal.userEntityRef) {
|
|
102
|
+
throw new errors.AuthenticationError(
|
|
103
|
+
"Refused to replace an existing authenticated session"
|
|
104
|
+
);
|
|
105
|
+
}
|
|
100
106
|
await httpAuth.issueUserCookie(res, {
|
|
101
107
|
credentials
|
|
102
108
|
});
|
|
@@ -109,6 +115,14 @@ async function createRouter(options) {
|
|
|
109
115
|
}
|
|
110
116
|
}
|
|
111
117
|
);
|
|
118
|
+
publicRouter.use(async (req, res, next) => {
|
|
119
|
+
const credentials = await getRequestCredentials(req, res);
|
|
120
|
+
if (credentials.principal.type === "none") {
|
|
121
|
+
next();
|
|
122
|
+
} else {
|
|
123
|
+
next("router");
|
|
124
|
+
}
|
|
125
|
+
});
|
|
112
126
|
publicRouter.use(
|
|
113
127
|
await createEntryPointRouter({
|
|
114
128
|
logger: logger.child({ entry: "public" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.cjs.js","sources":["../../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DatabaseService,\n resolvePackagePath,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport type { AppConfig } from '@backstage/config';\nimport helmet from 'helmet';\nimport express, { Request, Response } from 'express';\nimport Router from 'express-promise-router';\nimport fs from 'fs-extra';\nimport { resolve as resolvePath } from 'node:path';\nimport {\n createStaticAssetMiddleware,\n findStaticAssets,\n StaticAssetsStore,\n} from '../lib/assets';\nimport {\n CACHE_CONTROL_MAX_CACHE,\n CACHE_CONTROL_NO_CACHE,\n CACHE_CONTROL_REVALIDATE_CACHE,\n} from '../lib/headers';\nimport type { ConfigSchema } from '@backstage/config-loader';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { AuthenticationError, InputError } from '@backstage/errors';\nimport { injectConfig, readFrontendConfig } from '../lib/config';\n\n// express uses mime v1 while we only have types for mime v2\ntype Mime = { lookup(arg0: string): string };\n\n/**\n * @internal\n */\nexport interface RouterOptions {\n config: RootConfigService;\n logger: LoggerService;\n auth: AuthService;\n httpAuth: HttpAuthService;\n\n /**\n * If a database is provided it will be used to cache previously deployed static assets.\n *\n * This is a built-in alternative to using a `staticFallbackHandler`.\n */\n database: DatabaseService;\n\n /**\n * The name of the app package that content should be served from. The same app package should be\n * added as a dependency to the backend package in order for it to be accessible at runtime.\n *\n * In a typical setup with a single app package this would be set to 'app'.\n */\n appPackageName: string;\n\n /**\n * A request handler to handle requests for static content that are not present in the app bundle.\n *\n * This can be used to avoid issues with clients on older deployment versions trying to access lazy\n * loaded content that is no longer present. Typically the requests would fall back to a long-term\n * object store where all recently deployed versions of the app are present.\n *\n * Another option is to provide a `database` that will take care of storing the static assets instead.\n *\n * If both `database` and `staticFallbackHandler` are provided, the `database` will attempt to serve\n * static assets first, and if they are not found, the `staticFallbackHandler` will be called.\n */\n staticFallbackHandler?: express.Handler;\n\n /**\n *\n * Provides a ConfigSchema.\n *\n */\n schema?: ConfigSchema;\n}\n\n/**\n * @internal\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n appPackageName,\n staticFallbackHandler,\n auth,\n httpAuth,\n schema,\n } = options;\n\n const disableConfigInjection = config.getOptionalBoolean(\n 'app.disableConfigInjection',\n );\n const disableStaticFallbackCache = config.getOptionalBoolean(\n 'app.disableStaticFallbackCache',\n );\n\n const appDistDir = resolvePackagePath(appPackageName, 'dist');\n const staticDir = resolvePath(appDistDir, 'static');\n\n if (!(await fs.pathExists(staticDir))) {\n if (process.env.NODE_ENV === 'production') {\n logger.error(\n `Can't serve static app content from ${staticDir}, directory doesn't exist`,\n );\n }\n\n return Router();\n }\n\n logger.info(`Serving static app content from ${appDistDir}`);\n\n const appConfigs = disableConfigInjection\n ? undefined\n : await readFrontendConfig({\n config,\n appDistDir,\n env: process.env,\n schema,\n });\n\n const assetStore = !disableStaticFallbackCache\n ? await StaticAssetsStore.create({\n logger,\n database: options.database,\n })\n : undefined;\n\n const router = Router();\n\n router.use(helmet.frameguard({ action: 'deny' }));\n\n const publicDistDir = resolvePath(appDistDir, 'public');\n\n const disablePublicEntryPoint = config.getOptionalBoolean(\n 'app.disablePublicEntryPoint',\n );\n const enablePublicEntryPoint =\n !disablePublicEntryPoint && (await fs.pathExists(publicDistDir));\n\n if (enablePublicEntryPoint) {\n logger.info(\n `App is running in protected mode, serving public content from ${publicDistDir}`,\n );\n\n const publicRouter = Router();\n\n publicRouter.use(async (req, res, next) => {\n try {\n const credentials = await httpAuth.credentials(req, {\n allow: ['user', 'service', 'none'],\n allowLimitedAccess: true,\n });\n\n if (credentials.principal.type === 'none') {\n next();\n } else {\n next('router');\n }\n } catch {\n // If we fail to authenticate, make sure the session cookie is cleared\n // and continue as unauthenticated. If the user is logged in they will\n // immediately be redirected back to the protected app via the POST.\n await httpAuth.issueUserCookie(res, {\n credentials: await auth.getNoneCredentials(),\n });\n next();\n }\n });\n\n publicRouter.post(\n '*',\n express.urlencoded({ extended: true }),\n async (req, res, next) => {\n if (req.body.type === 'sign-in') {\n const credentials = await auth.authenticate(req.body.token);\n\n if (!auth.isPrincipal(credentials, 'user')) {\n throw new AuthenticationError('Invalid token, not a user');\n }\n\n await httpAuth.issueUserCookie(res, {\n credentials,\n });\n\n // Resume as if it was a GET request towards the outer protected router, serving index.html\n req.method = 'GET';\n next('router');\n } else {\n throw new InputError(\n 'Invalid POST request to app-backend wildcard endpoint',\n );\n }\n },\n );\n\n publicRouter.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'public' }),\n rootDir: publicDistDir,\n assetStore: assetStore?.withNamespace('public'),\n appConfigs, // TODO(Rugvip): We should not be including the full config here\n }),\n );\n\n router.use(publicRouter);\n }\n\n router.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'main' }),\n rootDir: appDistDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n }),\n );\n\n return router;\n}\n\nasync function createEntryPointRouter({\n logger,\n rootDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n}: {\n logger: LoggerService;\n rootDir: string;\n assetStore?: StaticAssetsStore;\n staticFallbackHandler?: express.Handler;\n appConfigs?: AppConfig[];\n}) {\n const staticDir = resolvePath(rootDir, 'static');\n\n const injectResult =\n appConfigs &&\n (await injectConfig({ appConfigs, logger, rootDir, staticDir }));\n\n const router = Router();\n\n // Use a separate router for static content so that a fallback can be provided by backend\n const staticRouter = Router();\n staticRouter.use(\n express.static(staticDir, {\n setHeaders: (res, path) => {\n if (injectResult?.injectedPath === path) {\n res.setHeader('Cache-Control', CACHE_CONTROL_REVALIDATE_CACHE);\n } else {\n res.setHeader('Cache-Control', CACHE_CONTROL_MAX_CACHE);\n }\n },\n }),\n );\n\n if (assetStore) {\n const assets = await findStaticAssets(staticDir);\n await assetStore.storeAssets(assets);\n // Remove any assets that are older than 7 days\n await assetStore.trimAssets({ maxAgeSeconds: 60 * 60 * 24 * 7 });\n\n staticRouter.use(createStaticAssetMiddleware(assetStore));\n }\n\n if (staticFallbackHandler) {\n staticRouter.use(staticFallbackHandler);\n }\n staticRouter.use((_req: Request, res: Response) => {\n res.status(404).end();\n });\n\n router.use('/static', staticRouter);\n\n const rootRouter = Router();\n rootRouter.use((req, _res, next) => {\n // Make sure / and /index.html are handled by the HTML5 route below\n if (req.path === '/' || req.path === '/index.html') {\n next('router');\n } else {\n next();\n }\n });\n rootRouter.use(\n express.static(rootDir, {\n setHeaders: (res, path) => {\n // The Cache-Control header instructs the browser to not cache html files since it might\n // link to static assets from recently deployed versions.\n if (\n (express.static.mime as unknown as Mime).lookup(path) === 'text/html'\n ) {\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n }\n },\n }),\n );\n router.use(rootRouter);\n\n // HTML5 routing\n router.get('/*', (_req, res) => {\n if (injectResult?.indexHtmlContent) {\n res.setHeader('Content-Type', 'text/html; charset=utf-8');\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n res.send(injectResult.indexHtmlContent);\n } else {\n res.sendFile(resolvePath(rootDir, 'index.html'), {\n headers: {\n // The Cache-Control header instructs the browser to not cache the index.html since it might\n // link to static assets from recently deployed versions.\n 'cache-control': CACHE_CONTROL_NO_CACHE,\n },\n });\n }\n });\n\n return router;\n}\n"],"names":["resolvePackagePath","resolvePath","fs","Router","readFrontendConfig","StaticAssetsStore","helmet","express","AuthenticationError","InputError","injectConfig","CACHE_CONTROL_REVALIDATE_CACHE","CACHE_CONTROL_MAX_CACHE","findStaticAssets","createStaticAssetMiddleware","CACHE_CONTROL_NO_CACHE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkGA,eAAsB,aACpB,OA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H;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO,MAAA;AACT;;"}
|
|
1
|
+
{"version":3,"file":"router.cjs.js","sources":["../../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DatabaseService,\n resolvePackagePath,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport type { AppConfig } from '@backstage/config';\nimport helmet from 'helmet';\nimport express, { Request, Response } from 'express';\nimport Router from 'express-promise-router';\nimport fs from 'fs-extra';\nimport { resolve as resolvePath } from 'node:path';\nimport {\n createStaticAssetMiddleware,\n findStaticAssets,\n StaticAssetsStore,\n} from '../lib/assets';\nimport {\n CACHE_CONTROL_MAX_CACHE,\n CACHE_CONTROL_NO_CACHE,\n CACHE_CONTROL_REVALIDATE_CACHE,\n} from '../lib/headers';\nimport type { ConfigSchema } from '@backstage/config-loader';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { AuthenticationError, InputError } from '@backstage/errors';\nimport { injectConfig, readFrontendConfig } from '../lib/config';\n\n// express uses mime v1 while we only have types for mime v2\ntype Mime = { lookup(arg0: string): string };\n\n/**\n * @internal\n */\nexport interface RouterOptions {\n config: RootConfigService;\n logger: LoggerService;\n auth: AuthService;\n httpAuth: HttpAuthService;\n\n /**\n * If a database is provided it will be used to cache previously deployed static assets.\n *\n * This is a built-in alternative to using a `staticFallbackHandler`.\n */\n database: DatabaseService;\n\n /**\n * The name of the app package that content should be served from. The same app package should be\n * added as a dependency to the backend package in order for it to be accessible at runtime.\n *\n * In a typical setup with a single app package this would be set to 'app'.\n */\n appPackageName: string;\n\n /**\n * A request handler to handle requests for static content that are not present in the app bundle.\n *\n * This can be used to avoid issues with clients on older deployment versions trying to access lazy\n * loaded content that is no longer present. Typically the requests would fall back to a long-term\n * object store where all recently deployed versions of the app are present.\n *\n * Another option is to provide a `database` that will take care of storing the static assets instead.\n *\n * If both `database` and `staticFallbackHandler` are provided, the `database` will attempt to serve\n * static assets first, and if they are not found, the `staticFallbackHandler` will be called.\n */\n staticFallbackHandler?: express.Handler;\n\n /**\n *\n * Provides a ConfigSchema.\n *\n */\n schema?: ConfigSchema;\n}\n\n/**\n * @internal\n */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n appPackageName,\n staticFallbackHandler,\n auth,\n httpAuth,\n schema,\n } = options;\n\n const disableConfigInjection = config.getOptionalBoolean(\n 'app.disableConfigInjection',\n );\n const disableStaticFallbackCache = config.getOptionalBoolean(\n 'app.disableStaticFallbackCache',\n );\n\n const appDistDir = resolvePackagePath(appPackageName, 'dist');\n const staticDir = resolvePath(appDistDir, 'static');\n\n if (!(await fs.pathExists(staticDir))) {\n if (process.env.NODE_ENV === 'production') {\n logger.error(\n `Can't serve static app content from ${staticDir}, directory doesn't exist`,\n );\n }\n\n return Router();\n }\n\n logger.info(`Serving static app content from ${appDistDir}`);\n\n const appConfigs = disableConfigInjection\n ? undefined\n : await readFrontendConfig({\n config,\n appDistDir,\n env: process.env,\n schema,\n });\n\n const assetStore = !disableStaticFallbackCache\n ? await StaticAssetsStore.create({\n logger,\n database: options.database,\n })\n : undefined;\n\n const router = Router();\n\n router.use(helmet.frameguard({ action: 'deny' }));\n\n const publicDistDir = resolvePath(appDistDir, 'public');\n\n const disablePublicEntryPoint = config.getOptionalBoolean(\n 'app.disablePublicEntryPoint',\n );\n const enablePublicEntryPoint =\n !disablePublicEntryPoint && (await fs.pathExists(publicDistDir));\n\n if (enablePublicEntryPoint) {\n logger.info(\n `App is running in protected mode, serving public content from ${publicDistDir}`,\n );\n\n const publicRouter = Router();\n\n const getRequestCredentials = async (\n req: express.Request,\n res: express.Response,\n ) => {\n try {\n return await httpAuth.credentials(req, {\n allow: ['user', 'service', 'none'],\n allowLimitedAccess: true,\n });\n } catch {\n // If we fail to authenticate, make sure the session cookie is cleared\n // and continue as unauthenticated. If the user is logged in they will\n // immediately be redirected back to the protected app via the POST.\n const credentials = await auth.getNoneCredentials();\n await httpAuth.issueUserCookie(res, {\n credentials,\n });\n return credentials;\n }\n };\n\n // Handle sign-in before checking the existing session cookie so repeated\n // handoffs remain idempotent for users that are already authenticated.\n publicRouter.post(\n '*',\n express.urlencoded({ extended: true }),\n async (req, res, next) => {\n if (req.body.type === 'sign-in') {\n const existingCredentials = await getRequestCredentials(req, res);\n\n if (auth.isPrincipal(existingCredentials, 'service')) {\n next('router');\n return;\n }\n\n const credentials = await auth.authenticate(req.body.token);\n\n if (!auth.isPrincipal(credentials, 'user')) {\n throw new AuthenticationError('Invalid token, not a user');\n }\n\n if (\n auth.isPrincipal(existingCredentials, 'user') &&\n existingCredentials.principal.userEntityRef !==\n credentials.principal.userEntityRef\n ) {\n throw new AuthenticationError(\n 'Refused to replace an existing authenticated session',\n );\n }\n\n await httpAuth.issueUserCookie(res, {\n credentials,\n });\n\n // Resume as if it was a GET request towards the outer protected router, serving index.html\n req.method = 'GET';\n next('router');\n } else {\n throw new InputError(\n 'Invalid POST request to app-backend wildcard endpoint',\n );\n }\n },\n );\n\n publicRouter.use(async (req, res, next) => {\n const credentials = await getRequestCredentials(req, res);\n\n if (credentials.principal.type === 'none') {\n next();\n } else {\n next('router');\n }\n });\n\n publicRouter.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'public' }),\n rootDir: publicDistDir,\n assetStore: assetStore?.withNamespace('public'),\n appConfigs, // TODO(Rugvip): We should not be including the full config here\n }),\n );\n\n router.use(publicRouter);\n }\n\n router.use(\n await createEntryPointRouter({\n logger: logger.child({ entry: 'main' }),\n rootDir: appDistDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n }),\n );\n\n return router;\n}\n\nasync function createEntryPointRouter({\n logger,\n rootDir,\n assetStore,\n staticFallbackHandler,\n appConfigs,\n}: {\n logger: LoggerService;\n rootDir: string;\n assetStore?: StaticAssetsStore;\n staticFallbackHandler?: express.Handler;\n appConfigs?: AppConfig[];\n}) {\n const staticDir = resolvePath(rootDir, 'static');\n\n const injectResult =\n appConfigs &&\n (await injectConfig({ appConfigs, logger, rootDir, staticDir }));\n\n const router = Router();\n\n // Use a separate router for static content so that a fallback can be provided by backend\n const staticRouter = Router();\n staticRouter.use(\n express.static(staticDir, {\n setHeaders: (res, path) => {\n if (injectResult?.injectedPath === path) {\n res.setHeader('Cache-Control', CACHE_CONTROL_REVALIDATE_CACHE);\n } else {\n res.setHeader('Cache-Control', CACHE_CONTROL_MAX_CACHE);\n }\n },\n }),\n );\n\n if (assetStore) {\n const assets = await findStaticAssets(staticDir);\n await assetStore.storeAssets(assets);\n // Remove any assets that are older than 7 days\n await assetStore.trimAssets({ maxAgeSeconds: 60 * 60 * 24 * 7 });\n\n staticRouter.use(createStaticAssetMiddleware(assetStore));\n }\n\n if (staticFallbackHandler) {\n staticRouter.use(staticFallbackHandler);\n }\n staticRouter.use((_req: Request, res: Response) => {\n res.status(404).end();\n });\n\n router.use('/static', staticRouter);\n\n const rootRouter = Router();\n rootRouter.use((req, _res, next) => {\n // Make sure / and /index.html are handled by the HTML5 route below\n if (req.path === '/' || req.path === '/index.html') {\n next('router');\n } else {\n next();\n }\n });\n rootRouter.use(\n express.static(rootDir, {\n setHeaders: (res, path) => {\n // The Cache-Control header instructs the browser to not cache html files since it might\n // link to static assets from recently deployed versions.\n if (\n (express.static.mime as unknown as Mime).lookup(path) === 'text/html'\n ) {\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n }\n },\n }),\n );\n router.use(rootRouter);\n\n // HTML5 routing\n router.get('/*', (_req, res) => {\n if (injectResult?.indexHtmlContent) {\n res.setHeader('Content-Type', 'text/html; charset=utf-8');\n res.setHeader('Cache-Control', CACHE_CONTROL_NO_CACHE);\n res.send(injectResult.indexHtmlContent);\n } else {\n res.sendFile(resolvePath(rootDir, 'index.html'), {\n headers: {\n // The Cache-Control header instructs the browser to not cache the index.html since it might\n // link to static assets from recently deployed versions.\n 'cache-control': CACHE_CONTROL_NO_CACHE,\n },\n });\n }\n });\n\n return router;\n}\n"],"names":["resolvePackagePath","resolvePath","fs","Router","readFrontendConfig","StaticAssetsStore","helmet","express","AuthenticationError","InputError","injectConfig","CACHE_CONTROL_REVALIDATE_CACHE","CACHE_CONTROL_MAX_CACHE","findStaticAssets","createStaticAssetMiddleware","CACHE_CONTROL_NO_CACHE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkGA,eAAsB,aACpB,OAAA,EACyB;AACzB,EAAA,MAAM;AAAA,IACJ,MAAA;AAAA,IACA,MAAA;AAAA,IACA,cAAA;AAAA,IACA,qBAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAA,MAAM,yBAAyB,MAAA,CAAO,kBAAA;AAAA,IACpC;AAAA,GACF;AACA,EAAA,MAAM,6BAA6B,MAAA,CAAO,kBAAA;AAAA,IACxC;AAAA,GACF;AAEA,EAAA,MAAM,UAAA,GAAaA,mCAAA,CAAmB,cAAA,EAAgB,MAAM,CAAA;AAC5D,EAAA,MAAM,SAAA,GAAYC,iBAAA,CAAY,UAAA,EAAY,QAAQ,CAAA;AAElD,EAAA,IAAI,CAAE,MAAMC,mBAAA,CAAG,UAAA,CAAW,SAAS,CAAA,EAAI;AACrC,IAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,MAAA,MAAA,CAAO,KAAA;AAAA,QACL,uCAAuC,SAAS,CAAA,yBAAA;AAAA,OAClD;AAAA,IACF;AAEA,IAAA,OAAOC,uBAAA,EAAO;AAAA,EAChB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in-app-backend",
|
|
3
|
-
"version": "0.5.19-next.
|
|
3
|
+
"version": "0.5.19-next.2",
|
|
4
4
|
"description": "A Backstage backend plugin that serves the Backstage frontend app",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"test": "backstage-cli package test"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@backstage/backend-plugin-api": "1.
|
|
65
|
+
"@backstage/backend-plugin-api": "1.11.0-next.1",
|
|
66
66
|
"@backstage/config": "1.3.10-next.0",
|
|
67
67
|
"@backstage/config-loader": "1.11.4-next.0",
|
|
68
68
|
"@backstage/errors": "1.3.2-next.0",
|
|
69
|
-
"@backstage/plugin-app-node": "0.1.50-next.
|
|
70
|
-
"@backstage/plugin-auth-node": "0.7.7-next.
|
|
69
|
+
"@backstage/plugin-app-node": "0.1.50-next.1",
|
|
70
|
+
"@backstage/plugin-auth-node": "0.7.7-next.1",
|
|
71
71
|
"@backstage/types": "1.2.2",
|
|
72
72
|
"express": "^4.22.0",
|
|
73
73
|
"express-promise-router": "^4.1.0",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"luxon": "^3.0.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@backstage/backend-app-api": "1.
|
|
83
|
-
"@backstage/backend-defaults": "0.18.1-next.
|
|
84
|
-
"@backstage/backend-test-utils": "1.11.8-next.
|
|
82
|
+
"@backstage/backend-app-api": "1.8.0-next.1",
|
|
83
|
+
"@backstage/backend-defaults": "0.18.1-next.2",
|
|
84
|
+
"@backstage/backend-test-utils": "1.11.8-next.1",
|
|
85
85
|
"@backstage/cli": "0.36.7-next.0",
|
|
86
86
|
"@types/express": "^4.17.6",
|
|
87
87
|
"@types/supertest": "^2.0.8",
|