Minor standardization

pull/235/head
ElementalAlchemist 4 years ago committed by Mike Lang
parent ae0e6d0385
commit be025e263f

@ -1,142 +1,150 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-US"> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Thrimbletrimmer Goes Forth</title>
<title>Thrimbletrimmer Goes Forth</title> <meta name="google-signin-client_id" content="345276493482-r84m2giavk10glnmqna0lbq8e1hdaus0.apps.googleusercontent.com">
<meta name="description" content=""> <script src="https://apis.google.com/js/platform.js?onload=onGLoad" async defer></script>
<script type="text/javascript">
var user;
function onSignIn(googleUser) {
user = googleUser;
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
console.log('ID Token: ' + googleUser.getAuthResponse().id_token);
}
function signOut() {
user = null;
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
<style type="text/css">
#google-sign-in {
margin-bottom: 10px;
}
<meta name="google-signin-client_id" content="345276493482-r84m2giavk10glnmqna0lbq8e1hdaus0.apps.googleusercontent.com"> #output-zone {
<script src="https://apis.google.com/js/platform.js?onload=onGLoad" async defer></script> border-bottom: 1px solid #000;
padding-bottom: 2px;
}
</style>
</head> </head>
<body> <body>
<!-- https://developers.google.com/identity/sign-in/web/sign-in --> <div id="google-sign-in">
<div class="g-signin2" data-onsuccess="onSignIn"></div> <!-- https://developers.google.com/identity/sign-in/web/sign-in -->
<a href="#" onclick="signOut();">Sign out</a> <div class="g-signin2" data-onsuccess="onSignIn"></div>
<a href="#" onclick="signOut();">Sign out</a>
<script> </div>
var user; <div>
function onSignIn(googleUser) { <input id="server" value="" placeholder="Server name" />
user = googleUser; <input id="rowId" value="04860aa4-d6a5-11e9-9d36-2a2ae2dbcce4" placeholder="Row ID" />
var profile = googleUser.getBasicProfile(); <input type="button" onclick="getRow()" value="Get Row"/>
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead. <a href="/thrimshim">All Rows</a>
console.log('Name: ' + profile.getName()); <div id="output-zone">
console.log('Image URL: ' + profile.getImageUrl()); <h3>Row Output</h3>
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present. <div id="rowdump"></div>
console.log('ID Token: ' + googleUser.getAuthResponse().id_token); </div>
} </div>
function signOut() { <div>
user = null; <br/>
var auth2 = gapi.auth2.getAuthInstance(); <input type="button" onclick="testAuth()" value="Test Auth" /><br />
auth2.signOut().then(function () { <input type="button" onclick="testSubmit()" value="Test Submit" /><br />
console.log('User signed out.'); <input type="button" onclick="testManualLink()" value="Test Manual Link" /><input id="manualLink" value="google.ca"/><br />
}); <input type="button" onclick="testReset()" value="Test Reset" /><br />
} </div>
</script> <script>
<div> function getRow() {
<br/> fetch(document.getElementById("server").value+"/thrimshim/"+document.getElementById("rowId").value).then(function (response) {
<input id="server" value="" /> response.text().then(function(data) {
<input id="rowId" value="04860aa4-d6a5-11e9-9d36-2a2ae2dbcce4" /> document.getElementById("rowdump").innerText = data;
<input type="button" onclick="getRow()" value="Get Row"/> });
<a href="/thrimshim">All Rows</a> });
<br/> }
<textarea id="rowdump"></textarea>
</div>
<div>
<br/>
<input type="button" onclick="testAuth()" value="Test Auth" /><br />
<input type="button" onclick="testSubmit()" value="Test Submit" /><br />
<input type="button" onclick="testManualLink()" value="Test Manual Link" /><input id="manualLink" value="google.ca"/><br />
<input type="button" onclick="testReset()" value="Test Reset" /><br />
</div>
<script>
function getRow() {
fetch(document.getElementById("server").value+"/thrimshim/"+document.getElementById("rowId").value).then(function (response) {
response.text().then(function(data) {
document.getElementById("rowdump").value=data;
});
});
}
function testAuth() { function testAuth() {
fetch(document.getElementById("server").value+"/thrimshim/auth-test", { fetch(document.getElementById("server").value+"/thrimshim/auth-test", {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
test: "123 Hello World?", test: "123 Hello World?",
token: user.getAuthResponse().id_token token: user.getAuthResponse().id_token
}) })
}).then(function(response) { }).then(function(response) {
if (response.status !== 200) { if (response.status !== 200) {
console.log('Looks like there was a problem. Status Code: ' + response.status); console.log('Looks like there was a problem. Status Code: ' + response.status);
return; return;
} }
// Examine the text in the response // Examine the text in the response
response.json().then(function(data) { response.json().then(function(data) {
console.log(data); console.log(data);
}); });
}).catch(function(err) { }).catch(function(err) {
console.log('Fetch Error :-S', err); console.log('Fetch Error :-S', err);
}); });
} }
function testSubmit() { function testSubmit() {
var wubData = { var wubData = {
allow_holes: "true", allow_holes: "true",
experimental: "true", experimental: "true",
state: "EDITED", state: "EDITED",
token: user.getAuthResponse().id_token, token: user.getAuthResponse().id_token,
upload_location: "YouTube", upload_location: "YouTube",
uploader_whitelist: null, uploader_whitelist: null,
video_channel: "rpglimitbreak", video_channel: "rpglimitbreak",
video_description: "Test Description", video_description: "Test Description",
video_end: "2019-09-14T03:54:28.546", video_end: "2019-09-14T03:54:28.546",
video_quality: "source", video_quality: "source",
video_start: "2019-09-14T03:48:06.546", video_start: "2019-09-14T03:48:06.546",
video_title: "Test" video_title: "Test"
} }
//Submit to thrimshim //Submit to thrimshim
fetch(document.getElementById("server").value+"/thrimshim/"+document.getElementById("rowId").value, { fetch(document.getElementById("server").value+"/thrimshim/"+document.getElementById("rowId").value, {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(wubData) body: JSON.stringify(wubData)
}).then(data => console.log(data)); }).then(data => console.log(data));
} }
function testManualLink() { function testManualLink() {
fetch(document.getElementById("server").value+"/thrimshim/manual-link/"+document.getElementById("rowId").value, { fetch(document.getElementById("server").value+"/thrimshim/manual-link/"+document.getElementById("rowId").value, {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify({
link: document.getElementById("manualLink").value, link: document.getElementById("manualLink").value,
token: user.getAuthResponse().id_token token: user.getAuthResponse().id_token
}) })
}).then(data => console.log(data)); }).then(data => console.log(data));
} }
function testReset() { function testReset() {
fetch(document.getElementById("server").value+"/thrimshim/reset/"+document.getElementById("rowId").value, { fetch(document.getElementById("server").value+"/thrimshim/reset/"+document.getElementById("rowId").value, {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({token: user.getAuthResponse().id_token}) body: JSON.stringify({token: user.getAuthResponse().id_token})
}).then(data => console.log(data)); }).then(data => console.log(data));
} }
</script> </script>
</body> </body>
</html> </html>

Loading…
Cancel
Save