irdata_js 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -9
- package/dist/auth/AuthManager.d.ts +1 -0
- package/dist/auth/AuthManager.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -110,19 +110,27 @@ npm run build
|
|
|
110
110
|
|
|
111
111
|
### Manual Verification (OAuth Flow)
|
|
112
112
|
|
|
113
|
-
This repository includes a local development proxy server to test the OAuth flow and API interaction, avoiding CORS issues during development.
|
|
113
|
+
This repository includes a local development proxy server and a demo application to test the OAuth flow and API interaction, avoiding CORS issues during development.
|
|
114
114
|
|
|
115
|
-
1. Create a file named `
|
|
115
|
+
1. Create a file named `config.json` in the `demo/` directory (ignored by git) with your configuration:
|
|
116
116
|
|
|
117
117
|
```json
|
|
118
118
|
{
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
119
|
+
"port": 80,
|
|
120
|
+
"basePath": "/irdata_js",
|
|
121
|
+
"redirectPath": "/irdata_js/callback",
|
|
122
|
+
"auth": {
|
|
123
|
+
"clientId": "YOUR_CLIENT_ID",
|
|
124
|
+
"redirectUri": "http://127.0.0.1/irdata_js/callback",
|
|
125
|
+
"tokenEndpoint": "http://127.0.0.1/irdata_js/token"
|
|
126
|
+
}
|
|
122
127
|
}
|
|
123
128
|
```
|
|
124
129
|
|
|
125
|
-
|
|
130
|
+
* `port`: The port the proxy server will listen on.
|
|
131
|
+
* `basePath`: The path prefix where the static files and proxy endpoints are served from.
|
|
132
|
+
* `redirectPath`: The path the proxy server intercepts for OAuth callbacks.
|
|
133
|
+
* `auth`: Your iRacing API credentials. Note that `tokenEndpoint` should include the `basePath`.
|
|
126
134
|
|
|
127
135
|
2. Start the proxy server:
|
|
128
136
|
|
|
@@ -130,10 +138,12 @@ This repository includes a local development proxy server to test the OAuth flow
|
|
|
130
138
|
npm run dev
|
|
131
139
|
```
|
|
132
140
|
|
|
133
|
-
|
|
141
|
+
*This command automatically generates the `demo/index.html` from the template using your configuration and starts the proxy server.*
|
|
142
|
+
*Depending on your system configuration, you might need elevated privileges (e.g., `sudo`) to listen on port 80.*
|
|
143
|
+
|
|
144
|
+
3. Open `http://127.0.0.1/irdata_js/` (or your configured `basePath`) in your browser.
|
|
145
|
+
* The demo app is configured to use the local proxy endpoints (e.g., `/irdata_js/token`, `/irdata_js/data`, `/irdata_js/passthrough`) to bypass CORS restrictions.
|
|
134
146
|
|
|
135
|
-
3. Open `http://127.0.0.1/examples/index.html` in your browser.
|
|
136
|
-
- The `index.html` is configured to use the local proxy endpoints (`/token`, `/data`, `/passthrough`) to bypass CORS restrictions enforced by the browser.
|
|
137
147
|
|
|
138
148
|
## License
|
|
139
149
|
|
package/dist/auth/AuthManager.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "irdata_js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "JavaScript library to interact with the iRacing /data API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"test": "vitest run",
|
|
16
16
|
"build": "tsc",
|
|
17
|
-
"dev": "node proxy_server.js",
|
|
17
|
+
"dev": "./generate_demo.sh && node proxy_server.js",
|
|
18
18
|
"lint": "eslint .",
|
|
19
19
|
"lint:fix": "eslint . --fix",
|
|
20
20
|
"format": "prettier --write .",
|