Skip to content

Commit

Permalink
nahhh
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlaubb committed Mar 9, 2025
1 parent 3e9c76d commit 69ef102
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
5 changes: 3 additions & 2 deletions docs/gen.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
</head>
<body>
<h1>Matrix AntiCheat Key Generator</h1>
<input type="text" id="textbox" placeholder="Enter the config string (.json)">
<button onclick="generateKey()">Generate settings key</button>
<input type="text" id="textbox" placeholder="Enter the key or json string here...">
<button onclick="generateKey()" id="gen">Type something to start...</button>
<h2>Output:</h2>
<p id="output">Click the button to generate</p>
<button id="copy-btn" onclick="copyText()">Copy</button>
<button id="copy-all" onclick="copyAll()">Copy whole string</button>
<script src="./gen.js"></script>
</body>
</html>
37 changes: 36 additions & 1 deletion docs/gen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,34 @@
var output = [];
var currentPart = 1;
setInterval(() => {
const input = document.getElementById("textbox").value;
if (input.length > 0) {
if (input.startsWith("#")) {
document.getElementById("gen").innerHTML = "Split key to input-able parts";
} else if (input.startsWith("{") || input.startsWith("export default")) {
document.getElementById("gen").innerHTML = "Convert json string to key";
} else {
document.getElementById("gen").innerHTML = "Not supported XwX";
}
} else {
document.getElementById("gen").innerHTML = "Type something to start...";
}
}, 100);
function generateKey () {
let input = document.getElementById("textbox").value;
if (input.length === 0) return;
if (input.startsWith("#") && input.endsWith("#")) {
if (!/^(#[(a-zA-Z)|/]+\,[^#]+#)+$/.test(input)) {
document.getElementById("output").innerHTML = "[Failed] Error: Failed to read the key.";
return;
}
document.getElementById("textbox").value = "";
currentPart = 1;
console.log(truncateString(outputt));
output = truncateString(input);
document.getElementById("output").innerHTML = output[0];
document.getElementById("copy-btn").innerHTML = `Copy (Part 1 of ${output.length})`;
}
input = input.replace("export default", "").trim();
if (input.endsWith(";")) input = input.slice(0, -1);
if (!input.startsWith("{") || !input.endsWith("}")) {
Expand Down Expand Up @@ -29,7 +56,6 @@ function generateKey () {
document.getElementById("output").innerHTML = output[0];
document.getElementById("copy-btn").innerHTML = `Copy (Part 1 of ${output.length})`;
}

function convertJson(obj, prefix = '') {
const result = {};
for (const key in obj) {
Expand Down Expand Up @@ -60,6 +86,15 @@ function copyText() {
document.getElementById("copy-btn").innerHTML = `Copy (Part ${currentPart} of ${output.length})`;
document.getElementById("output").innerHTML = output[currentPart - 1];
}
function copyAll() {
if (output.length > 0) {
navigator.clipboard.writeText(output.join("")).then(function() {
console.log("Text copied to clipboard");
}, function(err) {
console.error("Could not copy text: ", err);
});
}
}
function truncateString(s) {
const result = [];
const regex = /#[(a-zA-Z)|/]+\,[^#]+#/g;
Expand Down

0 comments on commit 69ef102

Please sign in to comment.