185 lines
6.7 KiB
HTML
185 lines
6.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>CyTube - Administration</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="">
|
|
<meta name="author" content="Calvin 'calzoneman' Montgomery">
|
|
|
|
<link href="./assets/css/bootstrap.css" rel="stylesheet">
|
|
<link href="./assets/css/ytsync.css" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
}
|
|
.loginform {
|
|
margin: 100px auto 20px;
|
|
padding: 19px 29px 29px;
|
|
border-radius: 5px 5px 5px 5px;
|
|
border: 1px solid #dedede;
|
|
max-width: 300px;
|
|
}
|
|
|
|
#log {
|
|
max-height: 500px;
|
|
overflow-y: scroll;
|
|
}
|
|
</style>
|
|
<link href="./assets/css/bootstrap-responsive.css" rel="stylesheet">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="wrapper">
|
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
<div class="navbar-inner">
|
|
<div class="container">
|
|
<a class="brand" href="index.html">CyTube</a>
|
|
<div class="">
|
|
<ul class="nav">
|
|
<li class="active"><a href="index.html">Home</a></li>
|
|
<li><a href="help.html">Help</a></li>
|
|
<li><a href="javascript:void(0)" id="optlink">Options</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div class="row">
|
|
<div id="loggedin" class="span6" style="display: none;">
|
|
<h3 id="welcome"></h3>
|
|
</div>
|
|
<form class="form-horizontal loginform" action="javascript:void(0);">
|
|
<div class="control-group">
|
|
<input id="name" type="text" placeholder="Username" class="input-block-level">
|
|
</div>
|
|
<div class="control-group">
|
|
<input id="pw" type="password" placeholder="Password" class="input-block-level">
|
|
</div>
|
|
<button id="login" class="btn btn-block">Authenticate</button>
|
|
</form>
|
|
</div>
|
|
<div class="row">
|
|
<div class="span8">
|
|
<h3>Log Viewer</h3>
|
|
<form class="form-inline" action="javascript:void(0);">
|
|
<button id="syslog" class="btn">Syslog</button>
|
|
<button id="errlog" class="btn">Error log</button>
|
|
<div class="input-append">
|
|
<input type="text" id="channame" placeholder="Channel Name">
|
|
<button class="btn" id="chanlog">Channel log</button>
|
|
</div>
|
|
</form>
|
|
<pre id="log"></pre>
|
|
</div>
|
|
</div>
|
|
</div> <!-- /container -->
|
|
<div class="push"></div>
|
|
<div id="sitefooter">
|
|
</div>
|
|
</div>
|
|
<div id="footer">
|
|
<p class="muted">
|
|
CyTube Software Copyright © 2013 Calvin Montgomery · Available for free on <a href="http://github.com/calzoneman/sync">GitHub</a> ·
|
|
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=5Y7PUVVGVSEWG&lc=US&item_name=CyTube¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted">Donate</a>
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<!-- Third party -->
|
|
<script src="./assets/js/jquery.js"></script>
|
|
<script src="./assets/js/bootstrap.js"></script>
|
|
<script src="./assets/js/bootstrap-transition.js"></script>
|
|
<script src="./assets/js/bootstrap-modal.js"></script>
|
|
|
|
<!-- Mine -->
|
|
<script src="./assets/js/iourl.js"></script>
|
|
<script type="text/javascript">
|
|
var host = document.location+"";
|
|
host = host.replace("http://", "");
|
|
if(host.indexOf("/") != -1)
|
|
host = host.substring(0, host.indexOf("/"));
|
|
host = "http://" + host;
|
|
var session = readCookie("sync_session") || "";
|
|
var uname = readCookie("sync_uname") || "";
|
|
var p = "";
|
|
if(uname && session) {
|
|
$.getJSON(IO_URL+"/api/json/login?name="+uname+"&session="+session+"&callback=?", function(data) {
|
|
if(data.success) {
|
|
$(".loginform").remove();
|
|
createCookie("sync_uname", uname, 7);
|
|
createCookie("sync_session", session, 7);
|
|
p = "name=" + uname + "&session=" + session;
|
|
}
|
|
});
|
|
}
|
|
var q = "";
|
|
$("#login").click(function() {
|
|
uname = $("#name").val();
|
|
q = "name=" + $("#name").val() + "&pw=" + $("#pw").val();
|
|
$.getJSON(IO_URL+"/api/json/login?"+q+"&callback=?", function(data) {
|
|
console.log(data);
|
|
if(data.success) {
|
|
$(".loginform").remove();
|
|
session = data.session;
|
|
createCookie("sync_uname", uname, 7);
|
|
createCookie("sync_session", session, 7);
|
|
p = "name=" + uname + "&session=" + session;
|
|
}
|
|
});
|
|
});
|
|
function getSyslog() {
|
|
$.ajax(IO_URL+"/api/plain/readlog?type=sys&"+p).done(function(data) {
|
|
$("#log").text(data);
|
|
});
|
|
}
|
|
$("#syslog").click(getSyslog);
|
|
function getErrlog() {
|
|
$.ajax(IO_URL+"/api/plain/readlog?type=err&"+p).done(function(data) {
|
|
$("#log").text(data);
|
|
});
|
|
}
|
|
$("#errlog").click(getErrlog);
|
|
function getChanlog() {
|
|
var chan = $("#channame").val();
|
|
$.ajax(IO_URL+"/api/plain/readlog?type=channel&channel="+chan+"&"+p).done(function(data) {
|
|
$("#log").text(data);
|
|
});
|
|
}
|
|
$("#chanlog").click(getChanlog);
|
|
$("#channame").keydown(function(ev) {
|
|
if(ev.keyCode == 13) {
|
|
getChanlog();
|
|
}
|
|
});
|
|
function createCookie(name,value,days) {
|
|
if (days) {
|
|
var date = new Date();
|
|
date.setTime(date.getTime()+(days*24*60*60*1000));
|
|
var expires = "; expires="+date.toGMTString();
|
|
}
|
|
else var expires = "";
|
|
document.cookie = name+"="+value+expires+"; path=/";
|
|
}
|
|
|
|
function readCookie(name) {
|
|
var nameEQ = name + "=";
|
|
var ca = document.cookie.split(";");
|
|
for(var i=0;i < ca.length;i++) {
|
|
var c = ca[i];
|
|
while (c.charAt(0)==" ") c = c.substring(1,c.length);
|
|
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function eraseCookie(name) {
|
|
createCookie(name,"",-1);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|