diff --git a/web/api.php b/web/api.php index 01f43b6..d178f19 100644 --- a/web/api.php +++ b/web/api.php @@ -141,6 +141,9 @@ switch($action) $o = array('status'=>'ok','emails'=>$data); } break; + case 'list-addresses': + $o = array('status'=>'ok','addresses'=>listEmailAdresses()); + break; } echo json_encode($o); diff --git a/web/index.html b/web/index.html index 1bbc98b..97e6dce 100644 --- a/web/index.html +++ b/web/index.html @@ -25,7 +25,8 @@
  - +   +
diff --git a/web/js/opentrashmail.js b/web/js/opentrashmail.js index 7197878..2bed3eb 100644 --- a/web/js/opentrashmail.js +++ b/web/js/opentrashmail.js @@ -49,6 +49,25 @@ function renderEmail(email,id,data) ') } +function listAddresses(e) +{ + clearInterval(timer); + e = e || window.event; + e.preventDefault(); + + $.get("api.php?a=list-addresses", function(data) { + if (data.status == "ok") { + accounts = data.addresses; + $("#main").html(`

Accounts

+
+ `) + } else + alert("Unable to fetch list of accounts") + },"json") +} + function loadAccount(email) { clearInterval(timer);