moved to json api
This commit is contained in:
parent
cac61f6ede
commit
8f5191f5cf
3 changed files with 12 additions and 7 deletions
|
@ -28,6 +28,11 @@ class RestRouter extends Router {
|
|||
&& $this->action === 'random_username') {
|
||||
return new RedirectToRandomAddressController($this->config['domains']);
|
||||
|
||||
} elseif ($this->action === "has_new_messages"
|
||||
&& isset($this->get_vars['email_ids'])
|
||||
&& isset($this->get_vars['address'])) {
|
||||
return new HasNewMessagesController($this->get_vars['email_ids'], $this->get_vars['address'], $this->config['domains'], $this->config['blocked_usernames']);
|
||||
|
||||
} elseif ($this->method === "GET"
|
||||
&& $this->action === 'emails'
|
||||
&& isset($this->get_vars['address'])) {
|
||||
|
@ -76,6 +81,12 @@ class JsonViewHandler implements ViewHandler {
|
|||
function invalid_input($config_domains) {
|
||||
$this->error(400, 'Bad Request');
|
||||
}
|
||||
|
||||
function new_mail_counter_json($counter) {
|
||||
header('Content-Type: application/json');
|
||||
print json_encode($counter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,11 +37,6 @@ class Router {
|
|||
&& isset($this->get_vars['address'])) {
|
||||
return new DeleteEmailController($this->get_vars['email_id'], $this->get_vars['address'], $this->config['domains'], $this->config['blocked_usernames']);
|
||||
|
||||
} elseif ($this->action === "has_new_messages"
|
||||
&& isset($this->get_vars['email_ids'])
|
||||
&& isset($this->get_vars['address'])) {
|
||||
return new HasNewMessagesController($this->get_vars['email_ids'], $this->get_vars['address'], $this->config['domains'], $this->config['blocked_usernames']);
|
||||
|
||||
} elseif ($this->action === 'random') {
|
||||
return new RedirectToRandomAddressController($this->config['domains']);
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ class ServerRenderViewHandler implements ViewHandler {
|
|||
}
|
||||
|
||||
function new_mail_counter_json($counter) {
|
||||
header('Content-Type: application/json');
|
||||
print json_encode($counter);
|
||||
$this->error("not implemented for ServerRenderViewHandler, see json-api");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue