summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-07-07 11:06:12 +0200
committerMinteck <contact@minteck.org>2022-07-07 11:06:12 +0200
commit3e064be8020ed1eccc5cddcac5ab355320ebccb5 (patch)
tree37ca0fa0141b5600955ce5d001a4c7a7745902a0 /Applications
parent0e9f2dc57e9df8fbc5a5da6d68d1268278aa4129 (diff)
downloadstrawberry-os-3e064be8020ed1eccc5cddcac5ab355320ebccb5.tar.gz
strawberry-os-3e064be8020ed1eccc5cddcac5ab355320ebccb5.tar.bz2
strawberry-os-3e064be8020ed1eccc5cddcac5ab355320ebccb5.zip
m. working on features scoots doesn't want to work onHEADmane
Diffstat (limited to 'Applications')
-rw-r--r--Applications/Debugger.app/Main.js70
-rw-r--r--Applications/System Profiler.app/Main.js81
2 files changed, 150 insertions, 1 deletions
diff --git a/Applications/Debugger.app/Main.js b/Applications/Debugger.app/Main.js
index 6e25339..5ab57bd 100644
--- a/Applications/Debugger.app/Main.js
+++ b/Applications/Debugger.app/Main.js
@@ -8,12 +8,80 @@ module.exports = () => {
Strawberry.StartLoad();
Strawberry.WhenLoaded = () => {
+ global._STRAWBERRY_DEBUG_MODE = true;
+
load("Strawberry.Dialog");
load("Strawberry.AppManager");
+ load("Strawberry.SystemInfo");
+
+ process.removeAllListeners("uncaughtException");
+ process.on('uncaughtException', (error) => {
+ let systemInfo = require(global._STRAWBERRY_SYSTEM_ROOT + "/Library/SDK/Modules/Strawberry.SystemInfo");
+ console.clear();
+
+ let processes = systemInfo.Processes();
+ let stack = error.stack.split("\n")
+ .filter(i => {
+ return i.startsWith(" at");
+ })
+ .map(i => {
+ return i.split("at ")[1].replace(/(.*) \((.*):(.*):(.*)\)/gm, "$1|$2|$3").split("|")
+ })
+ .filter(i => {
+ return i.length === 3
+ })
+ .map(i => {
+ return {
+ method: i[0],
+ file: i[1],
+ position: parseInt(i[2]),
+ column: parseInt(i[3]),
+ line: (
+ i[1].startsWith("/") ?
+ require('fs').readFileSync(i[1]).toString().trim().split("\n")[parseInt(i[2]) - 1].trim() :
+ null
+ )
+ }
+ })
+
+ require('fs').writeFileSync("/tmp/crash.txt", "\n" +
+ color.underline("Strawberry OS Crash Report") + "\n" +
+ "\n" +
+ "You are seeing this message because an error occurred within Strawberry OS itself or an application running on the system. The system has been stopped to prevent further instabilities, and since you have enabled the debugger, additional data has been collected and a crash report is shown." +
+ "\n" +
+ "\n" +
+ "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + "\n" +
+ "Your error is most likely here:" + "\n" +
+ " " + stack[0].line + "\n" +
+ " " + " ".repeat(stack[0].column - 1) + "^" + "\n" +
+ "\n" +
+ "If it is not, here is the entire crash report:" + "\n" +
+ "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + "\n\n" +
+ color.underline.green("Crash Summary:") + "\n" +
+ color.green(" Error Code: ") + " 0xF" + require('crypto').createHash('md5').update(error.message).digest('hex').substring(0, 7).toUpperCase() + "\n" +
+ color.green(" Error Type: ") + error.name + "\n" +
+ color.green(" Error Message: ") + error.message + "\n" +
+ "\n" +
+ color.underline.green("Stack Dump:") + "\n" +
+ stack.map(i => {
+ return " " + color.green(i.file) + ": " + i.method + ", line " + i.position + "\n " + (i.line ? chalk.cyan(i.line) : chalk.cyan("<no source link>"));
+ }).join("\n") +
+ "\n\n" +
+ color.underline.green("Open Processes:") + "\n" +
+ processes.map(i => { return " " + i; }).join("\n") + "\n" +
+ "\n" +
+ color.bgGreen.black("Press Q to close this crash report; press Ctrl+Opt+Del to restart your Strawberry device.\n")
+ );
+ require('child_process').spawnSync("bash", [ "-c", "cat /tmp/crash.txt | more -r" ], { stdio: "inherit" });
+ console.clear();
+ require('fs').unlinkSync("/tmp/crash.txt");
+ try { require(global._STRAWBERRY_SYSTEM_ROOT + '/Library/SDK/node_modules/show-terminal-cursor')(); } catch (e) {}
+ process.exit();
+ })
Strawberry.Audio.SystemSound("Strawberry.System.Window");
Strawberry.Dialog.ConfirmLines([
- color.underline("Strawberry Debugger"),
+ "Strawberry Debugger",
"",
"The Strawberry Debugger has been enabled. It will stay enabled",
"until the system is restarted.",
diff --git a/Applications/System Profiler.app/Main.js b/Applications/System Profiler.app/Main.js
new file mode 100644
index 0000000..563ed01
--- /dev/null
+++ b/Applications/System Profiler.app/Main.js
@@ -0,0 +1,81 @@
+// noinspection JSUnresolvedVariable
+
+module.exports = () => {
+ Strawberry.App = "System Profiler";
+ Strawberry.MultiPanes = true;
+ Strawberry.Menus = [
+ "Quit"
+ ]
+
+ Strawberry.WhenLoaded = () => {
+ load("Strawberry.Display");
+ load("Strawberry.Menubar");
+ }
+
+ Strawberry.Panes[0] = {
+ name: "System Software",
+ load: () => {}
+ }
+
+ Strawberry.Panes[1] = {
+ name: "Extensions",
+ load: () => {}
+ }
+
+ Strawberry.Panes[2] = {
+ name: "Diagnostics",
+ load: () => {}
+ }
+
+ Strawberry.Panes[3] = {
+ name: "Applications",
+ load: () => {}
+ }
+
+ Strawberry.Panes[4] = {
+ name: "Security and integrity",
+ load: () => {}
+ }
+
+ Strawberry.Panes[5] = {
+ name: "Physical and virtual memory",
+ load: () => {}
+ }
+
+ Strawberry.Panes[6] = {
+ name: "Processors and graphics",
+ load: () => {}
+ }
+
+ Strawberry.Panes[7] = {
+ name: "Applications",
+ load: () => {}
+ }
+
+ Strawberry.Panes[8] = {
+ name: "Disks",
+ load: () => {}
+ }
+
+ Strawberry.Panes[9] = {
+ name: "Startup",
+ load: () => {}
+ }
+
+ Strawberry.Panes[10] = {
+ name: "Network",
+ load: () => {}
+ }
+
+ Strawberry.Panes[11] = {
+ name: "Audio",
+ load: () => {}
+ }
+
+ Strawberry.Panes[12] = {
+ name: "Processes",
+ load: () => {}
+ }
+
+ Strawberry.StartLoad();
+} \ No newline at end of file