diff options
| author | Shulhan <ms@kilabit.info> | 2022-05-23 02:27:30 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-06-09 23:39:01 +0700 |
| commit | 03ae9f6bfde5262b44d2318cc1162c20d867a3f6 (patch) | |
| tree | 92e805bcd533bc1e2fa21c151b78a00a0b1526b5 /_www/block.d/index.html | |
| parent | fdb3c4462417dd1caeb28d263c1f3be6e453f6bb (diff) | |
| download | rescached-03ae9f6bfde5262b44d2318cc1162c20d867a3f6.tar.xz | |
all: change the HTTP API to update hosts in block.d
We have HTTP API to enable or disable block.d by batch by passing all
block.d records.
The name of HTTP API is /v2/block.d/update and this is duplicate with
API to update the content of hosts in block.d.
This changes fix this by creating new HTTP API /v2/block.d/fetch
that fetch the latest hosts file from specific block.d by its name.
While at it,
- reformat html and JavaScript files using js-beautify
- rename constants and methods for HTTP APIs
- add and update comments for some HTTP APIs
Diffstat (limited to '_www/block.d/index.html')
| -rw-r--r-- | _www/block.d/index.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/_www/block.d/index.html b/_www/block.d/index.html index 47ff4fa..6c32032 100644 --- a/_www/block.d/index.html +++ b/_www/block.d/index.html @@ -82,7 +82,7 @@ <div id="HostsBlocks" class="block_source"></div> <div> - <button onclick="updateHostsBlocks()">Save</button> + <button onclick="blockdUpdate()">Save</button> </div> <script src="/index.js"></script> @@ -110,10 +110,10 @@ resc.env.HostsBlocks[key].IsEnabled = val } - async function blockdUpdate(name) { - const res = await resc.BlockdUpdate(name) + async function blockdFetch(name) { + const res = await resc.BlockdFetch(name) if (res.code != 200) { - notifError("blockdUpdate: ", res.message) + notifError("blockdFetch: ", res.message) return } @@ -124,10 +124,10 @@ renderHostsBlocks(resc.env.HostsBlocks) } - async function updateHostsBlocks() { - const res = await resc.updateHostsBlocks(resc.env.HostsBlocks) + async function blockdUpdate() { + const res = await resc.BlockdUpdate(resc.env.HostsBlocks) if (res.code != 200) { - notifError("updateHostsBlocks: ", res.message) + notifError("blockdUpdate: ", res.message) return } @@ -158,7 +158,7 @@ <span class="info"> <div> ${hostsBlock.Name} - <button onclick="blockdUpdate('${k}')"> + <button onclick="blockdFetch('${k}')"> Update </button> </div> |
