By ${PLUGIN_AUTHOR} - JavaScript
${PLUGIN_DESCRIPTION}
diff --git a/mush.sh b/mush.sh
index 6ca76bc..e768cec 100644
--- a/mush.sh
+++ b/mush.sh
@@ -166,7 +166,7 @@ EOF
24) runjob attempt_dev_install ;;
25) runjob do_updates && exit 0 ;;
26) runjob do_dev_updates && exit 0 ;;
- 101) runjob hard_disable_nokill ;;
+ 101) runjob hard_disable_nokill ;; # anything prefixed with a 1 is for the helper extension, you can safely ignore these as a user
111) runjob hard_enable_nokill ;;
112) runjob ext_purge ;;
113) runjob list_plugins ;;
@@ -178,6 +178,21 @@ EOF
done
}
+do_install_plugin() {
+ local url=$1
+ local filename="$(echo "${url}" | rev | cut -d/ -f1 | rev)"
+ if [! -f /mnt/stateful_partition/murkmod/plugins/$filename ]; then
+ doas "pushd /mnt/stateful_partition/murkmod/plugins
+ curl $url -O
+ chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
+ popd" > /dev/null
+ local dependencies=($(grep -oP '(?<=PLUGIN_DEPENDENCIES\+=\()[^)]*' "$filename"))
+ for dep in "${dependencies[@]}"; do
+ do_install_plugin "$dep"
+ done
+ fi
+}
+
install_plugin_legacy() {
local raw_url="https://raw.githubusercontent.com/rainestorme/murkmod/main/plugins"
@@ -193,7 +208,7 @@ install_plugin_legacy() {
echo "Plugin not found"
else
echo "Installing..."
- doas "pushd /mnt/stateful_partition/murkmod/plugins && curl https://raw.githubusercontent.com/rainestorme/murkmod/main/plugins/$plugin_name -O && popd" > /dev/null
+ do_install_plugin "https://raw.githubusercontent.com/rainestorme/murkmod/main/plugins/$plugin_name"
echo "Installed $plugin_name"
fi
}
@@ -480,7 +495,7 @@ install_plugins() {
"") clear
echo "Using URL: ${download_urls[$selected_option]}"
echo "Installing plugin..."
- doas "pushd /mnt/stateful_partition/murkmod/plugins && curl ${download_urls[$selected_option]} -O && popd" > /dev/null
+ do_install_plugin "${download_urls[$selected_option]}"
echo "Done!"
;;
esac
From 67d519e0cc0107af681d73426383cd173b3f7be5 Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 20:50:27 +0000
Subject: [PATCH 02/11] Add delay for debugging - revert me later
---
mush.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/mush.sh b/mush.sh
index e768cec..0f4bd61 100644
--- a/mush.sh
+++ b/mush.sh
@@ -191,6 +191,7 @@ do_install_plugin() {
do_install_plugin "$dep"
done
fi
+ read -r -p "Press enter to continue." throwaway
}
install_plugin_legacy() {
From 4313f7b2886df3762d34e4f6bb2618e6f112931c Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 20:52:25 +0000
Subject: [PATCH 03/11] Fix syntax error
---
mush.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index 0f4bd61..bb27f7f 100644
--- a/mush.sh
+++ b/mush.sh
@@ -181,7 +181,7 @@ EOF
do_install_plugin() {
local url=$1
local filename="$(echo "${url}" | rev | cut -d/ -f1 | rev)"
- if [! -f /mnt/stateful_partition/murkmod/plugins/$filename ]; then
+ if [ ! -f /mnt/stateful_partition/murkmod/plugins/$filename ]; then
doas "pushd /mnt/stateful_partition/murkmod/plugins
curl $url -O
chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
From 1a813ca910d66df631d6310cf63bc37a4bf7bf2b Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 20:55:44 +0000
Subject: [PATCH 04/11] Remove perl dependency from grep
---
mush.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index bb27f7f..d63e22f 100644
--- a/mush.sh
+++ b/mush.sh
@@ -186,7 +186,7 @@ do_install_plugin() {
curl $url -O
chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
popd" > /dev/null
- local dependencies=($(grep -oP '(?<=PLUGIN_DEPENDENCIES\+=\()[^)]*' "$filename"))
+ local dependencies=($(grep -o '(PLUGIN_DEPENDENCIES\+=\()[^)]*' "$filename"))
for dep in "${dependencies[@]}"; do
do_install_plugin "$dep"
done
From f2c371917f4ac48f69dbf1019b4c4f0e2642a2ee Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 20:58:13 +0000
Subject: [PATCH 05/11] Fix filepath
---
mush.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index d63e22f..b5ea2d4 100644
--- a/mush.sh
+++ b/mush.sh
@@ -186,7 +186,7 @@ do_install_plugin() {
curl $url -O
chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
popd" > /dev/null
- local dependencies=($(grep -o '(PLUGIN_DEPENDENCIES\+=\()[^)]*' "$filename"))
+ local dependencies=($(grep -o '(PLUGIN_DEPENDENCIES\+=\()[^)]*' "/mnt/stateful_partition/murkmod/plugins/$filename"))
for dep in "${dependencies[@]}"; do
do_install_plugin "$dep"
done
From 3a3dfa8b5177bd667db4539a0249e03572e8d4eb Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 21:16:09 +0000
Subject: [PATCH 06/11] Damn you chatgpt
---
mush.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index b5ea2d4..6365527 100644
--- a/mush.sh
+++ b/mush.sh
@@ -186,7 +186,7 @@ do_install_plugin() {
curl $url -O
chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
popd" > /dev/null
- local dependencies=($(grep -o '(PLUGIN_DEPENDENCIES\+=\()[^)]*' "/mnt/stateful_partition/murkmod/plugins/$filename"))
+ local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
for dep in "${dependencies[@]}"; do
do_install_plugin "$dep"
done
From 6be52d1a9e85b02b5a6eae2387e0a8054579602e Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 21:28:22 +0000
Subject: [PATCH 07/11] Chatgpt does it again
---
mush.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index 6365527..6427f60 100644
--- a/mush.sh
+++ b/mush.sh
@@ -186,7 +186,7 @@ do_install_plugin() {
curl $url -O
chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
popd" > /dev/null
- local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
+ local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "/mnt/stateful_partition/murkmod/plgins/$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
for dep in "${dependencies[@]}"; do
do_install_plugin "$dep"
done
From 0cf465fc0dbb2b711dc50259b639a77198cd47fe Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 21:30:24 +0000
Subject: [PATCH 08/11] This is why this is a draft PR
---
mush.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index 6427f60..de07643 100644
--- a/mush.sh
+++ b/mush.sh
@@ -186,7 +186,7 @@ do_install_plugin() {
curl $url -O
chmod 775 /mnt/stateful_partition/murkmod/plugins/$filename
popd" > /dev/null
- local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "/mnt/stateful_partition/murkmod/plgins/$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
+ local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "/mnt/stateful_partition/murkmod/plugins/$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
for dep in "${dependencies[@]}"; do
do_install_plugin "$dep"
done
From 9bd679420d3de9e3ba9ad0b3eabcec8d2ec9a6ba Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 21:34:20 +0000
Subject: [PATCH 09/11] Debug logging, remove quotes from sub-dependencies
---
mush.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mush.sh b/mush.sh
index de07643..d932987 100644
--- a/mush.sh
+++ b/mush.sh
@@ -188,7 +188,10 @@ do_install_plugin() {
popd" > /dev/null
local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "/mnt/stateful_partition/murkmod/plugins/$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
for dep in "${dependencies[@]}"; do
- do_install_plugin "$dep"
+ echo "$dep"
+ local dep_fixed=$(echo "$dep" | tr -d '"')
+ echo "$dep_fixed"
+ do_install_plugin "$dep_fixed"
done
fi
read -r -p "Press enter to continue." throwaway
From 676ad08a97329ce9fdbee06d2995a3529726713c Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Sat, 27 Jan 2024 21:37:27 +0000
Subject: [PATCH 10/11] Fix URL resolving for dependencies
---
mush.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mush.sh b/mush.sh
index d932987..bb8e10e 100644
--- a/mush.sh
+++ b/mush.sh
@@ -188,10 +188,9 @@ do_install_plugin() {
popd" > /dev/null
local dependencies=($(grep -o 'PLUGIN_DEPENDENCIES\+=([^)]*)' "/mnt/stateful_partition/murkmod/plugins/$filename" | sed 's/PLUGIN_DEPENDENCIES\+=//; s/[()]//g'))
for dep in "${dependencies[@]}"; do
- echo "$dep"
local dep_fixed=$(echo "$dep" | tr -d '"')
- echo "$dep_fixed"
- do_install_plugin "$dep_fixed"
+ echo "Installing $dep_fixed..."
+ do_install_plugin "https://raw.githubusercontent.com/rainestorme/murkmod/main/plugins/$dep_fixed"
done
fi
read -r -p "Press enter to continue." throwaway
From 1a8e55dc8131bcfbbf59d133c942f4e7b01cd8b7 Mon Sep 17 00:00:00 2001
From: rainestorme <115757568+rainestorme@users.noreply.github.com>
Date: Wed, 13 Mar 2024 23:12:42 +0000
Subject: [PATCH 11/11] Install sh plugins even when depended on by js plugin
---
helper/js/murkmod.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/helper/js/murkmod.js b/helper/js/murkmod.js
index e3906c8..c0100b8 100644
--- a/helper/js/murkmod.js
+++ b/helper/js/murkmod.js
@@ -520,7 +520,8 @@ document.addEventListener("DOMContentLoaded", function () {
};
function handle_js_dep(plugin) {
- fetch(`https://api.github.com/repos/rainestorme/murkmod/contents/plugins/${plugin}`)
+ if (plugin.endsWith(".js")){
+ fetch(`https://api.github.com/repos/rainestorme/murkmod/contents/plugins/${plugin}`)
.then(response => {return response.json()})
.then(file => {
var file_content = atob(file.content);
@@ -539,6 +540,13 @@ document.addEventListener("DOMContentLoaded", function () {
});
localStorage.setItem("plugins", JSON.stringify(installed_plugins));
});
+ } else {
+ window.run_task("114\n", "", "> (1-", function (output) {
+ if (output.includes("Enter the name of a plugin (including the .sh) to install it (or q to quit):")) {
+ window.send(`${plugin}\n`);
+ }
+ }, function () {}, false, "");
+ }
}
document.querySelector("#store").addEventListener("click", function() {