mirror of
https://github.com/goauthentik/authentik
synced 2026-04-27 09:57:31 +02:00
* website: Unify Netlify redirects with Docusaurus's client-side router. * website: Flesh out client-redirects. * Potential fix for code scanning alert no. 256: Incomplete string escaping or encoding Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> * website: Use package. * website: use permanent redirect. * Apply suggestions from code review Co-authored-by: Dewi Roberts <dewi@goauthentik.io> Signed-off-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Dewi Roberts <dewi@goauthentik.io> Signed-off-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> * website: Spelling. * website: Add link. * website: Clarify. * website: Remove doc. * website: Add redirects for API and integrations. --------- Signed-off-by: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Dewi Roberts <dewi@goauthentik.io>
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
/* eslint-disable no-console */
|
|
/**
|
|
* @file Docusaurus client-side redirects plugin.
|
|
*
|
|
* @import { LoadContext, Plugin } from "@docusaurus/types"
|
|
* @import { RedirectEntry } from "./index.mjs"
|
|
*/
|
|
|
|
const PLUGIN_NAME = "ak-redirects-plugin";
|
|
|
|
/**
|
|
* @typedef {object} AKRedirectsPluginOptions
|
|
* @property {RedirectEntry[]} redirects parsed redirect entries
|
|
*/
|
|
|
|
/**
|
|
* @typedef {object} AKRedirectsPluginData
|
|
* @property {RedirectEntry[]} redirects parsed redirect entries
|
|
*/
|
|
|
|
/**
|
|
* @param {LoadContext} _loadContext
|
|
* @param {AKRedirectsPluginOptions} options
|
|
* @returns {Promise<Plugin<AKRedirectsPluginData>>}
|
|
*/
|
|
async function akRedirectsPlugin(_loadContext, { redirects }) {
|
|
return {
|
|
name: PLUGIN_NAME,
|
|
|
|
async loadContent() {
|
|
console.log(`🚀 ${PLUGIN_NAME} loaded`);
|
|
|
|
/**
|
|
* @type {AKRedirectsPluginData}
|
|
*/
|
|
const content = { redirects };
|
|
|
|
return content;
|
|
},
|
|
|
|
contentLoaded({ content, actions }) {
|
|
const { setGlobalData } = actions;
|
|
|
|
setGlobalData(content);
|
|
},
|
|
};
|
|
}
|
|
|
|
export default akRedirectsPlugin;
|