Added initial api to allow clientside code to query serverside configuration
Этот коммит содержится в:
@@ -40,6 +40,7 @@ func InitApi() {
|
|||||||
InitWebSocket(r)
|
InitWebSocket(r)
|
||||||
InitFile(r)
|
InitFile(r)
|
||||||
InitCommand(r)
|
InitCommand(r)
|
||||||
|
InitConfig(r)
|
||||||
|
|
||||||
templatesDir := utils.FindDir("api/templates")
|
templatesDir := utils.FindDir("api/templates")
|
||||||
l4g.Debug("Parsing server templates at %v", templatesDir)
|
l4g.Debug("Parsing server templates at %v", templatesDir)
|
||||||
|
|||||||
23
api/config.go
Обычный файл
23
api/config.go
Обычный файл
@@ -0,0 +1,23 @@
|
|||||||
|
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
|
||||||
|
// See License.txt for license information.
|
||||||
|
|
||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
l4g "code.google.com/p/log4go"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/mattermost/platform/utils"
|
||||||
|
"net/http"
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitConfig(r *mux.Router) {
|
||||||
|
l4g.Debug("Initializing config api routes")
|
||||||
|
|
||||||
|
sr := r.PathPrefix("/config").Subrouter()
|
||||||
|
sr.Handle("/get/bypass_email", ApiAppHandler(getBypassEmail)).Methods("GET")
|
||||||
|
}
|
||||||
|
|
||||||
|
func getBypassEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Write([]byte(strconv.FormatBool(utils.Cfg.EmailSettings.ByPassEmail)))
|
||||||
|
}
|
||||||
@@ -849,3 +849,24 @@ module.exports.updateValetFeature = function(data, success, error) {
|
|||||||
|
|
||||||
module.exports.track('api', 'api_teams_update_valet_feature');
|
module.exports.track('api', 'api_teams_update_valet_feature');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.isEmailEnabledSynchronous = function() {
|
||||||
|
var enabled = false;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
async: false,
|
||||||
|
url: '/api/v1/config/get/bypass_email',
|
||||||
|
dataType: 'json',
|
||||||
|
type: 'GET',
|
||||||
|
success: function(value) {
|
||||||
|
enabled = !value;
|
||||||
|
},
|
||||||
|
error: function(xhr, status, err) {
|
||||||
|
if (status != 200) {
|
||||||
|
handleError("isEmailEnabled", xhr, status, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return enabled;
|
||||||
|
};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user