Basic Websocket support working, without authentication (auth broken)

This commit is contained in:
Alexander Horner
2022-12-07 21:36:03 +00:00
parent fe4ae354b2
commit 1e1187e71f
5 changed files with 286 additions and 94 deletions

View File

@@ -40,6 +40,8 @@ namespace ntfysh_client
this.label3 = new System.Windows.Forms.Label();
this.password = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.connectionType = new System.Windows.Forms.ComboBox();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
@@ -49,18 +51,19 @@ namespace ntfysh_client
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.button1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 175);
this.panel1.Location = new System.Drawing.Point(0, 244);
this.panel1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(297, 44);
this.panel1.Size = new System.Drawing.Size(346, 51);
this.panel1.TabIndex = 0;
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(131, 11);
this.button2.Margin = new System.Windows.Forms.Padding(10, 10, 3, 10);
this.button2.Location = new System.Drawing.Point(153, 13);
this.button2.Margin = new System.Windows.Forms.Padding(12, 12, 4, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.Size = new System.Drawing.Size(88, 27);
this.button2.TabIndex = 1;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
@@ -69,10 +72,10 @@ namespace ntfysh_client
// button1
//
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button1.Location = new System.Drawing.Point(212, 11);
this.button1.Margin = new System.Windows.Forms.Padding(3, 10, 10, 10);
this.button1.Location = new System.Drawing.Point(247, 13);
this.button1.Margin = new System.Windows.Forms.Padding(4, 12, 12, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.Size = new System.Drawing.Size(88, 27);
this.button1.TabIndex = 2;
this.button1.Text = "Subscribe";
this.button1.UseVisualStyleBackColor = true;
@@ -81,9 +84,10 @@ namespace ntfysh_client
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Location = new System.Drawing.Point(14, 10);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.Size = new System.Drawing.Size(52, 15);
this.label1.TabIndex = 1;
this.label1.Text = "Topic ID:";
//
@@ -91,9 +95,10 @@ namespace ntfysh_client
//
this.topicId.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.topicId.Location = new System.Drawing.Point(12, 25);
this.topicId.Location = new System.Drawing.Point(14, 29);
this.topicId.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.topicId.Name = "topicId";
this.topicId.Size = new System.Drawing.Size(273, 20);
this.topicId.Size = new System.Drawing.Size(318, 23);
this.topicId.TabIndex = 0;
this.topicId.KeyDown += new System.Windows.Forms.KeyEventHandler(this.topicId_KeyDown);
//
@@ -101,19 +106,21 @@ namespace ntfysh_client
//
this.serverUrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.serverUrl.Location = new System.Drawing.Point(12, 64);
this.serverUrl.Location = new System.Drawing.Point(14, 74);
this.serverUrl.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.serverUrl.Name = "serverUrl";
this.serverUrl.Size = new System.Drawing.Size(273, 20);
this.serverUrl.Size = new System.Drawing.Size(318, 23);
this.serverUrl.TabIndex = 2;
this.serverUrl.Text = "https://ntfy.sh";
this.serverUrl.Text = "wss://ntfy.sh";
this.serverUrl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.serverUrl_KeyDown);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(10, 48);
this.label2.Location = new System.Drawing.Point(12, 55);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(66, 13);
this.label2.Size = new System.Drawing.Size(66, 15);
this.label2.TabIndex = 3;
this.label2.Text = "Server URL:";
//
@@ -121,18 +128,20 @@ namespace ntfysh_client
//
this.username.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.username.Location = new System.Drawing.Point(12, 103);
this.username.Location = new System.Drawing.Point(14, 119);
this.username.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.username.Name = "username";
this.username.Size = new System.Drawing.Size(273, 20);
this.username.Size = new System.Drawing.Size(318, 23);
this.username.TabIndex = 4;
this.username.KeyDown += new System.Windows.Forms.KeyEventHandler(this.username_KeyDown);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 87);
this.label3.Location = new System.Drawing.Point(12, 100);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(58, 13);
this.label3.Size = new System.Drawing.Size(63, 15);
this.label3.TabIndex = 5;
this.label3.Text = "Username:";
//
@@ -140,9 +149,10 @@ namespace ntfysh_client
//
this.password.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.password.Location = new System.Drawing.Point(12, 142);
this.password.Location = new System.Drawing.Point(14, 164);
this.password.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.password.Name = "password";
this.password.Size = new System.Drawing.Size(273, 20);
this.password.Size = new System.Drawing.Size(318, 23);
this.password.TabIndex = 6;
this.password.UseSystemPasswordChar = true;
this.password.KeyDown += new System.Windows.Forms.KeyEventHandler(this.password_KeyDown);
@@ -150,18 +160,44 @@ namespace ntfysh_client
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(10, 126);
this.label4.Location = new System.Drawing.Point(12, 145);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 13);
this.label4.Size = new System.Drawing.Size(60, 15);
this.label4.TabIndex = 7;
this.label4.Text = "Password:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(12, 190);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(99, 15);
this.label5.TabIndex = 9;
this.label5.Text = "Connection Type:";
//
// connectionType
//
this.connectionType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.connectionType.FormattingEnabled = true;
this.connectionType.Items.AddRange(new object[] {
"Websockets (Recommended)",
"Long HTTP JSON (Robust)"});
this.connectionType.Location = new System.Drawing.Point(14, 208);
this.connectionType.Name = "connectionType";
this.connectionType.Size = new System.Drawing.Size(318, 23);
this.connectionType.TabIndex = 10;
this.connectionType.TextChanged += new System.EventHandler(this.connectionType_TextChanged);
//
// SubscribeDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(297, 219);
this.ClientSize = new System.Drawing.Size(346, 295);
this.Controls.Add(this.connectionType);
this.Controls.Add(this.label5);
this.Controls.Add(this.password);
this.Controls.Add(this.label4);
this.Controls.Add(this.username);
@@ -172,6 +208,7 @@ namespace ntfysh_client
this.Controls.Add(this.label1);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SubscribeDialog";
@@ -179,6 +216,7 @@ namespace ntfysh_client
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Subscribe to new topic";
this.Load += new System.EventHandler(this.SubscribeDialog_Load);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -199,5 +237,7 @@ namespace ntfysh_client
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox password;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox connectionType;
}
}