diff --git a/pkg/api/api.go b/pkg/api/api.go index 9c75cbc5add6e5d8304dc0b0655d761fcef9b04a..d3c178dec53fdfb46ac3340c67c82282a65232f0 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -552,3 +552,9 @@ func DataExport(c *gin.Context) { badRequest(c, err) } } + +func GetDebugMode(c *gin.Context) { + successResponse(c, gin.H{ + "debug_mode": command.Opts.Debug, + }) +} diff --git a/pkg/api/routes.go b/pkg/api/routes.go index c69789b0607b5ca619e59190331659ddaf47055f..2f0798b959c52045de76178b347c5e117d3a8615 100644 --- a/pkg/api/routes.go +++ b/pkg/api/routes.go @@ -55,4 +55,5 @@ func SetupRoutes(router *gin.Engine) { api.GET("/history", GetHistory) api.GET("/bookmarks", GetBookmarks) api.GET("/export", DataExport) + api.GET("/debugmode", GetDebugMode) } diff --git a/static/js/app.js b/static/js/app.js index 31dddd5714c4790c328438ed3808f5f696c7283a..cfd6ea8d729499c8de6496374d21bd2847790aa7 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1789,7 +1789,6 @@ function goAuthorize(data, cb) { } var isAuthentic = false; - function handleMessage(e) { if (!isAuthentic) { goAuthorize(e.data, function () { @@ -1801,6 +1800,11 @@ function handleMessage(e) { } $(document).ready(function () { - //start(); - window.addEventListener("message", handleMessage); + apiCall("get", "/debugmode", {}, function (resp) { + if (resp.error || !resp.debug_mode) { + window.addEventListener("message", handleMessage); + } else { + start(); + } + }); });