Last active
August 29, 2015 14:13
-
-
Save foomin10/a3f348e27abe64dd37ea to your computer and use it in GitHub Desktop.
[804.zip] 過去ログ倉庫@いろいろ のパッチを chaika 1.7.3 に適用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 685f09c16147d7d44d0f5f392b78af4e33f0a955 Mon Sep 17 00:00:00 2001 | |
From: anonymous <anonymous@2ch.net> | |
Date: Tue, 9 Sep 2014 11:08:33 +0900 | |
Subject: [PATCH] =?UTF-8?q?[804.zip]=20=E9=81=8E=E5=8E=BB=E3=83=AD?= | |
=?UTF-8?q?=E3=82=B0=E5=80=89=E5=BA=AB=EF=BC=A0=E3=81=84=E3=82=8D=E3=81=84?= | |
=?UTF-8?q?=E3=82=8D=20=E3=81=AE=E3=83=91=E3=83=83=E3=83=81=E9=81=A9?= | |
=?UTF-8?q?=E7=94=A8?= | |
MIME-Version: 1.0 | |
Content-Type: text/plain; charset=UTF-8 | |
Content-Transfer-Encoding: 8bit | |
--- | |
chaika/defaults/preferences/chaika-pref.js | 4 + | |
chaika/modules/server/thread-status.properties | 10 ++ | |
chaika/modules/server/thread.js | 157 ++++++++++++++++++++++++- | |
3 files changed, 167 insertions(+), 4 deletions(-) | |
diff --git a/chaika/defaults/preferences/chaika-pref.js b/chaika/defaults/preferences/chaika-pref.js | |
index 4030798..d166f80 100644 | |
--- a/chaika/defaults/preferences/chaika-pref.js | |
+++ b/chaika/defaults/preferences/chaika-pref.js | |
@@ -110,6 +110,10 @@ pref("extensions.chaika.thread_aa_font_size", 16); | |
pref("extensions.chaika.thread_aa_line_space", 2); | |
pref("extensions.chaika.thread_show_be_icon", false); | |
pref("extensions.chaika.thread_get_log_from_mimizun", false); | |
+pref("extensions.chaika.thread_get_log_from_offlaw2", false); | |
+pref("extensions.chaika.thread_get_log_from_unkar", false); | |
+pref("extensions.chaika.thread_get_log_from_bg20", false); | |
+pref("extensions.chaika.thread_get_log_from_viprpg", false); | |
pref("extensions.chaika.thread_alert_got_log", true); | |
pref("extensions.chaika.thread_fix_invalid_anchor", false); | |
diff --git a/chaika/modules/server/thread-status.properties b/chaika/modules/server/thread-status.properties | |
index a315502..a7db1c5 100644 | |
--- a/chaika/modules/server/thread-status.properties | |
+++ b/chaika/modules/server/thread-status.properties | |
@@ -11,3 +11,13 @@ skin_load_error = スキン(%S) の読み込みに失敗したため、設定を | |
got_a_log_from_maru = 2chビューア(●) で「 %S 」のログを取得しました | |
got_a_log_from_mimizun = みみずん検索から「 %S 」のログを取得しました | |
+got_a_log_from_offlaw2 = 2ch過去ログ倉庫から「 %S 」のログを取得しました | |
+got_a_log_from_unkar = unkarから「 %S 」のログを取得しました | |
+got_a_log_from_bg20 = bg20鯖から「 %S 」のログを取得しました | |
+got_a_log_from_vip2ch = VIPService過去ログ倉庫から「 %S 」のログを取得しました | |
+got_a_log_from_viprpg = VIPツクスレ作品保管庫から「 %S 」のログを取得しました | |
+got_a_log_from_yykakiko = わいわいKakiko過去ログ倉庫から「 %S 」のログを取得しました | |
+got_a_log_from_blogkakiko = ぶろぐカキコ過去ログ倉庫から「 %S 」のログを取得しました | |
+got_a_log_from_blogban = Blogban過去ログ倉庫から「 %S 」のログを取得しました | |
+got_a_log_from_jane = Jane板過去ログ倉庫から「 %S 」のログを取得しました | |
+got_a_log_from_squad = 報告人作戦分隊過去ログ倉庫から「 %S 」のログを取得しました | |
diff --git a/chaika/modules/server/thread.js b/chaika/modules/server/thread.js | |
index 97dd198..eacba13 100644 | |
--- a/chaika/modules/server/thread.js | |
+++ b/chaika/modules/server/thread.js | |
@@ -791,11 +791,96 @@ Thread2ch.prototype = { | |
datDownload: function(aKako){ | |
this._maruMode = false; | |
this._mimizunMode = false; | |
+ this._offlaw2Mode = false; | |
+ this._unkarMode = false; | |
+ this._bg20Mode = false; | |
+ this._vip2chMode = false; | |
+ this._viprpgMode = false; | |
+ this._yykakikoMode = false; | |
+ this._blogkakikoMode = false; | |
+ this._blogbanMode = false; | |
+ this._janeMode = false; | |
+ this._squadMode = false; | |
if(aKako){ | |
this._kakoDatDownload = true; | |
- if(ChaikaRoninLogin.isLoggedIn()){ | |
+ if(this.thread.boardURL.host == "ex14.vip2ch.com" || this.thread.boardURL.host == "mattari.plusvip.jp" || this.thread.boardURL.host == "report-section.hiyoko.biz"){ | |
+ var vip2chURLSpec = [ | |
+ "http://", | |
+ this.thread.boardURL.host, | |
+ this.thread.boardURL.filePath, | |
+ "kako/", | |
+ this.thread.datID.substring(0, 4), | |
+ "/", | |
+ this.thread.datID.substring(0, 5), | |
+ "/", | |
+ this.thread.datID, | |
+ ".dat" | |
+ ].join(""); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ | |
+ var vip2chURL = ioService.newURI(vip2chURLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(vip2chURL); | |
+ if(this.thread.boardURL.host.match(/vip2ch/)){ | |
+ this._vip2chMode = true; | |
+ }else if(this.thread.boardURL.host.match(/hiyoko\.biz/)){ | |
+ this._squadMode = true; | |
+ }else{ | |
+ this._janeMode = true; | |
+ } | |
+ }else if(this.thread.boardURL.host == "jane.s28.xrea.com"){ | |
+ janeURLSpec = [ | |
+ "http://www13.atpages.jp/~janebbs/kakolog/dat/", | |
+ this.thread.datID, | |
+ ".dat" | |
+ ].join(""); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var janeURL = ioService.newURI(janeURLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(janeURL); | |
+ this._janeMode = true; | |
+ }else if(this.thread.boardURL.host.match(/(?:b|yy)\d+\.(?:\d+\.kg|kakiko\.com)/)){ | |
+ var kakikoURLSpec = [ | |
+ "http://", | |
+ this.thread.boardURL.host, | |
+ this.thread.boardURL.filePath, | |
+ "kako/", | |
+ this.thread.datID.substring(0, 4), | |
+ "/", | |
+ this.thread.datID.substring(0, 5), | |
+ "/", | |
+ this.thread.datID, | |
+ ".dat" | |
+ ].join(""); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var kakikoURL = ioService.newURI(kakikoURLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(kakikoURL); | |
+ if(this.thread.boardURL.host.match(/yy\d+/)){ | |
+ this._yykakikoMode = true; | |
+ }else{ | |
+ this._blogkakikoMode = true; | |
+ } | |
+ }else if(this.thread.boardURL.host.match("blogban.net")){ | |
+ var blogbanURLSpec = [ | |
+ "http://", | |
+ this.thread.boardURL.host, | |
+ this.thread.boardURL.filePath, | |
+ "kako/dat/", | |
+ this.thread.datID, | |
+ ".dat" | |
+ ].join("").replace("/kako", "_kako"); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var blogbanURL = ioService.newURI(blogbanURLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(blogbanURL); | |
+ this._blogbanMode = true; | |
+ }else if(this.thread.boardURL.host.match(/2ch|bbspink/) && ChaikaCore.pref.getBool("thread_get_log_from_offlaw2")) { | |
+ var offlaw2URLSpec = this.thread.plainURL.spec.replace(/read\.cgi\/([^\/]+)\/(\d{9,10})\/.*/, "offlaw2.so?shiro=kuma&bbs=$1&key=$2&sid=ERROR"); | |
+ | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var offlaw2URL = ioService.newURI(offlaw2URLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(offlaw2URL); | |
+ this._offlaw2Mode = true; | |
+ }else if(ChaikaRoninLogin.isLoggedIn()){ | |
//Rokka spec: https://github.com/Cipherwraith/Rokka/blob/master/README.md | |
let KAGI = encodeURIComponent(ChaikaCore.pref.getChar("login.ronin.session_id")); | |
let hostParts = this.thread.plainURL.host.split('.'); | |
@@ -813,6 +898,39 @@ Thread2ch.prototype = { | |
this.httpChannel = ChaikaCore.getHttpChannel(datKakoURL); | |
this._maruMode = true; | |
+ }else if(this.thread.boardURL.host.match(/2ch/) && ChaikaCore.pref.getBool("thread_get_log_from_bg20")){ | |
+ var bg20URLSpec = [ | |
+ "http://bg20.2ch.net/test/r.so/", | |
+ this.thread.boardURL.host, | |
+ this.thread.boardURL.filePath, | |
+ this.thread.datID, | |
+ "/" | |
+ ].join(""); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var bg20URL = ioService.newURI(bg20URLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(bg20URL); | |
+ this._bg20Mode = true; | |
+ }else if(ChaikaCore.pref.getBool("thread_get_log_from_unkar")){ | |
+ var unkarURLSpec = [ | |
+ "http://unkar.org/convert.php", | |
+ this.thread.boardURL.filePath, | |
+ this.thread.datID, | |
+ ".dat" | |
+ ].join(""); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var unkarURL = ioService.newURI(unkarURLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(unkarURL); | |
+ this._unkarMode = true; | |
+ }else if(ChaikaCore.pref.getBool("thread_get_log_from_viprpg")){ | |
+ var viprpgURLSpec = [ | |
+ "http://www.viprpg.org/archive/dat/", | |
+ this.thread.datID, | |
+ ".dat" | |
+ ].join(""); | |
+ var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
+ var viprpgURL = ioService.newURI(viprpgURLSpec, null, null).QueryInterface(Ci.nsIURL); | |
+ this.httpChannel = ChaikaCore.getHttpChannel(viprpgURL); | |
+ this._viprpgMode = true; | |
}else if(ChaikaCore.pref.getBool("thread_get_log_from_mimizun")){ | |
let mimizunURLSpec = [ | |
"http://mimizun.com/log/2ch", | |
@@ -899,7 +1017,7 @@ Thread2ch.prototype = { | |
this._aboneChecked = true; | |
- if(this._maruMode && !this._mimizunMode && this._data.length === 0){ | |
+ if(this._maruMode && !this._mimizunMode && !this._offlaw2Mode && !this._unkarMode && !this._bg20Mode && !this._vip2chMode && !this._viprpgMode && !this._yykakikoMode && !this._blogkakikoMode && !this._blogbanMode && !this._janeMode && !this._squadMode && this._data.length === 0){ | |
if(availableData.match(/\n/)){ | |
availableData = RegExp.rightContext; | |
}else{ | |
@@ -977,7 +1095,7 @@ Thread2ch.prototype = { | |
break; | |
case 302: // DAT落ち | |
case 403: // DAT落ちに対して403が返される場合がある: https://github.com/chaika/chaika/issues/105 | |
- if(this._kakoDatDownload){ | |
+ if(this._kakoDatDownload || this.thread.lineCount > 1000){ | |
this.write(this.converter.getFooter("dat_down")); | |
this.close(); | |
}else{ | |
@@ -992,6 +1110,16 @@ Thread2ch.prototype = { | |
this.write(this.converter.getFooter("abone")); | |
this.close(); | |
return; | |
+ case 404: // Not Found | |
+ if(this.thread.boardURL.host == "ex14.vip2ch.com" || this.thread.boardURL.host.match(/(?:b|yy)\d+\.(?:\d+\.kg|kakiko\.com)/) || this.thread.boardURL.host == "blogban.net" || this.thread.boardURL.host == "jane.s28.xrea.com" || this.thread.boardURL.host == "mattari.plusvip.jp" || this.thread.boardURL.host == "report-section.hiyoko.biz"){ | |
+ if(this._kakoDatDownload || this.thread.lineCount > 1000){ | |
+ this.write(this.converter.getFooter("dat_down")); | |
+ this.close(); | |
+ }else{ | |
+ this.datDownload(true); | |
+ } | |
+ return; | |
+ } | |
default: // HTTP エラー | |
this.write(this.converter.getFooter(httpStatus)); | |
this.close(); | |
@@ -1033,7 +1161,7 @@ Thread2ch.prototype = { | |
// .dat の追記書き込み | |
this.thread.appendContent(aDatContent); | |
- if(this._maruMode || this._mimizunMode){ | |
+ if(this._maruMode || this._mimizunMode || this._offlaw2Mode || this._unkarMode || this._bg20Mode || this._vip2chMode || this._viprpgMode || this._yykakikoMode || this._blogkakikoMode || this._blogbanMode || this._janeMode || this._squadMode){ | |
this.thread.maruGetted = true; | |
this._alertGotLog(); | |
} | |
@@ -1056,11 +1184,32 @@ Thread2ch.prototype = { | |
alertStrID = "got_a_log_from_maru"; | |
}else if(this._mimizunMode){ | |
alertStrID = "got_a_log_from_mimizun"; | |
+ }else if(this._offlaw2Mode){ | |
+ alertStrID = "got_a_log_from_offlaw2"; | |
+ }else if(this._unkarMode){ | |
+ alertStrID = "got_a_log_from_unkar"; | |
+ }else if(this._bg20Mode){ | |
+ alertStrID = "got_a_log_from_bg20"; | |
+ }else if(this._vip2chMode){ | |
+ alertStrID = "got_a_log_from_vip2ch"; | |
+ }else if(this._viprpgMode){ | |
+ alertStrID = "got_a_log_from_viprpg"; | |
+ }else if(this._yykakikoMode){ | |
+ alertStrID = "got_a_log_from_yykakiko"; | |
+ }else if(this._blogkakikoMode){ | |
+ alertStrID = "got_a_log_from_blogkakiko"; | |
+ }else if(this._blogbanMode){ | |
+ alertStrID = "got_a_log_from_blogban"; | |
+ }else if(this._janeMode){ | |
+ alertStrID = "got_a_log_from_jane"; | |
+ }else if(this._squadMode){ | |
+ alertStrID = "got_a_log_from_squad"; | |
}else{ | |
return; | |
} | |
var alertStr = statusBundle.formatStringFromName(alertStrID, [this.thread.title], 1); | |
+ alertStr = alertStr.replace(/&(?:amp;)?/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "\'").replace(/‚/g, "\u201a").replace(/„/g, "\u201e").replace(/&lsquo/g, "\u2018").replace(/’/g, "\u2019").replace(/“/g, "\u201c").replace(/”/g, "\u201d").replace(/•/g, "\u2022").replace(/'/g, "\'"); | |
try{ | |
var alertsService = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService); | |
alertsService.showAlertNotification("chrome://chaika/content/icon.png", "Chaika", alertStr, false, "", null); | |
-- | |
1.9.4.msysgit.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
コミットID 685f09c からパッチを作成
unkar は使えなくなりましたが、そのままにしております。