Use /api/v1 with token authentication
All server calls go through a shared axios instance (src/api.js) that gets a token with API_PASSWORD from the runtime config, renews it before it expires and retries once on 401. Character images are loaded with the token as blobs. Removes the unused express and cors dependencies and bumps the version to 1.2.0. Closes #2
This commit is contained in:
1 parent
d061e02d81
commit
b3ffef9fd9
13 files changed
+190
-47
No files matched your search
@@ -20,5 +20,20 @@ npm run build
|
||||
npm run lint
|
||||
```
|
||||
|
||||
## Configuration
|
||||
The Docker image writes `config.js` from `public/config.template.js` when the container starts, using these environment variables:
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `API_HOSTNAME` | URL of the MusicServer, for example `https://music.example.com`. Empty to use the same host as the frontend. |
|
||||
| `API_PASSWORD` | The MusicServer's `API_PASSWORD`, used to get an API token. Empty if the server has no password. Anyone who can open the frontend can read it. |
|
||||
|
||||
For `npm run serve`, create `public/config.js` (ignored by git):
|
||||
```js
|
||||
window.__RUNTIME_CONFIG__ = { API_HOSTNAME: 'http://localhost:8080', API_PASSWORD: '' };
|
||||
```
|
||||
|
||||
When the frontend is served by the MusicServer image, the server provides `config.js` with its own `API_PASSWORD`.
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
Reference in new issue
Block a user