Skip to content

Commit

Permalink
板一覧URL前後の"を削除する(動いてなかったのを修正)、あとhttpsの扱いのバグ修正
Browse files Browse the repository at this point in the history
  • Loading branch information
onihusube committed Apr 15, 2023
1 parent 9a37836 commit 756555e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 7 deletions.
41 changes: 41 additions & 0 deletions 2chAPIProxy/AppSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ public String CryptData(String data, bool encrypt = true)

public class BoardSettings
{
public string Preset { get; set; }

public string UserAgent { get; set; }

public bool SetOekaki { get; set; } = false;
Expand All @@ -436,4 +438,43 @@ public class BoardSettings

public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
}


public enum NonceTypeEnum
{
Sec = 0,
Milisec,
MilisecZero,
MilisecRandom
}

public enum RefererTypeEnum
{
BoardURL,
ThreadURL,
ThreadURLl50
}

public class PostSettings
{
public string UserAgent { get; set; }

public string AppKey { get; set; }

public string HMkey { get; set; }

public string PostFiledOrder { get; set; }

public string ThreadPostFieldOrder { get; set; }

public NonceTypeEnum NonceType { get; set; } = NonceTypeEnum.Milisec;

public RefererTypeEnum RefererType { get; set; } = RefererTypeEnum.ThreadURL;

public bool KeepAlive { get; set; } = false;

//public string ContentType { get; set; }

public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();
}
}
10 changes: 4 additions & 6 deletions 2chAPIProxy/DatProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,16 @@ private void BBSMenuURLReplace(ref Session oSession, bool is2ch)
{
FiddlerApplication.BeforeResponse -= MRHandler;
var html = ooSession.GetResponseBodyAsString();
//板一覧の板URLの前後に""があった場合に消す(大丈夫そうならいらない?)
// 板一覧の板URLの前後に""があった場合に消す(大丈夫そうならいらない?)
var ItaMatches = Regex.Matches(html, $@"<(?:A HREF|a href)={'"'}(?:https?:)?(//\w+?\.(?:2ch\.net|5ch\.net|bbspink\.com)/\w+/?){'"'}>(.+)</(?:A|a)>");
foreach (Match ita in ItaMatches)
{
String replace = $"<A HREF=http:{ita.Groups[1].Value}>{ita.Groups[2].Value}</A>";
html.Replace(ita.Value, replace);
String replace = $"<A HREF=https:{ita.Groups[1].Value}>{ita.Groups[2].Value}</A>";
html = html.Replace(ita.Value, replace);
}
//これがなんだったのか分からないけどバグっぽい
//html = Regex.Replace(html, $@"<(?:A HREF|a href)={'"'}(?:https?:)?(//.+?){'"'}>(.+?)</(?:A|a)>", "<A HREF=http:$1>$2</A>");
if (is2ch) html = html.Replace(".5ch.net/", ".2ch.net/");
//板のhttpsリンクをhttpにする
// 板のhttpsリンクをhttpにする
if (ViewModel.Setting.ReplaceHttpsLink) html = html.Replace("https", "http");
ooSession.ResponseBody = Encoding.GetEncoding("shift_jis").GetBytes(html);
};
Expand Down
2 changes: 1 addition & 1 deletion 2chAPIProxy/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:_2chAPIProxy" mc:Ignorable="d" x:Class="_2chAPIProxy.MainWindow"
Title="2chAPIProxy Ver:2022.05.06 test" Height="480" Width="640"
Title="2chAPIProxy Ver:2022.08.05" Height="480" Width="640"
Icon="icon3.ico" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" Background="White" d:DataContext="{d:DesignInstance {x:Type local:ViewModel}}">
<Window.InputBindings>
<KeyBinding Gesture="Ctrl+S" Command="{Binding SaveSetting}"/>
Expand Down

1 comment on commit 756555e

@onihusube
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#6

Please sign in to comment.