-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backend): host privacy policy on the back-end
Since I am forced by Google's OAuth2 to have a back-end, I might as well host the README.md policy there. Otherwise, I would have to separately maintain GitHub pages, and separate domains (because it would be tricky to host GitHub pages and auth backend endpoint on the same domain).
- Loading branch information
1 parent
644fef0
commit f99fda1
Showing
20 changed files
with
185 additions
and
72 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
File renamed without changes.
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
File renamed without changes.
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,7 @@ | ||
'use server'; | ||
|
||
import { markdownToJsx } from '../../../utils/markdownToHtml'; | ||
|
||
export default async function MainPage(): Promise<JSX.Element> { | ||
return markdownToJsx('../docs/privacy/README.md'); | ||
} |
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 @@ | ||
'use client'; | ||
|
||
import React from 'react'; | ||
|
||
import { Metadata } from 'next'; | ||
import { localization } from '../const/localization'; | ||
|
||
export default function Error({ error }: { error: Error }): JSX.Element { | ||
return <h1>{String(error)}</h1>; | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: localization.unexpectedErrorHasOccurred, | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,42 @@ | ||
import React from 'react'; | ||
|
||
import { baseUrl, robots, twitter } from '../const/siteConfig'; | ||
import { Metadata, Viewport } from 'next'; | ||
import { localization } from '../const/localization'; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: { | ||
readonly children: React.ReactNode; | ||
}): JSX.Element { | ||
return ( | ||
<html lang="en-US"> | ||
<body style={{ minHeight: '100vh', margin: 0, background: 'black' }}> | ||
{children} | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: { | ||
default: localization.siteTitle, | ||
template: `%s | ${localization.siteTitle}`, | ||
}, | ||
description: localization.siteDescription, | ||
applicationName: localization.siteTitle, | ||
keywords: localization.siteKeywords, | ||
creator: localization.siteAuthor, | ||
generator: 'Next.js', | ||
robots, | ||
twitter: { | ||
card: 'summary_large_image', | ||
site: twitter, | ||
creator: twitter, | ||
}, | ||
metadataBase: new URL(baseUrl), | ||
}; | ||
|
||
export const viewport: Viewport = { | ||
colorScheme: 'light', | ||
}; |
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,12 @@ | ||
import React from 'react'; | ||
|
||
import { localization } from '../const/localization'; | ||
import { Metadata } from 'next'; | ||
|
||
export default function NotFound(): JSX.Element { | ||
return <h1>{localization.notFound}</h1>; | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: localization.notFound, | ||
}; |
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,7 @@ | ||
'use server'; | ||
|
||
import { markdownToJsx } from '../utils/markdownToHtml'; | ||
|
||
export default async function MainPage(): Promise<JSX.Element> { | ||
return markdownToJsx('../README.md'); | ||
} |
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,10 @@ | ||
export const localization = { | ||
siteTitle: 'Calendar Plus', | ||
siteDescription: | ||
'Google Calendar extension that provides insights into where your time goes. Includes power user tools, data export and customization', | ||
siteKeywords: | ||
'Calendar Plus, Google Calendar, Google Chrome, productivity, time management, time tracking, data export, insights, analytics, power user, customization', | ||
siteAuthor: 'Max Patiiuk', | ||
notFound: 'Page not found', | ||
unexpectedErrorHasOccurred: 'An unexpected error has occurred', | ||
}; |
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,10 @@ | ||
export const robots = { index: true, follow: true } as const; | ||
export const privatePage = { index: false, follow: false } as const; | ||
export const twitter = '@maxpatiiuk'; | ||
export const githubRepository = 'maxpatiiuk/calendar-plus'; | ||
|
||
export const baseUrl = | ||
typeof process.env.VERCEL_URL === 'string' && | ||
process.env.VERCEL_URL.length > 0 | ||
? `https://${process.env.VERCEL_URL}` | ||
: 'http://localhost:3000'; |
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
File renamed without changes.
28 changes: 26 additions & 2 deletions
28
auth-backend/package-lock.json → backend/package-lock.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { githubRepository } from '../const/siteConfig'; | ||
import { marked } from 'marked'; | ||
import fs from 'node:fs/promises'; | ||
|
||
import 'github-markdown-css'; | ||
|
||
// Make relative URLs be relative to the GitHub repository | ||
marked.use({ | ||
renderer: { | ||
image(href, title, text) { | ||
const url = new URL( | ||
href, | ||
`https://github.com/${githubRepository}/raw/main/`, | ||
); | ||
return `<img src="${url}" alt="${text}" title="${title}">`; | ||
}, | ||
link(href, title, text) { | ||
const url = new URL( | ||
href, | ||
`https://github.com/${githubRepository}/tree/main/`, | ||
); | ||
return `<a href="${url}" title="${title}">${text}</a>`; | ||
}, | ||
}, | ||
}); | ||
|
||
export async function markdownToHtml(path: string): Promise<string> { | ||
const content = await fs.readFile(path, 'utf8'); | ||
return marked(content, { gfm: true, breaks: false }); | ||
} | ||
|
||
export async function markdownToJsx(path: string): Promise<JSX.Element> { | ||
const content = await markdownToHtml(path); | ||
return ( | ||
<div | ||
className="markdown-body" | ||
style={{ padding: '2rem', display: 'flex', justifyContent: 'center' }} | ||
> | ||
<main | ||
id="content" | ||
style={{ maxWidth: '50rem' }} | ||
dangerouslySetInnerHTML={{ __html: content }} | ||
/> | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
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