Skip to content

Commit 97de3bc

Browse files
authored
Merge pull request #9136 from github/repo-sync
repo sync
2 parents f396b5b + 8d7bb82 commit 97de3bc

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

components/sidebar/SidebarProduct.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export const SidebarProduct = () => {
5454
const isStandaloneCategory = childPage.page.documentType === 'article'
5555

5656
const childTitle = childPage.renderedShortTitle || childPage.renderedFullTitle
57-
58-
const isActive = routePath.includes(childPage.href) || routePath === childPage.href
57+
const isActive =
58+
routePath.includes(childPage.href + '/') || routePath === childPage.href
5959
const defaultOpen = hasExactCategory ? isActive : false
6060
return (
6161
<li

middleware/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import express from 'express'
2+
import basicAuth from 'express-basic-auth'
23
import instrument from '../lib/instrument-middleware.js'
34
import haltOnDroppedConnection from './halt-on-dropped-connection.js'
45
import abort from './abort.js'
@@ -61,6 +62,7 @@ import renderPage from './render-page.js'
6162
const { NODE_ENV } = process.env
6263
const isDevelopment = NODE_ENV === 'development'
6364
const isTest = NODE_ENV === 'test' || process.env.GITHUB_ACTIONS === 'true'
65+
const isProduction = NODE_ENV === 'production' && process.env.HEROKU_PRODUCTION_APP
6466

6567
// Catch unhandled promise rejections and passing them to Express's error handler
6668
// https://medium.com/@Abazhenov/using-async-await-in-express-with-node-8-b8af872c0016
@@ -143,16 +145,18 @@ export default function (app) {
143145
instrument(archivedEnterpriseVersionsAssets, './archived-enterprise-versions-assets')
144146
)
145147
)
146-
app.use(
147-
'/storybook',
148+
app.use('/storybook', [
149+
(isProduction &&
150+
basicAuth({ users: { octocat: process.env.STORYBOOK_PASSWORD }, challenge: true })) ||
151+
((req, res, next) => next()),
148152
express.static('storybook', {
149153
index: false,
150154
etag: false,
151155
immutable: true,
152156
lastModified: false,
153157
maxAge: '1 day', // Relatively short in case we update index.html
154-
})
155-
)
158+
}),
159+
])
156160
app.use(
157161
'/assets',
158162
express.static('assets', {

package-lock.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"dayjs": "^1.10.6",
3232
"dotenv": "^10.0.0",
3333
"express": "^4.17.1",
34+
"express-basic-auth": "^1.2.0",
3435
"express-rate-limit": "^5.3.0",
3536
"express-timeout-handler": "^2.2.2",
3637
"flat": "^5.0.2",

0 commit comments

Comments
 (0)