Skip to content

Commit

Permalink
[padding] rm
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinZonda committed Sep 25, 2020
1 parent da2eb39 commit 0d7c99d
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 119 deletions.
9 changes: 9 additions & 0 deletions NaiveSharp/ConstText/Msg.cs
@@ -0,0 +1,9 @@
namespace NaiveSharp.ConstText
{
public static class Msg
{
public const string RUNNING_UNDER_BGD = "Hi there! Naive # is still running under background!";

public const string TIP_TITLE = "Naive# Tip";
}
}
4 changes: 0 additions & 4 deletions NaiveSharp/Controller/Command.cs
Expand Up @@ -19,10 +19,6 @@ public static void RunNaive(string proto)
NaiveCmdBuilder.Proxy(Config.Scheme, Config.Username, Config.Password,
Config.Host) +
" --listen=" + proto.ToLower() + "://127.0.0.1:1080";
if (Config.Padding ?? false)
{
p.StartInfo.Arguments += " --padding";
}

// TODO: ADD EXTRA-HEADERS SUPPORT

Expand Down
12 changes: 1 addition & 11 deletions NaiveSharp/Controller/Sharelink.cs
Expand Up @@ -66,11 +66,6 @@ public class Sharelink

var query = HttpUtility.ParseQueryString(uri.Query);

config.Padding = null;
if (bool.TryParse(query["padding"], out bool n))
{
config.Padding = n;
}
if (!string.IsNullOrWhiteSpace(query["extra-headers"]))
{
config.ExtraHeaders = query["extra-headers"];
Expand All @@ -81,10 +76,7 @@ public class Sharelink
public static string Generate()
{
var queryC = HttpUtility.ParseQueryString(string.Empty);
if (Config.Padding.HasValue)
{
queryC.Add("padding", Config.Padding.ToString().ToLower());
}

if (!string.IsNullOrWhiteSpace(Config.ExtraHeaders))
{
queryC.Add("extra-headers", Config.ExtraHeaders);
Expand Down Expand Up @@ -121,8 +113,6 @@ public struct NaiveConfig

public string Scheme;

public bool? Padding;

public string ExtraHeaders;
}
}
4 changes: 1 addition & 3 deletions NaiveSharp/Model/Config.cs
Expand Up @@ -16,8 +16,6 @@ public class Config

public static string Scheme { set; get; } = "https";

public static bool? Padding { set; get; } = null;

public static string ExtraHeaders { set; get; } = null;

public static bool Debug { get; set; } = false;
Expand All @@ -26,7 +24,7 @@ public class Config

public static string ConvertToNs()
{
return Controller.NaiveCmdBuilder.Proxy(Scheme, Username, Password, Host).ToBase64() + " " + Padding;
return Controller.NaiveCmdBuilder.Proxy(Scheme, Username, Password, Host).ToBase64();
}

}
Expand Down
1 change: 1 addition & 0 deletions NaiveSharp/NaiveSharp.csproj
Expand Up @@ -97,6 +97,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ConstText\Msg.cs" />
<Compile Include="ConstText\Path\Clash.cs" />
<Compile Include="ConstText\Path\Config.cs" />
<Compile Include="ConstText\Path\Naive.cs" />
Expand Down
208 changes: 119 additions & 89 deletions NaiveSharp/View/MainWindow.Designer.cs

Large diffs are not rendered by default.

13 changes: 1 addition & 12 deletions NaiveSharp/View/MainWindow.cs
Expand Up @@ -221,15 +221,6 @@ private void txtHost_TextChanged(object sender, EventArgs e)
SyncToTag();
}

private void chkPadding_CheckedChanged(object sender, EventArgs e)
{
if (!(chkPadding.Checked == false && Config.Padding == null))
{
Config.Padding = chkPadding.Checked;
SyncToTag();
}
}

private void rdoHttps_CheckedChanged(object sender, EventArgs e)
{
if (rdoHttps.Checked)
Expand Down Expand Up @@ -360,7 +351,7 @@ private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
Hide();
if (Config.IsFirstTimeHide)
{
icnNotify.ShowBalloonTip(1000, "Naive # Tip", "Hey! Naive # is still running under background!",
icnNotify.ShowBalloonTip(1000, Msg.TIP_TITLE, Msg.RUNNING_UNDER_BGD,
ToolTipIcon.Info);
Config.IsFirstTimeHide = false;
}
Expand Down Expand Up @@ -433,8 +424,6 @@ private void tvwNodeList_AfterSelect(object sender, TreeViewEventArgs e)
txtHost.Text = x.Value.Host;
txtUsername.Text = x.Value.Username;
txtPassword.Text = x.Value.Password;
chkPadding.Checked = x.Value.Padding ?? false;
Config.Padding = x.Value.Padding;
rdoHttps.Checked = x.Value.Scheme.Contains("https");
rdoQuic.Checked = x.Value.Scheme.Contains("quic");
}
Expand Down

0 comments on commit 0d7c99d

Please sign in to comment.