added force-save feature, fixed log/stat send 'bug'

This commit is contained in:
That-Guy 2012-05-11 21:03:15 +02:00
parent 28fc63c5d0
commit 80a983ee32

View file

@ -520,6 +520,43 @@ td
} }
function forceJSONSave(callback)
{
// sends the 'force json save' command to the server
var data =
{
'authorize':
{
'username': settings.credentials.username,
'password': MD5(MD5(settings.credentials.password) + settings.credentials.authstring)
},
'save': 1
};
$.ajax(
{
'url': settings.server,
'data':
{
"command": JSON.stringify(data)
},
'dataType': 'jsonp',
'timeout': 10000,
'error': function()
{
console.log('forceJSONSave ERROR');
},
'success': function(d)
{
console.log('forceJSONSave returned', d);
}
});
}
function getData(callback) function getData(callback)
{ {
// this beast returns the server settings, but doesn't authorize first, // this beast returns the server settings, but doesn't authorize first,
@ -613,6 +650,9 @@ td
} }
}); });
delete data.log; // don't send the logs back to the server
delete data.statistics; // same goes for the stats
console.log('SEND', data); console.log('SEND', data);
$.ajax( $.ajax(
@ -665,23 +705,6 @@ td
//console.log('new (shinyness) object:', settings.settings); //console.log('new (shinyness) object:', settings.settings);
} }
/*
var fobj1 = {connector: 'HTTP', port: 42};
fobj1['interface'] = 'kekeksauce';
var fobj2 = {connector: 'RTMP', port: 1337};
fobj2['interface'] = 'rtmwhat';
var fobj3 = {connector: 'HTTP', port: 43};
fobj3['interface'] = 'moarmoar';
settings.settings.config.protocols = [fobj1, fobj2, fobj3];
*/
if(callback) if(callback)
{ {
callback(errorstr); callback(errorstr);
@ -888,9 +911,7 @@ settings.settings.config.protocols = [fobj1, fobj2, fobj3];
{ {
if(confirmDelete('Are you sure you want to force a JSON save?') == true) if(confirmDelete('Are you sure you want to force a JSON save?') == true)
{ {
// TODO FIXME forceJSONSave(); // :)
console.log('magie hier!'); // TODO FIXME
// /TODO /FIXME
} }
}).text( 'force save to JSON file' ) }).text( 'force save to JSON file' )
); );
@ -1267,7 +1288,7 @@ settings.settings.config.protocols = [fobj1, fobj2, fobj3];
var url = settings.settings.streams[streamname].channel.URL; var url = settings.settings.streams[streamname].channel.URL;
// TODO FIXME // TODO when embed code is done.
$('#page').append( $('<p>').text('This feature is not yet implemented.') ); $('#page').append( $('<p>').text('This feature is not yet implemented.') );
$('#page').append( $('<p>').text('The URL for this stream is ').append( $('<span>').attr('class', 'nocapitals').text(url) ) ); $('#page').append( $('<p>').text('The URL for this stream is ').append( $('<span>').attr('class', 'nocapitals').text(url) ) );
@ -1483,7 +1504,7 @@ settings.settings.config.protocols = [fobj1, fobj2, fobj3];
settings: {} settings: {}
}; };
break; break;
} // end switch :D } // end switch
//placeholder for older browsers //placeholder for older browsers
@ -1493,4 +1514,6 @@ settings.settings.config.protocols = [fobj1, fobj2, fobj3];
</script> </script>
</body>
</html> </html>