diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index c7c7a9e0..f2f3ac67 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -4,7 +4,6 @@ on: push: branches: - main - pull_request: jobs: build-publish: @@ -27,6 +26,9 @@ jobs: - name: Build website run: npm run build + env: + REACT_APP_DOC_SEARCH_APP_ID: ${{ secrets.DOC_SEARCH_APP_ID }} + REACT_APP_DOC_SEARCH_INDEX_NAME: ${{ secrets.DOC_SEARCH_INDEX_NAME }} - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 diff --git a/docusaurus.config.ts b/docusaurus.config.ts index bc2ef4c1..f4a2fc20 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -1,6 +1,7 @@ import {themes as prismThemes} from 'prism-react-renderer'; import type {Config} from '@docusaurus/types'; import type * as Preset from '@docusaurus/preset-classic'; +import * as process from "node:process"; const config: Config = { title: 'Brave Ads', @@ -26,6 +27,16 @@ const config: Config = { defaultLocale: 'en', locales: ['en'], }, + + headTags: [ + { + tagName: 'meta', + attributes: { + 'http-equiv': 'Content-Security-Policy', + content: `default-src 'none'; img-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; base-uri 'none'; form-action 'none'; connect-src https://*.algolia.net https://*.algolianet.com https://*.algolia.io;`, + }, + } + ], presets: [ [ @@ -102,6 +113,18 @@ const config: Config = { ], copyright: `Copyright © ${new Date().getFullYear()} Brave Software, Inc.`, }, + algolia: { + appId: process.env.REACT_APP_DOC_SEARCH_APP_ID, + // Public API key: it is safe to commit it + apiKey: '9d6bcc3afa8daed9395db8c441bc04a1', + indexName: process.env.REACT_APP_DOC_SEARCH_INDEX_NAME, + // Ensures that search results are relevant to the current language and version + contextualSearch: true, + searchParameters: { + analytics: false, + clickAnalytics: false, + } + }, prism: { theme: prismThemes.github, darkTheme: prismThemes.dracula, diff --git a/package-lock.json b/package-lock.json index 2d2233cf..2c80fa38 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5806,9 +5806,9 @@ "integrity": "sha512-cXLGjP0c4T3flZJKQSuziYoq7MlT+rnvfZjfp7h+I7K9BNX54kP9nyWvdbwjQ4u1iWbOL4u96fgeZLToQlZC7w==" }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", "engines": { "node": ">=6" } @@ -10857,9 +10857,9 @@ } }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -13766,9 +13766,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz", + "integrity": "sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==", "funding": [ { "type": "opencollective", @@ -13784,8 +13784,8 @@ } ], "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.1.2", + "picocolors": "^1.0.1" }, "bin": { "update-browserslist-db": "cli.js"