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() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/auth",
|
||||
url: "api/auth",
|
||||
}).then(function(response) {
|
||||
$rootScope.isLogged = response.data;
|
||||
$rootScope.student = response.data;
|
||||
@ -51,7 +51,7 @@ angular.module("AdLinApp")
|
||||
$rootScope.disconnectCurrentUser = function() {
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "/api/auth/logout"
|
||||
url: "api/auth/logout"
|
||||
}).then(function(response) {
|
||||
$rootScope.isLogged = false;
|
||||
$rootScope.student = null;
|
||||
@ -62,7 +62,7 @@ angular.module("AdLinApp")
|
||||
.controller("ProgressionController", function($scope, $interval, $http) {
|
||||
$scope.mychallenges = {};
|
||||
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
|
||||
});
|
||||
}
|
||||
@ -80,7 +80,7 @@ angular.module("AdLinApp")
|
||||
$scope.pleaseWait = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "/api/auth",
|
||||
url: "api/auth",
|
||||
data: $scope.auth
|
||||
}).then(function(response) {
|
||||
$scope.pleaseWait = false;
|
||||
@ -98,7 +98,7 @@ angular.module("AdLinApp")
|
||||
$scope.updateTunnelInfo = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/wginfo",
|
||||
url: "api/wginfo",
|
||||
}).then(function(response) {
|
||||
$scope.wginfo = response.data;
|
||||
});
|
||||
@ -108,7 +108,7 @@ angular.module("AdLinApp")
|
||||
$scope.updateTunnelsList = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/wg/",
|
||||
url: "api/wg/",
|
||||
}).then(function(response) {
|
||||
$scope.tunnels = response.data;
|
||||
}, function(response) {
|
||||
@ -123,7 +123,7 @@ angular.module("AdLinApp")
|
||||
$scope.pleaseWaitNew = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "/api/wg/",
|
||||
url: "api/wg/",
|
||||
data: {}
|
||||
}).then(function(response) {
|
||||
$scope.updateTunnelsList();
|
||||
@ -138,7 +138,7 @@ angular.module("AdLinApp")
|
||||
tunnel.pleaseWaitDrop = true;
|
||||
$http({
|
||||
method: 'DELETE',
|
||||
url: "/api/wg/" + tunnel.TokenText,
|
||||
url: "api/wg/" + tunnel.TokenText,
|
||||
data: {}
|
||||
}).then(function(response) {
|
||||
$scope.updateTunnelsList();
|
||||
@ -165,13 +165,13 @@ angular.module("AdLinApp")
|
||||
$scope.updateAssociationD = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/adomains/",
|
||||
url: "api/adomains/",
|
||||
}).then(function(response) {
|
||||
$scope.adomains = [];
|
||||
response.data.forEach(function(domain) {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/adomains/" + domain,
|
||||
url: "api/adomains/" + domain,
|
||||
}).then(function(response) {
|
||||
response.data.forEach(function(rr) {
|
||||
$scope.adomains.push(rr);
|
||||
@ -188,7 +188,7 @@ angular.module("AdLinApp")
|
||||
$scope.updateDelegatedD = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/",
|
||||
url: "api/ddomains/",
|
||||
}).then(function(response) {
|
||||
response.data.forEach(function(domain) {
|
||||
$scope.ddomains = response.data;
|
||||
@ -203,7 +203,7 @@ angular.module("AdLinApp")
|
||||
$scope.pleaseWaitNewAssociation = true;
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: "/api/adomains/",
|
||||
url: "api/adomains/",
|
||||
}).then(function(response) {
|
||||
$scope.updateAssociationD();
|
||||
$scope.pleaseWaitNewAssociation = false;
|
||||
@ -277,7 +277,7 @@ angular.module("AdLinApp")
|
||||
nsrr.values = nsrr.values.join(" ");
|
||||
$http({
|
||||
method: (nsrr.valuesfrom !== undefined)?'PATCH':'POST',
|
||||
url: "/api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
||||
url: "api/ddomains/" + nsrr.domain + "/" + nsrr.rr,
|
||||
data: nsrr,
|
||||
}).then(function(response) {
|
||||
$('#NSModal').modal('hide');
|
||||
@ -291,7 +291,7 @@ angular.module("AdLinApp")
|
||||
rr["pleaseWait" + rr.rr + "del"] = true;
|
||||
$http({
|
||||
method: 'DELETE',
|
||||
url: "/api/ddomains/" + domain + "/" + rr.rr,
|
||||
url: "api/ddomains/" + domain + "/" + rr.rr,
|
||||
data: rr,
|
||||
}).then(function(response) {
|
||||
callOnUpdateEvt();
|
||||
@ -307,7 +307,7 @@ angular.module("AdLinApp")
|
||||
var updateNS = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/NS",
|
||||
url: "api/ddomains/" + $scope.domain + "/NS",
|
||||
}).then(function(response) {
|
||||
$scope.domainNS = response.data;
|
||||
});
|
||||
@ -320,7 +320,7 @@ angular.module("AdLinApp")
|
||||
var updateGLUE = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/GLUE",
|
||||
url: "api/ddomains/" + $scope.domain + "/GLUE",
|
||||
}).then(function(response) {
|
||||
$scope.domainGLUE = response.data;
|
||||
});
|
||||
@ -333,7 +333,7 @@ angular.module("AdLinApp")
|
||||
var updateDS = function() {
|
||||
$http({
|
||||
method: 'GET',
|
||||
url: "/api/ddomains/" + $scope.domain + "/DS",
|
||||
url: "api/ddomains/" + $scope.domain + "/DS",
|
||||
}).then(function(response) {
|
||||
$scope.domainDS = response.data;
|
||||
});
|
||||
|
@ -18,7 +18,16 @@ var StaticDir string = "htdocs/"
|
||||
|
||||
func init() {
|
||||
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) {
|
||||
serveStaticAsset(w, r)
|
||||
@ -51,39 +60,6 @@ func init() {
|
||||
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")
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,34 @@ import (
|
||||
//go:generate go fmt bindata.go
|
||||
|
||||
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) {
|
||||
w.Header().Set("Content-Type", "text/css")
|
||||
if data, err := Asset(path.Join("htdocs", r.URL.Path)); err != nil {
|
||||
@ -92,73 +120,6 @@ func init() {
|
||||
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 {
|
||||
|
Reference in New Issue
Block a user