narou 3.1.11 → 3.2.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.
Potentially problematic release.
This version of narou might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +12 -9
- data/ChangeLog.md +42 -2
- data/README.md +32 -17
- data/lib/command/convert.rb +22 -7
- data/lib/command/init.rb +65 -29
- data/lib/command/mail.rb +24 -22
- data/lib/command/send.rb +26 -23
- data/lib/command/setting.rb +20 -5
- data/lib/command/update.rb +1 -1
- data/lib/command/update/general_lastup_updater.rb +4 -3
- data/lib/converterbase.rb +0 -33
- data/lib/downloader.rb +25 -4
- data/lib/helper.rb +19 -2
- data/lib/html.rb +4 -0
- data/lib/narou.rb +42 -10
- data/lib/novelconverter.rb +87 -38
- data/lib/novelinfo.rb +2 -1
- data/lib/novelsetting.rb +25 -14
- data/lib/version.rb +1 -1
- data/lib/web/appserver.rb +25 -122
- data/lib/web/public/resources/narou.library.js +34 -1
- data/lib/web/public/resources/narou.ui.js +66 -12
- data/lib/web/server_helpers.rb +121 -0
- data/lib/web/views/settings.haml +1 -1
- data/lib/web/views/style.scss +12 -0
- data/narou.gemspec +1 -0
- data/narou.rb +3 -7
- data/preset/ncode.syosetu.com/n9463br/setting.ini +0 -4
- data/preset/vertical_font.css +1 -1
- data/preset/vertical_font_with_dakuten.css +1 -1
- data/webnovel/kakuyomu.jp.yaml +12 -7
- data/webnovel/ncode.syosetu.com.yaml +5 -0
- data/webnovel/novel18.syosetu.com.yaml +5 -0
- data/webnovel/syosetu.org.yaml +3 -0
- metadata +17 -4
- data/preset/doubledash.png +0 -0
- data/preset/singledash.png +0 -0
| @@ -0,0 +1,121 @@ | |
| 1 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 2 | 
            +
            #
         | 
| 3 | 
            +
            # Copyright 2013 whiteleaf. All rights reserved.
         | 
| 4 | 
            +
            #
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # rubocop:disable Style/ClassAndModuleChildren
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            module Narou::ServerHelpers
         | 
| 9 | 
            +
              RELOAD_TIMING_DEFAULT = "every"
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              #
         | 
| 12 | 
            +
              # タグをHTMLで装飾する
         | 
| 13 | 
            +
              #
         | 
| 14 | 
            +
              def decorate_tags(tags)
         | 
| 15 | 
            +
                tags.sort.map do |tag|
         | 
| 16 | 
            +
                  %!<span class="tag label label-#{Command::Tag.get_color(tag)}" data-tag="#{escape_html(tag)}">#{escape_html(tag)}</span>!
         | 
| 17 | 
            +
                end.join(" ")
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              #
         | 
| 21 | 
            +
              # タグをHTMLで装飾する(除外タグ指定用)
         | 
| 22 | 
            +
              #
         | 
| 23 | 
            +
              def decorate_exclusion_tags(tags)
         | 
| 24 | 
            +
                tags.sort.map do |tag|
         | 
| 25 | 
            +
                  %!<span class="tag label label-#{Command::Tag.get_color(tag)}" data-exclusion-tag="#{escape_html(tag)}">^tag:#{escape_html(tag)}</span>!
         | 
| 26 | 
            +
                end.join(" ")
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              #
         | 
| 30 | 
            +
              # Rubyバージョンを構築
         | 
| 31 | 
            +
              #
         | 
| 32 | 
            +
              def build_ruby_version
         | 
| 33 | 
            +
                begin
         | 
| 34 | 
            +
                  `"#{RbConfig.ruby}" -v`.strip
         | 
| 35 | 
            +
                rescue
         | 
| 36 | 
            +
                  config = RbConfig::CONFIG
         | 
| 37 | 
            +
                  "ruby #{RUBY_VERSION}p#{config["PATCHLEVEL"]} [#{RUBY_PLATFORM}]"
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              #
         | 
| 42 | 
            +
              # 有効な novel ID だけの配列を生成する
         | 
| 43 | 
            +
              # ID が指定されなかったか、1件も存在しない場合は nil を返す
         | 
| 44 | 
            +
              #
         | 
| 45 | 
            +
              def select_valid_novel_ids(ids)
         | 
| 46 | 
            +
                return nil unless ids.kind_of?(Array)
         | 
| 47 | 
            +
                result = ids.select do |id|
         | 
| 48 | 
            +
                  id =~ /^\d+$/
         | 
| 49 | 
            +
                end
         | 
| 50 | 
            +
                result.empty? ? nil : result
         | 
| 51 | 
            +
              end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              #
         | 
| 54 | 
            +
              # フォーム情報の真偽値データを実際のデータに変換
         | 
| 55 | 
            +
              #
         | 
| 56 | 
            +
              def convert_on_off_to_boolean(str)
         | 
| 57 | 
            +
                case str
         | 
| 58 | 
            +
                when "on"
         | 
| 59 | 
            +
                  true
         | 
| 60 | 
            +
                when "off"
         | 
| 61 | 
            +
                  false
         | 
| 62 | 
            +
                else
         | 
| 63 | 
            +
                  nil
         | 
| 64 | 
            +
                end
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
              #
         | 
| 68 | 
            +
              # nil true false を nil on off という文字列に変換
         | 
| 69 | 
            +
              #
         | 
| 70 | 
            +
              def convert_boolean_to_on_off(bool)
         | 
| 71 | 
            +
                case bool
         | 
| 72 | 
            +
                when TrueClass
         | 
| 73 | 
            +
                  "on"
         | 
| 74 | 
            +
                when FalseClass
         | 
| 75 | 
            +
                  "off"
         | 
| 76 | 
            +
                else
         | 
| 77 | 
            +
                  "nil"
         | 
| 78 | 
            +
                end
         | 
| 79 | 
            +
              end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
              #
         | 
| 82 | 
            +
              # HTMLエスケープヘルパー
         | 
| 83 | 
            +
              #
         | 
| 84 | 
            +
              def h(text)
         | 
| 85 | 
            +
                Rack::Utils.escape_html(text)
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
              #
         | 
| 89 | 
            +
              # 与えられたデータが真偽値だった場合、設定画面用に「はい」「いいえ」に変換する
         | 
| 90 | 
            +
              # 真偽値ではなかった場合、そのまま返す
         | 
| 91 | 
            +
              #
         | 
| 92 | 
            +
              def value_to_msg(value)
         | 
| 93 | 
            +
                case value
         | 
| 94 | 
            +
                when TrueClass
         | 
| 95 | 
            +
                  "はい"
         | 
| 96 | 
            +
                when FalseClass
         | 
| 97 | 
            +
                  "いいえ"
         | 
| 98 | 
            +
                else
         | 
| 99 | 
            +
                  value
         | 
| 100 | 
            +
                end
         | 
| 101 | 
            +
              end
         | 
| 102 | 
            +
             | 
| 103 | 
            +
              def notepad_text_path
         | 
| 104 | 
            +
                File.join(Narou.local_setting_dir, "notepad.txt")
         | 
| 105 | 
            +
              end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
              def query_to_boolean(value, default: false)
         | 
| 108 | 
            +
                case value
         | 
| 109 | 
            +
                when "1", 1, "true", true
         | 
| 110 | 
            +
                  true
         | 
| 111 | 
            +
                when "0", 0, "false", false
         | 
| 112 | 
            +
                  false
         | 
| 113 | 
            +
                else
         | 
| 114 | 
            +
                  default
         | 
| 115 | 
            +
                end
         | 
| 116 | 
            +
              end
         | 
| 117 | 
            +
             | 
| 118 | 
            +
              def table_reload_timing
         | 
| 119 | 
            +
                Inventory.load("local_setting")["webui.table.reload-timing"] || RELOAD_TIMING_DEFAULT
         | 
| 120 | 
            +
              end
         | 
| 121 | 
            +
            end
         | 
    
        data/lib/web/views/settings.haml
    CHANGED
    
    
    
        data/lib/web/views/style.scss
    CHANGED
    
    | @@ -492,6 +492,14 @@ input::-ms-clear { | |
| 492 492 | 
             
              }
         | 
| 493 493 | 
             
            }
         | 
| 494 494 |  | 
| 495 | 
            +
            .tag {
         | 
| 496 | 
            +
              cursor: copy;
         | 
| 497 | 
            +
            }
         | 
| 498 | 
            +
             | 
| 499 | 
            +
            .tag-reset {
         | 
| 500 | 
            +
              cursor: pointer;
         | 
| 501 | 
            +
            }
         | 
| 502 | 
            +
             | 
| 495 503 | 
             
            #tag-list-canvas {
         | 
| 496 504 | 
             
              padding: 3px 20px;
         | 
| 497 505 | 
             
              overflow: auto;
         | 
| @@ -1139,3 +1147,7 @@ $console-color: white; | |
| 1139 1147 | 
             
                color: darkseagreen;
         | 
| 1140 1148 | 
             
              }
         | 
| 1141 1149 | 
             
            }
         | 
| 1150 | 
            +
             | 
| 1151 | 
            +
            .add-filter {
         | 
| 1152 | 
            +
              cursor: copy;
         | 
| 1153 | 
            +
            }
         | 
    
        data/narou.gemspec
    CHANGED
    
    | @@ -80,5 +80,6 @@ Gem::Specification.new do |gem| | |
| 80 80 | 
             
              gem.add_runtime_dependency 'systemu', '~> 2.6', '>= 2.6.5'
         | 
| 81 81 | 
             
              gem.add_runtime_dependency 'erubis', '~> 2.7'
         | 
| 82 82 | 
             
              gem.add_runtime_dependency 'open_uri_redirections', '~> 0.2', '>= 0.2.1'
         | 
| 83 | 
            +
              gem.add_runtime_dependency 'activesupport', '~> 5.2'
         | 
| 83 84 | 
             
            end
         | 
| 84 85 |  | 
    
        data/narou.rb
    CHANGED
    
    | @@ -25,12 +25,12 @@ end | |
| 25 25 | 
             
            require_relative "lib/inventory"
         | 
| 26 26 |  | 
| 27 27 | 
             
            $development = Narou.commit_version.!
         | 
| 28 | 
            -
             | 
| 29 | 
            -
               | 
| 28 | 
            +
            if $development
         | 
| 29 | 
            +
              begin
         | 
| 30 30 | 
             
                require "pry"
         | 
| 31 31 | 
             
                require "awesome_print"
         | 
| 32 | 
            +
              rescue LoadError
         | 
| 32 33 | 
             
              end
         | 
| 33 | 
            -
            rescue LoadError
         | 
| 34 34 | 
             
            end
         | 
| 35 35 |  | 
| 36 36 | 
             
            global = Inventory.load("global_setting", :global)
         | 
| @@ -44,10 +44,6 @@ require_relative "lib/narou_logger" | |
| 44 44 | 
             
            require_relative "lib/version"
         | 
| 45 45 | 
             
            require_relative "lib/commandline"
         | 
| 46 46 |  | 
| 47 | 
            -
            rescue_level = $debug ? Exception : StandardError
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            class HogeError < StandardError; end
         | 
| 50 | 
            -
             | 
| 51 47 | 
             
            Narou::Backtracer.capture do
         | 
| 52 48 | 
             
              CommandLine.run(ARGV.map(&:dup))
         | 
| 53 49 | 
             
            end
         | 
    
        data/preset/vertical_font.css
    CHANGED
    
    
    
        data/webnovel/kakuyomu.jp.yaml
    CHANGED
    
    | @@ -22,15 +22,15 @@ story: |- | |
| 22 22 | 
             
            # 目次取得設定
         | 
| 23 23 | 
             
            toc_url: \\k<top_url>/works/\\k<ncode>
         | 
| 24 24 | 
             
            subtitles: |-2
         | 
| 25 | 
            -
                        (?:<li class="widget-toc-chapter widget-toc-level1">
         | 
| 25 | 
            +
                        (?:<li class="widget-toc-chapter widget-toc-level1 js-vertical-composition-item">
         | 
| 26 26 | 
             
                          <span>(?<chapter>.+?)</span>
         | 
| 27 27 | 
             
                        </li>
         | 
| 28 | 
            -
                        )?(?:<li class="widget-toc-chapter widget-toc-level2">
         | 
| 28 | 
            +
                        )?(?:<li class="widget-toc-chapter widget-toc-level2 js-vertical-composition-item">
         | 
| 29 29 | 
             
                          <span>(?<subchapter>.+?)</span>
         | 
| 30 30 | 
             
                        </li>
         | 
| 31 31 | 
             
                        )?<li class="widget-toc-episode">
         | 
| 32 32 | 
             
                          <a href="(?<href>/works/\d+/episodes/(?<index>\d+))">
         | 
| 33 | 
            -
                            <span class="widget-toc-episode-titleLabel">(?<subtitle>.+?)</span>
         | 
| 33 | 
            +
                            <span class="widget-toc-episode-titleLabel js-vertical-composition-item">(?<subtitle>.+?)</span>
         | 
| 34 34 | 
             
                            <time class="widget-toc-episode-datePublished" datetime="(?<subupdate>.+?)">.+?</time>
         | 
| 35 35 | 
             
                          </a>
         | 
| 36 36 | 
             
                        </li>
         | 
| @@ -64,13 +64,13 @@ s: |- | |
| 64 64 |  | 
| 65 65 | 
             
            # general_firstup 初回掲載日
         | 
| 66 66 | 
             
            gf: |-2
         | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 67 | 
            +
                          <dt><span>公開日</span></dt>
         | 
| 68 | 
            +
                          <dd><time itemprop="datePublished" datetime="(?<general_firstup>.+?)">.+?</time>
         | 
| 69 69 |  | 
| 70 70 | 
             
            # novelupdated_at 小説の更新時刻。最終掲載日で代用
         | 
| 71 71 | 
             
            nu: |-2
         | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 72 | 
            +
                          <dt><span>最終更新日</span></dt>
         | 
| 73 | 
            +
                          <dd><time itemprop="dateModified" datetime="(?<novelupdated_at>.+?)">.+?</time>
         | 
| 74 74 |  | 
| 75 75 | 
             
            # general_lastup 最新話掲載日
         | 
| 76 76 | 
             
            gl: null
         | 
| @@ -78,3 +78,8 @@ gl: null | |
| 78 78 | 
             
            # writer 作者名
         | 
| 79 79 | 
             
            w: |-
         | 
| 80 80 | 
             
              (?:<span class="activityName" itemprop="author">(?<writer>.+?)</span>)|(?:<span class="screenName.*?">(?<writer>.+?)</span>)
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            # length 文字数
         | 
| 83 | 
            +
            l: |-2
         | 
| 84 | 
            +
                          <dt><span>総文字数</span></dt>
         | 
| 85 | 
            +
                          <dd>(?<length>.+?)文字</dd>
         | 
    
        data/webnovel/syosetu.org.yaml
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: narou
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3. | 
| 4 | 
            +
              version: 3.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - whiteleaf7
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2018-05-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: termcolorlight
         | 
| @@ -278,6 +278,20 @@ dependencies: | |
| 278 278 | 
             
                - - ">="
         | 
| 279 279 | 
             
                  - !ruby/object:Gem::Version
         | 
| 280 280 | 
             
                    version: 0.2.1
         | 
| 281 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 282 | 
            +
              name: activesupport
         | 
| 283 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 284 | 
            +
                requirements:
         | 
| 285 | 
            +
                - - "~>"
         | 
| 286 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 287 | 
            +
                    version: '5.2'
         | 
| 288 | 
            +
              type: :runtime
         | 
| 289 | 
            +
              prerelease: false
         | 
| 290 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 291 | 
            +
                requirements:
         | 
| 292 | 
            +
                - - "~>"
         | 
| 293 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 294 | 
            +
                    version: '5.2'
         | 
| 281 295 | 
             
            description: 小説家になろうで公開されている小説の管理、及び電子書籍データへの変換を支援します。縦書用に特化されており、横書き用に特化されたWEB小説を違和感なく縦書で読むことが出来るようになります。
         | 
| 282 296 | 
             
            email:
         | 
| 283 297 | 
             
            - 2nd.leaf@gmail.com
         | 
| @@ -422,6 +436,7 @@ files: | |
| 422 436 | 
             
            - lib/web/public/theme/fonts/glyphicons-halflings-regular.woff
         | 
| 423 437 | 
             
            - lib/web/public/theme/fonts/glyphicons-halflings-regular.woff2
         | 
| 424 438 | 
             
            - lib/web/pushserver.rb
         | 
| 439 | 
            +
            - lib/web/server_helpers.rb
         | 
| 425 440 | 
             
            - lib/web/settingmessages.rb
         | 
| 426 441 | 
             
            - lib/web/streaminginput.rb
         | 
| 427 442 | 
             
            - lib/web/streaminglogger.rb
         | 
| @@ -458,7 +473,6 @@ files: | |
| 458 473 | 
             
            - preset/DMincho.ttf
         | 
| 459 474 | 
             
            - preset/bordersymbols.txt
         | 
| 460 475 | 
             
            - preset/custom_chuki_tag.txt
         | 
| 461 | 
            -
            - preset/doubledash.png
         | 
| 462 476 | 
             
            - preset/mail_setting.yaml
         | 
| 463 477 | 
             
            - preset/ncode.syosetu.com/n1839bd/converter.rb
         | 
| 464 478 | 
             
            - preset/ncode.syosetu.com/n1839bd/setting.ini
         | 
| @@ -478,7 +492,6 @@ files: | |
| 478 492 | 
             
            - preset/ncode.syosetu.com/n9669bk/converter.rb
         | 
| 479 493 | 
             
            - preset/ncode.syosetu.com/n9669bk/setting.ini
         | 
| 480 494 | 
             
            - preset/ncode.syosetu.com/n9902bn/converter.rb
         | 
| 481 | 
            -
            - preset/singledash.png
         | 
| 482 495 | 
             
            - preset/vertical_font.css
         | 
| 483 496 | 
             
            - preset/vertical_font_with_dakuten.css
         | 
| 484 497 | 
             
            - template/converter.rb.erb
         | 
    
        data/preset/doubledash.png
    DELETED
    
    | Binary file | 
    
        data/preset/singledash.png
    DELETED
    
    | Binary file |