-
-
Couldn't load subscription status.
- Fork 5.6k
Footer adjustments #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Footer adjustments #596
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
829de18
feat: speed up site resolving
transitive-bullshit a8eb84d
🔔
transitive-bullshit 20319d2
WIP
transitive-bullshit a4f90e2
chore: updated the footer to make sure that it gets the current year ...
6eecc9d
chore: updated the footer to make sure that it gets the current year ...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
5 changes: 5 additions & 0 deletions
lib/canonical-page-map-cache.ts
This file contains hidden or 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,5 @@ | ||
| import { CanonicalPageMap } from './types' | ||
|
|
||
| export const getCanonicalPageMapCache = async (): Promise<CanonicalPageMap> => { | ||
| // TODO | ||
| } |
99 changes: 99 additions & 0 deletions
lib/cloudflare-kv.ts
This file contains hidden or 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,99 @@ | ||
| import fetch from 'node-fetch' | ||
|
|
||
| export class CloudflareKV { | ||
| accountId: string | ||
| apiKey: string | ||
| namespaceId: string | ||
| _headers: any | ||
|
|
||
| constructor({ | ||
| accountId, | ||
| apiKey, | ||
| namespaceId | ||
| }: { | ||
| accountId: string | ||
| apiKey: string | ||
| namespaceId: string | ||
| }) { | ||
| this.accountId = accountId | ||
| this.apiKey = apiKey | ||
| this.namespaceId = namespaceId | ||
|
|
||
| this._headers = { | ||
| Authorization: `Bearer ${this.apiKey}` | ||
| } | ||
| } | ||
|
|
||
| async get(key: string) { | ||
| const url = this._getUrl(key) | ||
| const headers = this._headers | ||
|
|
||
| const res = await fetch(url, { | ||
| headers | ||
| }) | ||
|
|
||
| if (res.ok) { | ||
| return res.text() | ||
| } else if (res.status === 404) { | ||
| return undefined | ||
| } else { | ||
| const body = await res.text() | ||
|
|
||
| throw new Error(`Error ${res.status} ${body}`) | ||
| } | ||
| } | ||
|
|
||
| async put( | ||
| key: string, | ||
| value, | ||
| { | ||
| expiration, | ||
| expirationTtl | ||
| }: { | ||
| expiration?: number | ||
| expirationTtl?: number | ||
| } = {} | ||
| ) { | ||
| const url = new URL(this._getUrl(key)) | ||
| const headers = this._headers | ||
| const query: any = {} | ||
|
|
||
| if (expiration) { | ||
| query.expiration = expiration | ||
| } | ||
|
|
||
| if (expirationTtl) { | ||
| query.expiration_ttl = Math.max(60, expirationTtl) | ||
| } | ||
|
|
||
| url.search = new URLSearchParams(query).toString() | ||
| const res = await fetch(url.toString(), { | ||
| method: 'PUT', | ||
| body: value, | ||
| headers | ||
| }) | ||
|
|
||
| console.log('CLOUDFLARE PUT', { key, value, ok: res.ok }) | ||
| if (!res.ok) { | ||
| console.log(await res.text()) | ||
| } | ||
| return res.ok | ||
| } | ||
|
|
||
| async delete(key: string): Promise<boolean> { | ||
| const url = this._getUrl(key) | ||
| const headers = this._headers | ||
|
|
||
| const res = await fetch(url, { | ||
| method: 'DELETE', | ||
| headers | ||
| }) | ||
|
|
||
| return res.ok | ||
| } | ||
|
|
||
| _getUrl(key: string) { | ||
| const { accountId, namespaceId } = this | ||
| return `https://api.cloudflare.com/client/v4/accounts/${accountId}/storage/kv/namespaces/${namespaceId}/values/${key}` | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
31 changes: 31 additions & 0 deletions
lib/get-site-map.ts
This file contains hidden or 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,31 @@ | ||
| import { getAllPages } from './get-all-pages' | ||
| import { getSiteForDomain } from './get-site-for-domain' | ||
| import * as config from './config' | ||
| import * as types from './types' | ||
|
|
||
| export async function getSiteMap({ | ||
| concurrency = 4, | ||
| pageConcurrency = 3, | ||
| full = false | ||
| }: { | ||
| concurrency?: number | ||
| pageConcurrency?: number | ||
| full?: boolean | ||
| } = {}): Promise<types.SiteMap> { | ||
| const site = await getSiteForDomain(config.domain) | ||
|
|
||
| const siteMap = await getAllPages( | ||
| site.rootNotionPageId, | ||
| site.rootNotionSpaceId, | ||
| { | ||
| concurrency, | ||
| pageConcurrency, | ||
| full | ||
| } | ||
| ) | ||
|
|
||
| return { | ||
| site, | ||
| ...siteMap | ||
| } | ||
| } |
35 changes: 0 additions & 35 deletions
lib/get-site-maps.ts
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.