Changes to api path
parent
dfee8efa97
commit
8f213e8df9
|
@ -18,10 +18,9 @@ server {
|
|||
access_log /var/log/nginx/access.log;
|
||||
root /web;
|
||||
|
||||
location /api/v1/ {
|
||||
try_files $uri $uri/ /json_api.php?$args;
|
||||
location ~ ^/api/v1/(.*)$ {
|
||||
try_files $uri $uri/ /json_api.php?query=$1;
|
||||
}
|
||||
rewrite ^/api/v1/([^/]+)/([^/]+)/([^/]+)/?$ /json_api.php?action=$1&cat=$2&object=$3? last;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
allow all;
|
||||
|
@ -167,10 +166,9 @@ server {
|
|||
access_log /var/log/nginx/access.log;
|
||||
root /web;
|
||||
|
||||
location /api/v1/ {
|
||||
try_files $uri $uri/ /json_api.php?$args;
|
||||
location ~ ^/api/v1/(.*)$ {
|
||||
try_files $uri $uri/ /json_api.php?query=$1;
|
||||
}
|
||||
rewrite ^/api/v1/([^/]+)/([^/]+)/([^/]+)/?$ /json_api.php?action=$1&cat=$2&object=$3? last;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
allow all;
|
||||
|
|
|
@ -306,7 +306,7 @@ $(document).ready(function() {
|
|||
type: "POST",
|
||||
dataType: "json",
|
||||
data: { "address": JSON.stringify(selected_aliases), "active": "1" },
|
||||
url: '/api/v1/edit/alias/post',
|
||||
url: '/api/v1/edit/alias',
|
||||
jsonp: false,
|
||||
complete: function (data) {
|
||||
location.reload();
|
||||
|
@ -322,7 +322,7 @@ $(document).ready(function() {
|
|||
type: "POST",
|
||||
dataType: "json",
|
||||
data: { "address": JSON.stringify(selected_aliases), "active": "0" },
|
||||
url: '/api/v1/edit/alias/post',
|
||||
url: '/api/v1/edit/alias',
|
||||
jsonp: false,
|
||||
complete: function (data) {
|
||||
location.reload();
|
||||
|
@ -349,7 +349,7 @@ $(document).ready(function() {
|
|||
type: "POST",
|
||||
dataType: "json",
|
||||
data: { "address": JSON.stringify(selected_aliases) },
|
||||
url: '/api/v1/delete/alias/post',
|
||||
url: '/api/v1/delete/alias',
|
||||
jsonp: false,
|
||||
complete: function (data) {
|
||||
location.reload();
|
||||
|
|
|
@ -1,14 +1,27 @@
|
|||
<?php
|
||||
/*
|
||||
edit/alias => POST data:
|
||||
{
|
||||
address: {a, b, c}, (where a, b, c represent alias addresses)
|
||||
active: 1 (0 or 1)
|
||||
}
|
||||
|
||||
delete/alias => POST data:
|
||||
{
|
||||
address: {a, b, c}, (where a, b, c represent alias addresses)
|
||||
}
|
||||
|
||||
*/
|
||||
header('Content-Type: application/json');
|
||||
require_once 'inc/prerequisites.inc.php';
|
||||
error_reporting(E_ALL);
|
||||
if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_username'])) {
|
||||
if (isset($_GET['action']) && isset($_GET['cat'])) {
|
||||
$category = filter_input(INPUT_GET, 'cat', FILTER_SANITIZE_STRING);
|
||||
$action = filter_input(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
|
||||
|
||||
if (isset($_GET['object'])) {
|
||||
$object = filter_input(INPUT_GET, 'object', FILTER_SANITIZE_STRING);
|
||||
}
|
||||
if (isset($_GET['query'])) {
|
||||
|
||||
$query = explode('/', $_GET['query']);
|
||||
$action = (isset($query[0])) ? $query[0] : null;
|
||||
$category = (isset($query[1])) ? $query[1] : null;
|
||||
$object = (isset($query[2])) ? $query[2] : null;
|
||||
|
||||
switch ($action) {
|
||||
case "get":
|
||||
|
|
Loading…
Reference in New Issue