refactor: Bring back deleted changes

This commit is contained in:
Isra 2023-09-09 23:00:56 -05:00
parent 3936dd0765
commit c0f50f0410
8 changed files with 486 additions and 158 deletions

View File

@ -1,42 +0,0 @@
name: cloudflare
on:
push:
pull_request:
repository_dispatch:
jobs:
ci:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
node: [ 18 ]
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Checkout
uses: actions/checkout@v3
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/package-lock.json')) }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Build
run: npm run build
env:
NITRO_PRESET: cloudflare
- name: Publish to Cloudflare
uses: cloudflare/wrangler-action@2.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}

View File

@ -1,3 +1,4 @@
module.exports = { module.exports = {
trailingComma: "all", trailingComma: 'all',
singleQuote: true,
}; };

3
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "editorconfig.editorconfig"]
}

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true
}

573
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,23 @@
{ {
"name": "simple-proxy",
"private": true, "private": true,
"version": "2.0.0",
"scripts": { "scripts": {
"prepare": "nitropack prepare", "prepare": "nitropack prepare",
"dev": "nitropack dev", "dev": "nitropack dev",
"build": "nitropack build", "build": "nitropack build",
"preview": "node .output/server/index.mjs" "preview": "node .output/server/index.mjs",
"lint": "eslint --ext .js src/",
"lint:fix": "eslint --fix --ext .js src/"
}, },
"dependencies": { "dependencies": {
"nitropack": "latest" "eslint-plugin-prettier": "^5.0.0",
"nitropack": "latest",
"node-fetch": "^3.3.2"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^8.48.0", "eslint": "^8.48.0",
"eslint-config-airbnb-base": "^15.0.0", "eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0"
"prettier": "^3.0.3",
"typescript": "^5.2.2"
} }
} }

View File

@ -1,3 +1,4 @@
import fetch from 'node-fetch';
import { import {
defineEventHandler, defineEventHandler,
EventHandlerRequest, EventHandlerRequest,
@ -33,6 +34,7 @@ async function handleRequest(
headers: requestData.headers, headers: requestData.headers,
method: requestData.method, method: requestData.method,
body: requestData.body, body: requestData.body,
redirect: "manual",
}); });
request.headers.set("Origin", new URL(requestData.destination).origin); request.headers.set("Origin", new URL(requestData.destination).origin);

View File

@ -1,4 +1,4 @@
name = "playground" name = "simple-proxy"
main = "./.output/server/index.mjs" main = "./.output/server/index.mjs"
workers_dev = true workers_dev = true
compatibility_date = "2022-09-10" compatibility_date = "2022-09-10"