echo '<!DOCTYPE html><html></html>' > /usr/lib/lua/luci/view/openclash/myip.htm
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 -nv "$DESTINATION" -d /www/ | |
| ln -s / /www/tinyfm/rootfs | |
| ln -s /etc/openclash /www/tinyfm/openclash | |
| # 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" |