Skip to content
This repository has been archived by the owner on Apr 7, 2024. It is now read-only.

Commit

Permalink
Optimization
Browse files Browse the repository at this point in the history
No longer scans for PIDs every 2.5 seconds
  • Loading branch information
Mars7383 committed Dec 27, 2021
1 parent f0dcd0f commit 6c9685e
Show file tree
Hide file tree
Showing 9 changed files with 157 additions and 92 deletions.
7 changes: 4 additions & 3 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@
<h2>QA Testing</h2>
<ul>
<li><a href="https://discord.com/users/572830503158284308">mattt#0001</a></li>
<li><a href="https://discord.com/users/556636433637703725">StereoThermal#7969</a></li>
<li><a href="https://discord.com/users/358691907792011266">Server_Noob#0365</a></li>
<li><a href="https://discord.com/users/556636433637703725">StereoTelemetry#7969</a></li>
<li><a href="https://discord.com/users/716124330718658633">AMD#0869</a></li>
<li><a href="https://discord.com/users/883588477474721842">Milkias#7314</a></li>
<li><a href="https://discord.com/users/443959874192408578">Shasy#0001</a></li>
<li><a href="https://discord.com/users/883588477474721842">aimlock1gou#7314</a></li>
<li><a href="https://discord.com/users/443959874192408578">Shasanta#0001</a></li>
<li><a href="https://discord.com/users/721544459086594049">ImmaturityDetected#1968</a></li>
<br>
</ul>
20 changes: 10 additions & 10 deletions build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"files": {
"main.css": "./static/css/main.3817b7f4.chunk.css",
"main.js": "./static/js/main.4dddd5b1.chunk.js",
"main.js.map": "./static/js/main.4dddd5b1.chunk.js.map",
"main.css": "./static/css/main.ef7df470.chunk.css",
"main.js": "./static/js/main.288579d3.chunk.js",
"main.js.map": "./static/js/main.288579d3.chunk.js.map",
"runtime-main.js": "./static/js/runtime-main.3d67b72f.js",
"runtime-main.js.map": "./static/js/runtime-main.3d67b72f.js.map",
"static/js/2.115e10fd.chunk.js": "./static/js/2.115e10fd.chunk.js",
"static/js/2.115e10fd.chunk.js.map": "./static/js/2.115e10fd.chunk.js.map",
"static/js/2.56c5226b.chunk.js": "./static/js/2.56c5226b.chunk.js",
"static/js/2.56c5226b.chunk.js.map": "./static/js/2.56c5226b.chunk.js.map",
"static/js/3.41faa0d5.chunk.js": "./static/js/3.41faa0d5.chunk.js",
"static/js/3.41faa0d5.chunk.js.map": "./static/js/3.41faa0d5.chunk.js.map",
"index.html": "./index.html",
"static/css/main.3817b7f4.chunk.css.map": "./static/css/main.3817b7f4.chunk.css.map",
"static/js/2.115e10fd.chunk.js.LICENSE.txt": "./static/js/2.115e10fd.chunk.js.LICENSE.txt"
"static/css/main.ef7df470.chunk.css.map": "./static/css/main.ef7df470.chunk.css.map",
"static/js/2.56c5226b.chunk.js.LICENSE.txt": "./static/js/2.56c5226b.chunk.js.LICENSE.txt"
},
"entrypoints": [
"static/js/runtime-main.3d67b72f.js",
"static/js/2.115e10fd.chunk.js",
"static/css/main.3817b7f4.chunk.css",
"static/js/main.4dddd5b1.chunk.js"
"static/js/2.56c5226b.chunk.js",
"static/css/main.ef7df470.chunk.css",
"static/js/main.288579d3.chunk.js"
]
}
2 changes: 1 addition & 1 deletion build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Calamari-M UI remake created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>Calamari</title><script src="utils.js"></script><script src="script-ware-funcs.js"></script><link href="./static/css/main.3817b7f4.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"41faa0d5"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./",a.oe=function(e){throw console.error(e),e};var i=this.webpackJsonpcaliware=this.webpackJsonpcaliware||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="./static/js/2.115e10fd.chunk.js"></script><script src="./static/js/main.4dddd5b1.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Calamari-M UI remake created using create-react-app"/><link rel="apple-touch-icon" href="./logo192.png"/><link rel="manifest" href="./manifest.json"/><title>Calamari</title><script src="utils.js"></script><script src="script-ware-funcs.js"></script><link href="./static/css/main.ef7df470.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,i=r[0],c=r[1],l=r[2],s=0,p=[];s<i.length;s++)a=i[s],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&p.push(o[a][0]),o[a]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var c=t[i];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+"static/js/"+({}[e]||e)+"."+{3:"41faa0d5"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){i.onerror=i.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:i})}),12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(r)},a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./",a.oe=function(e){throw console.error(e),e};var i=this.webpackJsonpcaliware=this.webpackJsonpcaliware||[],c=i.push.bind(i);i.push=r,i=i.slice();for(var l=0;l<i.length;l++)r(i[l]);var f=c;t()}([])</script><script src="./static/js/2.56c5226b.chunk.js"></script><script src="./static/js/main.288579d3.chunk.js"></script></body></html>
100 changes: 63 additions & 37 deletions build/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs2 = require("fs"); // these have a 2 in their name because they are redeclared in the other js file and that makes the interpreter sad :(
const path2 = require("path")
const path2 = require("path");
// Load prefs
let prefsFileLocation2 = path2.join(__dirname, "../../config.json");
var prefsObj2;
Expand Down Expand Up @@ -57,14 +57,21 @@ window.setPreference = async function(preference, value) { // string preference,
window.minimizeWindow = function() {
require("electron").remote.BrowserWindow.getFocusedWindow().minimize();
}

let updateAvailable = "unloaded";
window.togglePreferencePane = function(bool) {
if (bool) {
// we dont wanna keep checking the filesystem for update file, so we'll only do it once
if (updateAvailable == "unloaded") updateAvailable = fs.existsSync(path.join(__dirname, "../../newapp.asar"))
document.getElementById("configPage").style.position = "static"
document.getElementById("configPage").style.visibility = "visible"
try {if (updateAvailable) {
document.getElementById("pending").style.visibility = "visible"
firstUpdateCheck = false;
}} catch(err) {console.error(err)}
} else {
document.getElementById("configPage").style.position = "absolute"
document.getElementById("configPage").style.visibility = "hidden"
document.getElementById("pending").style.visibility = "hidden"
}
}

Expand All @@ -84,47 +91,65 @@ sessionStorage.outputScrollPos = 0;

let robloxExistedAtTheTimeThisVariableWasDefinedNoCap = false;

setInterval(() => {
if (document.getElementsByClassName("editorBox").length == 0) {
if (editorVisible) {
//console.log("Editor left the screen")
editorVisible = false;
}
}
if (document.getElementsByClassName("editorBox").length == 1) {
if (!editorVisible) {
// migrating code from setInterval to onclick events

var editorExists = true; //document.body.contains(document.getElementsByClassName("editorBox")[0]);
var observer = new MutationObserver(function(mutations) {
if (document.body.contains(document.getElementsByClassName("editorBox")[0])) {
if (!editorExists) {
console.log("editor inserted (and output)");
//console.log("Editor visible again")
document.getElementsByClassName("editorBox")[0].value = sessionStorage.editorText
document.getElementsByClassName("editorBox")[0].scrollTop = sessionStorage.editorScrollPos
let editorBox = document.getElementsByClassName("editorBox")[0];
let outputBox = document.getElementsByClassName("outputBox")[0];
editorBox.value = sessionStorage.editorText
editorBox.scrollTop = sessionStorage.editorScrollPos
editorVisible = true;
} else {
//console.log("Storing editor values")
sessionStorage.editorText = document.getElementsByClassName("editorBox")[0].value
sessionStorage.editorScrollPos = document.getElementsByClassName("editorBox")[0].scrollTop
}
}

if (document.getElementsByClassName("outputBox").length == 0) {
if (outputVisible) {
//console.log("Output left the screen")
outputVisible = false;
}
}
if (document.getElementsByClassName("outputBox").length == 1) {
if (!outputVisible) {
//console.log("Output visible again")
document.getElementsByClassName("outputBox")[0].value = sessionStorage.outputText;
document.getElementsByClassName("outputBox")[0].style.color = sessionStorage.outputColor;
document.getElementsByClassName("outputBox")[0].scrollTop = sessionStorage.outputScrollPos
outputBox.value = sessionStorage.outputText;
outputBox.style.color = sessionStorage.outputColor;
outputBox.scrollTop = sessionStorage.outputScrollPos
outputVisible = true;
} else {
//console.log("Storing output values")
sessionStorage.outputText = document.getElementsByClassName("outputBox")[0].value
sessionStorage.outputColor = document.getElementsByClassName("outputBox")[0].style.color
sessionStorage.outputScrollPos = document.getElementsByClassName("outputBox")[0].scrollTop
}
editorExists = true;
} else if (editorExists) {
editorExists = false;
console.log("editor removed (and output)");
//console.log("Editor left the screen")
editorVisible = false;
outputVisible = false;
//console.log("Storing editor values")
//outputBox.removeEventListener("change");
//editorBox.removeEventListener("change");
/*
sessionStorage.editorText = document.getElementsByClassName("editorBox")[0].value
sessionStorage.editorScrollPos = document.getElementsByClassName("editorBox")[0].scrollTop
//console.log("Output left the screen")
//console.log("Storing output values")
sessionStorage.outputText = document.getElementsByClassName("outputBox")[0].value
sessionStorage.outputColor = document.getElementsByClassName("outputBox")[0].style.color
sessionStorage.outputScrollPos = document.getElementsByClassName("outputBox")[0].scrollTop
*/
}

});
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOM fully loaded and parsed");
let editorBox = document.getElementsByClassName("editorBox")[0];
let outputBox = document.getElementsByClassName("outputBox")[0];
editorBox.addEventListener('change', (event) => {
sessionStorage.editorText = event.target.value;
sessionStorage.editorScrollPos = event.target.scrollTop;
});
outputBox.addEventListener('change', (event) => {
sessionStorage.outputText = event.target.value;
sessionStorage.outputScrollPos = event.target.scrollTop;
sessionStorage.outputColor = event.target.style.color
});
observer.observe(document.body, {childList: true, subtree: true});
});

/*
setInterval(() => {
// reset output box once roblox closes
if (getProcesses().length == 0) {
if (robloxExistedAtTheTimeThisVariableWasDefinedNoCap) {
Expand All @@ -140,4 +165,5 @@ setInterval(() => {
robloxExistedAtTheTimeThisVariableWasDefinedNoCap = true;
}
}, 1000);
}, 2500);
*/
2 changes: 1 addition & 1 deletion electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const createMainWindow = () => {
transparent: true,
frame: false,
titleBarStyle: 'customButtonsOnHover',
backgroundColor: '#00ffffff',
backgroundColor: 'ffffffff', //'#00ffffff',
closable: false,
maximizable: false,
resizable: false
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "caliware",
"version": "1.3.1",
"version": "1.3.2",
"bootstrapperVersion": "1.1.0",
"private": true,
"main": "electron/main.js",
"dependencies": {
"bindings": "^1.5.0",
"child_process": "^1.0.2",
"electron-is-dev": "^2.0.0",
"express": "^4.17.2",
"fs": "0.0.1-security",
"http": "0.0.1-security",
"keytar": "^7.6.0",
"node-fetch": "^2.6.1",
"os": "^0.1.2",
Expand Down
Loading

0 comments on commit 6c9685e

Please sign in to comment.