Proxy dashboard API through web server

This commit is contained in:
krustophski 2026-08-07 02:32:32 +03:00
parent 72b9174401
commit 148ffec10f

View file

@ -368,7 +368,7 @@
<div id="toast" class="toast"></div>
<script>
const API = 'http://127.0.0.1:30010';
const API_PROXY = '/api/proxy';
const PREFERRED_PRESET = 'RCP_LedVolumeLive';
const state = {
presetId: '',
@ -409,8 +409,15 @@
}
async function api(path, options = {}) {
const response = await fetch(API + path, {
...options,
const method = (options.method || 'GET').toUpperCase();
const payload = {
method,
url: path,
body: options.body ? JSON.parse(options.body) : undefined
};
const response = await fetch(API_PROXY, {
method: 'PUT',
body: JSON.stringify(payload),
headers: {
'Content-Type': 'application/json',
...(options.headers || {})