doccupine 0.0.55 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -0
- package/dist/templates/app/layout.js +4 -1
- package/dist/templates/components/layout/Footer.d.ts +1 -1
- package/dist/templates/components/layout/Footer.js +4 -1
- package/dist/templates/utils/branding.d.ts +1 -0
- package/dist/templates/utils/branding.js +22 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ import { llmTypesTemplate } from "./templates/services/llm/types.js";
|
|
|
64
64
|
import { styledDTemplate } from "./templates/types/styled.js";
|
|
65
65
|
import { orderNavItemsTemplate } from "./templates/utils/orderNavItems.js";
|
|
66
66
|
import { rateLimitTemplate } from "./templates/utils/rateLimit.js";
|
|
67
|
+
import { brandingTemplate } from "./templates/utils/branding.js";
|
|
67
68
|
import { configTemplate } from "./templates/utils/config.js";
|
|
68
69
|
import { accordionMdxTemplate } from "./templates/mdx/accordion.mdx.js";
|
|
69
70
|
import { aiAssistantMdxTemplate } from "./templates/mdx/ai-assistant.mdx.js";
|
|
@@ -258,6 +259,7 @@ class MDXToNextJSGenerator {
|
|
|
258
259
|
"services/llm/index.ts": llmIndexTemplate,
|
|
259
260
|
"services/llm/types.ts": llmTypesTemplate,
|
|
260
261
|
"types/styled.d.ts": styledDTemplate,
|
|
262
|
+
"utils/branding.ts": brandingTemplate,
|
|
261
263
|
"utils/orderNavItems.ts": orderNavItemsTemplate,
|
|
262
264
|
"utils/rateLimit.ts": rateLimitTemplate,
|
|
263
265
|
"utils/config.ts": configTemplate,
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
} from "@/utils/orderNavItems";
|
|
38
38
|
import { StaticLinks } from "@/components/layout/StaticLinks";
|
|
39
39
|
import { config } from "@/utils/config";
|
|
40
|
+
import { verifyBrandingKey } from "@/utils/branding";
|
|
40
41
|
import navigation from "@/navigation.json";
|
|
41
42
|
const Chat = dynamic(() => import("@/components/Chat").then((mod) => mod.Chat));
|
|
42
43
|
|
|
@@ -70,6 +71,8 @@ export default async function RootLayout({
|
|
|
70
71
|
}: Readonly<{
|
|
71
72
|
children: React.ReactNode;
|
|
72
73
|
}>) {
|
|
74
|
+
const hideBranding = verifyBrandingKey();
|
|
75
|
+
|
|
73
76
|
const defaultPages = [
|
|
74
77
|
{
|
|
75
78
|
slug: "",
|
|
@@ -104,7 +107,7 @@ export default async function RootLayout({
|
|
|
104
107
|
<DocsNavigation
|
|
105
108
|
result={result.length ? result : defaultResults}
|
|
106
109
|
/>
|
|
107
|
-
<Footer />
|
|
110
|
+
<Footer hideBranding={hideBranding} />
|
|
108
111
|
</DocsWrapper>
|
|
109
112
|
</ChtProvider>
|
|
110
113
|
</CherryThemeProvider>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const footerTemplate = "\"use client\";\nimport { useContext } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { styledSmall } from \"cherry-styled-components\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { GitHubLogo } from \"@/components/layout/Pictograms\";\n\nconst StyledFooter = styled.footer<{ theme: Theme; $isChatOpen?: boolean }>`\n padding: 20px;\n transition: all 0.3s ease;\n\n ${mq(\"lg\")} {\n padding: 0 340px 0 340px;\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 0 340px;\n `}\n }\n`;\n\nconst StyledFooterInner = styled.div<{ theme: Theme }>`\n border-top: solid 1px ${({ theme }) => theme.colors.grayLight};\n max-width: 640px;\n margin: 0 auto;\n padding: 33px 0 90px 0;\n color: ${({ theme }) => theme.colors.gray};\n ${({ theme }) => styledSmall(theme)};\n\n ${mq(\"lg\")} {\n padding: 32px 0;\n }\n\n & a {\n font-weight: 700;\n color: ${({ theme }) => theme.colors.primary};\n text-decoration: none;\n transition: all 0.3s ease;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primaryDark};\n }\n\n & svg {\n width: 18px;\n height: 18px;\n }\n }\n`;\n\nconst StyledFooterFlex = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n\nfunction Footer() {\n const { isOpen } = useContext(ChatContext);\n return (\n <StyledFooter $isChatOpen={isOpen}>\n <StyledFooterInner>\n <StyledFooterFlex>\n <span>\n Powered by <a href=\"https://doccupine.com\">Doccupine</a>\n </span>\n <a href=\"https://github.com/doccupine/\" target=\"_blank\">\n <GitHubLogo />\n </a>\n </StyledFooterFlex>\n </StyledFooterInner>\n </StyledFooter>\n );\n}\n\nexport { Footer };\n";
|
|
1
|
+
export declare const footerTemplate = "\"use client\";\nimport { useContext } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { styledSmall } from \"cherry-styled-components\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { GitHubLogo } from \"@/components/layout/Pictograms\";\n\nconst StyledFooter = styled.footer<{ theme: Theme; $isChatOpen?: boolean }>`\n padding: 20px;\n transition: all 0.3s ease;\n\n ${mq(\"lg\")} {\n padding: 0 340px 0 340px;\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 0 340px;\n `}\n }\n`;\n\nconst StyledFooterInner = styled.div<{ theme: Theme }>`\n border-top: solid 1px ${({ theme }) => theme.colors.grayLight};\n max-width: 640px;\n margin: 0 auto;\n padding: 33px 0 90px 0;\n color: ${({ theme }) => theme.colors.gray};\n ${({ theme }) => styledSmall(theme)};\n\n ${mq(\"lg\")} {\n padding: 32px 0;\n }\n\n & a {\n font-weight: 700;\n color: ${({ theme }) => theme.colors.primary};\n text-decoration: none;\n transition: all 0.3s ease;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primaryDark};\n }\n\n & svg {\n width: 18px;\n height: 18px;\n }\n }\n`;\n\nconst StyledFooterFlex = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n\nfunction Footer({ hideBranding }: { hideBranding?: boolean }) {\n const { isOpen } = useContext(ChatContext);\n\n if (hideBranding) return null;\n\n return (\n <StyledFooter $isChatOpen={isOpen}>\n <StyledFooterInner>\n <StyledFooterFlex>\n <span>\n Powered by <a href=\"https://doccupine.com\">Doccupine</a>\n </span>\n <a href=\"https://github.com/doccupine/\" target=\"_blank\">\n <GitHubLogo />\n </a>\n </StyledFooterFlex>\n </StyledFooterInner>\n </StyledFooter>\n );\n}\n\nexport { Footer };\n";
|
|
@@ -55,8 +55,11 @@ const StyledFooterFlex = styled.div\`
|
|
|
55
55
|
align-items: center;
|
|
56
56
|
\`;
|
|
57
57
|
|
|
58
|
-
function Footer() {
|
|
58
|
+
function Footer({ hideBranding }: { hideBranding?: boolean }) {
|
|
59
59
|
const { isOpen } = useContext(ChatContext);
|
|
60
|
+
|
|
61
|
+
if (hideBranding) return null;
|
|
62
|
+
|
|
60
63
|
return (
|
|
61
64
|
<StyledFooter $isChatOpen={isOpen}>
|
|
62
65
|
<StyledFooterInner>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const brandingTemplate = "import { verify, createPublicKey } from \"crypto\";\n\nconst PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAfRfGHxhXRFCOXxaC5IUcmi7KpsT/aFW869UJAm+xcso=\n-----END PUBLIC KEY-----`;\n\nexport function verifyBrandingKey(): boolean {\n const key = process.env.DOCCUPINE_KEY;\n if (!key) return false;\n try {\n const publicKey = createPublicKey(PUBLIC_KEY);\n return verify(\n null,\n Buffer.from(\"doccupine-premium\"),\n publicKey,\n Buffer.from(key, \"hex\"),\n );\n } catch {\n return false;\n }\n}\n";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const brandingTemplate = `import { verify, createPublicKey } from "crypto";
|
|
2
|
+
|
|
3
|
+
const PUBLIC_KEY = \`-----BEGIN PUBLIC KEY-----
|
|
4
|
+
MCowBQYDK2VwAyEAfRfGHxhXRFCOXxaC5IUcmi7KpsT/aFW869UJAm+xcso=
|
|
5
|
+
-----END PUBLIC KEY-----\`;
|
|
6
|
+
|
|
7
|
+
export function verifyBrandingKey(): boolean {
|
|
8
|
+
const key = process.env.DOCCUPINE_KEY;
|
|
9
|
+
if (!key) return false;
|
|
10
|
+
try {
|
|
11
|
+
const publicKey = createPublicKey(PUBLIC_KEY);
|
|
12
|
+
return verify(
|
|
13
|
+
null,
|
|
14
|
+
Buffer.from("doccupine-premium"),
|
|
15
|
+
publicKey,
|
|
16
|
+
Buffer.from(key, "hex"),
|
|
17
|
+
);
|
|
18
|
+
} catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
package/package.json
CHANGED