Skip to content

Instantly share code, notes, and snippets.

@anasfanani
Last active June 2, 2024 19:54
Show Gist options
  • Save anasfanani/3702de995a1b2953404bec4f72cdd349 to your computer and use it in GitHub Desktop.
Save anasfanani/3702de995a1b2953404bec4f72cdd349 to your computer and use it in GitHub Desktop.
Openclash Mod Collection

Mematikan Cek IP

echo '<!DOCTYPE html><html></html>' > /usr/lib/lua/luci/view/openclash/myip.htm

Menambahkan Clash Config Editor

curl -sL https://gist.githubusercontent.com/anasfanani/3702de995a1b2953404bec4f72cdd349/raw/config_editor.sh | sh
#!/bin/bash
# Source : https://blog.vpngame.com/tool-inject/openclash/openclash-mod-cara-menambahkan-menu-config-editor/
# Check if unzip is installed
if ! command -v unzip &> /dev/null; then
echo "unzip could not be found, installing..."
opkg update && opkg install unzip
fi
# Define the URL and the destination file
URL="https://github.com/noct99/blog.vpngame.com/raw/main/oceditor.zip"
DESTINATION="/www/oceditor.zip"
# Download the file
wget "$URL" -O "$DESTINATION"
# Check if the download was successful
if [ $? -eq 0 ]; then
echo "Download successful"
# Unzip the file
unzip "$DESTINATION" -d /www/
# Check if unzip was successful
if [ $? -eq 0 ]; then
echo "Unzip successful"
# Remove the zip file
rm "$DESTINATION"
else
echo "Unzip failed"
exit;
fi
else
echo "Download failed"
exit;
fi
cat <<'EOF' >/usr/lib/lua/luci/view/openclash/oceditor.htm
<%+header%>
<div class="cbi-map">
<iframe id="oceditor" style="width: 100%; min-height: 650px; border: none; border-radius: 2px;"></iframe>
</div>
<script type="text/javascript">
document.getElementById("oceditor").src = window.location.protocol + "//" + window.location.host + "/tinyfm/oceditor.php";
</script>
<%+footer%>
EOF
# Path to the file
FILE="/usr/lib/lua/luci/controller/openclash.lua"
# Modify the line containing "openclash/log" and change 80 to 90
sed -i '/openclash\/log/ s/80/90/' "$FILE"
# Add a new line after the modified line
sed -i '/openclash\/log/ a\
\ entry({"admin", "services", "openclash", "oceditor"},template("openclash/oceditor"),_("Config Editor"), 80).leaf = true
' "$FILE"
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment