mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2026-04-23 08:00:11 +08:00
Refactor after merge
This commit is contained in:
@@ -330,6 +330,53 @@
|
||||
</script>
|
||||
|
||||
|
||||
<button id="tuya">Tuya</button>
|
||||
<div>
|
||||
<form id="tuya-credentials-form">
|
||||
<select name="region" required>
|
||||
<option value="protect-eu.ismartlife.me">EU Central</option>
|
||||
<option value="protect-we.ismartlife.me">EU East</option>
|
||||
<option value="protect-us.ismartlife.me">US West</option>
|
||||
<option value="protect-ue.ismartlife.me">US East</option>
|
||||
<option value="protect.ismartlife.me">China</option>
|
||||
<option value="protect-in.ismartlife.me">India</option>
|
||||
</select>
|
||||
<input type="email" name="email" placeholder="email" required>
|
||||
<input type="password" name="password" placeholder="password" required>
|
||||
<button type="submit">login</button>
|
||||
</form>
|
||||
<table id="tuya-table"></table>
|
||||
</div>
|
||||
<script>
|
||||
document.getElementById('tuya').addEventListener('click', async ev => {
|
||||
ev.target.nextElementSibling.style.display = 'grid';
|
||||
});
|
||||
|
||||
document.getElementById('tuya-credentials-form').addEventListener('submit', async ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
const table = document.getElementById('tuya-table');
|
||||
table.innerText = 'loading...';
|
||||
|
||||
const query = new URLSearchParams(new FormData(ev.target));
|
||||
const url = new URL('api/tuya?' + query.toString(), location.href);
|
||||
|
||||
const r = await fetch(url, {cache: 'no-cache'});
|
||||
|
||||
if (!r.ok) {
|
||||
table.innerText = (await r.text()) || 'Unknown error';
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await r.json();
|
||||
|
||||
table.innerText = '';
|
||||
|
||||
drawTable(table, data);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<button id="roborock">Roborock</button>
|
||||
<div>
|
||||
<form id="roborock-form">
|
||||
|
||||
Reference in New Issue
Block a user