Browse Source

mergerfs_webui.cpp

webui
Antonio SJ Musumeci 1 week ago
parent
commit
e493336ccd
  1. 11
      index.html
  2. 6
      src/mergerfs_webui.cpp

11
index.html

@ -390,9 +390,14 @@
headers: {'Content-Type': 'application/json'}, headers: {'Content-Type': 'application/json'},
body: JSON.stringify(input.value) body: JSON.stringify(input.value)
}).then(response => { }).then(response => {
if (!response.ok) {
response.text().then(body => {
alert('Status: ' + response.status + '\nBody: ' + body);
if(!response.ok) {
response.json().then(body => {
msg = `HTTP Status: ${response.status}\n`
msg += `mount: ${body["error"]["mount"]}\n`
msg += `key: ${body["error"]["key"]}\n`
msg += `value: ${body["error"]["value"]}\n`
msg += `msg: ${body["error"]["msg"]}`
alert(msg)
}); });
} }
}); });

6
src/mergerfs_webui.cpp

@ -306,15 +306,15 @@ _generate_error(const fs::path &mount_,
switch(err_) switch(err_)
{ {
case -EROFS: case -EROFS:
rv["message"] = fmt::format("'{}' is readonly",key_);
rv["msg"] = fmt::format("'{}' is read only",key_);
break; break;
case -EINVAL: case -EINVAL:
rv["message"] = fmt::format("value '{}' is not valid for '{}'",
rv["msg"] = fmt::format("value '{}' is not valid for '{}'",
val_, val_,
key_); key_);
break; break;
default: default:
rv["message"] = strerror(-err_);
rv["msg"] = strerror(-err_);
break; break;
} }

Loading…
Cancel
Save