Files
Strix/webui/web/js/api/camera-search.js
T
eduard256 90063c3f3a Fix API paths for Home Assistant Ingress compatibility
- Change absolute API paths to relative paths in camera-search.js
- Change absolute API paths to relative paths in stream-discovery.js
- Fixes resource loading in HA Ingress environment
- Maintains compatibility with direct Docker installations
- Version bump to 1.0.2
2025-11-18 13:35:29 +03:00

27 lines
713 B
JavaScript

export class CameraSearchAPI {
constructor(baseURL = null) {
// Use relative URLs since API and UI are on the same port
if (!baseURL) {
this.baseURL = '';
} else {
this.baseURL = baseURL;
}
}
async search(query, limit = 10) {
const response = await fetch(`${this.baseURL}api/v1/cameras/search`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, limit }),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
}
}