예제 #1
0
        public void __SetSettings(List <Setting> body, IHttpContext context)
        {
            HttpApiServer server = context.Server;

            server.Options.Settings = body;
            server.SaveOptions();
        }
예제 #2
0
        public void __SetActionMaxrps(List <SetMaxrps> body, IHttpContext context)
        {
            HttpApiServer server = context.Server;

            if (body != null)
            {
                foreach (var i in body)
                {
                    foreach (var item in server.ActionFactory.Handlers)
                    {
                        if (item.ID == i.ID)
                        {
                            item.MaxRPS = i.Value;
                        }
                    }
                }
                server.Options.MaxrpsSettings.Clear();
                foreach (var item in server.ActionFactory.Handlers)
                {
                    server.Options.MaxrpsSettings.Add(new ActionMaxrps {
                        Url = item.SourceUrl, MaxRps = item.MaxRPS
                    });
                }
                server.SaveOptions();
            }
        }
예제 #3
0
        public void __ChangeAccessKey(string key, IHttpContext context)
        {
            byte[]        keyData = Convert.FromBase64String(key);
            HttpApiServer server  = context.Server;

            byte[] aseKey = Convert.FromBase64String(server.Options.AccessKey);
            key = Utils.DecryptStringAES(keyData, aseKey, aseKey);
            server.Options.AccessKey = key;
            server.SaveOptions();
        }
예제 #4
0
        public void __SetOptions(ServerSetting body, IHttpContext context)
        {
            HttpApiServer server = context.Server;

            server.BaseServer.Options.LogLevel = body.LogLevel;
            server.Options.StaticResurceType   = body.StaticResurceType;
            server.Options.SessionTimeOut      = body.SessionTimeOut;
            server.Options.MaxBodyLength       = body.MaxBodyLength;
            server.Options.LogLevel            = body.LogLevel;
            server.Options.WebSocketMaxRPS     = body.WebSocketMaxRPS;
            server.Options.MaxConnections      = body.MaxConnections;
            server.Options.WriteLog            = body.WriteLog;
            server.Options.LogToConsole        = body.LogToConsole;
            server.Options.CacheLogMaxSize     = body.CacheLogLength;
            server.ResourceCenter.SetDefaultPages(body.DefaultPage);
            server.ResourceCenter.SetFileExts(body.StaticResurceType);
            server.SaveOptions();
        }