narou 2.8.3 → 2.8.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of narou might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b383b0dfd3d47fda5cdf319be4bb15615e4757c
4
- data.tar.gz: 432a626b225f55fa99fe5450016e4108f768ad22
3
+ metadata.gz: 70f7f7b7209627370ad63d4870e25254e904434c
4
+ data.tar.gz: 8df9999d62fcac1dc06c4dd4ab063b7cdecfa2dc
5
5
  SHA512:
6
- metadata.gz: ac05edc568f56fa3e46f6d2f4bfb6a9444e21c5eb28deb5f44aefb7e92aae70ddeb2c8ae3c896d8c7296f331b6d901d0818f1dd74589014144bdbdd20317a897
7
- data.tar.gz: 123cb7ed8fbbff11d8dd07abebf90efcb1dde78462cda154f259de434c396a62a5b21054d1e9ff58069cd7f9384aaa1ccdd8900c476ed724e92ac1154add0013
6
+ metadata.gz: ff21146250d516906112510e453ba9113375a04f257d456a67ff73a834676aa3f35cbd6275822cc95cf7394aa977891c144147a4752849764006ad1fed417858
7
+ data.tar.gz: b7c5211400fc11eaa6d8512a36dfc211f68149f5a3dfa203be3ea8d3eef0d1fae885dfea87824c21169bb342384d7ddfe89c3f6966b497e4cc09fe1169f6cdc1
@@ -2,50 +2,12 @@
2
2
  更新履歴 - ChangeLog
3
3
  ====================
4
4
 
5
- 2.9.0 : develop
6
- ------------------
7
- #### WEB UI
8
- - メニュー(歯車アイコン)に「サーバを再起動」を追加しました。WEB UIから直接WEB
9
- UIサーバを再起動できるようになります
10
- - 「Narou.rbについて」ダイアログで最新バージョンを確認できた場合に、その場で
11
- システムの更新及び再起動が出来るようになりました
12
- - 小説リスト部分で右クリックすることで個別メニューを呼び出せるようになりました
13
- - 各小説をそれぞれ個別に更新出来るボタンを追加しました
14
- - 一部のボタンのアイコンを変更しました
15
- - 個別メニューから「更新」した場合は、凍結状態に関わらず更新出来るようになり
16
- ました
17
- - ツールチップを表示してしばらくしたら自動で閉じるようにしました
18
- - タグの並び順をソートするようにしました
19
- - 「表示」メニューに「変換設定ページは新規タブで開く」を追加しました
20
-
21
- #### 追加機能
22
- - `narou setting 変数名` コマンドで現在の設定値を確認出来るようになりました。
23
- (例 `narou s device`)
24
- - 変換プリセットを追加しました
25
- - n5115cq 最果てのパラディン
26
-
27
- #### 仕様変更
28
- - 変換処理で body や introduction 等を処理して最後に subtitle を変換していた
29
- のを先に subtitle を処理するように変更しました
30
- - converter.rb でサブタイトルで本文の処理内容を調整したい場合に今までの処理順
31
- では不可能だったため
32
-
33
- #### 修正
34
- - Windows において、WEB UI の「Narou.rbについて」ダイアログで最新バージョンの
35
- 確認に失敗する場合がある問題に対応しました
36
- - WEB UI の小説リストの項目を入れ替えた後に各種ボタンが反応しなくなるのを修正
37
- - 凍結済み小説を強制更新した際に凍結が解除されてしまう場合があったのを修正
38
- - thin などがすでにインストール済みの場合に narou web コマンドで WEB UI サーバ
39
- を起動できない場合があるので、必ず WEBrick で起動するようにしました
40
-
41
-
42
5
  2.8.3 : 2016/03/01
43
6
  ------------------
44
7
  #### HotFix
45
8
  - ノクターン・ムーンライト・ミッドナイトノベルズの認証方法変更に対応しました
46
9
  + 404エラーがでて凍結されてしまった場合、凍結を解除したあと再度更新して下さい
47
10
 
48
-
49
11
  2.8.2 : 2016/02/05
50
12
  ------------------
51
13
  #### HotFix
data/Gemfile CHANGED
@@ -8,5 +8,4 @@ gemspec
8
8
  gem "rspec"
9
9
  gem "rspec-core"
10
10
  gem "pry"
11
- gem "better_errors"
12
- gem "binding_of_caller"
11
+
data/README.md CHANGED
@@ -37,6 +37,13 @@ Narou.rb ― 「小説家になろう」「小説を読もう!」ダウンロ
37
37
  更新履歴 - ChangeLog
38
38
  --------------------
39
39
 
40
+ 2.8.3 : 2016/03/01
41
+ ------------------
42
+ #### HotFix
43
+ - ノクターン・ムーンライト・ミッドナイトノベルズの認証方法変更に対応しました
44
+ + 404エラーがでて凍結されてしまった場合、凍結を解除したあと再度更新して下さい
45
+
46
+
40
47
  2.8.2 : 2016/02/05
41
48
  ------------------
42
49
  #### HotFix
@@ -38,17 +38,11 @@ module Command
38
38
 
39
39
  @opt.separator <<-EOS
40
40
 
41
- これ以外にも設定出来る項目があります。確認する場合は
42
- narou setting -a コマンドを参照して下さい
43
-
44
41
  Examples:
45
- narou setting --list # 現在の設置値一覧を表示
46
- narou setting convert.no-open=true # 値を設定する
47
- narou setting convert.no-epub= # 右辺に何も書かないとその設定を削除出来る
48
- narou setting device # 変数名だけ書くと現在の値を確認出来る
49
-
50
- narou s convert.copy-to=C:/dropbox/mobi
51
- # パスにスペースが含まれる場合はダブルクウォーテーションで囲う
42
+ narou setting --list
43
+ narou setting convert.no-open=true
44
+ narou setting convert.no-epub= # 右辺に何も書かないとその設定を削除できる
45
+ narou setting convert.copy-to=C:/dropbox/mobi
52
46
  narou s convert.copy-to="C:\\Documents and Settings\\user\\epub"
53
47
 
54
48
  Options:
@@ -140,15 +134,6 @@ module Command
140
134
  deleted
141
135
  end
142
136
 
143
- def output_value(name, settings)
144
- scope = get_scope_of_variable_name(name)
145
- if scope
146
- puts settings[scope][name]
147
- else
148
- output_error("#{name} という変数は存在しません", name)
149
- end
150
- end
151
-
152
137
  def execute(argv)
153
138
  super
154
139
  if @options["burn"]
@@ -173,7 +158,7 @@ module Command
173
158
  next
174
159
  end
175
160
  if value.nil?
176
- output_value(name, settings)
161
+ output_error("書式が間違っています。#{name}=値 のように書いて下さい", name)
177
162
  next
178
163
  end
179
164
  scope = get_scope_of_variable_name(name)
@@ -14,7 +14,8 @@ module Command
14
14
  end
15
15
 
16
16
  def self.create_version_string
17
- commitversion = Narou.commit_version || `git describe --always`.strip + "(develop)"
17
+ cv_path = File.expand_path("commitversion", Narou.get_script_dir)
18
+ commitversion = File.exist?(cv_path) ? File.read(cv_path) : `git describe --always`.strip + "(develop)"
18
19
  "#{::Version} build #{commitversion}"
19
20
  end
20
21
  end
@@ -69,35 +69,7 @@ module Command
69
69
  end
70
70
 
71
71
  def execute(argv)
72
- if argv.delete("--boot")
73
- @rebooted = !!argv.delete("--reboot")
74
- super
75
- boot
76
- else
77
- argv << "--backtrace" if $display_backtrace
78
- argv << "--no-color" if $disable_color
79
- argv << "--boot"
80
- argv_copy = argv.dup
81
- begin
82
- loop do
83
- if $development
84
- system(RbConfig.ruby, "-x", $0, "web", *argv)
85
- else
86
- system("narou", "web", *argv)
87
- end
88
- break unless $?.exitstatus == Narou::EXIT_REQUEST_REBOOT
89
- argv = argv_copy.dup
90
- argv.push("--no-browser", "--reboot")
91
- end
92
- rescue Interrupt => e
93
- # 中断されてコンソールへの入力が可能になってから、WEBrick が終了するまで
94
- # タイムラグがあって表示がごちゃまぜになるので、終わるのを少し待つ
95
- sleep 3
96
- end
97
- end
98
- end
99
-
100
- def boot
72
+ super
101
73
  require_relative "../web/all"
102
74
  confirm_of_first
103
75
  params = Narou::AppServer.create_address(@options["port"])
@@ -111,20 +83,18 @@ module Command
111
83
  puts
112
84
 
113
85
  push_server.run
114
- open_browser_when_server_boot(address)
115
- send_rebooted_event_when_connection_recover(push_server)
116
-
86
+ unless @options["no-browser"]
87
+ Thread.new do
88
+ sleep 0.2 until Narou::AppServer.running?
89
+ Helper.open_browser(address)
90
+ end
91
+ end
117
92
  $stdout = Narou::StreamingLogger.new(push_server)
118
93
  ProgressBar.push_server = push_server
119
94
  Narou::AppServer.push_server = push_server
120
95
  Narou::Worker.instance.start
121
- send_hello_message
122
-
123
96
  Narou::AppServer.run!
124
97
  push_server.quit
125
- if Narou::AppServer.request_reboot?
126
- exit Narou::EXIT_REQUEST_REBOOT
127
- end
128
98
  rescue Errno::EADDRINUSE => e
129
99
  Helper.open_browser(address) unless @options["no-browser"]
130
100
  STDOUT.puts <<-EOS
@@ -137,33 +107,6 @@ module Command
137
107
  EOS
138
108
  exit Narou::EXIT_ERROR_CODE
139
109
  end
140
-
141
- def open_browser_when_server_boot(address)
142
- return if @options["no-browser"]
143
- Thread.new do
144
- sleep 0.2 until Narou::AppServer.running?
145
- Helper.open_browser(address)
146
- end
147
- end
148
-
149
- def send_rebooted_event_when_connection_recover(push_server)
150
- return unless @rebooted
151
- Thread.new do |th|
152
- timeout = Time.now + 20
153
- # WebSocketのコネクションが回復するまで待つ
154
- until push_server.connections.count != 0
155
- sleep 0.2
156
- th.kill if Time.now > timeout
157
- end
158
- puts "<yellow>再起動が完了しました。</yellow>".termcolor
159
- push_server.send_all(:"server.rebooted")
160
- end
161
- end
162
-
163
- def send_hello_message
164
- puts "<white>Narou.rb version #{::Version}</white>".termcolor
165
- end
166
-
167
110
  end
168
111
  end
169
112
 
@@ -782,7 +782,7 @@ class Downloader
782
782
  $stdout.silence do
783
783
  Command::Tag.execute!(%W(#{@id} --add 404 --color white --no-overwrite-color))
784
784
  end
785
- Command::Freeze.execute!([@id, "--on"])
785
+ Command::Freeze.execute!([@id])
786
786
  end
787
787
  else
788
788
  @stream.error "何らかの理由により目次が取得できませんでした(#{e.message})"
@@ -1112,9 +1112,6 @@ class Downloader
1112
1112
  end
1113
1113
  sleep(WAITING_TIME_FOR_503)
1114
1114
  retry
1115
- elsif e.message =~ /^404/
1116
- @stream.error "#{url} がダウンロード出来ませんでした。時間をおいて再度試してみてください"
1117
- exit Narou::EXIT_ERROR_CODE
1118
1115
  else
1119
1116
  raise
1120
1117
  end
@@ -21,7 +21,6 @@ module Narou
21
21
  GLOBAL_REPLACE_NAME = "replace.txt"
22
22
  EXIT_ERROR_CODE = 127
23
23
  EXIT_INTERRUPT = 126
24
- EXIT_REQUEST_REBOOT = 125
25
24
 
26
25
  UPDATE_SORT_KEYS = {
27
26
  "id" => "ID", "last_update" => "更新日", "title" => "タイトル", "author" => "作者名",
@@ -276,24 +275,5 @@ module Narou
276
275
  type == 2 ? "短編" : "連載"
277
276
  end
278
277
 
279
- #
280
- # Narou.rb gem の最新バージョン番号を取得する
281
- #
282
- # rubygems公式APIによる取得は、WindowsでのSSL証明書問題で取得出来ない
283
- # 環境があるため、gemコマンド経由で取得する
284
- #
285
- def latest_version
286
- response = `gem search ^narou$`.split("\n")
287
- if response.last =~ /\Anarou \((.+?)\)\z/
288
- $1
289
- end
290
- end
291
-
292
- def commit_version
293
- cv_path = File.expand_path("commitversion", get_script_dir)
294
- File.read(cv_path) if File.exist?(cv_path)
295
- end
296
- memoize :commit_version
297
-
298
278
  end
299
279
  end
@@ -623,7 +623,6 @@ class NovelConverter
623
623
  section["chapter"] = @converter.convert(section["chapter"], "chapter")
624
624
  end
625
625
  @inspector.subtitle = section["subtitle"]
626
- section["subtitle"] = @converter.convert(section["subtitle"], "subtitle")
627
626
  element = section["element"]
628
627
  data_type = element.delete("data_type") || "text"
629
628
  element.each do |text_type, elm_text|
@@ -633,6 +632,7 @@ class NovelConverter
633
632
  end
634
633
  element[text_type] = @converter.convert(elm_text, text_type)
635
634
  end
635
+ section["subtitle"] = @converter.convert(section["subtitle"], "subtitle")
636
636
  sections << section
637
637
  end
638
638
  @use_dakuten_font = @converter.use_dakuten_font
@@ -3,4 +3,4 @@
3
3
  # Copyright 2013 whiteleaf. All rights reserved.
4
4
  #
5
5
 
6
- Version = "2.8.3"
6
+ Version = "2.8.3.1"
@@ -6,8 +6,10 @@
6
6
  require "socket"
7
7
  require "sinatra/base"
8
8
  require "sinatra/json"
9
- require "sinatra/reloader" if $development
10
- require "better_errors" if $debug
9
+ if $debug
10
+ require "sinatra/reloader"
11
+ require "pry"
12
+ end
11
13
  require "tilt/erubis"
12
14
  require "tilt/haml"
13
15
  require "tilt/sass"
@@ -23,7 +25,7 @@ module Narou::ServerHelpers
23
25
  # タグをHTMLで装飾する
24
26
  #
25
27
  def decorate_tags(tags)
26
- tags.sort.map do |tag|
28
+ tags.map do |tag|
27
29
  %!<span class="tag label label-#{Command::Tag.get_color(tag)}" data-tag="#{escape_html(tag)}">#{escape_html(tag)}</span>!
28
30
  end.join(" ")
29
31
  end
@@ -104,13 +106,9 @@ module Narou::ServerHelpers
104
106
  end
105
107
 
106
108
  class Narou::AppServer < Sinatra::Base
107
- register Sinatra::Reloader if $development
109
+ register Sinatra::Reloader if $debug
108
110
  helpers Narou::ServerHelpers
109
111
 
110
- @@request_reboot = false
111
- @@already_update_system = false
112
- @@gem_update_last_log = ""
113
-
114
112
  configure do
115
113
  set :app_file, __FILE__
116
114
  set :erb, trim: "-"
@@ -121,31 +119,13 @@ class Narou::AppServer < Sinatra::Base
121
119
  Command::Version.create_version_string
122
120
  end
123
121
 
124
- set :environment, :production unless $development
125
- set :server, :webrick
126
-
127
- if $debug
128
- use BetterErrors::Middleware
129
- BetterErrors.application_root = Narou.get_script_dir
130
- end
122
+ set :environment, :production unless $debug
131
123
  end
132
124
 
133
125
  def self.push_server=(server)
134
126
  @@push_server = server
135
127
  end
136
128
 
137
- def self.push_server
138
- @@push_server
139
- end
140
-
141
- def self.request_reboot
142
- @@request_reboot = true
143
- end
144
-
145
- def self.request_reboot?
146
- @@request_reboot
147
- end
148
-
149
129
  #
150
130
  # サーバのアドレスを生成
151
131
  #
@@ -311,7 +291,7 @@ class Narou::AppServer < Sinatra::Base
311
291
  get "/about" do
312
292
  @narourb_version = settings.version
313
293
  @ruby_version = build_ruby_version
314
- haml :_about, layout: false
294
+ haml :about, layout: false
315
295
  end
316
296
 
317
297
  post "/shutdown" do
@@ -319,36 +299,6 @@ class Narou::AppServer < Sinatra::Base
319
299
  "シャットダウンしました。再起動するまで操作は出来ません"
320
300
  end
321
301
 
322
- post "/reboot" do
323
- self.class.request_reboot
324
- self.class.quit!
325
- haml :_rebooting, layout: false
326
- end
327
-
328
- post "/update_system" do
329
- Thread.new do
330
- buffer = `gem update --no-document narou`
331
- @@gem_update_last_log = buffer.strip!
332
- if buffer =~ /Nothing to update\z/
333
- @@push_server.send_all("server.update.nothing" => buffer)
334
- elsif buffer.include?("Gems updated: narou")
335
- @@already_update_system = true
336
- @@push_server.send_all("server.update.success" => buffer)
337
- else
338
- @@push_server.send_all("server.update.failure" => buffer)
339
- end
340
- end
341
- end
342
-
343
- post "/gem_update_last_log" do
344
- content_type "text/plain"
345
- @@gem_update_last_log
346
- end
347
-
348
- post "/check_already_update_system" do
349
- json({ result: @@already_update_system })
350
- end
351
-
352
302
  before "/novels/:id/*" do
353
303
  @id = params[:id]
354
304
  not_found unless @id =~ /^\d+$/
@@ -426,16 +376,12 @@ class Narou::AppServer < Sinatra::Base
426
376
  ext = device ? device.ebook_file_ext : ".epub"
427
377
  path = Narou.get_ebook_file_path(@id, ext)
428
378
  if File.exist?(path)
429
- send_file(path, filename: File.basename(path), type: "application/octet-stream")
379
+ send_file(path, filename: File.basename(path))
430
380
  else
431
381
  not_found
432
382
  end
433
383
  end
434
384
 
435
- not_found do
436
- "not found"
437
- end
438
-
439
385
  # -------------------------------------------------------------------------------
440
386
  # API's
441
387
  # -------------------------------------------------------------------------------
@@ -465,7 +411,7 @@ class Narou::AppServer < Sinatra::Base
465
411
  tags.include?("end") ? "完結" : nil,
466
412
  tags.include?("404") ? "削除" : nil,
467
413
  ].compact.join(", "),
468
- download: %!<a href="/novels/#{id}/download" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-download-alt"></span></a>!,
414
+ download: %!<a href="/novels/#{id}/download" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-book"></span></a>!,
469
415
  frozen: Narou.novel_frozen?(id),
470
416
  new_arrivals_date: data["new_arrivals_date"].tap { |m| break m.to_i if m },
471
417
  general_lastup: data["general_lastup"].tap { |m| break m.to_i if m }
@@ -583,7 +529,7 @@ class Narou::AppServer < Sinatra::Base
583
529
  target = params["target"] or return ""
584
530
  id = Downloader.get_id_by_target(target) or return ""
585
531
  @list = Command::Diff.new.get_diff_list(id)
586
- haml :_diff_list, layout: false
532
+ haml :diff_list, layout: false
587
533
  end
588
534
 
589
535
  post "/api/diff_clean" do
@@ -620,7 +566,7 @@ class Narou::AppServer < Sinatra::Base
620
566
  get "/api/tag_list" do
621
567
  result = '<div><span class="tag label label-default" data-tag="">タグ検索を解除</span></div>'
622
568
  tagname_list = Command::Tag.get_tag_list.keys
623
- tagname_list.sort.each do |tagname|
569
+ tagname_list.each do |tagname|
624
570
  result << "<div>#{decorate_tags([tagname])} " \
625
571
  "<span class='select-color-button' data-target-tag='#{h tagname}'>" \
626
572
  "<span class='#{Command::Tag.get_color(tagname)}'>a</span></span></div>"
@@ -737,7 +683,9 @@ class Narou::AppServer < Sinatra::Base
737
683
  end
738
684
 
739
685
  get "/api/version/latest.json" do
740
- json({ version: Narou.latest_version })
686
+ open("https://rubygems.org/api/v1/versions/narou/latest.json?#{Time.now.to_i}") do |fp|
687
+ fp.read
688
+ end
741
689
  end
742
690
 
743
691
  # -------------------------------------------------------------------------------