website: handle go-get requests statically (#5821)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		| @ -29,14 +29,6 @@ | |||||||
|   status = 301 |   status = 301 | ||||||
|   force = true |   force = true | ||||||
|  |  | ||||||
| # ?go-get=1 downloads |  | ||||||
| [[redirects]] |  | ||||||
|   from = "/*" |  | ||||||
|   to = "/.netlify/functions/go-get" |  | ||||||
|   status = 200 |  | ||||||
|   force = true |  | ||||||
|   query = {go-get = "1"} |  | ||||||
|  |  | ||||||
| # Container registry | # Container registry | ||||||
| [[redirects]] | [[redirects]] | ||||||
|   from = "/v2" |   from = "/v2" | ||||||
|  | |||||||
| @ -1,19 +0,0 @@ | |||||||
| const gitHubNamespace = "goauthentik"; |  | ||||||
|  |  | ||||||
| exports.handler = async function (event, context) { |  | ||||||
|     let repo = ""; |  | ||||||
|     if (event.path.startsWith("/api")) { |  | ||||||
|         repo = "client-go"; |  | ||||||
|     } else if (event.path.startsWith("/terraform-provider-authentik")) { |  | ||||||
|         repo = "terraform-provider-authentik"; |  | ||||||
|     } else { |  | ||||||
|         repo = "authentik"; |  | ||||||
|     } |  | ||||||
|     return { |  | ||||||
|         statusCode: 200, |  | ||||||
|         headers: { |  | ||||||
|             "content-type": "text/html", |  | ||||||
|         }, |  | ||||||
|         body: `<meta name="go-import" content="${event.headers.host}${event.path} git https://github.com/${gitHubNamespace}/${repo}">`, |  | ||||||
|     }; |  | ||||||
| }; |  | ||||||
							
								
								
									
										23
									
								
								website/src/pages/api.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								website/src/pages/api.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | import React from "react"; | ||||||
|  | import Layout from "@theme/Layout"; | ||||||
|  | import Head from "@docusaurus/Head"; | ||||||
|  | import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly"; | ||||||
|  |  | ||||||
|  | function APIPage() { | ||||||
|  |     return ( | ||||||
|  |         <Layout title="API"> | ||||||
|  |             <Head> | ||||||
|  |                 <meta | ||||||
|  |                     name="go-import" | ||||||
|  |                     content="goauthentik.io/api git https://github.com/goauthentik/client-go" | ||||||
|  |                 ></meta> | ||||||
|  |             </Head> | ||||||
|  |             <BrowserOnly> | ||||||
|  |                 {() => { | ||||||
|  |                     window.location.pathname = "/developer-docs/api/"; | ||||||
|  |                 }} | ||||||
|  |             </BrowserOnly> | ||||||
|  |         </Layout> | ||||||
|  |     ); | ||||||
|  | } | ||||||
|  | export default APIPage; | ||||||
| @ -2,6 +2,7 @@ import React from "react"; | |||||||
| import clsx from "clsx"; | import clsx from "clsx"; | ||||||
| import Layout from "@theme/Layout"; | import Layout from "@theme/Layout"; | ||||||
| import Link from "@docusaurus/Link"; | import Link from "@docusaurus/Link"; | ||||||
|  | import Head from "@docusaurus/Head"; | ||||||
| import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly"; | import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly"; | ||||||
| import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; | import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; | ||||||
| import useBaseUrl from "@docusaurus/useBaseUrl"; | import useBaseUrl from "@docusaurus/useBaseUrl"; | ||||||
| @ -63,6 +64,12 @@ function Home() { | |||||||
|     const { siteConfig = {} } = context; |     const { siteConfig = {} } = context; | ||||||
|     return ( |     return ( | ||||||
|         <Layout title="Welcome" description={siteConfig.tagline}> |         <Layout title="Welcome" description={siteConfig.tagline}> | ||||||
|  |             <Head> | ||||||
|  |                 <meta | ||||||
|  |                     name="go-import" | ||||||
|  |                     content="goauthentik.io git https://github.com/goauthentik/authentik" | ||||||
|  |                 ></meta> | ||||||
|  |             </Head> | ||||||
|             <header className={clsx("hero hero--primary", styles.heroBanner)}> |             <header className={clsx("hero hero--primary", styles.heroBanner)}> | ||||||
|                 <div className="container"> |                 <div className="container"> | ||||||
|                     <div className="row"> |                     <div className="row"> | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								website/src/pages/terraform-provider.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								website/src/pages/terraform-provider.jsx
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | import React from "react"; | ||||||
|  | import Layout from "@theme/Layout"; | ||||||
|  | import Head from "@docusaurus/Head"; | ||||||
|  | import BrowserOnly from "@docusaurus/core/lib/client/exports/BrowserOnly"; | ||||||
|  |  | ||||||
|  | function TerraformProviderPage() { | ||||||
|  |     return ( | ||||||
|  |         <Layout title="terraform-provider"> | ||||||
|  |             <Head> | ||||||
|  |                 <meta | ||||||
|  |                     name="go-import" | ||||||
|  |                     content="goauthentik.io/terraform-provider-authentik git https://github.com/goauthentik/terraform-provider-authentik" | ||||||
|  |                 ></meta> | ||||||
|  |             </Head> | ||||||
|  |             <BrowserOnly> | ||||||
|  |                 {() => { | ||||||
|  |                     window.location.assign( | ||||||
|  |                         "https://registry.terraform.io/providers/goauthentik/authentik/latest/docs" | ||||||
|  |                     ); | ||||||
|  |                 }} | ||||||
|  |             </BrowserOnly> | ||||||
|  |         </Layout> | ||||||
|  |     ); | ||||||
|  | } | ||||||
|  | export default TerraformProviderPage; | ||||||
		Reference in New Issue
	
	Block a user
	 Jens L
					Jens L