Example #1
0
        public IActionResult Index()
        {
            ShadowSocketConfig model = new ShadowSocketConfig();

            try
            {
                string configStr = System.IO.File.ReadAllText(Common.Utils.GetConfigPath());
                model = JsonConvert.DeserializeObject <ShadowSocketConfig>(configStr);
            }
            catch
            {
            }
            ViewData["MethodList"] = ShadowSocketConfig.MenthodList;
            return(View(model));
        }
Example #2
0
        public JsonResult ChangePort(ShadowSocketConfig model)
        {
            bool   result = false;
            string msg    = "ojb not k";

            try
            {
                string configStr = JsonConvert.SerializeObject(model, Formatting.Indented);
                System.IO.File.WriteAllText(Common.Utils.GetConfigPath(), configStr);
                result = true;
                msg    = Common.Utils.RunCommand("/usr/local/bin/ssserver",
                                                 $" -c {Common.Utils.GetConfigPath()} -d restart");
            }
            catch
            {
            }
            return(new JsonResult(new { result, msg }));
        }