Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
support automatic fetch og tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoyane committed Mar 29, 2024
1 parent 6f59f0d commit be6fd01
Show file tree
Hide file tree
Showing 17 changed files with 2,507 additions and 885 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
express-*
notion-proxy
gcp/
coverage/*
13 changes: 0 additions & 13 deletions Dockerfile

This file was deleted.

23 changes: 23 additions & 0 deletions Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18-slim

RUN apt-get update \
&& apt-get install -y wget gnupg python3 make g++ ca-certificates \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
&& sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& npm install -g pkg \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r pptruser && useradd -rm -g pptruser -G audio,video pptruser

USER pptruser

WORKDIR /notion-proxy
COPY package*.json ./
COPY src ./src

RUN npm ci
RUN pkg src/expressApp.js -o /notion-proxy/app

CMD ["/notion-proxy/app"]
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,27 @@ This proxy does not depend on Cloudflare and launches on express server.

### Node Version

18
`<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

| Env | Description | Default |
|-------------------|--------------------------------------------|----------------------------------|
| PAGE_TITLE | Page title on meta tag | "" |
| PAGE_DESC | Page desc on meta tag | "" |
| GOOGLE_FONT | See: `https://developers.google.com/fonts` | "" |
| 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 |
| 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

Expand Down
Loading

0 comments on commit be6fd01

Please sign in to comment.