Skip to content

Commit

Permalink
Fix bugs, refactor the code
Browse files Browse the repository at this point in the history
  • Loading branch information
racpast committed Jan 5, 2025
1 parent e318600 commit a1e5e75
Show file tree
Hide file tree
Showing 22 changed files with 1,707 additions and 507 deletions.
1 change: 1 addition & 0 deletions App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<Geometry x:Key="HelpGeometry">M512 85.333333c235.648 0 426.666667 191.018667 426.666667 426.666667s-191.018667 426.666667-426.666667 426.666667S85.333333 747.648 85.333333 512 276.352 85.333333 512 85.333333z m0 89.6a337.066667 337.066667 0 1 0 0 674.133334 337.066667 337.066667 0 0 0 0-674.133334z M551.381333 627.328v-9.813333c0-16.896 3.541333-31.658667 10.538667-45.738667 6.357333-12.672 15.488-24.618667 28.16-35.157333 33.706667-29.525333 54.144-48.512 60.458667-55.552 16.896-22.528 26.026667-51.370667 26.026666-86.528 0-42.88-14.08-76.629333-42.197333-101.248C606.208 267.946667 568.96 256 523.264 256c-52.053333 0-92.842667 14.762667-123.093333 44.288-30.933333 29.568-45.696 70.357333-45.696 122.410667h80.170666c0-29.568 5.632-52.778667 17.578667-68.949334 13.354667-19.669333 35.157333-28.842667 66.133333-28.842666 23.893333 0 42.88 6.357333 56.234667 19.712 12.672 13.354667 19.712 31.658667 19.712 54.869333 0 17.578667-6.357333 34.432-18.986667 49.92l-8.448 9.813333c-45.738667 40.832-73.173333 70.4-82.304 89.344-9.813333 18.986667-14.08 42.24-14.08 68.949334v9.813333h80.896zM512 768c15.488 0 28.16-4.906667 38.698667-14.762667 10.538667-9.813333 16.170667-23.210667 16.170666-38.698666 0-15.445333-5.632-28.16-15.488-37.973334a55.893333 55.893333 0 0 0-39.381333-14.762666c-15.488 0-28.16 4.906667-38.698667 14.762666-10.538667 9.813333-15.445333 22.528-15.445333 37.973334 0 15.488 4.906667 28.16 15.445333 37.973333 10.581333 9.856 23.210667 15.488 38.698667 15.488z</Geometry>
<Geometry x:Key="CropGeometry">M832 728V250.5c0-8.5 3.4-16.6 9.4-22.6L1001 68.3c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L796.1 182.6c-6 6-14.1 9.4-22.6 9.4H296c-4.4 0-8-3.6-8-8V8c0-4.4-3.6-8-8-8h-80c-4.4 0-8 3.6-8 8v176c0 4.4-3.6 8-8 8H8c-4.4 0-8 3.6-8 8v80c0 4.4 3.6 8 8 8h176c4.4 0 8 3.6 8 8v472c0 35.3 28.7 64 64 64h472c4.4 0 8 3.6 8 8v176c0 4.4 3.6 8 8 8h80c4.4 0 8-3.6 8-8V840c0-4.4 3.6-8 8-8h176c4.4 0 8-3.6 8-8v-80c0-4.4-3.6-8-8-8H840c-4.4 0-8-3.6-8-8zM296 288h375.4c7.1 0 10.7 8.6 5.7 13.7L301.7 677.1c-5 5-13.7 1.5-13.7-5.7V296c0-4.4 3.6-8 8-8z m432 448H352.6c-7.1 0-10.7-8.6-5.7-13.7l375.4-375.4c5-5 13.7-1.5 13.7 5.7V728c0 4.4-3.6 8-8 8z</Geometry>
<Geometry x:Key="HomeGeometry">M832 981.333333H597.333333V597.333333a21.333333 21.333333 0 0 0-21.333333-21.333333h-128a21.333333 21.333333 0 0 0-21.333333 21.333333v384H192a64 64 0 0 1-64-64V576H51.413333A42.666667 42.666667 0 0 1 21.333333 503.253333L466.773333 57.813333a64 64 0 0 1 90.453334 0L1002.666667 503.253333A42.666667 42.666667 0 0 1 972.586667 576H896v341.333333a64 64 0 0 1-64 64z m-192-42.666666h192a21.333333 21.333333 0 0 0 21.333333-21.333334V533.333333h119.253334L527.146667 87.893333a21.333333 21.333333 0 0 0-30.08 0L51.413333 533.333333H170.666667v384a21.333333 21.333333 0 0 0 21.333333 21.333334h192V597.333333a64 64 0 0 1 64-64h128a64 64 0 0 1 64 64z</Geometry>
<Geometry x:Key="ExperimentGeometry">M627.2 576c25.6 12.8 38.4 25.6 51.2 44.8l102.4 147.2c6.4 12.8 12.8 25.6 12.8 38.4 0 32-32 64-64 64H307.2c-38.4 0-64-25.6-64-64 0-12.8 6.4-25.6 12.8-38.4l96-140.8c19.2-32 51.2-57.6 83.2-70.4 12.8 6.4 12.8 0 19.2 0 44.8-12.8 70.4-12.8 121.6 0 12.8 6.4 32 12.8 51.2 19.2z m-108.8 32s-12.8 0-44.8 6.4c-25.6 6.4-51.2 25.6-70.4 51.2l-96 140.8c0 6.4 0 12.8 6.4 12.8h416s6.4 0 6.4-6.4l-102.4-147.2c-12.8-25.6-38.4-38.4-64-51.2-25.6-6.4-51.2-6.4-51.2-6.4z m-96 25.6zM217.6 627.2c19.2-25.6 32-44.8 44.8-64l6.4-12.8c19.2-32 64-102.4 89.6-224 6.4-38.4 12.8-76.8 12.8-121.6L377.6 44.8h281.6v204.8c0 121.6 38.4 230.4 102.4 320l121.6 172.8c32 51.2 32 108.8 0 160-25.6 51.2-76.8 76.8-128 76.8H268.8c-57.6 0-102.4-25.6-134.4-76.8s-25.6-102.4 0-153.6m51.2 32c-19.2 25.6-19.2 64 0 96s44.8 44.8 83.2 44.8h486.4c38.4 0 70.4-19.2 83.2-51.2 19.2-32 19.2-70.4 0-102.4l-121.6-166.4C640 499.2 601.6 384 601.6 256V102.4H435.2v102.4c0 51.2-6.4 96-12.8 134.4-32 134.4-83.2 204.8-108.8 243.2l-6.4 12.8c-12.8 25.6-25.6 38.4-44.8 70.4M723.2 102.4H313.6c-19.2 0-32-12.8-32-32s12.8-32 32-32h403.2c19.2 0 32 12.8 32 32s-12.8 32-25.6 32zM620.8 236.8H512c-19.2 0-32-12.8-32-32s12.8-25.6 32-25.6h108.8c19.2 0 32 12.8 32 32s-12.8 25.6-32 25.6zM627.2 358.4H518.4c-19.2 0-32-12.8-32-32s12.8-32 32-32h108.8c19.2 0 32 12.8 32 32s-12.8 32-32 32z</Geometry>
</ResourceDictionary>
</Application.Resources>
</Application>
156 changes: 151 additions & 5 deletions Helpers/HostsRecordHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace SNIBypassGUI
using RpNet.NetworkHelper;

namespace SNIBypassGUI
{
public class HostsSet
{
Expand Down Expand Up @@ -173,12 +175,13 @@ public class HostsSet
public static string[] GoogleSection =
{
"#\tGoogle Start",
"127.0.0.1 google.com",
"127.0.0.1 *.google.com",
"127.0.0.1 google.*",
"127.0.0.1 *.google",
"127.0.0.1 *.google.*",
"127.0.0.1 *.*.google",
"127.0.0.1 *.*.google.*",
"127.0.0.1 googleapis.com",
"127.0.0.1 *.googleapis.com",
"#\tGoogle End"
};

Expand Down Expand Up @@ -254,6 +257,56 @@ public class HostsSet
"127.0.0.1 *.z-lib.fm",
"#\tZ-Library End"
};

public static string[] GelbooruSection =
{
"#\tGelbooru Start",
"127.0.0.1 gelbooru.com",
"127.0.0.1 *.gelbooru.com",
"127.0.0.1 rmzsglng.com",
"127.0.0.1 *.rmzsglng.com",
"#\tGelbooru End"
};

public static string[] SankakuComplexSection =
{
"#\tSankaku Complex Start",
"208.100.24.247 sankakucomplex.com",
"208.100.24.254 s.sankakucomplex.com",
"143.244.50.86 v.sankakucomplex.com",
"208.100.24.244 chan.sankakucomplex.com",
"208.100.24.244 legacy.sankakucomplex.com",
"208.100.24.247 login.sankakucomplex.com",
"208.100.24.252 news.sankakucomplex.com",
"208.100.24.252 forum.sankakucomplex.com",
"208.100.24.247 legal.sankakucomplex.com",
"192.169.120.162 static.sankakucomplex.com",
"208.100.24.247 *.sankakucomplex.com",
"#\tSankaku Complex End"
};

public static string[] IwaraSection =
{
"#\tIwara Start",
"104.26.12.96 iwara.tv",
"104.26.12.96 *.iwara.tv",
"104.26.12.96 *.*.iwara.tv",
"#\tIwara End"
};

public static string[] GithubSection =
{
"#\tGithub Start",
"127.0.0.1 github.com",
"127.0.0.1 *.github.com",
"127.0.0.1 githubusercontent.com",
"127.0.0.1 *.githubusercontent.com",
"127.0.0.1 githubassets.com",
"127.0.0.1 *.githubassets.com",
"127.0.0.1 github.io",
"127.0.0.1 *.github.io",
"#\tGithub End"
};
}
public class HostsSet_Old
{
Expand Down Expand Up @@ -335,6 +388,7 @@ public class HostsSet_Old
"127.0.0.1 www.fanbox.cc",
"127.0.0.1 downloads.fanbox.cc",
"104.18.41.140 api.fanbox.cc",
"#\tFull support is not possible.",
"#\tpixivFANBOX End"
};

Expand Down Expand Up @@ -922,6 +976,7 @@ public class HostsSet_Old
"127.0.0.1 wikifunctions.org",
"127.0.0.1 www.wikifunctions.org",
"127.0.0.1 m.wikifunctions.org",
"#\tFull support is possible, but I'm lazy.",
"#\tWikimedia Foundation End"
};

Expand Down Expand Up @@ -1009,10 +1064,14 @@ public class HostsSet_Old
"#\tGoogle Start",
"127.0.0.1 google.com",
"127.0.0.1 www.google.com",
"127.0.0.1 google.md",
"127.0.0.1 www.google.md",
"127.0.0.1 google.cn",
"127.0.0.1 www.google.cn",
"127.0.0.1 google.com.hk",
"127.0.0.1 www.google.com.hk",
"127.0.0.1 play.google.com",
"127.0.0.1 accounts.google.com",
"127.0.0.1 googleapis.com",
"127.0.0.1 ajax.googleapis.com",
"#\tGoogle End"
};

Expand Down Expand Up @@ -1107,5 +1166,92 @@ public class HostsSet_Old
"127.0.0.1 www.z-lib.fm",
"#\tZ-Library End"
};

public static string[] GelbooruSection =
{
"#\tGelbooru Start",
"127.0.0.1 gelbooru.com",
"127.0.0.1 video-cdn1.gelbooru.com",
"127.0.0.1 video-cdn2.gelbooru.com",
"127.0.0.1 video-cdn3.gelbooru.com",
"127.0.0.1 img1.gelbooru.com",
"127.0.0.1 img2.gelbooru.com",
"127.0.0.1 img3.gelbooru.com",
"127.0.0.1 creative.rmzsglng.com",
"#\tGelbooru End"
};

public static string[] SankakuComplexSection =
{
"#\tSankaku Complex Start",
"208.100.24.247 sankakucomplex.com",
"208.100.24.254 s.sankakucomplex.com",
"143.244.50.86 v.sankakucomplex.com",
"208.100.24.244 chan.sankakucomplex.com",
"208.100.24.244 legacy.sankakucomplex.com",
"208.100.24.247 login.sankakucomplex.com",
"208.100.24.252 news.sankakucomplex.com",
"208.100.24.252 forum.sankakucomplex.com",
"208.100.24.247 legal.sankakucomplex.com",
"192.169.120.162 static.sankakucomplex.com",
"208.100.24.247 www.sankakucomplex.com",
"#\tSankaku Complex End"
};

public static string[] IwaraSection =
{
"#\tIwara Start",
"104.26.12.96 iwara.tv",
"104.26.12.96 api.iwara.tv",
"104.26.12.96 service.iwara.tv",
"104.26.12.96 blade.iwara.tv",
"104.26.12.96 i.iwara.tv",
"104.26.12.96 www.iwara.tv",
"104.26.12.96 silverwolf.iwara.tv",
"104.26.12.96 bronya.iwara.tv",
"104.26.12.96 mikoto.iwara.tv",
"104.26.12.96 files.iwara.tv",
"104.26.12.96 himeko.iwara.tv",
"104.26.12.96 robin.iwara.tv",
"104.26.12.96 firefly.iwara.tv",
"#\tFull support is not possible.",
"#\tIwara End"
};

public static string[] GithubSection =
{
"#\tGithub Start",
"127.0.0.1 github.com",
"127.0.0.1 www.github.com",
"127.0.0.1 gist.github.com",
"127.0.0.1 codeload.github.com",
"127.0.0.1 api.github.com",
"127.0.0.1 redirect.github.com",
"127.0.0.1 copilot.github.com",
"127.0.0.1 services.github.com",
"127.0.0.1 community.github.com",
"127.0.0.1 education.github.com",
"127.0.0.1 enterprise.github.com",
"127.0.0.1 classroom.github.com",
"127.0.0.1 central.github.com",
"127.0.0.1 collector.github.com",
"127.0.0.1 lab.github.com",
"127.0.0.1 pages.github.com",
"127.0.0.1 resources.github.com",
"127.0.0.1 developer.github.com",
"127.0.0.1 partner.github.com",
"127.0.0.1 desktop.github.com",
"127.0.0.1 guides.github.com",
"127.0.0.1 support.github.com",
"127.0.0.1 docs.github.com",
"127.0.0.1 githubusercontent.com",
"127.0.0.1 analytics.githubusercontent.com",
"127.0.0.1 assets-cdn.githubusercontent.com",
"127.0.0.1 githubassets.com",
"127.0.0.1 www.githubassets.com",
"127.0.0.1 github.io",
"127.0.0.1 www.github.io",
"#\tGithub End"
};
}
}
24 changes: 20 additions & 4 deletions Helpers/PublicHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
using System.Security.Cryptography.X509Certificates;
using RpNet.FileHelper;
using System.Collections.Generic;
using System.Windows.Controls.Primitives;
using System.Collections.ObjectModel;
using System.Windows.Documents;


namespace SNIBypassGUI
{
Expand All @@ -23,7 +20,7 @@ public class PublicHelper
public static FilesINI ConfigINI = new FilesINI();

// 既定版本号,更新时需要修改
public const string PresetGUIVersion = "V3.4";
public const string PresetGUIVersion = "V3.5";

// 用于判断是否需要禁用适配器IPv6的域名
public const string DomainForIPv6DisableDecision = "pixiv.net";
Expand All @@ -32,6 +29,20 @@ public class PublicHelper
public const string PresetYiyan = "行远自迩,登高自卑。";
public const string PresetYiyanForm = "—— 戴圣「礼记」";

// s.pximg.net
public static string[] pximgIP = new string[]
{
"210.140.139.135",
"210.140.139.132",
"210.140.139.137",
"210.140.139.134",
"210.140.139.131",
"210.140.139.133",
"210.140.139.130",
"210.140.139.129",
"210.140.139.136"
};

// 字符串转换为布尔值的类
public class StringBoolConverter
{
Expand Down Expand Up @@ -169,6 +180,7 @@ public static bool InstallCertificate()
{
{ "程序设置:Background", "Preset" },
{ "程序设置:ActiveAdapter", "" },
{ "程序设置:PixivIPPreference", "false" },
{ "高级设置:DebugMode", "false" },
{ "高级设置:GUIDebug", "false" },
{ "高级设置:DomainNameResolutionMethod", "DnsService" },
Expand Down Expand Up @@ -198,14 +210,18 @@ public class SwitchItem
new SwitchItem {FaviconImageSource = "Resources/favicons/e-hentai.ico", SwitchTitle = "E-Hentai(含里站)", LinksText = "e-hentai.org|、|exhentai.org", ToggleButtonName="ehentaiTB", SectionName = "E-Hentai", HostsRecord = HostsSet.EHentaiSection, OldHostsRecord = HostsSet_Old.EHentaiSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/etsy.png", SwitchTitle = "Etsy", LinksText = "etsy.com", ToggleButtonName="etsyTB", SectionName = "Etsy", HostsRecord = HostsSet.EtsySection, OldHostsRecord = HostsSet_Old.EtsySection},
new SwitchItem {FaviconImageSource = "Resources/favicons/fdroid.png", SwitchTitle = "F-Droid(未完整支持)", LinksText = "f-droid.org", ToggleButtonName="fdroidTB", SectionName = "F-Droid", HostsRecord = HostsSet.FDroidSection, OldHostsRecord = HostsSet_Old.FDroidSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/gelbooru.png", SwitchTitle = "Gelbooru(纯看运气)", LinksText = "gelbooru.com", ToggleButtonName="gelbooruTB", SectionName = "Gelbooru", HostsRecord = HostsSet.GelbooruSection, OldHostsRecord = HostsSet_Old.GelbooruSection },
new SwitchItem {FaviconImageSource = "Resources/favicons/github.png", SwitchTitle = "Github", LinksText = "github.com", ToggleButtonName="githubTB", SectionName = "Github", HostsRecord = HostsSet.GithubSection, OldHostsRecord = HostsSet_Old.GithubSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/google.png", SwitchTitle = "谷歌搜索", LinksText = "google.com", ToggleButtonName="googleTB", SectionName = "Google", HostsRecord = HostsSet.GoogleSection, OldHostsRecord = HostsSet_Old.GoogleSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/iwara.png", SwitchTitle = "Iwara", LinksText = "iwara.tv", ToggleButtonName= "iwaraTB", SectionName = "Iwara", HostsRecord = HostsSet.IwaraSection, OldHostsRecord = HostsSet_Old.IwaraSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/nyaa.png", SwitchTitle = "Nyaa(含里站)", LinksText = "nyaa.si|、|sukebei.nyaa.si", ToggleButtonName="nyaaTB", SectionName = "Nyaa", HostsRecord = HostsSet.NyaaSection, OldHostsRecord = HostsSet_Old.NyaaSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/ok.png", SwitchTitle = "OK", LinksText = "ok.ru", ToggleButtonName="okTB", SectionName = "OK", HostsRecord = HostsSet.OKSection, OldHostsRecord = HostsSet_Old.OKSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/okx.png", SwitchTitle = "OKX.COM", LinksText = "okx.com", ToggleButtonName="okxTB", SectionName = "OKX.COM", HostsRecord = HostsSet.OKXCOMSection, OldHostsRecord = HostsSet_Old.OKXCOMSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/pixiv.ico", SwitchTitle = "Pixiv", LinksText = "pixiv.net", ToggleButtonName="pixivTB", SectionName = "Pixiv", HostsRecord = HostsSet.PixivSection, OldHostsRecord = HostsSet_Old.PixivSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/pixivFANBOX.ico", SwitchTitle = "pixivFANBOX", LinksText = "fanbox.cc", ToggleButtonName="fanboxTB", SectionName = "pixivFANBOX", HostsRecord = HostsSet.pixivFANBOXSection, OldHostsRecord = HostsSet_Old.pixivFANBOXSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/pornhub.ico", SwitchTitle = "Pornhub(不稳定)", LinksText = "pornhub.com", ToggleButtonName="pornhubTB", SectionName = "Pornhub", HostsRecord = HostsSet.PornhubSection, OldHostsRecord = HostsSet_Old.PornhubSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/proton.png", SwitchTitle = "Proton", LinksText = "proton.me", ToggleButtonName="protonTB", SectionName = "Proton", HostsRecord = HostsSet.ProtonSection, OldHostsRecord = HostsSet_Old.ProtonSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/sankakucomplex.ico", SwitchTitle = "Sankaku Complex", LinksText = "sankakucomplex.com", ToggleButtonName="sankakucomplexTB", SectionName = "Sankaku Complex", HostsRecord = HostsSet.SankakuComplexSection, OldHostsRecord = HostsSet_Old.SankakuComplexSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/steamcommunity.ico", SwitchTitle = "Steam Community", LinksText = "steamcommunity.com", ToggleButtonName="steamcommunityTB", SectionName = "Steam Community", HostsRecord = HostsSet.SteamCommunitySection, OldHostsRecord = HostsSet_Old.SteamCommunitySection},
new SwitchItem {FaviconImageSource = "Resources/favicons/telegram.png", SwitchTitle = "Telegram", LinksText = "telegram.org", ToggleButtonName="telegramTB", SectionName = "Telegram", HostsRecord = HostsSet.TelegramSection, OldHostsRecord = HostsSet_Old.TelegramSection},
new SwitchItem {FaviconImageSource = "Resources/favicons/thenewyorktimes.png", SwitchTitle = "The New York Times", LinksText = "nytimes.com", ToggleButtonName="thenewyorktimesTB", SectionName = "The New York Times", HostsRecord = HostsSet.TheNewYorkTimesSection, OldHostsRecord = HostsSet_Old.TheNewYorkTimesSection},
Expand Down
2 changes: 1 addition & 1 deletion ImageClippingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="/Resources/DefaultBkg.png"/>
<ImageBrush Stretch="UniformToFill" ImageSource="/Resources/DefaultBkg.jpg"/>
</Grid.Background>
<Border x:Name="TopBar" Grid.Row="0" Margin="20,10,20,0" Background="#70FFFFFF" BorderThickness="1.5,1.5,1.5,1.5" CornerRadius="5,5,5,5">
<Border.BorderBrush>
Expand Down
Loading

0 comments on commit a1e5e75

Please sign in to comment.