public JuicedWebSocketBehavior(JuicedRemoteConsole parent, JuicedRconConfig.Profile profile) { this.parent = parent; Profile = profile; IgnoreExtensions = true; }
/// <summary> /// TryRemoveWebSocketService tries to remove a service from the RCON server based on a profile /// </summary> /// <param name="profile"></param> /// <returns></returns> public bool TryRemoveWebSocketService(JuicedRconConfig.Profile profile) { if (!profile.Enabled || string.IsNullOrEmpty(profile.Password)) { return(false); } server.RemoveWebSocketService($"/{profile.Password}"); Log(LogType.Log, $"Disabled rcon profile {profile.DisplayName}"); return(true); }
public JuicedRemoteConsole(JuicedRcon parent) { this.parent = parent; rootProfile = JuicedRconConfig.Profile.CreateRootProfile(); port = Interface.Oxide.Config.Rcon.Port; commands = new Dictionary <string, Func <string[], string> > { { CommandType.CommandJuicedRconEnable, (args) => parent.EnableCommand(args) }, { CommandType.CommandJuicedRconDisable, (args) => parent.DisableCommand(args) }, { CommandType.CommandJuicedRconProfile, (args) => parent.ProfileCommand(args) } }; }
/// <summary> /// TryAddWebSocketService tries to add a service to the RCON server based on a profile /// </summary> /// <param name="profile"></param> /// <returns></returns> public bool TryAddWebSocketService(JuicedRconConfig.Profile profile) { if (!profile.Enabled) { return(false); } if (string.IsNullOrEmpty(profile.Password)) { Log(LogType.Error, $"Unable to start rcon profile {profile.DisplayName}: it is recommended a password is set"); return(false); } server.AddWebSocketService($"/{profile.Password}", () => new JuicedWebSocketBehavior(this, profile)); Log(LogType.Log, $"Enabled rcon profile {profile.DisplayName}"); return(true); }