frontend: prefix cdn and origin with commento

This commit is contained in:
Adhityaa 2018-06-05 15:31:14 +05:30
parent ee65be7bac
commit d4f617a703
9 changed files with 14 additions and 14 deletions

View File

@ -46,8 +46,8 @@ func initStaticRouter(router *mux.Router) error {
prefix := "" prefix := ""
if dir == "js" { if dir == "js" {
prefix = "window.origin='" + os.Getenv("ORIGIN") + "';\n" prefix = "window.commento_origin='" + os.Getenv("ORIGIN") + "';\n"
prefix += "window.cdn='" + os.Getenv("CDN_PREFIX") + "';\n" prefix += "window.commento_cdn='" + os.Getenv("CDN_PREFIX") + "';\n"
} }
asset[p] = prefix + string(contents); asset[p] = prefix + string(contents);

View File

@ -42,7 +42,7 @@
} }
global.buttonDisable("#add-site-button"); global.buttonDisable("#add-site-button");
global.post(global.origin + "/api/domain/new", json, function(resp) { global.post(global.commento_origin + "/api/domain/new", json, function(resp) {
global.buttonEnable("#add-site-button"); global.buttonEnable("#add-site-button");
$("#new-domain-name").val(""); $("#new-domain-name").val("");
@ -69,7 +69,7 @@
session: global.cookieGet("session"), session: global.cookieGet("session"),
}; };
global.post(global.origin + "/api/domain/list", json, function(resp) { global.post(global.commento_origin + "/api/domain/list", json, function(resp) {
if (!resp.success) { if (!resp.success) {
global.globalErrorShow(resp.message); global.globalErrorShow(resp.message);
return; return;
@ -111,7 +111,7 @@
domain: domain, domain: domain,
}; };
global.post(global.origin + "/api/domain/update", json, function(resp) { global.post(global.commento_origin + "/api/domain/update", json, function(resp) {
if (callback !== undefined) if (callback !== undefined)
callback(resp.success); callback(resp.success);
@ -130,7 +130,7 @@
domain: domain, domain: domain,
}; };
global.post(global.origin + "/api/domain/delete", json, function(resp) { global.post(global.commento_origin + "/api/domain/delete", json, function(resp) {
if (!resp.success) { if (!resp.success) {
global.globalErrorShow(resp.message); global.globalErrorShow(resp.message);
return; return;

View File

@ -18,7 +18,7 @@
} }
global.buttonDisable("#disqus-import-button"); global.buttonDisable("#disqus-import-button");
global.post(global.origin + "/api/import/disqus", json, function(resp) { global.post(global.commento_origin + "/api/import/disqus", json, function(resp) {
global.buttonEnable("#disqus-import-button"); global.buttonEnable("#disqus-import-button");
if (!resp.success) { if (!resp.success) {

View File

@ -6,7 +6,7 @@
var html = '' + var html = '' +
'<div id="commento"></div>\n' + '<div id="commento"></div>\n' +
'<script src="' + window.cdn + '/js/commento.js"><\/script>\n' + '<script src="' + window.commento_cdn + '/js/commento.js"><\/script>\n' +
''; '';
$("#code-div").text(html); $("#code-div").text(html);

View File

@ -29,7 +29,7 @@
if (idx == -1) { if (idx == -1) {
data.domains[data.cd].moderators.push({"email": email, "timeAgo": "just now"}); data.domains[data.cd].moderators.push({"email": email, "timeAgo": "just now"});
global.buttonDisable("#new-mod-button"); global.buttonDisable("#new-mod-button");
global.post(global.origin + "/api/domain/moderator/new", json, function(resp) { global.post(global.commento_origin + "/api/domain/moderator/new", json, function(resp) {
global.buttonEnable("#new-mod-button"); global.buttonEnable("#new-mod-button");
if (!resp.success) { if (!resp.success) {
@ -68,7 +68,7 @@
if (idx != -1) { if (idx != -1) {
data.domains[data.cd].moderators.splice(idx, 1); data.domains[data.cd].moderators.splice(idx, 1);
global.post(global.origin + "/api/domain/moderator/delete", json, function(resp) { global.post(global.commento_origin + "/api/domain/moderator/delete", json, function(resp) {
if (!resp.success) { if (!resp.success) {
global.globalErrorShow(resp.message); global.globalErrorShow(resp.message);
return return

View File

@ -43,7 +43,7 @@
} }
$(".view").hide(); $(".view").hide();
post(global.origin + "/api/domain/statistics", json, function(resp) { post(global.commento_origin + "/api/domain/statistics", json, function(resp) {
$("#statistics-view").show(); $("#statistics-view").show();
if (!resp.success) { if (!resp.success) {

View File

@ -57,7 +57,7 @@
}; };
global.buttonDisable("#login-button"); global.buttonDisable("#login-button");
global.post(global.origin + "/api/owner/login", json, function(resp) { global.post(global.commento_origin + "/api/owner/login", json, function(resp) {
global.buttonEnable("#login-button"); global.buttonEnable("#login-button");
if (!resp.success) { if (!resp.success) {

View File

@ -6,7 +6,7 @@
"session": global.cookieGet("session"), "session": global.cookieGet("session"),
}; };
global.post(global.origin + "/api/owner/self", json, function(resp) { global.post(global.commento_origin + "/api/owner/self", json, function(resp) {
if (!resp.success || !resp.loggedIn) { if (!resp.success || !resp.loggedIn) {
document.location = "/login"; document.location = "/login";
return; return;

View File

@ -25,7 +25,7 @@
}; };
global.buttonDisable("#signup-button"); global.buttonDisable("#signup-button");
post(global.origin + "/api/owner/new", json, function(resp) { post(global.commento_origin + "/api/owner/new", json, function(resp) {
global.buttonEnable("#signup-button") global.buttonEnable("#signup-button")
if (!resp.success) { if (!resp.success) {