diff options
| author | Kristian Lyngstol <kly@kly.no> | 2016-03-04 17:47:56 +0000 | 
|---|---|---|
| committer | Kristian Lyngstol <kly@kly.no> | 2016-03-04 17:47:56 +0000 | 
| commit | aafd5a80db7b5ee27d1c432a4db93da48fbecb8a (patch) | |
| tree | 3235337d8488228ea54a5c9dd6a1b6b67474aaa2 | |
| parent | 289a855db874aefa4ae90f0029555ada4383fbbc (diff) | |
nms: Rename API end points and separate public/private
| -rw-r--r-- | web/etc/apache2/nms.tg16.gathering.org.conf | 25 | ||||
| -rw-r--r-- | web/nms.gathering.org/api/API.rst (renamed from web/nms.gathering.org/API.rst) | 0 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/private/comment-add (renamed from web/nms.gathering.org/comment-add.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/private/comment-change (renamed from web/nms.gathering.org/comment-change.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/private/comments (renamed from web/nms.gathering.org/comment.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/private/port-state (renamed from web/nms.gathering.org/port-state.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/private/switch-add (renamed from web/nms.gathering.org/switches_add.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/public/ping (renamed from web/nms.gathering.org/ping.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/public/switch-state (renamed from web/nms.gathering.org/switch-state.pl) | 2 | ||||
| -rwxr-xr-x | web/nms.gathering.org/api/public/switches (renamed from web/nms.gathering.org/switches.pl) | 2 | ||||
| -rw-r--r-- | web/nms.gathering.org/js/nms.js | 12 | 
11 files changed, 32 insertions, 21 deletions
| diff --git a/web/etc/apache2/nms.tg16.gathering.org.conf b/web/etc/apache2/nms.tg16.gathering.org.conf index 13fbefb..9a6d7cd 100644 --- a/web/etc/apache2/nms.tg16.gathering.org.conf +++ b/web/etc/apache2/nms.tg16.gathering.org.conf @@ -4,23 +4,34 @@          ServerAlias einstein.tg16.gathering.org          DocumentRoot /srv/tgmanage/web/nms.gathering.org +	ScriptAlias /api/private/ /srv/tgmanage/web/nms.gathering.org/api/private/ +	ScriptAlias /api/public/ /srv/tgmanage/web/nms.gathering.org/api/public/ +	<Directory "/srv/tgmanage/web/nms.gathering.org/api/private/"> +		AllowOverride None +		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch +		<RequireAny> +			AuthUserFile /srv/tgmanage/web/.htpasswd +	                AuthName "Tech:Server Secret Volcano Lair" +        	        AuthType Basic +			Require valid-user +		</RequireAny> +	</Directory> +	<Directory "/srv/tgmanage/web/nms.gathering.org/api/public/"> +		AllowOverride None +		Options +ExecCGI -MultiViews +Indexes +SymLinksIfOwnerMatch +		Require all granted +	</Directory>          <Directory "/srv/tgmanage/web/nms.gathering.org">                  AllowOverride None -                Options Indexes FollowSymLinks ExecCGI MultiViews +                Options Indexes FollowSymLinks MultiViews -                AddHandler cgi-script .cgi .sh .pl .py                  AddDefaultCharset UTF-8 -		SetEnvIF ^X-Forwarded-For$ "^185\.12\.59\.12$" AllowIP -         	SetEnvIF ^X-Forwarded-For$ "^2a02:ed02:1337::12$" AllowIP -  		<RequireAny>  			AuthUserFile /srv/tgmanage/web/.htpasswd  	                AuthName "Tech:Server Secret Volcano Lair"          	        AuthType Basic  			Require valid-user -			 -			Require env AllowIP  		</RequireAny>          </Directory> diff --git a/web/nms.gathering.org/API.rst b/web/nms.gathering.org/api/API.rst index b56db64..b56db64 100644 --- a/web/nms.gathering.org/API.rst +++ b/web/nms.gathering.org/api/API.rst diff --git a/web/nms.gathering.org/comment-add.pl b/web/nms.gathering.org/api/private/comment-add index fd7e371..beb7b21 100755 --- a/web/nms.gathering.org/comment-add.pl +++ b/web/nms.gathering.org/api/private/comment-add @@ -1,6 +1,6 @@  #! /usr/bin/perl  # vim:ts=8:sw=8 -use lib '../../include'; +use lib '../../../../include';  use utf8;  use nms::web;  use strict; diff --git a/web/nms.gathering.org/comment-change.pl b/web/nms.gathering.org/api/private/comment-change index d860777..ccf336d 100755 --- a/web/nms.gathering.org/comment-change.pl +++ b/web/nms.gathering.org/api/private/comment-change @@ -1,6 +1,6 @@  #! /usr/bin/perl  # vim:ts=8:sw=8 -use lib '../../include'; +use lib '../../../../include';  use utf8;  use nms;  use nms::web; diff --git a/web/nms.gathering.org/comment.pl b/web/nms.gathering.org/api/private/comments index 7a45d76..4adfb2b 100755 --- a/web/nms.gathering.org/comment.pl +++ b/web/nms.gathering.org/api/private/comments @@ -1,7 +1,7 @@  #! /usr/bin/perl  # vim:ts=8:sw=8 -use lib '../../include'; +use lib '../../../../include';  use nms::web;  use strict;  use warnings; diff --git a/web/nms.gathering.org/port-state.pl b/web/nms.gathering.org/api/private/port-state index f0efbf9..6410805 100755 --- a/web/nms.gathering.org/port-state.pl +++ b/web/nms.gathering.org/api/private/port-state @@ -1,7 +1,7 @@  #! /usr/bin/perl  # vim:ts=8:sw=8 -use lib '../../include'; +use lib '../../../../include';  use nms::web;  use strict;  use warnings; diff --git a/web/nms.gathering.org/switches_add.pl b/web/nms.gathering.org/api/private/switch-add index fe23049..1dc331f 100755 --- a/web/nms.gathering.org/switches_add.pl +++ b/web/nms.gathering.org/api/private/switch-add @@ -3,7 +3,7 @@  #use CGI qw(fatalsToBrowser);  use DBI; -use lib '../../include'; +use lib '../../../../include';  use nms;  use nms::web qw(%get_params %json finalize_output get_input);  use strict; diff --git a/web/nms.gathering.org/ping.pl b/web/nms.gathering.org/api/public/ping index dbdb82a..f713df1 100755 --- a/web/nms.gathering.org/ping.pl +++ b/web/nms.gathering.org/api/public/ping @@ -1,5 +1,5 @@  #! /usr/bin/perl -use lib '../../include'; +use lib '../../../../include';  use nms::web;  my $q = $nms::web::dbh->prepare("SELECT DISTINCT ON (sysname) time,sysname, latency_ms FROM ping NATURAL JOIN switches WHERE time in (select max(time) from ping where " . $nms::web::when . " group by switch)"); diff --git a/web/nms.gathering.org/switch-state.pl b/web/nms.gathering.org/api/public/switch-state index f429bf9..81e8d91 100755 --- a/web/nms.gathering.org/switch-state.pl +++ b/web/nms.gathering.org/api/public/switch-state @@ -1,7 +1,7 @@  #! /usr/bin/perl  # vim:ts=8:sw=8 -use lib '../../include'; +use lib '../../../../include';  use nms::web;  use strict;  use warnings; diff --git a/web/nms.gathering.org/switches.pl b/web/nms.gathering.org/api/public/switches index afd073f..4df81f2 100755 --- a/web/nms.gathering.org/switches.pl +++ b/web/nms.gathering.org/api/public/switches @@ -3,7 +3,7 @@  use CGI qw(fatalsToBrowser);  use DBI; -use lib '../../include'; +use lib '../../../../include';  use nms;  use nms::web;  use strict; diff --git a/web/nms.gathering.org/js/nms.js b/web/nms.gathering.org/js/nms.js index d3c9681..ace6e31 100644 --- a/web/nms.gathering.org/js/nms.js +++ b/web/nms.gathering.org/js/nms.js @@ -757,7 +757,7 @@ function updatePing()  	nms.outstandingAjaxRequests++;  	$.ajax({  		type: "GET", -		url: "/ping.pl" + now, +		url: "/api/public/ping" + now,  		dataType: "text",  		success: function (data, textStatus, jqXHR) {  			nms.ping_data = JSON.parse(data); @@ -806,7 +806,7 @@ function commentChange(id,state)  	}  	$.ajax({  		type: "POST", -		url: "/comment-change.pl", +		url: "/api/private/comment-change",  		dataType: "text",  		data:myData,  		success: function (data, textStatus, jqXHR) { @@ -823,7 +823,7 @@ function addComment(sw,comment)  	};  	$.ajax({  		type: "POST", -		url: "/comment-add.pl", +		url: "/api/private/comment-add",  		dataType: "text",  		data:myData,  		success: function (data, textStatus, jqXHR) { @@ -847,7 +847,7 @@ function updatePorts()  		now = "?now=" + nms.now;  	$.ajax({  		type: "GET", -		url: "/port-state.pl"+ now , +		url: "/api/private/port-state"+ now ,  		dataType: "text",  		success: function (data, textStatus, jqXHR) {  			var  switchdata = JSON.parse(data); @@ -870,7 +870,7 @@ function updatePorts()  	});  	$.ajax({  		type: "GET", -		url: "/switches.pl"+ now , +		url: "/api/public/switches"+ now ,  		dataType: "text",  		success: function (data, textStatus, jqXHR) {  			var switchdata = JSON.parse(data); @@ -889,7 +889,7 @@ function updatePorts()  	updateAjaxInfo();  	$.ajax({  		type: "GET", -		url: "/port-state.pl" + now, +		url: "/api/private/port-state" + now,  		dataType: "text",  		success: function (data, textStatus, jqXHR) {  			var  switchdata = JSON.parse(data); | 
