fork download
  1. function roninLogin(wp, isRes)
  2. {
  3. if ((String(wp.thread.url)).indexOf('bbspink') < 0) { return true; }
  4.  
  5. // ---- [ログイン情報] --------------------------
  6.  
  7. var userEmail = '';
  8. var secretKey = '';
  9.  
  10. // ---- [初期認証] ------------------------------
  11.  
  12. var session = v2c.getScriptObject();
  13.  
  14. if (!session) {
  15. var data = new java.lang.String('ID=' + userEmail + '&PW=' + secretKey);
  16. var hr = v2c.createHttpRequest('http://a...content-available-to-author-only...k.com/ronin/?' + data);
  17. hr.setRequestProperty('User-Agent', 'DOLIB/1.00');
  18. hr.setRequestProperty('X-2ch-UA', 'V2C/2.11.4');
  19. hr.setRequestProperty('Referer', 'http://a...content-available-to-author-only...k.com');
  20. hr.setRequestProperty('Host', 'http://a...content-available-to-author-only...k.com');
  21. session = {};
  22. session.tt = new Date();
  23. session.sid = String(hr.getContentsAsString()).replace(/[\r\n]/g, '');
  24. if (session.sid.indexOf('SESSION-ID=ERROR:') >= 0) {
  25. v2c.println('[post.js:PINKチャンネル浪人BETA] セッションの取得に失敗しました。\r\nIDとパスワードに誤りがないか確認してください。');
  26. return false;
  27. }
  28. v2c.setScriptObject(session);
  29. }
  30.  
  31. // ---- [POSTデータ作成] ------------------------
  32.  
  33. /*
  34. var boundary = "ghj39458tu43";
  35. function putd(boun, name, val) {
  36. return '---' + boun + '\r\n' +
  37. 'Content-Disposition: form-data; name="' + name + '"\r\n' +
  38. '\r\n' +
  39. val + '\r\n';
  40. }
  41. var data = putd(boundary, 'bbs', wp.thread.board.key);
  42. data += putd(boundary, 'key', wp.thread.key);
  43. data += putd(boundary, 'sid', session.sid);
  44. data += putd(boundary, 'FROM', wp.name);
  45. data += putd(boundary, 'MESSAGE', wp.message);
  46. data += putd(boundary, 'mail', wp.mail);
  47. data += putd(boundary, 'time', '1');
  48. data += putd(boundary, 'submit', '書き込む');
  49. if (!isRes) {
  50. data += putd(boundary, 'subject', wp.title);
  51. }
  52.  
  53. data += '---' + boundary + '--\r\n';
  54. data = new java.lang.String(data);
  55. var buf = data.getBytes("MS932");
  56. */
  57. v2c.println(session.sid);
  58. var data = 'bbs=' + wp.thread.board.key + '&key=' + wp.thread.key + '&sid=' + session.sid + '&FROM=' + wp.name + '&MESSAGE=' + wp.message + '&mail=' + wp.mail + '&time=1&submit=書き込む';
  59.  
  60. // ---- [レスorスレ立て送信] --------------------
  61. var hr = v2c.createHttpRequest('http://' + wp.thread.url.host + '/test/bbs.cgi?guid=ON', data);
  62. hr.setRequestProperty('Host', wp.thread.board.url.host);
  63. hr.setRequestProperty('Referer', wp.thread.url);
  64. hr.setRequestProperty('User-Agent', 'Monazilla/1.00');
  65. var responseMes = hr.getContentsAsString();
  66. v2c.println(responseMes);
  67. if (responseMes.indexOf('書きこみが終わりました。') >= 0) {
  68. wp.name.text = '';
  69. wp.mail.text = '';
  70. wp.title.text = '';
  71. wp.message.text = '';
  72. java.lang.Thread.sleep(1000);
  73. var hr = v2c.createHttpRequest('http://' + wp.thread.host + '/' + wp.thread.board.key + '/dat/' + wp.thread.key + '.dat');
  74. var dat = hr.getContentsAsBytes();
  75. v2c.println(dat);
  76. if (dat) {
  77. var th = wp.thread;
  78. th.importDatBytes(dat);
  79. var res = th.getRes(th.localResCount - 1);
  80. var rl = v2c.getResLabel('書き込み');
  81. if (rl) { res.setResLabel(rl); }
  82. }
  83. }
  84. /*
  85. var postUrl = 'http://' + wp.thread.url.host + '/test/bbs.cgi?guid=ON';
  86. var url = new java.net.URL(postUrl);
  87. var conn = url.openConnection();
  88. with (conn) {
  89. setDoOutput(true);
  90. setRequestProperty('Host', wp.thread.board.url.host);
  91. setRequestProperty('Referer', wp.thread.url);
  92. setRequestProperty('User-Agent', 'Monazilla/1.00');
  93. with (JavaImporter(java.io)) {
  94. var dos = new DataOutputStream(getOutputStream());
  95. dos.write(buf, 0, buf.length);
  96. dos.flush();
  97. dos.close();
  98.  
  99. var ins = getInputStream();
  100. var bReader = new BufferedReader(new InputStreamReader(ins));
  101.  
  102. var responseData = null;
  103. if (getResponseCode() == 200) {
  104. while ((responseData = bReader.readLine()) != null) {
  105. v2c.println(responseData);
  106. }
  107. }
  108. ins.close();
  109. }
  110. }
  111. */
  112.  
  113. return false;
  114. }
  115.  
  116.  
Success #stdin #stdout 0.46s 382912KB
stdin
Standard input is empty
stdout
Standard output is empty