Archived
1
0

alter UI & fix editor bug

This commit is contained in:
Snipcola 2024-04-13 21:42:59 +01:00
parent 6a8a4e2331
commit bcae7c84bd
No known key found for this signature in database
GPG Key ID: 82054D886DEA0E69
4 changed files with 117 additions and 65 deletions
src-tauri
src
assets
scripts
styles
index.html

@ -23,8 +23,8 @@
"title": "KrampUI",
"minWidth": 400,
"minHeight": 200,
"width": 650,
"height": 375,
"width": 700,
"height": 400,
"resizable": true,
"maximizable": true,
"alwaysOnTop": true,

@ -1,7 +1,7 @@
const { invoke } = window.__TAURI__.tauri;
const { open, Command } = window.__TAURI__.shell;
const { appWindow, LogicalSize } = window.__TAURI__.window;
const { getVersion } = window.__TAURI__.app;
const { getName, getVersion } = window.__TAURI__.app;
const process = window.__TAURI__.process;
const dialog = window.__TAURI__.dialog;
const event = window.__TAURI__.event;
@ -10,11 +10,16 @@ const fs = window.__TAURI__.fs;
require.config({ paths: { "vs": "./assets/external/monaco" }});
let debug = false;
let exploitIndicator, exploitTabs, exploitEditor, exploitScripts, exploitScriptsSearch, exploitScriptsFolder;
let editor, editorGetText, editorSetText, editorSetScroll;
let exploitInject, exploitExecute, exploitImport, exploitExport, exploitClear, exploitKill, exploitFolder;
let connected, prevActive, editorReady, tabs, unsavedTabData, injecting, dataDirectory;
let settings, version, wsPort;
let settings, title, version, wsPort;
function alert(message, title) {
dialog.message(message, title || (debug ? `${title} [DEV]` : title));
}
async function log(message, type = "info") {
await invoke("log", { message, type });
@ -167,14 +172,14 @@ async function getSettings() {
autoInject: json.autoInject,
topMost: json.topMost,
keyToggle: json.keyToggle,
editorFontSize: json.editorFontSize || 12
editorFontSize: json.editorFontSize || 14
};
else {
const settings = {
autoInject: false,
topMost: true,
keyToggle: false,
editorFontSize: 12
editorFontSize: 14
};
await setSettings(settings);
@ -199,8 +204,8 @@ async function getWindowDimensions() {
};
else {
const windowDimensions = {
width: 650,
height: 375
width: 700,
height: 400
};
await setWindowDimensions(windowDimensions);
@ -271,7 +276,7 @@ async function injectAutoExec() {
task.spawn(codeToRun)
else
task.spawn(function()
error("[KrampUI] Execution failed, check for syntax errors.")
error("[${debug ? `${title} (DEV)` : title}] Execution failed, check for syntax errors.")
end)
end
end
@ -290,7 +295,7 @@ async function injectAutoExec() {
end
`;
await writeFile("autoexec/__krampui", text.replace(/(--.*$|\/\*[\s\S]*?\*\/)/gm, "").replace(/\s+/g, " ").trim());
await writeFile(`autoexec/__${title?.toLowerCase()}`, text.replace(/(--.*$|\/\*[\s\S]*?\*\/)/gm, "").replace(/\s+/g, " ").trim());
}
function randomString(length) {
@ -1461,7 +1466,7 @@ async function inject(autoInject) {
const errors = ["error:", "redownload", "create a ticket", "make a ticket", "cannot find user", "mismatch", "out of date", "failed to", "no active subscription"];
if (errors.some((s) => text.toLowerCase().includes(s)) && !text.toLowerCase().endsWith(":")) {
alert(`[Ro-Exec] ${text}`);
alert(text, "Ro-Exec Loader");
done();
} else {
exploitInject.classList.add("disabled");
@ -1633,19 +1638,18 @@ function setupEditor(editorFontSize) {
{ token: "string", foreground: "adf195" }
],
colors: {
"editor.background": "#191c29",
"editor.foreground": "#c6cff3",
"list.hoverBackground": "#2f354e",
"editor.selectionBackground": "#282d42",
"editorSuggestWidget.background": "#282d42",
"editorSuggestWidget.selectedBackground": "#2f354e",
"editorSuggestWidget.highlightForeground": "#c6cff3",
"editorSuggestWidget.border": "#2f354e",
"editorOverviewRuler.border": "#2f354e",
"editor.lineHighlightBackground": "#1d2130",
"editorCursor.foreground": "#c6cff3",
"editor.selectionHighlightBorder": "#282d42",
"editorGutter.background": "#171a26"
"editor.background": "#191a1e",
"editor.foreground": "#aaabad",
"list.hoverBackground": "#2a2c32",
"editor.selectionBackground": "#35373b",
"editorSuggestWidget.background": "#35373b",
"editorSuggestWidget.selectedBackground": "#2a2c32",
"editorSuggestWidget.highlightForeground": "#aaabad",
"editorSuggestWidget.border": "#2a2c32",
"editorOverviewRuler.border": "#2a2c32",
"editor.lineHighlightBackground": "#1d1e23",
"editorCursor.foreground": "#aaabad",
"editorGutter.background": "#17181c"
}
});
@ -1874,7 +1878,7 @@ function setupEditor(editorFontSize) {
}
function resetZoom() {
editorFontSize = 12;
editorFontSize = 14;
setEditorFontSize(editorFontSize);
setZoom();
}
@ -1909,7 +1913,7 @@ async function checkRobloxActive() {
}
}
window.addEventListener("DOMContentLoaded", async function () {
async function main() {
// Prevent Events
document.addEventListener("contextmenu", (e) => e.preventDefault());
document.addEventListener("keydown", function(e) {
@ -1924,6 +1928,7 @@ window.addEventListener("DOMContentLoaded", async function () {
});
// Set-up
title = await getName();
version = await getVersion();
dataDirectory = await getData();
unsavedTabData = await getUnsavedTabData();
@ -1932,7 +1937,6 @@ window.addEventListener("DOMContentLoaded", async function () {
await createDirectory(dataDirectory);
await createDirectory("scripts");
await createDirectory("autoexec");
setupEditor(settings.editorFontSize);
// Window Dimensions
let windowDimensions = await getWindowDimensions();
@ -1953,8 +1957,10 @@ window.addEventListener("DOMContentLoaded", async function () {
});
// Version
const versionElem = document.querySelector(".kr-titlebar .version");
const titleElem = document.querySelector(".kr-titlebar .brand .text");
const versionElem = document.querySelector(".kr-titlebar .brand .version");
if (version && versionElem) versionElem.textContent = `(${version})`;
if (title && titleElem) titleElem.textContent = debug ? `${title} [DEV]` : title;
// Events
event.listen("update", function (e) {
@ -2027,6 +2033,9 @@ window.addEventListener("DOMContentLoaded", async function () {
populateTabs(true);
document.querySelector(".kr-add-tab").addEventListener("click", addNewTab);
// Editor
setupEditor(settings.editorFontSize);
// Buttons
exploitInject = document.querySelector(".kr-inject");
exploitExecute = document.querySelector(".kr-execute");
@ -2122,7 +2131,7 @@ window.addEventListener("DOMContentLoaded", async function () {
if (foundDropdownContent.classList.contains("active")) {
const dropdownWidth = foundDropdownContent.clientWidth;
const dropdownHeight = foundDropdownContent.clientHeight;
const offset = 10;
const offset = 15;
const offsetX = (e.clientX + dropdownWidth + offset > window.innerWidth) ? window.innerWidth - (dropdownWidth + offset) : e.clientX;
const offsetY = (e.clientY + dropdownHeight + offset > window.innerHeight) ? window.innerHeight - (dropdownHeight + offset) : e.clientY + offset;
@ -2137,4 +2146,11 @@ window.addEventListener("DOMContentLoaded", async function () {
// Show
show();
});
}
function error(e) {
alert(e.message);
}
if (debug) window.addEventListener("error", error);
window.addEventListener("DOMContentLoaded", main);

@ -1,16 +1,16 @@
/* Variables */
:root {
--darker: #090a0e;
--dark: #10121a;
--light: #191c29;
--lighter: #282d42;
--lightest: #2f354e;
--primary: #5267bb;
--text: #c6cff3;
--text-dimmed: #a7afce;
--green: #befdb3;
--yellow: #f1e092;
--red: #ee9b9b;
--darker: #0e0f11;
--dark: #131417;
--light: #191a1e;
--lighter: #35373b;
--lightest: #2a2c32;
--primary: #214ee2;
--text: #aaabad;
--text-dimmed: #8a8a8b;
--green: #93e685;
--yellow: #eecd3d;
--red: #e64040;
}
/* Font */
@ -64,7 +64,6 @@ body > .container {
overflow: hidden;
border-radius: 5px;
box-sizing: border-box;
border: 1px solid var(--lighter);
background-color: var(--dark);
transition: opacity 0.1s ease-in;
}
@ -156,7 +155,7 @@ body > .container > *:not(.active):not(.kr-titlebar) {
}
.kr-dropdown-content > div {
font-size: 0.7rem;
font-size: 0.75rem;
display: flex;
justify-content: center;
align-items: center;
@ -171,7 +170,7 @@ body > .container > *:not(.active):not(.kr-titlebar) {
align-items: center !important;
justify-content: center !important;
width: 0.75rem !important;
font-size: 0.5rem !important;
font-size: 0.6rem !important;
}
.kr-dropdown-content > div:not(:first-child) {
@ -259,7 +258,18 @@ body > .container > *:not(.active):not(.kr-titlebar) {
.exploit .bar .buttons {
display: flex;
width: 100%;
gap: 0.35rem;
}
.exploit .bar .buttons > *:not(.seperator) {
flex-grow: 1;
}
.exploit .bar .buttons .kr-dropdown {
margin-right: -1px;
}
.exploit .bar .buttons .kr-dropdown .kr-button {
width: 100%;
}
.exploit .bar .buttons .kr-button {
@ -267,23 +277,47 @@ body > .container > *:not(.active):not(.kr-titlebar) {
border: 0.25px solid var(--lighter);
box-sizing: border-box;
background-color: var(--dark);
font-size: 0.7rem;
font-size: 0.75rem;
display: flex;
align-items: center;
justify-content: center;
padding: 0.35rem 0.5rem;
gap: 0.5rem;
width: 100%;
}
.exploit .bar .buttons > * {
width: calc((100% - 1rem) / 7) !important;
flex-grow: 1;
}
.exploit .bar .buttons .kr-button:hover {
background-color: var(--light);
}
.exploit .bar .buttons .kr-button:not(:first-child):not(:last-child) {
border-radius: 0;
}
.exploit .bar .buttons .kr-button:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.exploit .bar .buttons .kr-button:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.exploit .bar .buttons .seperator {
padding: 0.25rem;
}
.exploit .bar .buttons .after-seperator {
border-top-left-radius: 2.5px !important;
border-bottom-left-radius: 2.5px !important;
}
.exploit .bar .buttons .before-seperator {
border-top-right-radius: 2.5px !important;
border-bottom-right-radius: 2.5px !important;
}
.exploit > .main {
display: flex;
gap: 0.5rem;
@ -328,7 +362,7 @@ body > .container > *:not(.active):not(.kr-titlebar) {
display: flex;
align-items: center;
justify-content: center;
font-size: 0.5rem;
font-size: 0.6rem;
padding: 0.25rem;
box-sizing: border-box;
background-color: var(--light);
@ -357,8 +391,8 @@ body > .container > *:not(.active):not(.kr-titlebar) {
text-wrap: nowrap;
background-color: var(--light);
border: 1px solid var(--lighter);
padding: 0.15rem 0.25rem;
font-size: 0.7rem;
padding: 0.1rem 0.25rem;
font-size: 0.75rem;
border-radius: 2.5px;
box-sizing: border-box;
user-select: none;
@ -383,7 +417,7 @@ body > .container > *:not(.active):not(.kr-titlebar) {
}
.exploit > .main > .container > .tabs > .list .kr-tab > i {
font-size: 0.5rem;
font-size: 0.6rem;
}
.exploit > .main > .container > .tabs > .list .kr-tab:not([contentEditable="true"]):not(.selected).active {
@ -426,7 +460,7 @@ body > .container > *:not(.active):not(.kr-titlebar) {
display: flex;
align-items: center;
justify-content: center;
font-size: 0.5rem;
font-size: 0.6rem;
padding: 0.25rem;
width: 1.5rem;
box-sizing: border-box;
@ -470,7 +504,7 @@ body > .container > *:not(.active):not(.kr-titlebar) {
flex-direction: row-reverse;
white-space: nowrap;
padding: 0.1rem 0.2rem;
font-size: 0.7rem;
font-size: 0.75rem;
width: fit-content;
border-radius: 2.5px;
gap: 0.3rem;

@ -15,8 +15,7 @@
<div class="kr-titlebar">
<div class="tb-drag" data-tauri-drag-region></div>
<div class="brand">
<img class="image" src="./assets/images/icon.png">
<p class="text">KrampUI</p>
<p class="text"></p>
<p class="version"></p>
</div>
<div class="buttons">
@ -43,12 +42,15 @@
<div class="kr-dropdown-delete-loader">Delete Loader <i class="fa-solid fa-delete-left"></i></div>
</div>
</div>
<button class="kr-button kr-kill disabled"><i class="fa-solid fa-ban"></i> <span class="text">Kill</span></button>
<button class="kr-button kr-execute disabled"><i class="fa-solid fa-scroll"></i> <span class="text">Execute</span></button>
<button class="kr-button kr-clear"><i class="fa-solid fa-delete-left"></i> <span class="text">Clear</span></button>
<button class="kr-button kr-import"><i class="fa-solid fa-upload"></i> <span class="text">Import</span></button>
<button class="kr-button kr-export"><i class="fa-solid fa-floppy-disk"></i> <span class="text">Export</span></button>
<button class="kr-button kr-folder"><i class="fa-solid fa-folder"></i> <span class="text">Folder</span></button>
<button class="kr-button kr-kill before-seperator disabled"><i class="fa-solid fa-ban"></i> <span class="text">Kill</span></button>
<div class="seperator"></div>
<button class="kr-button kr-execute after-seperator disabled"><i class="fa-solid fa-scroll"></i> <span class="text">Execute</span></button>
<button class="kr-button kr-clear before-seperator"><i class="fa-solid fa-delete-left"></i> <span class="text">Clear</span></button>
<div class="seperator"></div>
<button class="kr-button kr-import after-seperator"><i class="fa-solid fa-upload"></i> <span class="text">Import</span></button>
<button class="kr-button kr-export before-seperator"><i class="fa-solid fa-floppy-disk"></i> <span class="text">Export</span></button>
<div class="seperator"></div>
<button class="kr-button kr-folder after-seperator"><i class="fa-solid fa-folder"></i> <span class="text">Folder</span></button>
</div>
</div>
<div class="main">