mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-04 01:50:55 +01:00
Workaround for broken @cloudflare/worker-types v4
This commit is contained in:
parent
1be8f809f3
commit
bb1ace97fd
4 changed files with 15 additions and 21 deletions
26
package-lock.json
generated
26
package-lock.json
generated
|
@ -13,7 +13,7 @@
|
|||
"toucan-js": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^3.19.0",
|
||||
"@cloudflare/workers-types": "^4.20230307.0",
|
||||
"@microsoft/eslint-formatter-sarif": "^3.0.0",
|
||||
"@sentry/webpack-plugin": "^1.20.0",
|
||||
"@types/jest": "^29.5.0",
|
||||
|
@ -650,9 +650,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@cloudflare/workers-types": {
|
||||
"version": "3.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-3.19.0.tgz",
|
||||
"integrity": "sha512-0FRcsz7Ea3jT+gc5gKPIYciykm1bbAaTpygdzpCwGt0RL+V83zWnYN30NWDW4rIHj/FHtz+MIuBKS61C8l7AzQ==",
|
||||
"version": "4.20230307.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230307.0.tgz",
|
||||
"integrity": "sha512-Go968aDDcqONHQcUdgIiPRkPdT4QTzD0ecHJsI1u7ZiHPMOoZn+Dy7hYsdUJ5ldX9wTZDrICBM1rDKTRaDUitg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@discoveryjs/json-ext": {
|
||||
|
@ -1737,12 +1737,6 @@
|
|||
"node": ">=16.13"
|
||||
}
|
||||
},
|
||||
"node_modules/@miniflare/shared-test-environment/node_modules/@cloudflare/workers-types": {
|
||||
"version": "4.20230215.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230215.0.tgz",
|
||||
"integrity": "sha512-s71gaGwtEIxjSu6l0cekbXm9AwjrmrFVcHPNx9tHidG2dnqamYf5Nms/KgMYZf7gnjdKOp/ZChYFeJJkNv3QfA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@miniflare/shared-test-environment/node_modules/@miniflare/cache": {
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.12.1.tgz",
|
||||
|
@ -8047,9 +8041,9 @@
|
|||
}
|
||||
},
|
||||
"@cloudflare/workers-types": {
|
||||
"version": "3.19.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-3.19.0.tgz",
|
||||
"integrity": "sha512-0FRcsz7Ea3jT+gc5gKPIYciykm1bbAaTpygdzpCwGt0RL+V83zWnYN30NWDW4rIHj/FHtz+MIuBKS61C8l7AzQ==",
|
||||
"version": "4.20230307.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230307.0.tgz",
|
||||
"integrity": "sha512-Go968aDDcqONHQcUdgIiPRkPdT4QTzD0ecHJsI1u7ZiHPMOoZn+Dy7hYsdUJ5ldX9wTZDrICBM1rDKTRaDUitg==",
|
||||
"dev": true
|
||||
},
|
||||
"@discoveryjs/json-ext": {
|
||||
|
@ -8789,12 +8783,6 @@
|
|||
"@miniflare/web-sockets": "2.12.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cloudflare/workers-types": {
|
||||
"version": "4.20230215.0",
|
||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230215.0.tgz",
|
||||
"integrity": "sha512-s71gaGwtEIxjSu6l0cekbXm9AwjrmrFVcHPNx9tHidG2dnqamYf5Nms/KgMYZf7gnjdKOp/ZChYFeJJkNv3QfA==",
|
||||
"dev": true
|
||||
},
|
||||
"@miniflare/cache": {
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/@miniflare/cache/-/cache-2.12.1.tgz",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"author": "dangered wolf",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^3.19.0",
|
||||
"@cloudflare/workers-types": "^4.20230307.0",
|
||||
"@microsoft/eslint-formatter-sarif": "^3.0.0",
|
||||
"@sentry/webpack-plugin": "^1.20.0",
|
||||
"@types/jest": "^29.5.0",
|
||||
|
|
|
@ -170,8 +170,14 @@ const versionRequest = async (request: Request) => {
|
|||
request.headers.get('x-real-ip') ||
|
||||
request.headers.get('cf-connecting-ip') ||
|
||||
'Unknown IP',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - @cloudflare/workers-types v4 is missing IncomingRequestCfProperties.city despite it being a real property
|
||||
city: request.cf?.city || 'Unknown City',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - @cloudflare/workers-types v4 is missing IncomingRequestCfProperties.country / region despite it being a real property
|
||||
region: request.cf?.region || request.cf?.country || 'Unknown Region',
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - @cloudflare/workers-types v4 is missing IncomingRequestCfProperties.country despite it being a real property
|
||||
country: request.cf?.country || 'Unknown Country',
|
||||
asn: `AS${request.cf?.asn || '??'} (${
|
||||
request.cf?.asOrganization || 'Unknown ASN'
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"allowJs": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"types": ["@cloudflare/workers-types", "@types/jest"]
|
||||
"types": ["@cloudflare/workers-types/2022-11-30", "@types/jest"]
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist", "test"]
|
||||
|
|
Loading…
Add table
Reference in a new issue