This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
-
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.
- Loading branch information
Showing
5 changed files
with
57 additions
and
39 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
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 |
---|---|---|
@@ -1,34 +1,46 @@ | ||
## Notion proxy | ||
# Notion proxy | ||
|
||
Deliver notion pages via your domain. | ||
Reference [fruitionsite](https://github.com/stephenou/fruitionsite) for rewrite html processing. | ||
This proxy does not depend on Cloudflare and launches on express server. | ||
|
||
### Node Version | ||
## Node Version | ||
|
||
`<20.5.1` | ||
|
||
If using version 21.x or above, it will generate a deprecation warning indicating the use of the deprecated punycode module. | ||
|
||
### Environment variable | ||
|
||
| ProxyConfig | Description | Default | | ||
|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| | ||
| PROXY_PORT | Proxy port number | "3456" | | ||
| DOMAIN | Proxy domain for rewrite | "localhost:3456" | | ||
| IS_TLS | Proxy tls(http/https) for rewrite | "false" | | ||
| NOTION_PAGE_ID | Notion public page id | "f1db0cfbe246475784c67f279289abea" | | ||
| CUSTOM_SCRIPT | Custom script | "" | | ||
| CONTENT_CACHE_SEC | Cache time for loaded content (sec) | "300" | | ||
| GOOGLE_FONT | See: `https://developers.google.com/fonts` | "" | | ||
| AUTO_SET_OGP | The server automatically extracts Open Graph Protocol (OGP) data from your NotionId upon startup. <br/>When this feature is enabled, the values of `OG_TAG_TITLE` and `OG_TAG_IMAGE_URL` are utilized for automatic configuration.<br/>If you prefer to wait until the OGP tags are fetched automatically, you can use the `/readyz` command.<br/><br/>Requirement<br/>- Headless chrome<br/>- CPU is always allocated<br/>- At least 512MB of memory for better | "false" | | ||
| OG_TAG_TITLE | Title for og tag | "" | | ||
| OG_TAG_DESC | Description for og tag | "" | | ||
| OG_TAG_IMAGE_URL | Image url for og tag | "" | | ||
| OG_TAG_TYPE | Type for og tag | "website" | | ||
| TWITTER_CARD | Twitter card for og tag | "summary_large_image" | | ||
|
||
### Getting started | ||
## Environment variable | ||
|
||
| ProxyConfig | Description | Default | | ||
|-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------| | ||
| PROXY_PORT | Proxy port number | "3456" | | ||
| DOMAIN | Proxy domain for rewrite | "localhost:3456" | | ||
| IS_TLS | Proxy tls(http/https) for rewrite | "false" | | ||
| NOTION_PAGE_ID | Notion public page id | "f1db0cfbe246475784c67f279289abea" | | ||
| CUSTOM_SCRIPT | Custom script | "" | | ||
| CONTENT_CACHE_SEC | Cache time for loaded content (sec) | "300" | | ||
| GOOGLE_FONT | See: `https://developers.google.com/fonts` | "" | | ||
| AUTO_SET_OGP | The server automatically extracts Open Graph Protocol (OGP) data from your NotionId upon startup. <br/>When this feature is enabled, the values of `OG_TAG_TITLE` and `OG_TAG_IMAGE_URL` are utilized for automatic configuration.<br/>If you prefer to wait until the OGP tags are fetched automatically, you can use the `/readyz` command.<br/><br/>Requirements<br/>- Headless chrome<br/>- CPU is always allocated<br/>- At least 512MB of memory for better | "false" | | ||
| OG_TAG_TITLE | Title for og tag | "" | | ||
| OG_TAG_DESC | Description for og tag | "" | | ||
| OG_TAG_IMAGE_URL | Image url for og tag | "" | | ||
| OG_TAG_TYPE | Type for og tag | "website" | | ||
| TWITTER_CARD | Twitter card for og tag | "summary_large_image" | | ||
|
||
### Note for AUTO_SET_OGP variable | ||
|
||
**OgTag setting priority** | ||
|
||
Environment variables with OG_xxx in prefix are set with the highest priority. | ||
So, if AUTO_SET_OGP is enabled but the OG_xxx environment variable is set, OG_xxx will have priority. | ||
|
||
**Headless chrome Requirements** | ||
|
||
At startup, we are extracting og tags from the NotionId page using Chrome Headless. | ||
So, CPU allocation is necessary. Please be cautious when using request allocation in services like Cloud Functions or Cloud Run or Other. | ||
|
||
## Getting started | ||
|
||
Start proxy for debug on local. | ||
|
||
|
@@ -38,7 +50,7 @@ $ npm test | |
$ npm start_proxy | ||
> [email protected] start | ||
> node src/index.js | ||
NotionProxy listening at localhost:3456, NotionId: f1db0cfbe246475784c67f279289abea | ||
Proxy listening at localhost:3456, NotionId: f1db0cfbe246475784c67f279289abea | ||
``` | ||
|
||
Start proxy binary. | ||
|
@@ -47,5 +59,5 @@ Start proxy binary. | |
$ npm install -g pkg | ||
$ npm run build | ||
$ ./notion-proxy | ||
NotionProxy listening at localhost:3456, NotionId: f1db0cfbe246475784c67f279289abea | ||
Proxy listening at localhost:3456, NotionId: f1db0cfbe246475784c67f279289abea | ||
``` |
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