예제 #1
0
        private void save_button_Click(object sender, RoutedEventArgs e)
        {
            HttpQuery query = new HttpQuery();
            //query.RequestCookies.Add(ClientSession.SessionCookie);
            Json json = new Json();

            json["username"] = textbox_username.Text;
            json["password"] = textbox_password.Password;
            json["nickname"] = textbox_nickname.Text;
            json["email"]    = textbox_email.Text;
            json["phone"]    = textbox_phone.Text;
            try
            {
                var response = Json.Decode(query.Post(ClientConfig.ServerUrl + "user/registe", json.Encode()));
                if (response["status"] == 0)
                {
                    MessageBox.Show("注册成功!");

                    this.Close();
                }
                else
                {
                    MessageBox.Show(response["error"], "注册失败!");
                }
            }
            catch
            {
                MessageBox.Show("注册失败!");
            }
        }
예제 #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            HttpQuery query = new HttpQuery();
            //query.RequestCookies.Add(ClientSession.SessionCookie);
            Json json = new Json();

            json["username"] = textUserName.Text;
            json["password"] = textPassWord.Password;
            try
            {
                var response = Json.Decode(query.Post(ClientConfig.ServerUrl + "user/checkLogin", json.Encode()));
                if (response["status"] == 0)
                {
                    ClientSession.user_info     = response["info"]["user_info"].ConvertTo <UserInfo>();
                    ClientSession.SessionCookie = query.ResponseCookies[0];

                    var main = new Main();
                    main.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show(response["error"], "登录失败!");
                }
            }
            catch
            {
                MessageBox.Show("登录失败!");
            }
        }
예제 #3
0
        public static bool ReceiveMail()
        {
            var http = new HttpQuery();

            http.timeout = 120;
            http.Post(serverAddress + "tickers/receiveMail", "");
            return(true);
        }
예제 #4
0
        public static bool SendSMS()
        {
            var http = new HttpQuery();

            http.timeout = 120;
            http.Post(serverAddress + "tickers/sendSms", "");
            return(true);
        }
예제 #5
0
        public static bool AddMessage()
        {
            var http = new HttpQuery();

            http.timeout = 120;
            http.Post(serverAddress + "tickers/addMessage", "");
            return(true);
        }
예제 #6
0
        static bool Prefix(
            ref bool __state,
            string reporterUserId,
            string reportedUserId,
            string reason,
            ref int reportedId,
            string reporterNickname,
            string reportedNickname,
            bool friendlyFire)
        {
            try
            {
                string pings = "";

                foreach (string s in ReportPing.Instance.Config.RoleId)
                {
                    pings += $"<@&{s}> ";
                }

                pings = Uri.EscapeDataString(pings);

                string payload = JsonSerializer.ToJsonString <DiscordWebhook>(new DiscordWebhook(
                                                                                  pings, CheaterReport.WebhookUsername,
                                                                                  CheaterReport.WebhookAvatar, false, new DiscordEmbed[1]
                {
                    new DiscordEmbed(CheaterReport.ReportHeader, "rich", CheaterReport.ReportContent,
                                     CheaterReport.WebhookColor, new DiscordEmbedField[10]
                    {
                        new DiscordEmbedField("Server Name", CheaterReport.ServerName, false),
                        new DiscordEmbedField("Server Endpoint", string.Format("{0}:{1}", (object)ServerConsole.Ip, (object)ServerConsole.Port), false),
                        new DiscordEmbedField("Reporter UserID", CheaterReport.AsDiscordCode(reporterUserId), false),
                        new DiscordEmbedField("Reporter Nickname", CheaterReport.DiscordSanitize(reporterNickname), false),
                        new DiscordEmbedField("Reported UserID", CheaterReport.AsDiscordCode(reportedUserId), false),
                        new DiscordEmbedField("Reported Nickname", CheaterReport.DiscordSanitize(reportedNickname), false),
                        new DiscordEmbedField("Reported ID", reportedId.ToString(), false),
                        new DiscordEmbedField("Reason", CheaterReport.DiscordSanitize(reason), false),
                        new DiscordEmbedField("Timestamp", TimeBehaviour.Rfc3339Time(), false),
                        new DiscordEmbedField("UTC Timestamp", TimeBehaviour.Rfc3339Time(DateTimeOffset.UtcNow), false)
                    })
                }));
                HttpQuery.Post(friendlyFire ? FriendlyFireConfig.WebhookUrl : CheaterReport.WebhookUrl, "payload_json=" + payload);
                __state = true;
            }
            catch (Exception ex)
            {
                ServerConsole.AddLog("Failed to send report by webhook: " + ex.Message, ConsoleColor.Gray);
                Debug.LogException(ex);
                __state = false;
            }

            return(false);
        }
예제 #7
0
        private void Request(string auth)
        {
            fromClipboard.Enabled = false;
            scanQR.Enabled        = false;
            userIDLabel.Text      = "";
            nicknameLabel.Text    = "";
            issuanceLabel.Text    = "";
            expirationLabel.Text  = "";

            statusLabel.Text      = "Token validation in progress...";
            statusPanel.BackColor = Color.DarkGray;

            var decoded = JsonConvert.DeserializeObject <Dictionary <string, string> >(HttpQuery.Post(
                                                                                           "https://api.scpslgame.com/v2/tools/validatetoken.php",
                                                                                           $"auth={WebUtility.UrlEncode(auth)}" + (Authed ? "&token=" + ApiToken : "")));

            if (decoded["success"] == "false")
            {
                statusLabel.Text      = "Error: " + decoded["error"];
                statusPanel.BackColor = Color.Crimson;

                fromClipboard.Enabled = true;
                scanQR.Enabled        = true;
                return;
            }

            if (decoded["verified"] == "false")
            {
                statusLabel.Text      = "Digital signature invalid";
                statusPanel.BackColor = Color.Crimson;

                fromClipboard.Enabled = true;
                scanQR.Enabled        = true;
                return;
            }

            userIDLabel.Text     = decoded["UserID"];
            nicknameLabel.Text   = Base64Decode(decoded["Nickname"]);
            issuanceLabel.Text   = decoded["Issuance time"];
            expirationLabel.Text = decoded["Expiration time"];

            if (!decoded.ContainsKey("clean") || !decoded.ContainsKey("GlobalBan"))
            {
                if (decoded["newToken"] == "false")
                {
                    statusLabel.Text      = "Signature verification successful, token is old.";
                    statusPanel.BackColor = Color.MediumAquamarine;
                }
                else
                {
                    statusLabel.Text      = "Signature verification successful";
                    statusPanel.BackColor = Color.DeepSkyBlue;
                }

                fromClipboard.Enabled = true;
                scanQR.Enabled        = true;
                return;
            }

            if (decoded["clean"] == "true")
            {
                if (decoded["newToken"] == "false")
                {
                    statusLabel.Text      = "Signature verification successful, token is old.";
                    statusPanel.BackColor = Color.MediumAquamarine;
                }
                else
                {
                    statusLabel.Text      = "Signature verification successful, not banned in any game, token is old.";
                    statusPanel.BackColor = Color.Teal;
                }
            }
            else
            {
                if (decoded["GlobalBan"] == "true")
                {
                    if (decoded["newToken"] == "false")
                    {
                        statusLabel.Text      = "Signature verification successful, banned in SCP:SL, token is old.";
                        statusPanel.BackColor = Color.OrangeRed;
                    }
                    else
                    {
                        statusLabel.Text      = "Signature verification successful, banned in SCP:SL.";
                        statusPanel.BackColor = Color.OrangeRed;
                    }
                }
                else
                {
                    if (decoded["newToken"] == "false")
                    {
                        statusLabel.Text      = "Signature verification successful, banned in other games, token is old.";
                        statusPanel.BackColor = Color.DarkOrange;
                    }
                    else
                    {
                        statusLabel.Text      = "Signature verification successful, banned in other games.";
                        statusPanel.BackColor = Color.Orange;
                    }
                }
            }

            fromClipboard.Enabled = true;
            scanQR.Enabled        = true;
        }