From 5decc412521dd2c644677a69adb8364d9bd79d6c Mon Sep 17 00:00:00 2001 From: Braydon Date: Thu, 4 May 2023 04:00:45 -0400 Subject: [PATCH] Add files --- .gitea/workflows/publish.yml | 35 +++++++++++++++++++++++++ .gitignore | 1 + package-lock.json | 51 ++++++++++++++++++++++++++++++++++++ package.json | 5 ++++ server.js | 10 +++++++ 5 files changed, 102 insertions(+) create mode 100644 .gitea/workflows/publish.yml create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 server.js diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml new file mode 100644 index 0000000..53f96fd --- /dev/null +++ b/.gitea/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish Image + +on: + push: + branches: ["master"] + +jobs: + docker: + strategy: + matrix: + arch: ["ubuntu-latest"] + git-version: ["2.38.4"] + + runs-on: ${{ matrix.arch }} + container: git.rainnny.club/rainnny/gitea-runner:node-18 + steps: + - name: Checkout + uses: https://github.com/actions/checkout@v3 + + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v2 + + - name: Login to Repo + uses: https://github.com/docker/login-action@v2 + with: + registry: git.rainnny.club + username: ${{ secrets.REPO_USERNAME }} + password: ${{ secrets.REPO_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v4 + with: + push: true + context: . + tags: git.rainnny.club/rainnny/cors-anywhere:latest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..f70c691 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,51 @@ +{ + "name": "cors-anywhere", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "cors-anywhere": "^0.4.4" + } + }, + "node_modules/cors-anywhere": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cors-anywhere/-/cors-anywhere-0.4.4.tgz", + "integrity": "sha512-8OBFwnzMgR4mNrAeAyOLB2EruS2z7u02of2bOu7i9kKYlZG+niS7CTHLPgEXKWW2NAOJWRry9RRCaL9lJRjNqg==", + "dependencies": { + "http-proxy": "1.11.1", + "proxy-from-env": "0.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eventemitter3": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.2.0.tgz", + "integrity": "sha512-DOFqA1MF46fmZl2xtzXR3MPCRsXqgoFqdXcrCVYM3JNnfUeHTm/fh/v/iU7gBFpwkuBmoJPAm5GuhdDfSEJMJA==" + }, + "node_modules/http-proxy": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.11.1.tgz", + "integrity": "sha512-qz7jZarkVG3G6GMq+4VRJPSN4NkIjL4VMTNhKGd8jc25BumeJjWWvnY3A7OkCGa8W1TTxbaK3dcE0ijFalITVA==", + "dependencies": { + "eventemitter3": "1.x.x", + "requires-port": "0.x.x" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/proxy-from-env": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-0.0.1.tgz", + "integrity": "sha512-B9Hnta3CATuMS0q6kt5hEezOPM+V3dgaRewkFtFoaRQYTVNsHqUvFXmndH06z3QO1ZdDnRELv5vfY6zAj/gG7A==" + }, + "node_modules/requires-port": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-0.0.1.tgz", + "integrity": "sha512-AzPDCliPoWDSvEVYRQmpzuPhGGEnPrQz9YiOEvn+UdB9ixBpw+4IOZWtwctmpzySLZTy7ynpn47V14H4yaowtA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..13178be --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "cors-anywhere": "^0.4.4" + } +} diff --git a/server.js b/server.js new file mode 100644 index 0000000..cd1537e --- /dev/null +++ b/server.js @@ -0,0 +1,10 @@ +const host = process.env.HOST || "0.0.0.0"; // The host to bind to +const port = process.env.PORT || 8080; // The port to bind to +require("cors-anywhere") + .createServer({ + originWhitelist: [], // Allow all origins + requireHeader: ["origin", "x-requested-with"], + }) + .listen(port, host, function () { + console.log(`CORS Proxy started on ${host}:${port}`); + });