mirror of
https://github.com/movie-web/simple-proxy.git
synced 2025-09-13 13:03:26 +00:00
Compare commits
29 Commits
v2.1.2
...
3fab3a39ec
Author | SHA1 | Date | |
---|---|---|---|
|
3fab3a39ec | ||
|
414b03cd8e | ||
|
f3612d4a4e | ||
|
f0d858460c | ||
|
9d2df30348 | ||
|
0af2174784 | ||
|
b25fc06857 | ||
|
84ac1c6fa1 | ||
|
2d4b1a5848 | ||
|
6097252cf0 | ||
|
3769b37e8a | ||
|
de07b4882b | ||
|
259b7bf1f7 | ||
|
2b77df66ec | ||
|
d907fa36f2 | ||
|
610ac5db2c | ||
|
ddabde15b6 | ||
|
e09decb8e2 | ||
|
440ae9bd2c | ||
|
d0c5a41c69 | ||
|
6bb6914798 | ||
|
f47e4f9ec1 | ||
|
b16ebe48b0 | ||
|
6828e31497 | ||
|
8b26bcf554 | ||
|
5a09e0c602 | ||
|
8852fca320 | ||
|
1e147a793d | ||
|
e88a4f3203 |
4
.github/workflows/cloudflare.yml
vendored
4
.github/workflows/cloudflare.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 20
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install packages
|
||||
|
@@ -14,16 +14,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 20
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install packages
|
||||
@@ -41,16 +41,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
node-version: 20
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install pnpm packages
|
||||
@@ -58,3 +58,17 @@ jobs:
|
||||
|
||||
- name: Build Project
|
||||
run: pnpm build
|
||||
|
||||
docker:
|
||||
name: Build docker
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v5
|
13
.github/workflows/publish.yml
vendored
13
.github/workflows/publish.yml
vendored
@@ -19,17 +19,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Docker buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Get version
|
||||
id: package-version
|
||||
uses: martinbeentjes/npm-get-version-action@main
|
||||
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
- name: Extract Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
flavor: |
|
||||
@@ -47,9 +47,12 @@ jobs:
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: .
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v${{ steps.package-version.outputs.current-version }}
|
||||
release_name: Bot v${{ steps.package-version.outputs.current-version }}
|
||||
release_name: Simple-proxy v${{ steps.package-version.outputs.current-version }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
body: |
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@ node_modules
|
||||
.output
|
||||
.env
|
||||
dist
|
||||
.netlify
|
||||
|
@@ -1,4 +1,4 @@
|
||||
FROM node:18-alpine as base
|
||||
FROM node:20-alpine as base
|
||||
WORKDIR /app
|
||||
|
||||
# Build layer
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# simple-proxy
|
||||
|
||||
Simple reverse proxy to bypass CORS, used by [movie-web](https://movie-web.app).
|
||||
Read the docs at https://docs.movie-web.app/proxy
|
||||
Read the docs at https://docs.movie-web.app/proxy/introduction
|
||||
|
||||
---
|
||||
|
||||
@@ -18,3 +18,4 @@ Read the docs at https://docs.movie-web.app/proxy
|
||||
- cloudflare workers
|
||||
- AWS lambda
|
||||
- nodejs
|
||||
- netlify edge functions
|
||||
|
4
netlify.toml
Normal file
4
netlify.toml
Normal file
@@ -0,0 +1,4 @@
|
||||
[build]
|
||||
command = "pnpm build:netlify"
|
||||
publish = "."
|
||||
edge_functions = ".netlify"
|
15
package.json
15
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "simple-proxy",
|
||||
"private": true,
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.4",
|
||||
"scripts": {
|
||||
"prepare": "nitropack prepare",
|
||||
"dev": "nitropack dev",
|
||||
@@ -9,15 +9,16 @@
|
||||
"build:cloudflare": "NITRO_PRESET=cloudflare npm run build",
|
||||
"build:aws": "NITRO_PRESET=aws_lambda npm run build",
|
||||
"build:node": "NITRO_PRESET=node-server npm run build",
|
||||
"build:netlify": "NITRO_PRESET=netlify_edge npm run build",
|
||||
"start": "node .output/server/index.mjs",
|
||||
"lint": "eslint --ext .ts src/",
|
||||
"lint:fix": "eslint --fix --ext .ts src/",
|
||||
"preinstall": "npx only-allow pnpm"
|
||||
},
|
||||
"dependencies": {
|
||||
"h3": "^1.9.0",
|
||||
"h3": "^1.10.0",
|
||||
"jose": "^5.2.0",
|
||||
"nitropack": "latest"
|
||||
"nitropack": "^2.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||
@@ -26,6 +27,12 @@
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.0",
|
||||
"eslint-plugin-prettier": "^5.0.0"
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"@rollup/wasm-node": "^4.9.4"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"rollup": "npm:@rollup/wasm-node"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
701
pnpm-lock.yaml
generated
701
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -41,17 +41,22 @@ export default defineEventHandler(async (event) => {
|
||||
const token = await createTokenIfNeeded(event);
|
||||
|
||||
// proxy
|
||||
await specificProxyRequest(event, destination, {
|
||||
blacklistedHeaders: getBlacklistedHeaders(),
|
||||
fetchOptions: {
|
||||
redirect: 'follow',
|
||||
headers: getProxyHeaders(event.headers),
|
||||
body,
|
||||
},
|
||||
onResponse(outputEvent, response) {
|
||||
const headers = getAfterResponseHeaders(response.headers, response.url);
|
||||
setResponseHeaders(outputEvent, headers);
|
||||
if (token) setTokenHeader(event, token);
|
||||
},
|
||||
});
|
||||
try {
|
||||
await specificProxyRequest(event, destination, {
|
||||
blacklistedHeaders: getBlacklistedHeaders(),
|
||||
fetchOptions: {
|
||||
redirect: 'follow',
|
||||
headers: getProxyHeaders(event.headers),
|
||||
body,
|
||||
},
|
||||
onResponse(outputEvent, response) {
|
||||
const headers = getAfterResponseHeaders(response.headers, response.url);
|
||||
setResponseHeaders(outputEvent, headers);
|
||||
if (token) setTokenHeader(event, token);
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Error fetching', e);
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
@@ -20,6 +20,7 @@ const blacklistedHeaders = [
|
||||
'x-forwarded-proto',
|
||||
'forwarded',
|
||||
'x-real-ip',
|
||||
'content-length',
|
||||
...Object.keys(headerMap),
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user