aboutsummaryrefslogtreecommitdiff
path: root/_www/rescached.js
AgeCommit message (Collapse)Author
2024-07-15internal/cmd/www: an HTTP server for testing web UIShulhan
The web user interface can be run using existing rescached server by setting the SERVER value in class Rescached (_www/rescached.js).
2024-07-07_www: reformat all files using prettierShulhan
2022-06-12_www: refactoring, various bug fixes and cleanupsShulhan
On refactoring, - standardize the method names on the rescached.js to match with the Client, for example prefixing block.d operations with Blockd. - use the GET /block.d, GET /hosts.d, GET /zone.d to fetch the resources instead of using GET /environment for all. On bug fixes, - fix updating SOA record on zone.d due to refactoring
2022-06-12all: fixes HTTP API for updating environmentShulhan
There are two issues when updating environment. One is on the front, where debug value is send as string. Another one is the back, where new environment overwrite all of options where it should only update only DNS server options and Debug fields.
2022-06-09all: change the HTTP API to update hosts in block.dShulhan
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
2022-05-22all: move the documentation under _www/doc directoryShulhan
This also allow the latest/released documentation viewed on the web user interface under /doc path. While at it, reformat HTML and CSS files using js-beautify and JavaScript files using clang-format [1]. [1] https://google.github.io/styleguide/jsguide.html#formatting
2022-05-16all: use consistent parameter name for zone nameShulhan
Some zone APIs use "name" and some use "zone" for passing the zone name. This changes made all zone APIs to use "name" as parameter name.
2022-05-16_www: fetch the zone's records when clicking zoneShulhan
Previously, the zone's records is fetched along with response from API environment. If zone have many records, this cause the API environment response larger, not suited for managing environment itself. This changes make the zone's records to be fetched immediately when user click on one of the zone file.
2022-05-15all: refactoring the HTTP API for deleting zone recordShulhan
Previously, the HTTP API for deleting a record is by passing the parameters as JSON in the body. This may cause issue if HTTP client does not support sending body in DELETE method. This changes the method to pass the parameters in the query, DELETE /zone.d/rr?zone=<string>&type=<string>&record=<base64 json> Parameters, - zone: the zone name, - type: the record type, - record: the content of record with its domain name and value.
2022-05-14all: refactoring HTTP API for adding new zone.d recordShulhan
Previously, the request for adding new record on zone file is by passing the zone name and type inside the path, /zone.d/:name/rr/:type This commit changes it to pass all parameters inside the request body as JSON, { "zone": <string>, "kind": <string>, "record": <base64 string|base64 JSON> } For example, to add A record for subdomain "www" to zone file "my.zone", the request format would be, { "zone": "my.zone", "kind": "A", "record": "eyJOYW1lIjoid3d3IiwiVmFsdWUiOiIxMjcuMC4wLjEifQ==" } Where "record" value is equal to `{"Name":"www","Value":"127.0.0.1"}`. On the response, we changes it to return only the new record instead of all record in the zone.
2022-05-14all: refactor the HTTP API for zone.dShulhan
Previously, the the HTTP API for creating and deleting zone file is by passing the zone file name in path of URL. This changes move the parameter name to POST body when creating new zone file and in the DELETE query when deleting zone file.
2022-04-25all: refactor the APIs to manage hosts.d resource records (RR)Shulhan
There are two APIs to manage hosts.d RR: create and delete. Previously, the create API pass the hosts name inside and values inside the path, POST /hosts.d/<name>/rr?domain=&value= This commit changes the request type to form, so all parameters move to body, POST /hosts.d/rr Content-Type: application/x-www-form-urlencoded name=&domain=&value= On delete API, we changes the name parameter to be send on query parameter along with domain to be deleted. Previously, the delete API was DELETE /hosts.d/<name>/rr?domain= now it become DELETE /hosts.d/rr?name=&domain=
2022-04-23all: change the hosts.d HTTP API request type to form and queryShulhan
Using dynamic value in the URL path is not a good practice, so we move the API for hosts.d to create, delete, and get to form and query parameters.
2022-04-22all: changes the block.d update API request type to x-www-form-urlencodedShulhan
Instead of passing whole block.d object with single field Name set, send the request using urlencoded form.
2022-04-20_www: implement function to update block.d hosts fileShulhan
In the /block.d page, in each provider we provide a button to update the hosts file directly.
2022-04-19all: rename the page and HTTP API for hosts_blocks to block.dShulhan
This is to make all terminology to be consistent, from configuration to page URL, and API.
2022-03-15all: change the rescached license to GPL 3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2021-12-25www: implement functionality to remove cache by record nameShulhan
In the web user interface (WUI), we have a button "Remove from cache" that displayed per record, but somehow this feature is not implemented, probably missing from commits due to rebase or I completely forgot about it. Anyway, this commit implement the feature to remove record from cache by clicking the button. On success, it will remove the removed record from search result. Fix #10
2021-01-22_www: display the list of caches in front pageShulhan
When user open the rescached web interface, the front page will render and refresh the list of non-local caches per 10 seconds.
2021-01-20all: rewrite the web user interface and the APIsShulhan