Skip to content

Commit

Permalink
Monakey寿命管理の雑対応
Browse files Browse the repository at this point in the history
  • Loading branch information
onihusube committed Mar 31, 2022
1 parent 513eb87 commit 2a375f9
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 7 deletions.
16 changes: 10 additions & 6 deletions 2chAPIProxy/DatProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,8 @@ private void ResPost(Session oSession, bool is2ch)
return;
}

private String Monakey = "00000000-0000-0000-0000-000000000000";
private string Monakey = "00000000-0000-0000-0000-000000000000";
//private string Monakey = "7b6799cc2bb1eef3acadffeecc180df6d1c7caab887326120056660f6ac05b45";


// キー要素があればそれを、無ければ空文字
Expand Down Expand Up @@ -1149,10 +1150,6 @@ private void ResPostv2(Session oSession, bool is2ch)
using (System.IO.Stream PostStream = Write.GetRequestStream())
{
PostStream.Write(Body, 0, Body.Length);
foreach (var header in Write.Headers.AllKeys)
{
System.Diagnostics.Debug.WriteLine($"{header}:{Write.Headers[header].ToString()}");
}

HttpWebResponse wres = (HttpWebResponse)Write.GetResponse();
if (wres.Cookies.Count > 0)
Expand All @@ -1174,12 +1171,19 @@ private void ResPostv2(Session oSession, bool is2ch)
this.Monakey = wres.Headers["X-MonaKey"];
ViewModel.OnModelNotice("MonaKeyを更新しました。");

// 1秒待機する
// 5秒待機する
Thread.Sleep(5000);
}
if (wres.Headers.AllKeys.Contains("X-Chx-Error") == true)
{
ViewModel.OnModelNotice("X-Chx-Error : " + wres.Headers["X-Chx-Error"]);

// E3000番台のエラーが帰ってきたらMonaKeyを更新する(雑な暫定対応
if (wres.Headers["X-Chx-Error"].Contains("E3331") == false && wres.Headers["X-Chx-Error"].Contains("E3"))
{
Monakey = "00000000-0000-0000-0000-000000000000";
}

}

Cookie["DMDM"] = Cookie["MDMD"] = "";
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.03.31 test" Height="480" Width="640"
Title="2chAPIProxy Ver:2022.04.01 test" 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
53 changes: 53 additions & 0 deletions doc/書き込み新仕様関連.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,3 +567,56 @@ Content-Type:text/html; charset=Shift_JIS
Date:Wed, 30 Mar 2022 17:24:46 GMT
Server:cloudflare
```

# 成功 1日放置後

```
オリジナルリクエストヘッダ
Host:egg.5ch.net
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language:ja,en-US;q=0.7,en;q=0.3
Accept-Encoding:gzip, deflate
Referer:http://egg.5ch.net/test/read.cgi/software/1647908521/
Upgrade-Insecure-Requests:1
Content-Type:application/x-www-form-urlencoded
Content-Length:140
Connection:keep-alive
Cookie:READJS="off"; yuki=akari
リクエストヘッダ
User-Agent:Monazilla/1.00 2chMate/0.8.10.153 Dalvik/2.1.0 (Linux; U; Android 12; SC-03L Build/SP1A.210812.016)
Accept:text/html
Content-Type:application/x-www-form-urlencoded
X-PostSig:5a0b940f8cc209fb5fa1eed71fddf39a0e271ce0ec2c08cae8c4110109ff8357
X-APIKey:8yoeAcaLXiEY1FjEuJBKgkPxirkDqn
X-PostNonce:1648740494.174
X-MonaKey:7b6799cc2bb1eef3acadffeecc180df6d1c7caab887326120056660f6ac05b45
Referer:https://egg.5ch.net/test/read.cgi/software/1647908521/
Host:egg.5ch.net
Cookie:READJS="off"; yuki=akari
Content-Length:140
Accept-Encoding:gzip, deflate
Connection:Close
レスポンスヘッダ
Transfer-Encoding:chunked
Connection:close
X-PostPlace:software/1647908521
X-Resnum:254
X-PostDate:1648740634.02
X-PosterID:52NxN5vY
X-RONIN-Stat:NONE
X-Condition:0/0
X-Proc-Time:0.410833 sec.
X-BBx-Stat:180.60.38.129, NONE
Vary:Accept-Encoding
CF-Cache-Status:DYNAMIC
Expect-CT:max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
CF-RAY:6f4a207fa9eafbe8-KIX
Content-Encoding:
Content-Type:text/html; charset=Shift_JIS
Date:Thu, 31 Mar 2022 15:30:34 GMT
Server:cloudflare
```

1 comment on commit 2a375f9

@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.

#2

Please sign in to comment.