* * Contributors: * - bobbyunknown * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ include './cfg.php'; include './manager.php'; $dirPath = "$neko_dir/config"; $arrFiles = array(); $arrFiles = glob("$dirPath/*.yaml"); $ruleDirPath = "$neko_dir/rule_provider"; $tmpPath = "$neko_www/lib/tmprules.txt"; $rulePath = ""; $strRules = ""; $strNewRules = ""; $core_mode = exec("uci -q get neko.cfg.core_mode"); if(isset($_POST['config_content']) && isset($_POST['save_config'])){ if ($core_mode == 'singbox') { $config_file = "$neko_dir/config/singbox.json"; file_put_contents($config_file, $_POST['config_content']); } else { if(isset($selected_config) && file_exists($selected_config)) { file_put_contents($selected_config, $_POST['config_content']); } } } if(isset($_POST['action'])) { if($_POST['action'] == 'load_proxy') { $proxyPath = $_POST['proxycfg']; if(file_exists($proxyPath)) { echo file_get_contents($proxyPath); exit; } } if($_POST['action'] == 'save_proxy') { $proxyPath = $_POST['proxycfg']; $content = $_POST['content']; if(file_exists($proxyPath)) { file_put_contents($proxyPath, $content); echo "success"; exit; } } } if(isset($_POST['action'])) { if($_POST['action'] == 'load_rules') { $rulesPath = $_POST['rulescfg']; if(file_exists($rulesPath)) { echo file_get_contents($rulesPath); exit; } } if($_POST['action'] == 'save_rules') { $rulesPath = $_POST['rulescfg']; $content = $_POST['content']; if(file_exists($rulesPath)) { file_put_contents($rulesPath, $content); echo "success"; exit; } } } if(isset($_POST['clashconfig'])){ $dt = $_POST['clashconfig']; shell_exec("uci set neko.cfg.selected_config='$dt' && uci commit neko"); $selected_config = $dt; } if(isset($_POST['neko'])){ $dt = $_POST['neko']; if ($dt == 'apply') shell_exec("$neko_dir/core/neko -r"); } if(isset($_POST['rulescfg'])){ $dt = $_POST['rulescfg']; $strRules = shell_exec("cat $dt"); $rulePath = $dt; shell_exec("echo $dt > $tmpPath"); } if(isset($_POST['newrulescfg'])){ $dt = $_POST['newrulescfg']; $strNewRules = $dt; $tmpData = exec("cat $tmpPath"); shell_exec("echo \"$strNewRules\" > $tmpData"); shell_exec("rm $tmpPath"); } if(isset($_POST["path_selector"])) { if ($_POST['path_selector'] == 'Option') { header('Content-Type: application/json'); echo json_encode([ 'status' => 'error', 'title' => 'Error!', 'message' => 'Please select the correct directory', 'icon' => 'error' ]); exit; } if ($_POST['path_selector'] == 'BACKUP CONFIG') { backupConfig(); exit; } if ($_POST['path_selector'] == 'RESTORE CONFIG') { restoreConfig(); exit; } up_controller($_POST['path_selector']); exit; } if(isset($_POST["file_action"])) { $action = explode("@", $_POST["file_action"]); $command = $action[0]; if($command === 'down') { $result = action_controller($_POST["file_action"]); exit; } $result = action_controller($_POST["file_action"]); header('Content-Type: application/json'); echo json_encode($result); exit; } ?>
Config Editor

Config Information

Proxy

Rules

Converter

Config File Manager

Upload & Backup file

NOTE
Restore your configuration is destroying our old configuration at neko directory!!!
Backup is include of directory configs, proxy_provider, and rule_provider.

Config files

Files Action

Proxy Provider files

Files Action

Rules Provider files

Files Action