@alore/auth-react-sdk
Advanced tools
@@ -245,2 +245,3 @@ import type { AuthMachineContext, AuthProviderConfig, FetchWithProgressiveBackoffConfig, ForgeData } from '../types'; | ||
| private delay; | ||
| private isLocalUrl; | ||
| fetchWithProgressiveBackoff(url: RequestInfo | URL, options?: RequestInit, config?: FetchWithProgressiveBackoffConfig): Promise<Response>; | ||
@@ -247,0 +248,0 @@ private parseErrorResponse; |
@@ -451,2 +451,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| } | ||
| // eslint-disable-next-line class-methods-use-this | ||
| isLocalUrl(urlString) { | ||
| try { | ||
| const parsed = new URL(urlString); | ||
| const isHttp = parsed.protocol === 'http:'; | ||
| const isLoopbackHost = parsed.hostname === 'localhost' || | ||
| parsed.hostname === '127.0.0.1' || | ||
| parsed.hostname === '::1'; | ||
| const isPort8000 = parsed.port === '8000'; | ||
| return isHttp || isLoopbackHost || isPort8000; | ||
| } | ||
| catch (_e) { | ||
| return false; | ||
| } | ||
| } | ||
| fetchWithProgressiveBackoff( | ||
@@ -461,3 +476,3 @@ // eslint-disable-next-line no-undef | ||
| let delayValue = initialDelay; | ||
| const isLocal = this.aloreBaseUrl.includes('localhost') || this.aloreBaseUrl.includes('127.0.0.1'); | ||
| const isLocal = this.isLocalUrl(this.aloreBaseUrl); | ||
| // eslint-disable-next-line no-undef | ||
@@ -464,0 +479,0 @@ const init = Object.assign(Object.assign({}, options), { credentials: 'include', headers: Object.assign(Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.headers), { 'X-CLIENT-ID': this.clientId }), (isLocal && { 'CF-Connecting-IP': '127.0.0.1' })) }); |
+1
-1
| { | ||
| "name": "@alore/auth-react-sdk", | ||
| "version": "1.1.0-alpha.8", | ||
| "version": "1.1.0-alpha.9", | ||
| "repository": "https://github.com/0xCarbon/alore-js", | ||
@@ -5,0 +5,0 @@ "description": "SDK for Alore Auth", |
73717
0.72%1068
1.52%