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 = {
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,
"version": "2.0.0",
"scripts": {
"prepare": "nitropack prepare",
"dev": "nitropack dev",
"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": {
"nitropack": "latest"
"eslint-plugin-prettier": "^5.0.0",
"nitropack": "latest",
"node-fetch": "^3.3.2"
},
"devDependencies": {
"eslint": "^8.48.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.0.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
"eslint-config-prettier": "^9.0.0"
}
}

View File

@ -1,3 +1,4 @@
import fetch from 'node-fetch';
import {
defineEventHandler,
EventHandlerRequest,
@ -33,6 +34,7 @@ async function handleRequest(
headers: requestData.headers,
method: requestData.method,
body: requestData.body,
redirect: "manual",
});
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"
workers_dev = true
compatibility_date = "2022-09-10"