Skip to content

Commit 80488f1

Browse files
authored
Merge branch 'main' into repo-sync
2 parents dcb2cf6 + 26f4a56 commit 80488f1

59 files changed

Lines changed: 727 additions & 679 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/staging-deploy-pr.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ env:
3636
BUILD_ACTIONS_RUN_LOG: https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}
3737

3838
jobs:
39-
debug:
40-
runs-on: ubuntu-latest
41-
steps:
42-
- name: Dump full context for debugging
43-
env:
44-
GITHUB_CONTEXT: ${{ toJSON(github) }}
45-
run: echo "$GITHUB_CONTEXT"
46-
4739
pr-metadata:
4840
# This is needed because the workflow we depend on
4941
# (see on.workflow_run.workflows) might be running from pushes on

lib/page.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import renderContent from './render-content/index.js'
1313
import processLearningTracks from './process-learning-tracks.js'
1414
import { productMap } from './all-products.js'
1515
import slash from 'slash'
16-
import statsd from './statsd.js'
1716
import readFileContents from './read-file-contents.js'
1817
import getLinkData from './get-link-data.js'
1918
import getDocumentType from './get-document-type.js'
@@ -114,9 +113,7 @@ class Page {
114113
this.showMiniToc = this.showMiniToc === false ? this.showMiniToc : true
115114
}
116115

117-
// Instrument the `_render` method, so externally we call #render
118-
// but it's wrapped in a timer that reports to Datadog
119-
this.render = statsd.asyncTimer(this._render.bind(this), 'page.render')
116+
this.render = this._render.bind(this)
120117

121118
return this
122119
}

middleware/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import helpToDocs from './redirects/help-to-docs.js'
3434
import languageCodeRedirects from './redirects/language-code-redirects.js'
3535
import handleRedirects from './redirects/handle-redirects.js'
3636
import findPage from './find-page.js'
37+
import spotContentFlaws from './spot-content-flaws.js'
3738
import blockRobots from './block-robots.js'
3839
import archivedEnterpriseVersionsAssets from './archived-enterprise-versions-assets.js'
3940
import events from './events.js'
@@ -173,6 +174,7 @@ export default function (app) {
173174

174175
// *** Config and context for rendering ***
175176
app.use(asyncMiddleware(instrument(findPage, './find-page'))) // Must come before archived-enterprise-versions, breadcrumbs, featured-links, products, render-page
177+
app.use(asyncMiddleware(instrument(spotContentFlaws, './spot-content-flaws'))) // Must come after findPage
176178
app.use(instrument(blockRobots, './block-robots'))
177179

178180
// Check for a dropped connection before proceeding

middleware/render-page.js

Lines changed: 5 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import { get } from 'lodash-es'
22
import patterns from '../lib/patterns.js'
33
import getMiniTocItems from '../lib/get-mini-toc-items.js'
44
import Page from '../lib/page.js'
5+
import statsd from '../lib/statsd.js'
56
import { isConnectionDropped } from './halt-on-dropped-connection.js'
67
import { nextApp, nextHandleRequest } from './next.js'
78

8-
const pageCache = new Map()
9-
109
export default async function renderPage(req, res, next) {
1110
if (req.path.startsWith('/storybook')) {
1211
return nextHandleRequest(req, res)
@@ -31,45 +30,6 @@ export default async function renderPage(req, res, next) {
3130
// Is the request for JSON debugging info?
3231
const isRequestingJsonForDebugging = 'json' in req.query && process.env.NODE_ENV !== 'production'
3332

34-
// ****** temporary caching measure for holiday spam prevention *********
35-
36-
const isApiPage =
37-
req.context.currentPathWithoutLanguage.includes('rest/reference') ||
38-
req.context.currentPathWithoutLanguage.includes('graphql/reference')
39-
40-
// Serve from the cache if possible
41-
const isCacheable =
42-
// Skip for CI
43-
!process.env.CI &&
44-
// Skip for tests
45-
process.env.NODE_ENV !== 'test' &&
46-
// Skip for HTTP methods other than GET
47-
req.method === 'GET' &&
48-
// Skip for JSON debugging info requests
49-
!isRequestingJsonForDebugging &&
50-
// Only API pages
51-
isApiPage
52-
53-
// don't cache query strings
54-
const originalUrl = req.originalUrl.split('?')[0]
55-
56-
if (isCacheable) {
57-
// Stop processing if the connection was already dropped
58-
if (isConnectionDropped(req, res)) return
59-
60-
const cachedHtml = pageCache.get(originalUrl)
61-
if (cachedHtml) {
62-
// Stop processing if the connection was already dropped
63-
if (isConnectionDropped(req, res)) return
64-
65-
console.log(`Serving from cached version of ${originalUrl}`)
66-
// statsd.increment('page.sent_from_cache')
67-
return res.send(cachedHtml)
68-
}
69-
}
70-
71-
// ****** [end] temporary caching measure for holiday spam prevention *********
72-
7333
// add page context
7434
const context = Object.assign({}, req.context, { page })
7535

@@ -88,7 +48,10 @@ export default async function renderPage(req, res, next) {
8848
if (isConnectionDropped(req, res)) return
8949

9050
// render page
91-
context.renderedPage = await page.render(context)
51+
const pageRenderTimed = statsd.asyncTimer(page.render, 'middleware.render_page', [
52+
`path:${req.pagePath || req.path}`,
53+
])
54+
context.renderedPage = await pageRenderTimed(context)
9255

9356
// Stop processing if the connection was already dropped
9457
if (isConnectionDropped(req, res)) return
@@ -145,12 +108,5 @@ export default async function renderPage(req, res, next) {
145108
// Hand rendering over to NextJS
146109
req.context.renderedPage = context.renderedPage
147110
req.context.miniTocItems = context.miniTocItems
148-
149-
// ****** temporary caching measure for holiday spam prevention *********
150-
if (isCacheable) {
151-
pageCache.set(originalUrl, req.context.renderedPage)
152-
}
153-
// ****** [end] temporary caching measure for holiday spam prevention *********
154-
155111
return nextHandleRequest(req, res)
156112
}

middleware/spot-content-flaws.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// This middleware, exclusively in 'development' tries to spot flaws in
2+
// the content you're actively viewing.
3+
// The hopeful assumption is that if you're actively viewing this
4+
// page on localhost, you're actively working on its content.
5+
6+
import path from 'path'
7+
8+
import kleur from 'kleur'
9+
10+
export default async function spotContentFlaws(req, res, next) {
11+
const { page } = req.context
12+
if (process.env.NODE_ENV === 'development' && page) {
13+
const trailingSlashRedirects = (page.redirect_from || []).filter(
14+
(uri) => uri.endsWith('/') && uri.startsWith('/')
15+
)
16+
if (trailingSlashRedirects.length > 0) {
17+
console.warn(
18+
`The page ${kleur.bold(path.relative(process.cwd(), page.fullPath))} has ${
19+
trailingSlashRedirects.length
20+
} redirect_from entries that have a trailing slash\n ${kleur.yellow(
21+
trailingSlashRedirects.join('\n ')
22+
)}`
23+
)
24+
console.log(
25+
"If you're actively working on this page, consider",
26+
kleur.bold('deleting all trailing slashes in redirect_from.\n')
27+
)
28+
}
29+
}
30+
31+
return next()
32+
}

package-lock.json

Lines changed: 24 additions & 23 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
@@ -49,6 +49,7 @@
4949
"imurmurhash": "^0.1.4",
5050
"js-cookie": "^3.0.1",
5151
"js-yaml": "^4.1.0",
52+
"kleur": "4.1.4",
5253
"liquidjs": "^9.22.1",
5354
"lodash": "^4.17.21",
5455
"lodash-es": "^4.17.21",
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: 認証のないサインアップの無効化
2+
title: Disabling unauthenticated sign-ups
33
redirect_from:
4-
- /enterprise/admin/articles/disabling-sign-ups/
4+
- /enterprise/admin/articles/disabling-sign-ups
55
- /enterprise/admin/user-management/disabling-unauthenticated-sign-ups
66
- /enterprise/admin/authentication/disabling-unauthenticated-sign-ups
77
- /admin/authentication/disabling-unauthenticated-sign-ups
8-
intro: ビルトイン認証を使っている場合、認証されていない人がアカウントを作成するのをブロックできます。
8+
intro: 'If you''re using built-in authentication, you can block unauthenticated people from being able to create an account.'
99
versions:
1010
ghes: '*'
1111
type: how_to
@@ -15,9 +15,9 @@ topics:
1515
- Enterprise
1616
shortTitle: Block account creation
1717
---
18-
1918
{% data reusables.enterprise_site_admin_settings.access-settings %}
2019
{% data reusables.enterprise_site_admin_settings.management-console %}
2120
{% data reusables.enterprise_management_console.privacy %}
22-
3. **Enable sign-up(サインアップの有効化)**の選択を外してください。 ![[Enable sign-up] チェックボックス](/assets/images/enterprise/management-console/enable-sign-up.png)
21+
3. Unselect **Enable sign-up**.
22+
![Enable sign-up checkbox](/assets/images/enterprise/management-console/enable-sign-up.png)
2323
{% data reusables.enterprise_management_console.save-settings %}

translations/ja-JP/content/admin/authentication/authenticating-users-for-your-github-enterprise-server-instance/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: GitHub Enterprise Server インスタンスでユーザを認証する
3-
intro: '{% data variables.product.prodname_ghe_server %} のビルトイン認証を使うか、CASLDAPSAML のいずれかを選択して既存のアカウントを統合し、{% data variables.product.product_location %} へのユーザアクセスを集中管理できます。'
2+
title: Authenticating users for your GitHub Enterprise Server instance
3+
intro: 'You can use {% data variables.product.prodname_ghe_server %}''s built-in authentication, or choose between CAS, LDAP, or SAML to integrate your existing accounts and centrally manage user access to {% data variables.product.product_location %}.'
44
redirect_from:
5-
- /enterprise/admin/categories/authentication/
6-
- /enterprise/admin/guides/installation/user-authentication/
7-
- /enterprise/admin/articles/inviting-users/
8-
- /enterprise/admin/guides/migrations/authenticating-users-for-your-github-enterprise-instance/
5+
- /enterprise/admin/categories/authentication
6+
- /enterprise/admin/guides/installation/user-authentication
7+
- /enterprise/admin/articles/inviting-users
8+
- /enterprise/admin/guides/migrations/authenticating-users-for-your-github-enterprise-instance
99
- /enterprise/admin/user-management/authenticating-users-for-your-github-enterprise-server-instance
1010
- /enterprise/admin/authentication/authenticating-users-for-your-github-enterprise-server-instance
1111
versions:
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: CASの利用
2+
title: Using CAS
33
redirect_from:
4-
- /enterprise/admin/articles/configuring-cas-authentication/
5-
- /enterprise/admin/articles/about-cas-authentication/
4+
- /enterprise/admin/articles/configuring-cas-authentication
5+
- /enterprise/admin/articles/about-cas-authentication
66
- /enterprise/admin/user-management/using-cas
77
- /enterprise/admin/authentication/using-cas
88
- /admin/authentication/using-cas
9-
intro: 'CAS は、複数の Web アプリケーションのためのシングルサインオン (SSO) プロトコルです。 CASのユーザアカウントは、ユーザがサインインするまで{% ifversion ghes %}ユーザライセンス{% else %}シート{% endif %}を消費しません。'
9+
intro: 'CAS is a single sign-on (SSO) protocol for multiple web applications. A CAS user account does not take up a {% ifversion ghes %}user license{% else %}seat{% endif %} until the user signs in.'
1010
versions:
1111
ghes: '*'
1212
type: how_to
@@ -17,10 +17,9 @@ topics:
1717
- Identity
1818
- SSO
1919
---
20-
2120
{% data reusables.enterprise_user_management.built-in-authentication %}
2221

23-
## CASでのユーザ名についての考慮
22+
## Username considerations with CAS
2423

2524
{% data reusables.enterprise_management_console.username_normalization %}
2625

@@ -29,24 +28,25 @@ topics:
2928
{% data reusables.enterprise_user_management.two_factor_auth_header %}
3029
{% data reusables.enterprise_user_management.external_auth_disables_2fa %}
3130

32-
## CASの属性
31+
## CAS attributes
3332

34-
以下の属性が利用できます。
33+
The following attributes are available.
3534

36-
| 属性名 | 種類 | 説明 |
37-
| ------ | -- | -------------------------------------------------------- |
38-
| `ユーザ名` | 必須 | {% data variables.product.prodname_ghe_server %} のユーザ名 |
35+
| Attribute name | Type | Description |
36+
|--------------------------|----------|-------------|
37+
| `username` | Required | The {% data variables.product.prodname_ghe_server %} username. |
3938

40-
## CASの設定
39+
## Configuring CAS
4140
{% warning %}
4241

43-
**警告:**{% data variables.product.product_location %}でCASを設定するまでは、ユーザはCASのユーザ名とパスワードをAPIリクエストの認証やHTTP/HTTPS経由のGit操作に使えないことに注意してください。 その代わりに、ユーザは[アクセストークンを作成](/enterprise/{{ currentVersion }}/user/articles/creating-an-access-token-for-command-line-use)しなければなりません。
42+
**Warning:** Before configuring CAS on {% data variables.product.product_location %}, note that users will not be able to use their CAS usernames and passwords to authenticate API requests or Git operations over HTTP/HTTPS. Instead, they will need to [create an access token](/enterprise/{{ currentVersion }}/user/articles/creating-an-access-token-for-command-line-use).
4443

4544
{% endwarning %}
4645

4746
{% data reusables.enterprise_site_admin_settings.access-settings %}
4847
{% data reusables.enterprise_site_admin_settings.management-console %}
4948
{% data reusables.enterprise_management_console.authentication %}
50-
3. **CAS**を選択してください。 ![CAS の選択](/assets/images/enterprise/management-console/cas-select.png)
51-
4. {% data reusables.enterprise_user_management.built-in-authentication-option %} ![CAS ビルトイン認証の選択チェックボックス](/assets/images/enterprise/management-console/cas-built-in-authentication.png)
52-
5. **Server URL(サーバのURL)**フィールドにCASサーバの完全なURLを入力してください。 CAS サーバが {% data variables.product.prodname_ghe_server %} が検証できない証明書を使っているなら、`ghe-ssl-ca-certificate-install` を使えばその証明書を信頼済みの証明書としてインストールできます。
49+
3. Select **CAS**.
50+
![CAS select](/assets/images/enterprise/management-console/cas-select.png)
51+
4. {% data reusables.enterprise_user_management.built-in-authentication-option %} ![Select CAS built-in authentication checkbox](/assets/images/enterprise/management-console/cas-built-in-authentication.png)
52+
5. In the **Server URL** field, type the full URL of your CAS server. If your CAS server uses a certificate that can't be validated by {% data variables.product.prodname_ghe_server %}, you can use the `ghe-ssl-ca-certificate-install` command to install it as a trusted certificate.

0 commit comments

Comments
 (0)