token-validator: maatma should be the root of token-validator
This commit is contained in:
parent
a4a7b48a4f
commit
e1f7027109
@ -37,7 +37,7 @@ angular.module("AdLinApp")
|
|||||||
$rootScope.checkLoginState = function() {
|
$rootScope.checkLoginState = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/auth",
|
url: "api/auth",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$rootScope.isLogged = response.data;
|
$rootScope.isLogged = response.data;
|
||||||
$rootScope.student = response.data;
|
$rootScope.student = response.data;
|
||||||
@ -51,7 +51,7 @@ angular.module("AdLinApp")
|
|||||||
$rootScope.disconnectCurrentUser = function() {
|
$rootScope.disconnectCurrentUser = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: "/api/auth/logout"
|
url: "api/auth/logout"
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$rootScope.isLogged = false;
|
$rootScope.isLogged = false;
|
||||||
$rootScope.student = null;
|
$rootScope.student = null;
|
||||||
@ -62,7 +62,7 @@ angular.module("AdLinApp")
|
|||||||
.controller("ProgressionController", function($scope, $interval, $http) {
|
.controller("ProgressionController", function($scope, $interval, $http) {
|
||||||
$scope.mychallenges = {};
|
$scope.mychallenges = {};
|
||||||
var refreshChal = function() {
|
var refreshChal = function() {
|
||||||
$http.get("/api/students/" + $scope.student.id + "/progress").then(function(response) {
|
$http.get("api/students/" + $scope.student.id + "/progress").then(function(response) {
|
||||||
$scope.mychallenges = response.data
|
$scope.mychallenges = response.data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ angular.module("AdLinApp")
|
|||||||
$scope.pleaseWait = true;
|
$scope.pleaseWait = true;
|
||||||
$http({
|
$http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: "/api/auth",
|
url: "api/auth",
|
||||||
data: $scope.auth
|
data: $scope.auth
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.pleaseWait = false;
|
$scope.pleaseWait = false;
|
||||||
@ -98,7 +98,7 @@ angular.module("AdLinApp")
|
|||||||
$scope.updateTunnelInfo = function() {
|
$scope.updateTunnelInfo = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/wginfo",
|
url: "api/wginfo",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.wginfo = response.data;
|
$scope.wginfo = response.data;
|
||||||
});
|
});
|
||||||
@ -108,7 +108,7 @@ angular.module("AdLinApp")
|
|||||||
$scope.updateTunnelsList = function() {
|
$scope.updateTunnelsList = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/wg/",
|
url: "api/wg/",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.tunnels = response.data;
|
$scope.tunnels = response.data;
|
||||||
}, function(response) {
|
}, function(response) {
|
||||||
@ -123,7 +123,7 @@ angular.module("AdLinApp")
|
|||||||
$scope.pleaseWaitNew = true;
|
$scope.pleaseWaitNew = true;
|
||||||
$http({
|
$http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: "/api/wg/",
|
url: "api/wg/",
|
||||||
data: {}
|
data: {}
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.updateTunnelsList();
|
$scope.updateTunnelsList();
|
||||||
@ -138,7 +138,7 @@ angular.module("AdLinApp")
|
|||||||
tunnel.pleaseWaitDrop = true;
|
tunnel.pleaseWaitDrop = true;
|
||||||
$http({
|
$http({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: "/api/wg/" + tunnel.TokenText,
|
url: "api/wg/" + tunnel.TokenText,
|
||||||
data: {}
|
data: {}
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.updateTunnelsList();
|
$scope.updateTunnelsList();
|
||||||
@ -165,13 +165,13 @@ angular.module("AdLinApp")
|
|||||||
$scope.updateAssociationD = function() {
|
$scope.updateAssociationD = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/adomains/",
|
url: "api/adomains/",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.adomains = [];
|
$scope.adomains = [];
|
||||||
response.data.forEach(function(domain) {
|
response.data.forEach(function(domain) {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/adomains/" + domain,
|
url: "api/adomains/" + domain,
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
response.data.forEach(function(rr) {
|
response.data.forEach(function(rr) {
|
||||||
$scope.adomains.push(rr);
|
$scope.adomains.push(rr);
|
||||||
@ -188,7 +188,7 @@ angular.module("AdLinApp")
|
|||||||
$scope.updateDelegatedD = function() {
|
$scope.updateDelegatedD = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/ddomains/",
|
url: "api/ddomains/",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
response.data.forEach(function(domain) {
|
response.data.forEach(function(domain) {
|
||||||
$scope.ddomains = response.data;
|
$scope.ddomains = response.data;
|
||||||
@ -203,7 +203,7 @@ angular.module("AdLinApp")
|
|||||||
$scope.pleaseWaitNewAssociation = true;
|
$scope.pleaseWaitNewAssociation = true;
|
||||||
$http({
|
$http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: "/api/adomains/",
|
url: "api/adomains/",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.updateAssociationD();
|
$scope.updateAssociationD();
|
||||||
$scope.pleaseWaitNewAssociation = false;
|
$scope.pleaseWaitNewAssociation = false;
|
||||||
@ -277,7 +277,7 @@ angular.module("AdLinApp")
|
|||||||
nsrr.values = nsrr.values.join(" ");
|
nsrr.values = nsrr.values.join(" ");
|
||||||
$http({
|
$http({
|
||||||
method: (nsrr.valuesfrom !== undefined)?'PATCH':'POST',
|
method: (nsrr.valuesfrom !== undefined)?'PATCH':'POST',
|
||||||
url: "/api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
url: "api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
||||||
data: nsrr,
|
data: nsrr,
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$('#NSModal').modal('hide');
|
$('#NSModal').modal('hide');
|
||||||
@ -291,7 +291,7 @@ angular.module("AdLinApp")
|
|||||||
rr["pleaseWait" + rr.rr + "del"] = true;
|
rr["pleaseWait" + rr.rr + "del"] = true;
|
||||||
$http({
|
$http({
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
url: "/api/ddomains/" + domain + "/" + rr.rr,
|
url: "api/ddomains/" + domain + "/" + rr.rr,
|
||||||
data: rr,
|
data: rr,
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
callOnUpdateEvt();
|
callOnUpdateEvt();
|
||||||
@ -307,7 +307,7 @@ angular.module("AdLinApp")
|
|||||||
var updateNS = function() {
|
var updateNS = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/ddomains/" + $scope.domain + "/NS",
|
url: "api/ddomains/" + $scope.domain + "/NS",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.domainNS = response.data;
|
$scope.domainNS = response.data;
|
||||||
});
|
});
|
||||||
@ -320,7 +320,7 @@ angular.module("AdLinApp")
|
|||||||
var updateGLUE = function() {
|
var updateGLUE = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/ddomains/" + $scope.domain + "/GLUE",
|
url: "api/ddomains/" + $scope.domain + "/GLUE",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.domainGLUE = response.data;
|
$scope.domainGLUE = response.data;
|
||||||
});
|
});
|
||||||
@ -333,7 +333,7 @@ angular.module("AdLinApp")
|
|||||||
var updateDS = function() {
|
var updateDS = function() {
|
||||||
$http({
|
$http({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: "/api/ddomains/" + $scope.domain + "/DS",
|
url: "api/ddomains/" + $scope.domain + "/DS",
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
$scope.domainDS = response.data;
|
$scope.domainDS = response.data;
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,16 @@ var StaticDir string = "htdocs/"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Router().GET("/", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
Router().GET("/", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
http.ServeFile(w, r, path.Join(StaticDir, "index.html"))
|
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
||||||
|
})
|
||||||
|
Router().GET("/auth", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
||||||
|
})
|
||||||
|
Router().GET("/domains", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
||||||
|
})
|
||||||
|
Router().GET("/tunnels", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
||||||
})
|
})
|
||||||
Router().GET("/css/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
Router().GET("/css/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
serveStaticAsset(w, r)
|
serveStaticAsset(w, r)
|
||||||
@ -51,39 +60,6 @@ func init() {
|
|||||||
serveStaticAsset(w, r)
|
serveStaticAsset(w, r)
|
||||||
})
|
})
|
||||||
|
|
||||||
Router().GET("/maatma/", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/auth", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/domains", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/tunnels", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
http.ServeFile(w, r, path.Join(StaticDir, "maatma.html"))
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/css/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/maatma")
|
|
||||||
serveStaticAsset(w, r)
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/fonts/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/maatma")
|
|
||||||
serveStaticAsset(w, r)
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/img/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/maatma")
|
|
||||||
serveStaticAsset(w, r)
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/js/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/maatma")
|
|
||||||
serveStaticAsset(w, r)
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/views/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
r.URL.Path = strings.TrimPrefix(r.URL.Path, "/maatma")
|
|
||||||
serveStaticAsset(w, r)
|
|
||||||
})
|
|
||||||
|
|
||||||
flag.StringVar(&StaticDir, "static", StaticDir, "Directory containing static files")
|
flag.StringVar(&StaticDir, "static", StaticDir, "Directory containing static files")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,34 @@ import (
|
|||||||
//go:generate go fmt bindata.go
|
//go:generate go fmt bindata.go
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
Router().GET("/", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
||||||
|
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
||||||
|
} else {
|
||||||
|
w.Write(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Router().GET("/auth", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
||||||
|
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
||||||
|
} else {
|
||||||
|
w.Write(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Router().GET("/domains", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
||||||
|
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
||||||
|
} else {
|
||||||
|
w.Write(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Router().GET("/tunnels", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
|
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
||||||
|
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
||||||
|
} else {
|
||||||
|
w.Write(data)
|
||||||
|
}
|
||||||
|
})
|
||||||
Router().GET("/css/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
Router().GET("/css/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
w.Header().Set("Content-Type", "text/css")
|
w.Header().Set("Content-Type", "text/css")
|
||||||
if data, err := Asset(path.Join("htdocs", r.URL.Path)); err != nil {
|
if data, err := Asset(path.Join("htdocs", r.URL.Path)); err != nil {
|
||||||
@ -92,73 +120,6 @@ func init() {
|
|||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
Router().GET("/maatma/", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
|
||||||
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/auth", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
|
||||||
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/domains", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
|
||||||
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/tunnels", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
if data, err := Asset("htdocs/maatma.html"); err != nil {
|
|
||||||
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/css/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
w.Header().Set("Content-Type", "text/css")
|
|
||||||
if data, err := Asset(path.Join("htdocs", strings.TrimPrefix(r.URL.Path, "/maatma"))); err != nil {
|
|
||||||
http.NotFound(w, r)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/fonts/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
if data, err := Asset(path.Join("htdocs", strings.TrimPrefix(r.URL.Path, "/maatma"))); err != nil {
|
|
||||||
http.NotFound(w, r)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/img/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
if data, err := Asset(path.Join("htdocs", strings.TrimPrefix(r.URL.Path, "/maatma"))); err != nil {
|
|
||||||
http.NotFound(w, r)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/js/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
w.Header().Set("Content-Type", "text/javascript")
|
|
||||||
if data, err := Asset(path.Join("htdocs", strings.TrimPrefix(r.URL.Path, "/maatma"))); err != nil {
|
|
||||||
http.NotFound(w, r)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
Router().GET("/maatma/views/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
|
||||||
w.Header().Set("Content-Type", "text/html")
|
|
||||||
if data, err := Asset(path.Join("htdocs", strings.TrimPrefix(r.URL.Path, "/maatma"))); err != nil {
|
|
||||||
http.NotFound(w, r)
|
|
||||||
} else {
|
|
||||||
w.Write(data)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func sanitizeStaticOptions() error {
|
func sanitizeStaticOptions() error {
|
||||||
|
Reference in New Issue
Block a user