-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from open-frames/nm/initial-commit
Create Open Frames Proxy
- Loading branch information
Showing
22 changed files
with
5,453 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# flyctl launch added from .gitignore | ||
# Logs | ||
**/logs | ||
**/*.log | ||
**/npm-debug.log* | ||
**/yarn-debug.log* | ||
**/yarn-error.log* | ||
**/lerna-debug.log* | ||
**/.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
**/report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
**/pids | ||
**/*.pid | ||
**/*.seed | ||
**/*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
**/lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
**/coverage | ||
**/*.lcov | ||
|
||
# nyc test coverage | ||
**/.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
**/.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
**/bower_components | ||
|
||
# node-waf configuration | ||
**/.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
**/build/Release | ||
|
||
# Dependency directories | ||
**/node_modules | ||
**/jspm_packages | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
**/web_modules | ||
|
||
# TypeScript cache | ||
**/*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
**/.npm | ||
|
||
# Optional eslint cache | ||
**/.eslintcache | ||
|
||
# Optional stylelint cache | ||
**/.stylelintcache | ||
|
||
# Microbundle cache | ||
**/.rpt2_cache | ||
**/.rts2_cache_cjs | ||
**/.rts2_cache_es | ||
**/.rts2_cache_umd | ||
|
||
# Optional REPL history | ||
**/.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
**/*.tgz | ||
|
||
# Yarn Integrity file | ||
**/.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
**/.env | ||
**/.env.development.local | ||
**/.env.test.local | ||
**/.env.production.local | ||
**/.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
**/.cache | ||
**/.parcel-cache | ||
|
||
# Next.js build output | ||
**/.next | ||
**/out | ||
|
||
# Nuxt.js build / generate output | ||
**/.nuxt | ||
**/dist | ||
|
||
# Gatsby files | ||
**/.cache | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
**/.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
**/.temp | ||
**/.cache | ||
|
||
# Docusaurus cache and generated files | ||
**/.docusaurus | ||
|
||
# Serverless directories | ||
**/.serverless | ||
|
||
# FuseBox cache | ||
**/.fusebox | ||
|
||
# DynamoDB Local files | ||
**/.dynamodb | ||
|
||
# TernJS port file | ||
**/.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
**/.vscode-test | ||
|
||
# yarn v2 | ||
**/.yarn/cache | ||
**/.yarn/unplugged | ||
**/.yarn/build-state.yml | ||
**/.yarn/install-state.gz | ||
**/.pnp.* | ||
|
||
# Mac OS | ||
**/.DS_STORE | ||
fly.toml |
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,38 @@ | ||
name: Publish Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to GitHub Packages | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,32 @@ | ||
# use the official Bun image | ||
# see all versions at https://hub.docker.com/r/oven/bun/tags | ||
FROM oven/bun:1 as base | ||
WORKDIR /usr/src/app | ||
|
||
# install dependencies into temp directory | ||
# this will cache them and speed up future builds | ||
FROM base AS install | ||
# install with --production (exclude devDependencies) | ||
RUN mkdir -p /temp/prod | ||
COPY package.json bun.lockb /temp/prod/ | ||
RUN cd /temp/prod && bun install --frozen-lockfile --production | ||
|
||
# copy node_modules from temp directory | ||
# then copy all (non-ignored) project files into the image | ||
FROM base AS prerelease | ||
COPY --from=install /temp/prod/node_modules node_modules | ||
COPY . . | ||
|
||
# [optional] tests & build | ||
ENV NODE_ENV=production | ||
|
||
# copy production dependencies and source code into final image | ||
FROM base AS release | ||
COPY --from=install /temp/prod/node_modules node_modules | ||
COPY --from=prerelease /usr/src/app/src ./src | ||
COPY --from=prerelease /usr/src/app/package.json . | ||
|
||
# run the app | ||
USER bun | ||
EXPOSE 8080/tcp | ||
ENTRYPOINT [ "bun", "run", "src/index.ts" ] |
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 +1,19 @@ | ||
# proxy | ||
# OpenGraph Proxy | ||
|
||
A simple proxy server to read OpenGraph tags from a URL without revealing client IP addresses. Designed to also support Farcaster Frames. | ||
|
||
## Setup | ||
|
||
To install dependencies: | ||
|
||
```bash | ||
bun install | ||
``` | ||
|
||
To run: | ||
|
||
```bash | ||
bun run src/index.ts | ||
``` | ||
|
||
This project was created using `bun init` in bun v1.0.25. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. |
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,22 @@ | ||
# fly.toml app configuration file generated for open-frames-proxy on 2024-02-14T15:21:00-08:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = 'open-frames-proxy' | ||
primary_region = 'sea' | ||
|
||
[build] | ||
|
||
[http_service] | ||
internal_port = 8080 | ||
force_https = true | ||
auto_stop_machines = true | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ['app'] | ||
|
||
[[vm]] | ||
memory = '1gb' | ||
cpu_kind = 'shared' | ||
cpus = 1 |
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,18 @@ | ||
{ | ||
"name": "@xmtp/link-preview-server", | ||
"module": "src/index.ts", | ||
"type": "module", | ||
"scripts": { | ||
"start": "bun run src/index.ts", | ||
"test": "bun test" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest" | ||
}, | ||
"peerDependencies": { | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"cheerio": "^1.0.0-rc.12" | ||
} | ||
} |
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 @@ | ||
export const TAG_PREFIXES = ["og:", "fc:", "of:", "xmtp:"] as const; | ||
export const PORT = 8080; | ||
export const CORS_HEADERS = { | ||
"Access-Control-Allow-Origin": "*", | ||
"Access-Control-Allow-Methods": "OPTIONS, GET, POST", | ||
"Access-Control-Allow-Headers": "*", | ||
}; |
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,3 @@ | ||
export class NoRedirectError extends Error {} | ||
|
||
export class InvalidRequestError extends Error {} |
Oops, something went wrong.