Skip to content

Instantly share code, notes, and snippets.

@hello-smile6
Created December 28, 2021 06:08
Show Gist options
  • Save hello-smile6/300233990d1789534ed93053c5137e1a to your computer and use it in GitHub Desktop.
Save hello-smile6/300233990d1789534ed93053c5137e1a to your computer and use it in GitHub Desktop.
Manual TurboWarp Cloud Vars Update
<!DOCTYPE html>
<html>
<head>
<title>TurboWarp Client</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/MystPi/dreamcss/src/dream.css" />
</head>
<body>
<h1>TurboWarp Client</h1>
<input type="number" id="project-id" />
<button id="start">
Start
</button>
<br/>
<section id="var-cpl" style="display: none">
<h2>Set variable</h2>
<input type="text" id="var-name" placeholder="Variable name" />
<input type="number" id="var-value" placeholder="Variable value" />
<button id="set-var">
Set variable
</button>
</section>
<pre id="log">
</pre>
<script>
document.getElementById("start").addEventListener("click",function() {
try {
var socket=new WebSocket("wss://clouddata.turbowarp.org/");
window.socket=socket;
var log=document.getElementById("log");
log.textContent+="\nInitializing.";
socket.addEventListener("open",function() {
document.getElementById("project-id").disabled=true;
log.textContent+="\nConnected to server.";
document.getElementById("var-cpl").style.display="block";
socket.send(JSON.stringify({method: "handshake",user: "9pfs",project_id: document.getElementById("project-id").value}));
});
socket.addEventListener("message",function(e) {
log.textContent+="\n".concat(e.data);
});
socket.addEventListener("close",function(e) {
document.getElementById("project-id").disabled=false;
window.socket=null;
log.textContent+="\n".concat("Closed connection.\nCode: ",e.code,"\nReason: ",e.reason);
document.getElementById("var-cpl").style.display="none";
});
}
catch(e) {
alert(e.stack);
}
});
document.getElementById("set-var").addEventListener("click",function() {
socket.send(JSON.stringify({
method: "set",
user: "example",
project_id: document.getElementById("project-id").value,
name: "\u2601 ".concat(document.getElementById("var-name").value),
value: document.getElementById("var-value").value.toString()
}));
});
</script>
</body>
</html>
@hello-smile6
Copy link
Author

@s-Pixels How is this?

@webdev03
Copy link

hMmM

@hello-smile6
Copy link
Author

@webdev03 I made it last night because I was bored.

@hello-smile6
Copy link
Author

@webdev03
Copy link

I see you

@hello-smile6
Copy link
Author

@webdev03 Same

@The-Cloud-Dev
Copy link

This literally only changes cloud vars on turbowarp. How is better than s2py?!

@hello-smile6
Copy link
Author

@The-Cloud-Dev It works in the browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment