forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block a few more things in AIRGAP (github#17657)
* Block a few more things in AIRGAP * Update middleware/context.js Co-authored-by: Vanessa Yuen <[email protected]> * Update product-landing.html Co-authored-by: Vanessa Yuen <[email protected]>
- Loading branch information
1 parent
4a23a3e
commit a3ad549
Showing
11 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
{% include breadcrumbs %} | ||
|
||
<div class="graphql-container"> | ||
<iframe id="graphiql" class="graphql-explorer" scrolling="no" src="{{ graphql.explorerUrl }}" allowfullscreen> | ||
<p>You must have iframes enabled to use this feature.</p> | ||
</iframe> | ||
{% if process.env.AIRGAP %} | ||
<p>GraphQL explorer is not available on this environment.</p> | ||
{% else %} | ||
<iframe id="graphiql" class="graphql-explorer" scrolling="no" src="{{ graphql.explorerUrl }}" allowfullscreen> | ||
<p>You must have iframes enabled to use this feature.</p> | ||
</iframe> | ||
{% endif %} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<script id="search-options" type="application/json">{{ searchOptions }}</script> | ||
<script id="expose" type="application/json">{{ expose }}</script> | ||
<script src="{{ builtAssets.main.js }}"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default function airgapLinks () { | ||
// When in an airgapped environment, | ||
// show a tooltip on external links | ||
const { airgap } = JSON.parse(document.getElementById('expose').text) | ||
if (!airgap) return | ||
|
||
const externaLinks = Array.from( | ||
document.querySelectorAll('a[href^="http"], a[href^="//"]') | ||
) | ||
externaLinks.forEach(link => { | ||
link.classList.add('tooltipped') | ||
link.setAttribute('aria-label', 'This link may not work in this environment.') | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ module.exports = async function syncSearchIndexes (opts = {}) { | |
|
||
// The page version will be the new version, e.g., free-pro-team@latest, [email protected] | ||
const records = await buildRecords(indexName, indexablePages, pageVersion, languageCode) | ||
const index = process.env.USE_LUNR | ||
const index = process.env.AIRGAP | ||
? new LunrIndex(indexName, records) | ||
: new AlgoliaIndex(indexName, records) | ||
|
||
|
@@ -80,7 +80,7 @@ module.exports = async function syncSearchIndexes (opts = {}) { | |
fs.writeFileSync(cacheFile, JSON.stringify(index, null, 2)) | ||
console.log('wrote dry-run index to disk: ', cacheFile) | ||
} else { | ||
if (process.env.USE_LUNR) { | ||
if (process.env.AIRGAP) { | ||
await index.write() | ||
console.log('wrote index to file: ', indexName) | ||
} else { | ||
|
@@ -93,7 +93,7 @@ module.exports = async function syncSearchIndexes (opts = {}) { | |
|
||
// Fetch a list of index names and cache it for tests | ||
// to ensure that an index exists for every language and GHE version | ||
const remoteIndexNames = process.env.USE_LUNR | ||
const remoteIndexNames = process.env.AIRGAP | ||
? await getLunrIndexNames() | ||
: await getRemoteIndexNames() | ||
const cachedIndexNamesFile = path.join(__dirname, './cached-index-names.json') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters