Rocky_Mountain_Vending/.pnpm-store/v10/files/d5/6c4696bcffce462d299c1174654a1b3e1d47d4efb9257ee306ad6909f994f92f6a4665d8618bd83ca8daeb4438d4e71932412715102923a66809fe2889bc2c
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

1 line
No EOL
6.9 KiB
Text

{"version":3,"file":"getIpAddress.js","sources":["../../../src/vendor/getIpAddress.ts"],"sourcesContent":["// Vendored / modified from @sergiodxa/remix-utils\n\n// https://github.com/sergiodxa/remix-utils/blob/02af80e12829a53696bfa8f3c2363975cf59f55e/src/server/get-client-ip-address.ts\n// MIT License\n\n// Copyright (c) 2021 Sergio Xalambrí\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE.\n\n// The headers to check, in priority order\nexport const ipHeaderNames = [\n 'X-Client-IP',\n 'X-Forwarded-For',\n 'Fly-Client-IP',\n 'CF-Connecting-IP',\n 'Fastly-Client-Ip',\n 'True-Client-Ip',\n 'X-Real-IP',\n 'X-Cluster-Client-IP',\n 'X-Forwarded',\n 'Forwarded-For',\n 'Forwarded',\n 'X-Vercel-Forwarded-For',\n];\n\n/**\n * Get the IP address of the client sending a request.\n *\n * It receives a Request headers object and use it to get the\n * IP address from one of the following headers in order.\n *\n * If the IP address is valid, it will be returned. Otherwise, null will be\n * returned.\n *\n * If the header values contains more than one IP address, the first valid one\n * will be returned.\n */\nexport function getClientIPAddress(headers: { [key: string]: string | string[] | undefined }): string | null {\n // This will end up being Array<string | string[] | undefined | null> because of the various possible values a header\n // can take\n const headerValues = ipHeaderNames.map((headerName: string) => {\n const rawValue = headers[headerName];\n const value = Array.isArray(rawValue) ? rawValue.join(';') : rawValue;\n\n if (headerName === 'Forwarded') {\n return parseForwardedHeader(value);\n }\n\n return value?.split(',').map((v: string) => v.trim());\n });\n\n // Flatten the array and filter out any falsy entries\n const flattenedHeaderValues = headerValues.reduce((acc: string[], val) => {\n if (!val) {\n return acc;\n }\n\n return acc.concat(val);\n }, []);\n\n // Find the first value which is a valid IP address, if any\n const ipAddress = flattenedHeaderValues.find(ip => ip !== null && isIP(ip));\n\n return ipAddress || null;\n}\n\nfunction parseForwardedHeader(value: string | null | undefined): string | null {\n if (!value) {\n return null;\n }\n\n for (const part of value.split(';')) {\n if (part.startsWith('for=')) {\n return part.slice(4);\n }\n }\n\n return null;\n}\n\n//\n/**\n * Custom method instead of importing this from `net` package, as this only exists in node\n * Accepts:\n * 127.0.0.1\n * 192.168.1.1\n * 192.168.1.255\n * 255.255.255.255\n * 10.1.1.1\n * 0.0.0.0\n * 2b01:cb19:8350:ed00:d0dd:fa5b:de31:8be5\n *\n * Rejects:\n * 1.1.1.01\n * 30.168.1.255.1\n * 127.1\n * 192.168.1.256\n * -1.2.3.4\n * 1.1.1.1.\n * 3...3\n * 192.168.1.099\n */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