narou 3.5.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f37fc846838d47f62b093acfd19416b7eb81a992eaf50feb4f05a857624b3bbf
4
- data.tar.gz: 9765f2c1e9d88f266a922410f5f3ed89b70060c553c4f557bbac282fa7fc3a4b
3
+ metadata.gz: 77ab6235ef1ca1a8b4118c2986f51dacb824833df2cdb10132bbd9635d9dde1b
4
+ data.tar.gz: 718dd667b95a2301cb99f7e9e52d05698ecd88aef8b2864cce89efecf46e0fb3
5
5
  SHA512:
6
- metadata.gz: 770d433baf61c01dc2d577e79fb8be0d6ca418c62fb6f6900c84b8401b1658b2c08beb65c5bcf58352bc70b62735b8cdb47caf4c25fe1bc15b2dad183eb6fc04
7
- data.tar.gz: 726d8579ab32be6ad94e9d2a84c764bea0c7c2f78b5ca7e9c7584f2b30340f472315e30781f16a44cf5d72043396271e6903d8a5002d4b5eaf8c51cf3ebb7e8e
6
+ metadata.gz: 4325e3c255961dc300b5485f28c55cbe3443c7061ce520b65d32109c4acf97264653d4c9e77fda8dff65a094600e0f598a7beccc3465adc96e29cffde24dc6d6
7
+ data.tar.gz: 78ab226c92e31c198896ed9289f62a0e907a72a17026c15c23175ae9f45fd5b7b11f63972b14607f19642ea3d112019d44762d1da33440d7fc21d3900df9182f
data/.circleci/config.yml CHANGED
@@ -3,7 +3,7 @@ jobs:
3
3
  build:
4
4
  working_directory: ~/circleci-narou
5
5
  docker:
6
- - image: circleci/ruby:2.5
6
+ - image: circleci/ruby:3.0
7
7
  environment:
8
8
  BUNDLE_JOBS: 1
9
9
  BUNDLE_RETRY: 3
@@ -12,8 +12,8 @@ jobs:
12
12
  - checkout
13
13
 
14
14
  - run:
15
- name: Which bundler?
16
- command: bundle -v
15
+ name: Install bundler 2.1.4
16
+ command: gem install bundler:2.1.4
17
17
 
18
18
  # Restore bundle cache
19
19
  - restore_cache:
data/.rubocop.yml CHANGED
@@ -176,7 +176,7 @@ Style/StringLiterals:
176
176
  Style/SymbolProc:
177
177
  Enabled: true
178
178
 
179
- Layout/Tab:
179
+ Layout/IndentationStyle:
180
180
  Enabled: true
181
181
 
182
182
  Layout/TrailingEmptyLines:
data/ChangeLog.md CHANGED
@@ -1,6 +1,43 @@
1
1
  更新履歴 - ChangeLog
2
2
  ====================
3
3
 
4
+ 3.8.0: 2021/06/27
5
+ -----------------
6
+ #### 修正内容
7
+ - タイトル名もしくは作者名に特定の記号を使うことで任意のコードを実行できて
8
+ しまう問題を修正 [CVE-2021-35514]
9
+ - この問題を発見した RyotaK に感謝します
10
+
11
+
12
+ 3.7.2: 2021/06/05
13
+ -----------------
14
+ #### 追加機能
15
+ - folder コマンドに --no-open (-n) オプションを追加しました
16
+
17
+ #### 修正内容
18
+ - gem update を行うとクラッシュする場合があったのを修正
19
+ - psych 4.0 からの非互換に対応
20
+ - その他軽微な修正
21
+
22
+ 3.7.1: 2021/04/01
23
+ -----------------
24
+ #### 修正内容
25
+ - その他の小説の最新話掲載日を確認しようとするとクラッシュする不具合を修正
26
+
27
+
28
+ 3.7.0: 2021/01/23
29
+ -----------------
30
+ #### 修正内容
31
+ - Apple Silicon 搭載 Mac でも動く様にライブラリをアップデート
32
+ - device を kobo に設定し、ebook-filename-length-limit でファイル名が制限され
33
+ た場合に send コマンドが正常に実行できない不具合を修正
34
+
35
+ 3.6.0: 2021/01/02
36
+ -----------------
37
+ #### 修正内容
38
+ - Ruby 3.0 に対応
39
+
40
+
4
41
  3.5.1: 2020/03/21
5
42
  -----------------
6
43
  #### 修正内容
data/Gemfile.lock CHANGED
@@ -1,119 +1,122 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- narou (3.5.0)
5
- activesupport (~> 5.2)
4
+ narou (3.7.2)
5
+ activesupport (>= 6.1, < 8.0)
6
6
  diff-lcs (~> 1.2, >= 1.2.5)
7
7
  erubis (~> 2.7)
8
+ ffi (~> 1.4, >= 1.4.2)
8
9
  haml (>= 5.1.2, < 6)
9
10
  mail (~> 2.6.0, >= 2.6.6)
10
11
  memoist (~> 0.11.0)
11
12
  open_uri_redirections (~> 0.2, >= 0.2.1)
12
13
  pony (~> 1, >= 1.11)
14
+ psych (~> 4.0)
13
15
  rubyzip (~> 2.0, >= 2.0.0)
14
- sass (~> 3.4, >= 3.4.18)
15
- sinatra (~> 1.4, >= 1.4.5)
16
- sinatra-contrib (~> 1.4, >= 1.4.2)
16
+ sassc (~> 2.4)
17
+ sinatra (~> 2.0, >= 2.0.8.1)
18
+ sinatra-contrib (~> 2.0, >= 2.0.8.1)
17
19
  systemu (~> 2.6, >= 2.6.5)
18
20
  termcolorlight (~> 1.0, >= 1.1.1)
19
21
  tilt (~> 2.0, >= 2.0.10)
20
22
  unicode-display_width (~> 1.4)
23
+ webrick (~> 1.7)
21
24
 
22
25
  GEM
23
26
  remote: https://rubygems.org/
24
27
  specs:
25
- activesupport (5.2.4.1)
28
+ activesupport (6.1.3.2)
26
29
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
- i18n (>= 0.7, < 2)
28
- minitest (~> 5.1)
29
- tzinfo (~> 1.1)
30
+ i18n (>= 1.6, < 2)
31
+ minitest (>= 5.1)
32
+ tzinfo (~> 2.0)
33
+ zeitwerk (~> 2.3)
30
34
  awesome_print (1.8.0)
31
- backports (3.15.0)
32
- byebug (11.1.1)
33
- coderay (1.1.2)
34
- concurrent-ruby (1.1.5)
35
- diff-lcs (1.3)
36
- docile (1.3.2)
35
+ byebug (11.1.3)
36
+ coderay (1.1.3)
37
+ concurrent-ruby (1.1.8)
38
+ diff-lcs (1.4.4)
39
+ docile (1.3.5)
37
40
  erubis (2.7.0)
38
- ffi (1.12.2)
39
- haml (5.1.2)
41
+ ffi (1.14.2)
42
+ ffi (1.14.2-java)
43
+ haml (5.2.1)
40
44
  temple (>= 0.8.0)
41
45
  tilt
42
- i18n (1.7.0)
46
+ i18n (1.8.10)
43
47
  concurrent-ruby (~> 1.0)
44
48
  mail (2.6.6)
45
49
  mime-types (>= 1.16, < 4)
46
50
  memoist (0.11.0)
47
- method_source (0.9.2)
51
+ method_source (1.0.0)
48
52
  mime-types (3.3.1)
49
53
  mime-types-data (~> 3.2015)
50
- mime-types-data (3.2019.1009)
51
- minitest (5.13.0)
52
- multi_json (1.14.1)
54
+ mime-types-data (3.2021.0225)
55
+ minitest (5.14.4)
56
+ multi_json (1.15.0)
57
+ mustermann (1.1.1)
58
+ ruby2_keywords (~> 0.0.1)
53
59
  open_uri_redirections (0.2.1)
54
60
  pony (1.13.1)
55
61
  mail (>= 2.0)
56
- pry (0.12.2)
57
- coderay (~> 1.1.0)
58
- method_source (~> 0.9.0)
59
- pry-byebug (3.8.0)
62
+ pry (0.13.1)
63
+ coderay (~> 1.1)
64
+ method_source (~> 1.0)
65
+ pry-byebug (3.9.0)
60
66
  byebug (~> 11.0)
61
- pry (~> 0.10)
62
- rack (1.6.12)
63
- rack-protection (1.5.5)
67
+ pry (~> 0.13.0)
68
+ psych (4.0.0)
69
+ rack (2.2.3)
70
+ rack-protection (2.1.0)
64
71
  rack
65
- rack-test (1.1.0)
66
- rack (>= 1.0, < 3)
67
- rb-fsevent (0.10.3)
68
- rb-inotify (0.10.1)
69
- ffi (~> 1.0)
70
- rspec (3.9.0)
71
- rspec-core (~> 3.9.0)
72
- rspec-expectations (~> 3.9.0)
73
- rspec-mocks (~> 3.9.0)
74
- rspec-core (3.9.1)
75
- rspec-support (~> 3.9.1)
76
- rspec-expectations (3.9.0)
72
+ rspec (3.10.0)
73
+ rspec-core (~> 3.10.0)
74
+ rspec-expectations (~> 3.10.0)
75
+ rspec-mocks (~> 3.10.0)
76
+ rspec-core (3.10.1)
77
+ rspec-support (~> 3.10.0)
78
+ rspec-expectations (3.10.1)
77
79
  diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.9.0)
79
- rspec-mocks (3.9.1)
80
+ rspec-support (~> 3.10.0)
81
+ rspec-mocks (3.10.1)
80
82
  diff-lcs (>= 1.2.0, < 2.0)
81
- rspec-support (~> 3.9.0)
83
+ rspec-support (~> 3.10.0)
82
84
  rspec-retry (0.6.2)
83
85
  rspec-core (> 3.3)
84
- rspec-support (3.9.2)
86
+ rspec-support (3.10.1)
85
87
  rspec_junit_formatter (0.4.1)
86
88
  rspec-core (>= 2, < 4, != 2.12.0)
87
- rubyzip (2.0.0)
88
- sass (3.7.4)
89
- sass-listen (~> 4.0.0)
90
- sass-listen (4.0.0)
91
- rb-fsevent (~> 0.9, >= 0.9.4)
92
- rb-inotify (~> 0.9, >= 0.9.7)
93
- simplecov (0.18.2)
89
+ ruby2_keywords (0.0.4)
90
+ rubyzip (2.3.0)
91
+ sassc (2.4.0)
92
+ ffi (~> 1.9)
93
+ simplecov (0.21.2)
94
94
  docile (~> 1.1)
95
95
  simplecov-html (~> 0.11)
96
- simplecov-html (0.12.0)
97
- sinatra (1.4.8)
98
- rack (~> 1.5)
99
- rack-protection (~> 1.4)
100
- tilt (>= 1.3, < 3)
101
- sinatra-contrib (1.4.7)
102
- backports (>= 2.0)
96
+ simplecov_json_formatter (~> 0.1)
97
+ simplecov-html (0.12.3)
98
+ simplecov_json_formatter (0.1.2)
99
+ sinatra (2.1.0)
100
+ mustermann (~> 1.0)
101
+ rack (~> 2.2)
102
+ rack-protection (= 2.1.0)
103
+ tilt (~> 2.0)
104
+ sinatra-contrib (2.1.0)
103
105
  multi_json
104
- rack-protection
105
- rack-test
106
- sinatra (~> 1.4.0)
107
- tilt (>= 1.3, < 3)
106
+ mustermann (~> 1.0)
107
+ rack-protection (= 2.1.0)
108
+ sinatra (= 2.1.0)
109
+ tilt (~> 2.0)
108
110
  systemu (2.6.5)
109
111
  temple (0.8.2)
110
112
  termcolorlight (1.1.1)
111
- thread_safe (0.3.6)
112
113
  tilt (2.0.10)
113
- timecop (0.9.1)
114
- tzinfo (1.2.6)
115
- thread_safe (~> 0.1)
116
- unicode-display_width (1.6.0)
114
+ timecop (0.9.2)
115
+ tzinfo (2.0.4)
116
+ concurrent-ruby (~> 1.0)
117
+ unicode-display_width (1.7.0)
118
+ webrick (1.7.0)
119
+ zeitwerk (2.4.2)
117
120
 
118
121
  PLATFORMS
119
122
  java
@@ -124,11 +127,11 @@ DEPENDENCIES
124
127
  narou!
125
128
  pry (~> 0.12)
126
129
  pry-byebug (~> 3.8)
127
- rspec (~> 3.9)
130
+ rspec (~> 3.10)
128
131
  rspec-retry (~> 0.6)
129
132
  rspec_junit_formatter (~> 0.4)
130
- simplecov (~> 0.18)
133
+ simplecov (~> 0.20)
131
134
  timecop (~> 0.9)
132
135
 
133
136
  BUNDLED WITH
134
- 1.17.3
137
+ 2.2.15
data/README.md CHANGED
@@ -34,12 +34,12 @@ Narou.rb - 小説家になろうのダウンローダ&縦書き整形&管理
34
34
  更新履歴 - ChangeLog
35
35
  --------------------
36
36
 
37
- 3.5.1: 2020/03/21
37
+ 3.8.0: 2021/06/27
38
38
  -----------------
39
39
  #### 修正内容
40
- - 小説家になろう系列の挿絵をダウンロード時に、サムネイル画像を取得するように
41
- なってしまっていたのを修正
42
- - Ruby 2.7 で narou setting -l を実行時に警告が大量に出ていたのを修正
40
+ - タイトル名もしくは作者名に特定の記号を使うことで任意のコードを実行できて
41
+ しまう問題を修正 [CVE-2021-35514]
42
+ - この問題を発見した RyotaK に感謝します
43
43
 
44
44
  ----
45
45
 
@@ -45,7 +45,7 @@ module Command
45
45
  if @options["vote"]
46
46
  # TODO: 最新話の場所をAPIで取得する
47
47
  data_dir = Downloader.get_novel_data_dir_by_target(data["id"])
48
- latest_index = YAML.load_file(File.join(data_dir, Downloader::TOC_FILE_NAME))["subtitles"].last["index"]
48
+ latest_index = YAML.unsafe_load_file(File.join(data_dir, Downloader::TOC_FILE_NAME))["subtitles"].last["index"]
49
49
  open_url = "#{toc_url + latest_index}/#my_novelpoint"
50
50
  else
51
51
  open_url = toc_url
data/lib/command/diff.rb CHANGED
@@ -212,8 +212,8 @@ module Command
212
212
  cache_sections = []
213
213
  cache_section_list.each do |path|
214
214
  match_latest_path = File.join(novel_dir, File.basename(path))
215
- latest_novel_sections << YAML.load_file(match_latest_path) if File.exist?(match_latest_path)
216
- cache_sections << YAML.load_file(path)
215
+ latest_novel_sections << YAML.unsafe_load_file(match_latest_path) if File.exist?(match_latest_path)
216
+ cache_sections << YAML.unsafe_load_file(path)
217
217
  end
218
218
 
219
219
  novel_info = Database.instance[id]
@@ -23,7 +23,12 @@ module Command
23
23
  narou folder musyoku
24
24
  narou folder 0
25
25
  narou f 0
26
+
27
+ Options:
26
28
  EOS
29
+ @opt.on("-n", "--no-open", "フォルダを開かずにパスだけ表示する") {
30
+ @options["no-open"] = true
31
+ }
27
32
  end
28
33
 
29
34
  def execute(argv)
@@ -33,7 +38,7 @@ module Command
33
38
  argv.each do |target|
34
39
  dir = Downloader.get_novel_data_dir_by_target(target)
35
40
  if dir
36
- Helper.open_directory(dir)
41
+ Helper.open_directory(dir) unless @options["no-open"]
37
42
  puts dir
38
43
  else
39
44
  error "#{target} は存在しません"
@@ -537,8 +537,8 @@ module Command
537
537
  "webui.theme" => {
538
538
  type: :select, help: "WEB UI 用テーマ選択",
539
539
  invisible: true,
540
- select_keys: Narou.get_theme_names,
541
- select_summaries: Narou.get_theme_names,
540
+ select_keys: Narou.theme_names,
541
+ select_summaries: Narou.theme_names,
542
542
  tab: :webui
543
543
  },
544
544
  "webui.table.reload-timing" => {
@@ -4,6 +4,7 @@
4
4
  # Copyright 2013 whiteleaf. All rights reserved.
5
5
  #
6
6
 
7
+ require "net/http"
7
8
  require_relative "../../narou/api"
8
9
 
9
10
  module Command
@@ -63,7 +64,7 @@ module Command
63
64
  interval.wait
64
65
  begin
65
66
  downloader = Downloader.new(id)
66
- next unless downloader.get_latest_table_of_contents(through_error: true)
67
+ next unless downloader.get_latest_table_of_contents(downloader.load_toc_file, through_error: true)
67
68
  dates = {
68
69
  "novelupdated_at" => downloader.get_novelupdated_at,
69
70
  "general_lastup" => downloader.get_general_lastup,
data/lib/device.rb CHANGED
@@ -91,13 +91,12 @@ class Device
91
91
  end
92
92
 
93
93
  def eject
94
- if ejectable?
95
- begin
96
- Device.eject(@device_module::VOLUME_NAME)
97
- rescue CantEject => e
98
- error e.message
99
- end
100
- end
94
+ return unless ejectable?
95
+
96
+ Device.eject(@device_module::VOLUME_NAME)
97
+ yield if block_given?
98
+ rescue CantEject => e
99
+ error e.message
101
100
  end
102
101
 
103
102
  def self.support_eject?
data/lib/downloader.rb CHANGED
@@ -157,7 +157,7 @@ class Downloader
157
157
  # toc 読込
158
158
  #
159
159
  def self.get_toc_data(archive_path)
160
- YAML.load_file(File.join(archive_path, TOC_FILE_NAME))
160
+ YAML.unsafe_load_file(File.join(archive_path, TOC_FILE_NAME))
161
161
  end
162
162
 
163
163
  def self.get_toc_by_target(target)
@@ -778,6 +778,7 @@ class Downloader
778
778
  @setting["story"] = story_html.to_aozora
779
779
  end
780
780
  @setting["info"] = info
781
+ replace_external_properties_of_setting
781
782
 
782
783
  @setting["title"] = get_title
783
784
  if series_novel?
@@ -801,6 +802,7 @@ class Downloader
801
802
  raise if through_error # エラー処理はしなくていいからそのまま例外を受け取りたい時用
802
803
  if e.message.include?("404")
803
804
  @stream.error "小説が削除されているか非公開な可能性があります"
805
+ sleep_for_download
804
806
  if database.novel_exists?(@id)
805
807
  Command::Tag.execute!(%W(#{@id} --add 404 --color white --no-overwrite-color), io: Narou::NullIO.new)
806
808
  Command::Freeze.execute!(@id, "--on")
@@ -1042,7 +1044,7 @@ class Downloader
1042
1044
  def different_section?(old_relative_path, new_subtitle_info)
1043
1045
  path = get_novel_data_dir.join(old_relative_path)
1044
1046
  return true unless path.exist?
1045
- YAML.load_file(path)["element"] != new_subtitle_info["element"]
1047
+ YAML.unsafe_load_file(path)["element"] != new_subtitle_info["element"]
1046
1048
  end
1047
1049
 
1048
1050
  #
@@ -1267,7 +1269,7 @@ class Downloader
1267
1269
  #
1268
1270
  # 小説データの格納ディレクトリから読み込む
1269
1271
  def load_novel_data(filename)
1270
- YAML.load_file(get_novel_data_dir.join(filename))
1272
+ YAML.unsafe_load_file(get_novel_data_dir.join(filename))
1271
1273
  rescue Errno::ENOENT
1272
1274
  nil
1273
1275
  end
@@ -1302,4 +1304,9 @@ class Downloader
1302
1304
  Template.write(filename, novel_dir_path, binding, binary_version)
1303
1305
  end
1304
1306
  end
1307
+
1308
+ def replace_external_properties_of_setting
1309
+ @setting["title"] = @setting["title"].delete("\r\n")
1310
+ @setting["author"] = @setting["author"].delete("\r\n")
1311
+ end
1305
1312
  end