Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions htdocs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ div.container {
position: relative;
width: 40px;
height: 40px;
background: url(/images/clock-bkgnd.png) no-repeat center center;
background: url(../images/clock-bkgnd.png) no-repeat center center;
background-size: 36px 36px;
}

Expand All @@ -35,15 +35,15 @@ div.container {
}

#d_header_clock_hour {
background-image: url(/images/clock-hour.png);
background-image: url(../images/clock-hour.png);
}

#d_header_clock_minute {
background-image: url(/images/clock-minute.png);
background-image: url(../images/clock-minute.png);
}

#d_header_clock_second {
background-image: url(/images/clock-second.png);
background-image: url(../images/clock-second.png);
}

#d_tab_time {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/index-dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>Loading...</title>
<meta name="description" content="A simple distributed task scheduler and runner.">
<meta name="author" content="Joseph Huckaby">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="shortcut icon" href="favicon.ico">

<!-- BUILD: COMBINE_STYLE_START -->
<link rel="stylesheet" href="css/base.css">
Expand Down Expand Up @@ -112,8 +112,8 @@
<script src="js/pages/admin/APIKeys.js"></script>
<!-- BUILD: COMBINE_SCRIPT_END -->

<script src="/socket.io/socket.io.js"></script>
<script src="/api/app/config?callback=app.receiveConfig"></script>
<script src="socket.io/socket.io.js"></script>
<script src="api/app/config?callback=app.receiveConfig"></script>

</body>
</html>
19 changes: 10 additions & 9 deletions htdocs/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ app.extend({
// receive config from server
if (resp.code) {
app.showProgress( 1.0, "Waiting for master server..." );
setTimeout( function() { load_script( '/api/app/config?callback=app.receiveConfig' ); }, 1000 );
setTimeout( function() { load_script( 'api/app/config?callback=app.receiveConfig' ); }, 1000 );
return;
}
delete resp.code;
Expand Down Expand Up @@ -79,7 +79,7 @@ app.extend({
for (var idx = 0, len = this.preload_images.length; idx < len; idx++) {
var filename = '' + this.preload_images[idx];
var img = new Image();
img.src = '/images/'+filename;
img.src = 'images/'+filename;
}

// populate prefs for first time user
Expand Down Expand Up @@ -230,7 +230,7 @@ app.extend({
doExternalLogin: function() {
// login using external user management system
// Force API to hit current page hostname vs. master server, so login redirect URL reflects it
app.api.post( '/api/user/external_login', { cookie: document.cookie }, function(resp) {
app.api.post( 'api/user/external_login', { cookie: document.cookie }, function(resp) {
if (resp.user) {
Debug.trace("User Session Resume: " + resp.username + ": " + resp.session_id);
app.hideProgress();
Expand Down Expand Up @@ -275,16 +275,17 @@ app.extend({
this.socket.removeAllListeners();
if (this.socket.connected) this.socket.disconnect();
this.socket = null;
}

}
const path = config.subdir + "/socket.io";
var socket = this.socket = io( url, {
// forceNew: true,
transports: config.socket_io_transports || ['websocket'],
reconnection: false,
reconnectionDelay: 1000,
reconnectionDelayMax: 2000,
reconnectionAttempts: 9999,
timeout: 3000
timeout: 3000,
path:path,
} );

socket.on('connect', function() {
Expand Down Expand Up @@ -486,14 +487,14 @@ app.extend({
this.masterHostname = hostname;

if (config.web_direct_connect) {
this.base_api_url = this.proto + this.masterHostname + ':' + this.port + config.base_api_uri;
this.base_api_url = this.proto + this.masterHostname + ':' + this.port + config.subdir + config.base_api_uri;
if (!config.web_socket_use_hostnames && this.servers && this.servers[this.masterHostname] && this.servers[this.masterHostname].ip) {
// use ip instead of hostname if available
this.base_api_url = this.proto + this.servers[this.masterHostname].ip + ':' + this.port + config.base_api_uri;
this.base_api_url = this.proto + this.servers[this.masterHostname].ip + ':' + this.port + config.subdir + config.base_api_uri;
}
}
else {
this.base_api_url = this.proto + location.host + config.base_api_uri;
this.base_api_url = this.proto + location.host + config.subdir + config.base_api_uri;
}

Debug.trace("API calls now going to: " + this.base_api_url);
Expand Down
5 changes: 3 additions & 2 deletions htdocs/js/pages/JobDetails.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,15 +1057,16 @@ Class.subclass( Page.Base, "Page.JobDetails", {
$('#d_live_job_log').append(
'<pre class="log_chunk" style="color:#888">Log Watcher: Connecting to server: ' + url + '...</pre>'
);

const path = config.subdir + "/socket.io";
this.socket = io( url, {
forceNew: true,
transports: config.socket_io_transports || ['websocket'],
reconnection: true,
reconnectionDelay: 1000,
reconnectionDelayMax: 5000,
reconnectionAttempts: 9999,
timeout: 5000
timeout: 5000,
path:path
} );

this.socket.on('connect', function() {
Expand Down
8 changes: 8 additions & 0 deletions lib/api/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,25 @@ module.exports = Class.create({
return callback({ code: 'master', description: "No master server found" });
}

var subdir = this.server.config.get("subdir");
if (subdir && subdir.match(/^\/?([A-z0-9-_+]+\/?)+$/g)) {
subdir = "/" + subdir.replace(/^\/|\/$/g, '');
} else {
subdir = "";
}
var resp = {
code: 0,
version: this.server.__version,
config: Tools.mergeHashes( this.server.config.get('client'), {
debug: this.server.debug ? 1 : 0,
job_memory_max: this.server.config.get('job_memory_max'),
subdir: subdir,
base_api_uri: this.api.config.get('base_uri'),
default_privileges: this.usermgr.config.get('default_privileges'),
free_accounts: this.usermgr.config.get('free_accounts'),
external_users: this.usermgr.config.get('external_user_api') ? 1 : 0,
external_user_api: this.usermgr.config.get('external_user_api') || '',
custom_live_log_socket_url: this.server.config.get('custom_live_log_socket_url'),
Comment thread
gsahbi marked this conversation as resolved.
web_socket_use_hostnames: this.server.config.get('web_socket_use_hostnames') || 0,
web_direct_connect: this.server.config.get('web_direct_connect') || 0,
socket_io_transports: this.server.config.get('socket_io_transports') || 0
Expand Down
3 changes: 2 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ module.exports = {

// prepare to make api calls
request = cronicle.request;
api_url = server.config.get('base_app_url') + server.API.config.get('base_uri');
api_url = server.config.get('base_app_url')
+ server.config.get('subdir') + server.API.config.get('base_uri');

// cancel auto ticks, so we can send our own later
clearTimeout( server.tickTimer );
Expand Down
1 change: 1 addition & 0 deletions sample_conf/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"base_app_url": "http://localhost:3012",
"subdir": "",
"email_from": "admin@localhost",
"smtp_hostname": "localhost",
"smtp_port": 25,
Expand Down