Skip to content

Commit

Permalink
一部の鯖(uni.2ch.netなど)の移転に対応
Browse files Browse the repository at this point in the history
  • Loading branch information
gomita committed Mar 29, 2014
1 parent 6bf5420 commit 4fece75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chrome/content/foxage2ch/transfer.js
Expand Up @@ -37,7 +37,7 @@ var TransferWizard = {
var loadCallback = function(aResponseText) {
if (aResponseText.indexOf("<title>2chbbs..</title>" ) < 0 ||
aResponseText.indexOf("Change your bookmark ASAP.") < 0 ||
!/<a href=\"([^\"]+)\">GO !<\/a>/.test(aResponseText)) {
!/<a href=\"([^\"]+)\">GO !<\/a/.test(aResponseText)) {
this._errorCallback(this.owner.bundle.getString("DETECT_FAILURE"));
return;
}
Expand Down
12 changes: 12 additions & 0 deletions modules/utils.jsm
Expand Up @@ -606,7 +606,18 @@ HTTPRequest.prototype = {
FoxAge2chUtils.reportError("Redirected: " + orgURL + " > " + url);
}
// #debug-end
// 一部の鯖(uni.2ch.netなど)で、移転済みにも関わらずsubject.txtがリダイレクトされず
// HTTPステータス200で返ってくるため、その中身まで見ないと移転済みかを判別できない。
var validateSubjectTxt = function(aText) {
var lines = aText.split("\n");
return (
lines.length == 3 &&
lines[0].indexOf("9246366142.dat<>") == 0 &&
lines[1].indexOf("9248888888.dat<>") == 0
);
};
if (aEvent.type == "load" && this._request.status == 200 && this._request.responseText &&
!validateSubjectTxt(this._request.responseText) &&
errorURLs.indexOf(url) < 0)
// ステータス200でなおかつレスポンステキストありでなおかつ人大杉でない
this._loadCallback(this._request.responseText);
Expand All @@ -615,6 +626,7 @@ HTTPRequest.prototype = {
// ステータス302 (人大杉)
// ステータス403 (バーボンハウス)
// レスポンステキストなし (移転済み板のsubject.txt)
// 9246366142.datと9248888888.datしかない (移転済み)
// http://www2.2ch.net/live.html (人大杉)
// http://server.maido3.com/ (移転済み?)
this._errorCallback(this._request.status);
Expand Down

0 comments on commit 4fece75

Please sign in to comment.