fixes #356 - issue where accessing a NodeBB using a different machine name

from one that it was set up with causing template data to not load, as it
was being accessed via absolute url, instead of relative url
v1.18.x
Julian Lam 12 years ago
parent 1160f39cb0
commit f08067bab2

@ -38,8 +38,8 @@ var ajaxify = {};
window.onscroll = null;
// end
var url = url.replace(/\/$/, "");
// Remove trailing slash
url = url.replace(/\/$/, "");
var hash = window.location.hash;

@ -1,8 +1,6 @@
var socket,
config,
app = {},
API_URL = null;
app = {};
(function () {
var showWelcomeMessage = false;
@ -12,8 +10,6 @@ var socket,
$.ajax({
url: RELATIVE_PATH + '/api/config',
success: function (data) {
API_URL = data.api_url;
config = data;
if(socket) {
socket.disconnect();

@ -114,13 +114,9 @@
templates.load_template = function (callback, url, template) {
var location = document.location || window.location,
rootUrl = location.protocol + '//' + (location.hostname || location.host) + (location.port ? ':' + location.port : '');
var api_url = (url === '' || url === '/') ? 'home' : url;
var tpl_url = templates.get_custom_map(api_url.split('?')[0]);
var trimmed = api_url;
api_url = (url === '' || url === '/') ? 'home' : url,
tpl_url = templates.get_custom_map(api_url.split('?')[0]),
trimmed = api_url;
if (!tpl_url) {
tpl_url = templates.getTemplateNameFromUrl(api_url);
@ -128,7 +124,6 @@
var template_data = null;
(function () {
var timestamp = new Date().getTime(); //debug
@ -155,8 +150,7 @@
}());
(function () {
jQuery.get(API_URL + api_url, function (data) {
jQuery.get(RELATIVE_PATH + '/api/' + api_url, function (data) {
if (!data) {
ajaxify.go('404');

@ -10,7 +10,7 @@ jQuery(document).ready(function () {
QUnit.init();
asyncTest( "Loading Categories", function() {
jQuery.get(config.api_url + 'home', function(data) {
jQuery.get(RELATIVE_PATH + '/api/home', function(data) {
ok( data.categories.length > 0, JSON.stringify(data.categories) );
start();

Loading…
Cancel
Save