tdiary 5.6.0 → 5.7.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.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +61 -59
  4. data/doc/HOWTO-authenticate-in-rack.md +3 -3
  5. data/doc/HOWTO-make-theme.md +3 -3
  6. data/js/00default.js +22 -12
  7. data/js/caretposition.js +1 -0
  8. data/js/draft.js +228 -51
  9. data/js/image.js +126 -29
  10. data/js/preview.js +12 -50
  11. data/js/update.js +54 -0
  12. data/js/update_preview.js +79 -0
  13. data/lib/aws/pa_api.rb +7 -7
  14. data/lib/tdiary/admin.rb +66 -3
  15. data/lib/tdiary/cli.rb +14 -10
  16. data/lib/tdiary/core_ext.rb +46 -8
  17. data/lib/tdiary/dispatcher/update_main.rb +6 -0
  18. data/lib/tdiary/io/plugin_pstore.rb +2 -1
  19. data/lib/tdiary/plugin/00default.rb +3 -0
  20. data/lib/tdiary/rack/auth/basic.rb +72 -9
  21. data/lib/tdiary/tasks/auth.rake +2 -4
  22. data/lib/tdiary/tasks/release.rake +5 -4
  23. data/lib/tdiary/version.rb +1 -1
  24. data/lib/tdiary.rb +3 -0
  25. data/misc/plugin/amazon.rb +48 -11
  26. data/misc/plugin/amazon_rakuten.rb +79 -0
  27. data/misc/plugin/draft.rb +83 -0
  28. data/misc/plugin/en/image.rb +5 -0
  29. data/misc/plugin/en/makerss.rb +4 -0
  30. data/misc/plugin/en/preview.rb +0 -2
  31. data/misc/plugin/image.rb +19 -13
  32. data/misc/plugin/ja/makerss.rb +3 -0
  33. data/misc/plugin/ja/preview.rb +0 -2
  34. data/misc/plugin/makerss.rb +5 -4
  35. data/misc/plugin/my-sequel.rb +1 -0
  36. data/misc/plugin/preview.rb +0 -8
  37. data/theme/base.css +32 -2
  38. data/theme/conf.css +60 -0
  39. data/theme/default/default.css +33 -8
  40. data/vendor/bundle/ruby/3.4.0/cache/bcrypt-3.1.22.gem +0 -0
  41. data/vendor/bundle/ruby/3.4.0/cache/date-3.6.0.gem +0 -0
  42. data/vendor/bundle/ruby/3.4.0/cache/fastimage-2.4.3.gem +0 -0
  43. data/vendor/bundle/ruby/3.4.0/cache/net-imap-0.6.8.gem +0 -0
  44. data/vendor/bundle/ruby/3.4.0/cache/net-protocol-0.4.0.gem +0 -0
  45. data/vendor/bundle/ruby/3.4.0/cache/net-smtp-0.5.2.gem +0 -0
  46. data/vendor/bundle/ruby/3.4.0/cache/pstore-0.3.0.gem +0 -0
  47. data/vendor/bundle/ruby/3.4.0/cache/rack-3.2.8.gem +0 -0
  48. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/bcrypt-3.1.22/bcrypt_ext.so +0 -0
  49. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/bcrypt-3.1.22/gem_make.out +28 -0
  50. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/cgi-0.5.2/cgi/escape.so +0 -0
  51. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/cgi-0.5.2/gem_make.out +6 -6
  52. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/date_core.so +0 -0
  53. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/gem.build_complete +0 -0
  54. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/gem_make.out +26 -0
  55. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/mkmf.log +140 -0
  56. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/CHANGELOG +127 -0
  57. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/COPYING +28 -0
  58. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/README.md +192 -0
  59. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/jruby/bcrypt_jruby/BCrypt.java +926 -0
  60. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/Makefile +273 -0
  61. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/bcrypt_ext.c +125 -0
  62. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt.c +57 -0
  63. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt.h +24 -0
  64. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_blowfish.c +903 -0
  65. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_blowfish.h +27 -0
  66. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_gensalt.c +124 -0
  67. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_gensalt.h +30 -0
  68. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/extconf.rb +22 -0
  69. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/ow-crypt.h +43 -0
  70. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/wrapper.c +554 -0
  71. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/x86.S +203 -0
  72. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt/engine.rb +134 -0
  73. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt/error.rb +22 -0
  74. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt/password.rb +106 -0
  75. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt.rb +16 -0
  76. data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt_ext.so +0 -0
  77. data/vendor/bundle/ruby/3.4.0/gems/cgi-0.5.2/ext/cgi/escape/Makefile +3 -3
  78. data/vendor/bundle/ruby/3.4.0/gems/cgi-0.5.2/lib/cgi/escape.so +0 -0
  79. data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/Makefile +4 -4
  80. data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_core.c +293 -77
  81. data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_parse.c +14 -4
  82. data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_strptime.c +13 -13
  83. data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/extconf.rb +6 -0
  84. data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/lib/date.rb +1 -1
  85. data/vendor/bundle/ruby/3.4.0/gems/date-3.6.0/lib/date_core.so +0 -0
  86. data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/avif.rb +1 -0
  87. data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/fiber_stream.rb +6 -1
  88. data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/heic.rb +1 -0
  89. data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/iso_bmff.rb +15 -5
  90. data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/jxl.rb +1 -0
  91. data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/version.rb +1 -1
  92. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/Gemfile +3 -3
  93. data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.8/README.md +103 -0
  94. data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.8/Rakefile +74 -0
  95. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/command_data.rb +13 -10
  96. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/config/attr_accessors.rb +2 -2
  97. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/config/attr_type_coercion.rb +14 -26
  98. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/config.rb +63 -3
  99. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/esearch_result.rb +2 -2
  100. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/fetch_data.rb +5 -5
  101. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/response_data.rb +79 -79
  102. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/response_parser/parser_utils.rb +1 -1
  103. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/response_parser.rb +2 -1
  104. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/client_adapter.rb +6 -6
  105. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/search_result.rb +4 -6
  106. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sequence_set.rb +413 -52
  107. data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.8/lib/net/imap/utils.rb +49 -0
  108. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap.rb +195 -46
  109. data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/rdoc.rake +24 -0
  110. data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/lib/net/protocol.rb +38 -23
  111. data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp.rb +5 -8
  112. data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/lib/pstore.rb +52 -31
  113. data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/pstore.gemspec +1 -0
  114. data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/CHANGELOG.md +34 -0
  115. data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart/parser.rb +7 -2
  116. data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart/uploaded_file.rb +1 -0
  117. data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/request.rb +5 -2
  118. data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/static.rb +1 -1
  119. data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/version.rb +1 -1
  120. data/vendor/bundle/ruby/3.4.0/specifications/bcrypt-3.1.22.gemspec +33 -0
  121. data/vendor/bundle/ruby/3.4.0/specifications/{date-3.5.1.gemspec → date-3.6.0.gemspec} +3 -3
  122. data/vendor/bundle/ruby/3.4.0/specifications/{fastimage-2.4.1.gemspec → fastimage-2.4.3.gemspec} +3 -3
  123. data/vendor/bundle/ruby/3.4.0/specifications/{net-imap-0.6.6.gemspec → net-imap-0.6.8.gemspec} +3 -3
  124. data/vendor/bundle/ruby/3.4.0/specifications/{net-protocol-0.3.0.gemspec → net-protocol-0.4.0.gemspec} +2 -2
  125. data/vendor/bundle/ruby/3.4.0/specifications/{net-smtp-0.5.1.gemspec → net-smtp-0.5.2.gemspec} +4 -4
  126. data/vendor/bundle/ruby/3.4.0/specifications/{pstore-0.2.1.gemspec → pstore-0.3.0.gemspec} +3 -2
  127. data/vendor/bundle/ruby/3.4.0/specifications/{rack-3.2.7.gemspec → rack-3.2.8.gemspec} +2 -2
  128. data/views/preview.rhtml +2 -1
  129. data/views/preview.rhtml.en +2 -1
  130. data/views/update.rhtml +10 -1
  131. data/views/update.rhtml.en +10 -1
  132. metadata +242 -200
  133. data/misc/plugin/amp.rb +0 -118
  134. data/vendor/bundle/ruby/3.4.0/cache/date-3.5.1.gem +0 -0
  135. data/vendor/bundle/ruby/3.4.0/cache/fastimage-2.4.1.gem +0 -0
  136. data/vendor/bundle/ruby/3.4.0/cache/net-imap-0.6.6.gem +0 -0
  137. data/vendor/bundle/ruby/3.4.0/cache/net-protocol-0.3.0.gem +0 -0
  138. data/vendor/bundle/ruby/3.4.0/cache/net-smtp-0.5.1.gem +0 -0
  139. data/vendor/bundle/ruby/3.4.0/cache/pstore-0.2.1.gem +0 -0
  140. data/vendor/bundle/ruby/3.4.0/cache/rack-3.2.7.gem +0 -0
  141. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/date_core.so +0 -0
  142. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/gem_make.out +0 -24
  143. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/mkmf.log +0 -93
  144. data/vendor/bundle/ruby/3.4.0/gems/date-3.5.1/lib/date_core.so +0 -0
  145. data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.6/README.md +0 -77
  146. data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.6/Rakefile +0 -24
  147. data/views/amp.rhtml +0 -34
  148. /data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/{date-3.5.1 → bcrypt-3.1.22}/gem.build_complete +0 -0
  149. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/BSDL +0 -0
  150. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/COPYING +0 -0
  151. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/README.md +0 -0
  152. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_strftime.c +0 -0
  153. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_tmx.h +0 -0
  154. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/prereq.mk +0 -0
  155. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/zonetab.h +0 -0
  156. /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/zonetab.list +0 -0
  157. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/MIT-LICENSE +0 -0
  158. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/README.md +0 -0
  159. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage.rb +0 -0
  160. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/bmp.rb +0 -0
  161. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/exif.rb +0 -0
  162. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/gif.rb +0 -0
  163. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/ico.rb +0 -0
  164. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/image_base.rb +0 -0
  165. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/jpeg.rb +0 -0
  166. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/jxlc.rb +0 -0
  167. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/png.rb +0 -0
  168. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/psd.rb +0 -0
  169. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/stream_util.rb +0 -0
  170. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/svg.rb +0 -0
  171. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/tiff.rb +0 -0
  172. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/type_parser.rb +0 -0
  173. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/webp.rb +0 -0
  174. /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage.rb +0 -0
  175. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/BSDL +0 -0
  176. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/COPYING +0 -0
  177. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/LICENSE.txt +0 -0
  178. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/docs/styles.css +0 -0
  179. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/authenticators.rb +0 -0
  180. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/config/attr_inheritance.rb +0 -0
  181. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/config/attr_version_defaults.rb +0 -0
  182. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/connection_state.rb +0 -0
  183. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/data_encoding.rb +0 -0
  184. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/deprecated_client_options.rb +0 -0
  185. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/errors.rb +0 -0
  186. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/flags.rb +0 -0
  187. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/response_reader.rb +0 -0
  188. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/anonymous_authenticator.rb +0 -0
  189. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/authentication_exchange.rb +0 -0
  190. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/authenticators.rb +0 -0
  191. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/cram_md5_authenticator.rb +0 -0
  192. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/digest_md5_authenticator.rb +0 -0
  193. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/external_authenticator.rb +0 -0
  194. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/gs2_header.rb +0 -0
  195. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/login_authenticator.rb +0 -0
  196. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/oauthbearer_authenticator.rb +0 -0
  197. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/plain_authenticator.rb +0 -0
  198. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/protocol_adapters.rb +0 -0
  199. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/scram_algorithm.rb +0 -0
  200. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/scram_authenticator.rb +0 -0
  201. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/stringprep.rb +0 -0
  202. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl/xoauth2_authenticator.rb +0 -0
  203. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl.rb +0 -0
  204. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/sasl_adapter.rb +0 -0
  205. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/stringprep/nameprep.rb +0 -0
  206. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/stringprep/saslprep.rb +0 -0
  207. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/stringprep/saslprep_tables.rb +0 -0
  208. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/stringprep/tables.rb +0 -0
  209. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/stringprep/trace.rb +0 -0
  210. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/stringprep.rb +0 -0
  211. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/uidplus_data.rb +0 -0
  212. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap/vanished_data.rb +0 -0
  213. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/net-imap.gemspec +0 -0
  214. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/benchmarks.rake +0 -0
  215. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/rfcs.rake +0 -0
  216. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/saslprep.rake +0 -0
  217. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/string_prep_tables_generator.rb +0 -0
  218. /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/sample/net-imap.rb +0 -0
  219. /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/BSDL +0 -0
  220. /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/COPYING +0 -0
  221. /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/README.md +0 -0
  222. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/LICENSE.txt +0 -0
  223. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/NEWS.md +0 -0
  224. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/README.md +0 -0
  225. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp/auth_cram_md5.rb +0 -0
  226. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp/auth_login.rb +0 -0
  227. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp/auth_plain.rb +0 -0
  228. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp/auth_xoauth2.rb +0 -0
  229. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp/authenticator.rb +0 -0
  230. /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/net-smtp.gemspec +0 -0
  231. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/BSDL +0 -0
  232. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/COPYING +0 -0
  233. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/Gemfile +0 -0
  234. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/README.md +0 -0
  235. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/Rakefile +0 -0
  236. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/bin/console +0 -0
  237. /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/bin/setup +0 -0
  238. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/CONTRIBUTING.md +0 -0
  239. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/MIT-LICENSE +0 -0
  240. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/README.md +0 -0
  241. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/SPEC.rdoc +0 -0
  242. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/auth/abstract/handler.rb +0 -0
  243. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/auth/abstract/request.rb +0 -0
  244. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/auth/basic.rb +0 -0
  245. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/bad_request.rb +0 -0
  246. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/body_proxy.rb +0 -0
  247. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/builder.rb +0 -0
  248. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/cascade.rb +0 -0
  249. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/common_logger.rb +0 -0
  250. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/conditional_get.rb +0 -0
  251. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/config.rb +0 -0
  252. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/constants.rb +0 -0
  253. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/content_length.rb +0 -0
  254. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/content_type.rb +0 -0
  255. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/deflater.rb +0 -0
  256. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/directory.rb +0 -0
  257. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/etag.rb +0 -0
  258. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/events.rb +0 -0
  259. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/files.rb +0 -0
  260. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/head.rb +0 -0
  261. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/headers.rb +0 -0
  262. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/lint.rb +0 -0
  263. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/lock.rb +0 -0
  264. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/media_type.rb +0 -0
  265. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/method_override.rb +0 -0
  266. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mime.rb +0 -0
  267. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mock.rb +0 -0
  268. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mock_request.rb +0 -0
  269. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mock_response.rb +0 -0
  270. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart/generator.rb +0 -0
  271. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart.rb +0 -0
  272. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/null_logger.rb +0 -0
  273. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/query_parser.rb +0 -0
  274. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/recursive.rb +0 -0
  275. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/reloader.rb +0 -0
  276. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/response.rb +0 -0
  277. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/rewindable_input.rb +0 -0
  278. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/runtime.rb +0 -0
  279. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/sendfile.rb +0 -0
  280. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/show_exceptions.rb +0 -0
  281. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/show_status.rb +0 -0
  282. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/tempfile_reaper.rb +0 -0
  283. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/urlmap.rb +0 -0
  284. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/utils.rb +0 -0
  285. /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack.rb +0 -0
@@ -92,11 +92,12 @@ def amazon_detail_html(item)
92
92
  image = amazon_image(item)
93
93
  @conf['amazon.imgsize'] = size_orig
94
94
 
95
+ size = %Q|height="#{h image[:height]}" width="#{h image[:width]}"| if image[:height]
95
96
  url = amazon_url(item)
96
97
  <<-HTML
97
98
  <a class="amazon-detail" href="#{url}"><span class="amazon-detail">
98
99
  <img class="amazon-detail left" src="#{h image[:src]}"
99
- height="#{h image[:height]}" width="#{h image[:width]}"
100
+ #{size}
100
101
  alt="">
101
102
  <span class="amazon-detail-desc">
102
103
  <span class="amazon-title">#{h title}</span><br>
@@ -125,7 +126,7 @@ def amazon_to_html(item, with_image = true, label = nil, pos = 'amazon')
125
126
  unless image[:src] then
126
127
  img = ''
127
128
  else
128
- size = %Q|height="#{h image[:height]}" width="#{h image[:width]}"|
129
+ size = %Q|height="#{h image[:height]}" width="#{h image[:width]}"| if image[:height]
129
130
  img = <<-HTML
130
131
  <img class="#{h pos}" src="#{h image[:src]}"
131
132
  #{size} alt="#{h alt}">
@@ -138,6 +139,28 @@ def amazon_to_html(item, with_image = true, label = nil, pos = 'amazon')
138
139
  %Q|<a href="#{h url}">#{img}#{h label}</a>|
139
140
  end
140
141
 
142
+ # Items given by ISBN or JAN code that Amazon doesn't answer for are asked of a plugin defining amazon_book_item(code), like amazon_rakuten.rb.
143
+ def amazon_book_json(item_id)
144
+ return nil unless defined?(amazon_book_item) && /\A(?:\d{9}[\dX]|\d{13})\z/i =~ item_id
145
+ item = amazon_book_item(item_id)
146
+ {'ItemsResult' => {'Items' => [item]}}.to_json if item
147
+ end
148
+
149
+ # PA-API and the pages of Amazon take an ASIN, which is the ISBN-10 for a book and which a JAN code doesn't have
150
+ def amazon_asin(item_id)
151
+ case item_id
152
+ when /\A978\d{10}\z/ then AWS::PAAPI.isbn13to10(item_id)
153
+ when /\A\d{13}\z/ then nil
154
+ else item_id
155
+ end
156
+ end
157
+
158
+ def amazon_link(item_id, label)
159
+ asin = amazon_asin(item_id)
160
+ url = asin ? "https://www.amazon.co.jp/dp/#{asin}" : "https://www.amazon.co.jp/s?k=#{item_id}"
161
+ %Q|<a href="#{h url}">#{h(label || url)}</a>|
162
+ end
163
+
141
164
  def amazon_get(asin, with_image = true, label = nil, pos = 'amazon')
142
165
  asin = asin.to_s.strip.gsub(/-/, '')
143
166
  country, item_id = asin.scan(/\A(..):(.*)/).flatten
@@ -149,16 +172,32 @@ def amazon_get(asin, with_image = true, label = nil, pos = 'amazon')
149
172
  begin
150
173
  cache = "#{@cache_path}/amazon"
151
174
  Dir::mkdir( cache ) unless File::directory?( cache )
175
+ file = "#{cache}/#{country}#{item_id}.json"
152
176
  begin
153
- json = File::read("#{cache}/#{country}#{item_id}.json")
177
+ json = File::read(file)
178
+ # PA-API answered a code without an ASIN with an error, which was cached before such codes went to amazon_book_json
179
+ raise Errno::ENOENT if json.empty? || !amazon_asin(item_id) && !JSON.parse(json)['ItemsResult']
154
180
  rescue Errno::ENOENT
155
181
  access_key = @conf['amazon.access_key']
156
182
  secret_key = @conf['amazon.secret_key']
157
- return asin unless access_key && secret_key
158
- partner_tag = @conf['amazon.aid']
159
- paapi = AWS::PAAPI.new(access_key, secret_key, partner_tag)
160
- json = paapi.get_items(item_id, country.to_sym)
161
- File::open("#{cache}/#{country}#{item_id}.json", 'wb'){|f| f.write(json)}
183
+ if access_key && secret_key && !File::exist?(file) && amazon_asin(item_id)
184
+ begin
185
+ partner_tag = @conf['amazon.aid']
186
+ paapi = AWS::PAAPI.new(access_key, secret_key, partner_tag)
187
+ json = paapi.get_items(item_id, country.to_sym)
188
+ rescue Net::HTTPExceptions => e
189
+ # An empty cache records a 403, which PA-API keeps answering, so the item isn't asked about again until the cache is cleared
190
+ File::write(file, '') if e.response.code == '403'
191
+ json = amazon_book_json(item_id)
192
+ raise unless json
193
+ end
194
+ else
195
+ json = amazon_book_json(item_id)
196
+ unless json
197
+ return (access_key && secret_key || File::exist?(file)) ? amazon_link(item_id, label) : asin
198
+ end
199
+ end
200
+ File::open(file, 'wb'){|f| f.write(json)}
162
201
  end
163
202
  item = JSON.parse(json)["ItemsResult"]["Items"][0]
164
203
  if pos == 'detail' then
@@ -185,9 +224,7 @@ def amazon_get(asin, with_image = true, label = nil, pos = 'amazon')
185
224
  message = ''
186
225
  # Handle 429 "Too Many Requests" and 403 "Forbidden"
187
226
  if /^429|^403/ =~ e.message then
188
- url = "https://www.amazon.co.jp/dp/#{h asin}"
189
- label ||= url
190
- message << %Q|<a href="#{h url}">#{h label}</a>|
227
+ message << amazon_link(item_id, label)
191
228
  end
192
229
  if @mode == 'preview' then
193
230
  message << %Q|<span class="message">(#{h e.message})</span>|
@@ -0,0 +1,79 @@
1
+ #
2
+ # amazon_rakuten.rb: look books of amazon.rb up in Rakuten Books
3
+ #
4
+ # PA-API refuses Associates accounts that don't meet its eligibility
5
+ # requirements, which leaves amazon.rb without titles and images. With
6
+ # this plugin, books given by ISBN come from Rakuten Books Book Search
7
+ # API instead, and magazines, DVDs, games and other items given by JAN
8
+ # code from Rakuten Books Total Search API. They link to Rakuten Books
9
+ # as its terms require.
10
+ #
11
+ # options:
12
+ # @options['rakuten.app_id'] : application ID of Rakuten Web Service
13
+ # @options['rakuten.access_key'] : access key of the application
14
+ # @options['rakuten.affiliate_id'] : Rakuten Affiliate ID for the links (optional)
15
+ #
16
+ # Register the application as an API/backend service allowing the IP
17
+ # address of the server. Rakuten requires the credit this plugin puts in
18
+ # the footer.
19
+ #
20
+ # Copyright (c) 2026 Hiroshi SHIBATA <hsbt@ruby-lang.org>
21
+ # Distributed under the GPL2 or any later version.
22
+ #
23
+ require 'json'
24
+ require 'net/http'
25
+
26
+ def amazon_book_item(code)
27
+ app_id = @conf['rakuten.app_id']
28
+ access_key = @conf['rakuten.access_key']
29
+ return nil unless app_id && access_key
30
+
31
+ api, key = /\A(?:\d{9}[\dX]|97[89]\d{10})\z/i =~ code ? ['BooksBook', :isbn] : ['BooksTotal', :isbnjan]
32
+ uri = URI("https://openapi.rakuten.co.jp/services/api/#{api}/Search/20170404")
33
+ params = {applicationId: app_id, accessKey: access_key, key => code, outOfStockFlag: 1, formatVersion: 2}
34
+ params[:affiliateId] = @conf['rakuten.affiliate_id'] if @conf['rakuten.affiliate_id']
35
+ uri.query = URI.encode_www_form(params)
36
+ # Rakuten answers 429 to more than one request a second
37
+ sleep 1 if @amazon_rakuten_requested
38
+ @amazon_rakuten_requested = true
39
+ response = Net::HTTP.get_response(uri)
40
+ response.value
41
+ book = JSON.parse(response.body)['Items'][0]
42
+ return nil unless book
43
+
44
+ {
45
+ 'DetailPageURL' => book['affiliateUrl'].to_s.empty? ? book['itemUrl'] : book['affiliateUrl'],
46
+ 'ItemInfo' => {
47
+ 'Title' => {'DisplayValue' => book['title']},
48
+ 'ByLineInfo' => {
49
+ # DVDs and CDs have artistName and label in place of author and publisherName
50
+ 'Contributors' => [{'Name' => [book['author'], book['artistName']].find {|name| !name.to_s.empty? }.to_s[%r{[^/]*}]}],
51
+ 'Manufacturer' => {'DisplayValue' => [book['publisherName'], book['label']].find {|name| !name.to_s.empty? }}
52
+ }
53
+ },
54
+ 'Images' => {
55
+ 'Primary' => {
56
+ 'Small' => {'URL' => book['smallImageUrl']},
57
+ 'Medium' => {'URL' => book['mediumImageUrl']},
58
+ 'Large' => {'URL' => book['largeImageUrl']}
59
+ }
60
+ },
61
+ 'OffersV2' => {
62
+ 'Listings' => [{'Price' => {'Money' => {'DisplayAmount' => "¥#{book['itemPrice'].to_s.gsub(/(\d)(?=(\d{3})+\z)/, '\1,')}"}}}]
63
+ }
64
+ }
65
+ rescue => e
66
+ @logger.error "amazon_rakuten.rb: #{e.message}"
67
+ nil
68
+ end
69
+
70
+ add_footer_proc do
71
+ %Q|<div class="footer"><a href="https://developers.rakuten.com/">Supported by Rakuten Developers</a></div>|
72
+ end
73
+
74
+ # Local Variables:
75
+ # mode: ruby
76
+ # indent-tabs-mode: t
77
+ # tab-width: 3
78
+ # ruby-indent-level: 3
79
+ # End:
data/misc/plugin/draft.rb CHANGED
@@ -1,11 +1,93 @@
1
1
  #
2
2
  # draft.rb: save draft data to Web Storage automatically
3
+ # and keep a copy of them on the server
4
+ #
5
+ # options:
6
+ # @options['draft.sync_interval'] : seconds between uploads to the server (default 300)
3
7
  #
4
8
  # Copyright (c) MATSUOKA Kohei <http://www.machu.jp/>
5
9
  # Distributed under the GPL2 or any later version.
6
10
  #
11
+ require 'json'
12
+
13
+ def draft_max_count
14
+ 10
15
+ end
16
+
17
+ def draft_restore( db )
18
+ %w(drafts deleted).map {|key| JSON.parse( db.get( key ) || '[]' ) }
19
+ end
20
+
21
+ def draft_id?( id )
22
+ id.kind_of?( String ) and /\A[0-9a-z]{1,32}\z/.match?( id )
23
+ end
24
+
25
+ def draft_valid?( item )
26
+ item.kind_of?( Hash ) and
27
+ draft_id?( item['id'] ) and
28
+ item['date'].kind_of?( Integer ) and
29
+ item['value'].kind_of?( String ) and !item['value'].empty? and
30
+ ( item['form'].nil? or /\A(append|replace):\d{0,8}\z/.match?( item['form'].to_s ) )
31
+ end
32
+
33
+ def draft_sync( items )
34
+ transaction( 'draft' ) do |db|
35
+ drafts, deleted = draft_restore( db )
36
+ items.each do |item|
37
+ # a draft submitted as a diary must not come back from another browser
38
+ next if !draft_valid?( item ) or deleted.include?( item['id'] )
39
+ stored = drafts.find {|d| d['id'] == item['id'] }
40
+ if !stored
41
+ drafts << item.slice( 'id', 'date', 'value', 'form' )
42
+ elsif stored['date'] < item['date']
43
+ stored.update( item.slice( 'date', 'value', 'form' ) )
44
+ end
45
+ end
46
+ db.set( 'drafts', drafts.sort_by {|d| d['date'] }.last( draft_max_count ).to_json )
47
+ end
48
+ end
49
+
50
+ def draft_delete( id )
51
+ transaction( 'draft' ) do |db|
52
+ drafts, deleted = draft_restore( db )
53
+ db.set( 'drafts', drafts.reject {|d| d['id'] == id }.to_json )
54
+ db.set( 'deleted', (deleted - [id] + [id]).last( 100 ).to_json )
55
+ end
56
+ end
57
+
7
58
  if /\A(form|edit|preview|showcomment)\z/ === @mode then
8
59
  enable_js('draft.js')
60
+ server = nil
61
+ transaction( 'draft' ) do |db|
62
+ drafts, deleted = draft_restore( db )
63
+ server = { 'drafts' => drafts, 'deleted' => deleted, 'max' => draft_max_count }
64
+ end
65
+ add_js_setting( '$tDiary.plugin.draft' )
66
+ # keep the drafts from closing the script element
67
+ add_js_setting( '$tDiary.plugin.draft.server', server.to_json.gsub( '<', '\\u003c' ) )
68
+ add_js_setting( '$tDiary.plugin.draft.interval', (@conf['draft.sync_interval'] || 300).to_i )
69
+ add_js_setting( '$tDiary.plugin.draft.label', {
70
+ 'saved' => '下書きを保存しました (このブラウザ %local、サーバー %server)',
71
+ 'unsent' => '未送信',
72
+ 'found' => '未投稿の下書きがあります: %title',
73
+ 'restore' => '復元する',
74
+ 'dismiss' => '閉じる'
75
+ }.to_json )
76
+ end
77
+
78
+ if @mode == 'formplugin' and @cgi.params['plugin_draft_sync'][0] then
79
+ begin
80
+ items = JSON.parse( @cgi.params['plugin_draft_sync'][0] )
81
+ draft_sync( items ) if items.kind_of?( Array )
82
+ rescue JSON::ParserError
83
+ end
84
+ end
85
+
86
+ add_update_proc do
87
+ id = @cgi.params['plugin_draft_id'][0]
88
+ if /\A(append|replace)\z/ =~ @mode and draft_id?( id ) then
89
+ draft_delete( id )
90
+ end
9
91
  end
10
92
 
11
93
  add_edit_proc do
@@ -14,6 +96,7 @@ add_edit_proc do
14
96
  下書き:
15
97
  <select name="drafts"></select>
16
98
  <button type="button" id="draft_load">読み込み</button>
99
+ <input type="hidden" name="plugin_draft_id" value="">
17
100
  </div>
18
101
  EOS
19
102
  end
@@ -27,6 +27,10 @@
27
27
  # URL of the image directory. Default is './images/'.
28
28
  # @options['image.maxwidth']
29
29
  # Max display width of image without specified 'size' parameter.
30
+ # @options['image.resize']
31
+ # Images are shrunk on upload so that the longer side fits in this
32
+ # many pixels. Default is 1600. Exif, including the location, is
33
+ # dropped at the same time (except GIF).
30
34
  #
31
35
  def image_error_num( max ); "You can add images upto #{h max} par a day."; end
32
36
  def image_error_size( max ); "You can add images upto #{h max} bytes par an image."; end
@@ -38,6 +42,7 @@ def image_label_delete; 'Delete checked images'; end
38
42
  def image_label_only_jpeg; 'Only JPEG'; end
39
43
  def image_label_add_image; 'Upload the image'; end
40
44
  def image_label_drop_here; 'Drop files here'; end
45
+ def image_label_upload_failed; 'Could not upload the image'; end
41
46
 
42
47
  # Local Variables:
43
48
  # mode: ruby
@@ -16,6 +16,10 @@ def makerss_conf_html
16
16
  <option value="f"#{' selected' unless @conf['makerss.hidecontent']}>Include</option>
17
17
  <option value="t"#{' selected' if @conf['makerss.hidecontent']}>Hide</option></select>
18
18
  encoded contents of your diary in the feed.
19
+ <li><select name="makerss.hidesubtitle">
20
+ <option value="f"#{' selected' unless @conf['makerss.hidesubtitle']}>Include</option>
21
+ <option value="t"#{' selected' if @conf['makerss.hidesubtitle']}>Hide</option></select>
22
+ subtitles in the encoded contents.
19
23
  <li>Include summary of your contents<select name="makerss.shortdesc">
20
24
  <option value="f"#{' selected' unless @conf['makerss.shortdesc']}>as long as possible</option>
21
25
  <option value="t"#{' selected' if @conf['makerss.shortdesc']}>only some portion</option></select>
@@ -1,5 +1,3 @@
1
1
  @preview_label_conf = 'preview'
2
- @preview_label_interval = 'refresh interval'
3
- @preview_label_interval_desc = 'Specify the interval at which to display the preview in seconds.'
4
2
  @preview_label_min_width = 'side by side screen width'
5
3
  @preview_label_min_width_desc = 'Specifies the width to display the preview screen side-by-side in pixels.'
data/misc/plugin/image.rb CHANGED
@@ -36,6 +36,9 @@
36
36
  # @options['image.maxwidth']
37
37
  # sizeを指定しなかった場合に指定できる画像の最大表示幅。無指定時はnil
38
38
  # 表示のたびにファイルアクセスが入るので、重くなるかも?
39
+ # @options['image.resize']
40
+ # アップロード時に縮小する画像の長辺のピクセル数。無指定時は1600
41
+ # 縮小と同時に位置情報などのExifも取り除かれます(GIFを除く)。
39
42
  #
40
43
  # ライセンスについて:
41
44
  # Copyright (c) 2002,2003 Daisuke Kato <dai@kato-agri.com>
@@ -55,6 +58,7 @@ unless @resource_loaded then
55
58
  def image_label_only_jpeg; 'JPEGのみ'; end
56
59
  def image_label_add_image; 'この画像をアップロードする'; end
57
60
  def image_label_drop_here; 'ここにファイルをドロップ'; end
61
+ def image_label_upload_failed; '画像をアップロードできませんでした'; end
58
62
  end
59
63
 
60
64
  def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
@@ -142,17 +146,22 @@ def image_list( date )
142
146
  list
143
147
  end
144
148
 
145
- if /^(form|edit|formplugin|showcomment)$/ =~ @mode then
149
+ if /^(form|edit|formplugin|showcomment|preview)$/ =~ @mode then
146
150
  enable_js( 'image.js' )
147
151
  add_js_setting( '$tDiary.plugin.image' )
148
152
  add_js_setting( '$tDiary.plugin.image.alt', %Q|'#{image_label_description}'| )
149
153
  add_js_setting( '$tDiary.plugin.image.drop_here', %Q|'#{image_label_drop_here}'| )
154
+ add_js_setting( '$tDiary.plugin.image.failed', %Q|'#{image_label_upload_failed}'| )
155
+ add_js_setting( '$tDiary.plugin.image.date', %Q|'#{@date.strftime( '%Y%m%d' )}'| )
156
+ resize = @options['image.resize'].to_i
157
+ add_js_setting( '$tDiary.plugin.image.resize', resize > 0 ? resize : 1600 )
150
158
  end
151
159
 
152
160
  if /^formplugin$/ =~ @mode then
153
161
  maxnum = @options['image.maxnum'] || 1
154
162
  maxsize = @options['image.maxsize'] || 10000
155
163
 
164
+ @image_added = []
156
165
  begin
157
166
  date = @date.strftime( "%Y%m%d" )
158
167
  images = image_list( date )
@@ -167,7 +176,9 @@ if /^formplugin$/ =~ @mode then
167
176
  rescue NameError
168
177
  size = file.stat.size
169
178
  end
170
- output = "#{@image_dir}/#{date}_#{images.length}.#{extension}"
179
+ number = images.length + @image_added.length
180
+ output = "#{@image_dir}/#{date}_#{number}.#{extension}"
181
+ @image_added << number
171
182
  File::umask( 022 )
172
183
  File::open( output, "wb" ) do |f|
173
184
  f.print file.read
@@ -198,25 +209,20 @@ add_form_proc do |date|
198
209
  </div>
199
210
  <form id="plugin-image-delimage" class="update" method="post" action="#{h @update}"><div>
200
211
  #{csrf_protection}
201
- <table id="image-table">
202
- <tr>]
203
- tmp = ''
212
+ <div id="image-table">]
204
213
  images.each_with_index do |img,id|
205
214
  next unless img
206
215
  _, img_w, img_h = image_info(File.join(@image_dir,img))
207
- r << %Q[<td><img id="image-index-#{id}" class="image-img form" src="#{h @image_url}/#{h img}" alt="#{id}" width="#{h( (img_w && img_w > 160) ? 160 : (img_w ? img_w : 160) )}"></td>]
208
216
  img_info = ''
209
217
  if img_w && img_h
210
218
  img_info << %Q|<span class="image-width">#{img_w}</span> x <span class="image-height">#{img_h}</span>|
211
219
  end
212
- tmp << %Q[<td id="image-info-#{id}">
213
- <label><input type="checkbox" tabindex="#{tabidx+id*2}" name="plugin_image_id" value="#{id}">&nbsp;#{img_info}</label>
214
- </td>]
220
+ r << %Q[<div class="image-item">
221
+ <img id="image-index-#{id}" class="image-img form"#{' data-added="true"' if @image_added&.include?( id )} src="#{h @image_url}/#{h img}" alt="#{id}" width="#{h( (img_w && img_w > 160) ? 160 : (img_w ? img_w : 160) )}">
222
+ <label id="image-info-#{id}"><input type="checkbox" tabindex="#{tabidx+id*2}" name="plugin_image_id" value="#{id}">&nbsp;#{img_info}</label>
223
+ </div>]
215
224
  end
216
- r << "</tr><tr>"
217
- r << tmp
218
- r << %Q[</tr>
219
- </table>
225
+ r << %Q[</div>
220
226
  <input type="hidden" name="plugin_image_delimage" value="true">
221
227
  <input type="hidden" name="date" value="#{date.strftime( '%Y%m%d' )}">
222
228
  <input type="submit" tabindex="#{tabidx+97}" name="plugin" value="#{image_label_delete}">
@@ -14,6 +14,9 @@ def makerss_conf_html
14
14
  <li>フィードに本文全体を<select name="makerss.hidecontent">
15
15
  <option value="f"#{' selected' unless @conf['makerss.hidecontent']}>含める</option>
16
16
  <option value="t"#{' selected' if @conf['makerss.hidecontent']}>含めない</option></select></li>
17
+ <li>フィードの本文にサブタイトルを<select name="makerss.hidesubtitle">
18
+ <option value="f"#{' selected' unless @conf['makerss.hidesubtitle']}>含める</option>
19
+ <option value="t"#{' selected' if @conf['makerss.hidesubtitle']}>含めない</option></select></li>
17
20
  <li>フィードに含める説明を<select name="makerss.shortdesc">
18
21
  <option value="f"#{' selected' unless @conf['makerss.shortdesc']}>できるだけ長くする</option>
19
22
  <option value="t"#{' selected' if @conf['makerss.shortdesc']}>最初だけにする</option></select></li>
@@ -1,5 +1,3 @@
1
1
  @preview_label_conf = '日記のプレビュー'
2
- @preview_label_interval = '更新間隔 (秒)'
3
- @preview_label_interval_desc = 'プレビューを表示する間隔を秒単位で指定します。間隔を短くするとよりリアルタイムになりますが、その分サーバーに負荷がかかります。'
4
2
  @preview_label_min_width = '横並びで表示する画面サイズ (px)'
5
3
  @preview_label_min_width_desc = 'プレビュー画面を横並びで表示する幅をピクセル単位で指定します。ここで指定した幅より画面サイズが小さい場合は縦に並べて表示します。'
@@ -4,6 +4,7 @@
4
4
  #
5
5
  # options configurable through settings:
6
6
  # @conf['makerss.hidecontent'] : hide full-text content. default: false
7
+ # @conf['makerss.hidesubtitle'] : hide subtitle in full-text content. default: false
7
8
  # @conf['makerss.shortdesc'] : shorter description. default: false
8
9
  # @conf['makerss.comment_link'] : insert tsukkomi's link. default: false
9
10
  #
@@ -284,8 +285,8 @@ def makerss_update
284
285
  end
285
286
 
286
287
  rsses.each{|rss| rss.head( makerss_header( uri ) ) }
287
- db.keys.map{|k|get(db, k)}.sort.each_with_index do |rdfsec, idx|
288
- if rdfsec && rdfsec.section['visibility']
288
+ db.keys.map{|k|get(db, k)}.compact.sort.each_with_index do |rdfsec, idx|
289
+ if rdfsec.section['visibility']
289
290
  rsses.each {|rss|
290
291
  rss.item( makerss_seq( uri, rdfsec ), makerss_body( uri, rdfsec ), rdfsec )
291
292
  }
@@ -395,7 +396,7 @@ def makerss_body( uri, rdfsec )
395
396
  rdf << %Q|<description>#{h makerss_desc_shorten( desc )}</description>\n|
396
397
  unless @conf['makerss.hidecontent']
397
398
  text = ''
398
- text << '<h3>' + apply_plugin( subtitle.sub( /^(\[([^\]]+)\])+ */, '' ) ).strip + '</h3>' if subtitle and not subtitle.empty?
399
+ text << '<h3>' + apply_plugin( subtitle.sub( /^(\[([^\]]+)\])+ */, '' ) ).strip + '</h3>' if subtitle and not subtitle.empty? and not @conf['makerss.hidesubtitle']
399
400
  text << body_enter
400
401
  text << body
401
402
  text << body_leave
@@ -451,7 +452,7 @@ add_header_proc {
451
452
 
452
453
  add_conf_proc( 'makerss', @makerss_conf_label, 'update' ) do
453
454
  if @mode == 'saveconf' then
454
- %w( hidecontent shortdesc comment_link no_comments).each do |s|
455
+ %w( hidecontent hidesubtitle shortdesc comment_link no_comments).each do |s|
455
456
  item = "makerss.#{s}"
456
457
  @conf[item] = ( 't' == @cgi.params[item][0] )
457
458
  end
@@ -289,6 +289,7 @@ _END
289
289
  begin
290
290
  PStore.new(path).transaction(true) do |db|
291
291
  db.roots.each do |cached_anchor|
292
+ next if cached_anchor == :__ruby_version
292
293
  yield(cached_anchor, db[cached_anchor])
293
294
  end
294
295
  end
@@ -6,27 +6,19 @@
6
6
  # Distributed under the GPL2 or any later version.
7
7
  #
8
8
 
9
- @conf['preview.interval'] ||= 10
10
9
  @conf['preview.min_width'] ||= 896
11
10
 
12
11
  if /\A(form|edit|preview)\z/ === @mode then
13
12
  enable_js('preview.js')
14
13
  add_js_setting('$tDiary.plugin.preview')
15
- add_js_setting('$tDiary.plugin.preview.interval', @conf['preview.interval'].to_json)
16
14
  add_js_setting('$tDiary.plugin.preview.minWidth', @conf['preview.min_width'].to_json)
17
15
  end
18
16
 
19
17
  add_conf_proc('preview', @preview_label_conf, 'update') do
20
18
  if @mode == 'saveconf'
21
- @conf['preview.interval'] = @cgi.params['preview.interval'][0].to_i
22
19
  @conf['preview.min_width'] = @cgi.params['preview.min_width'][0].to_i
23
20
  end
24
21
  ERB.new(%q{
25
- <h3><%= @preview_label_interval %></h3>
26
- <div>
27
- <p><%= @preview_label_interval_desc %></p>
28
- <p><input name="preview.interval" value="<%=h @conf['preview.interval'] %>"> sec</p>
29
- </div>
30
22
  <h3><%= @preview_label_min_width %></h3>
31
23
  <div>
32
24
  <p><%= @preview_label_min_width_desc %></p>
data/theme/base.css CHANGED
@@ -136,6 +136,18 @@ img.right, img.amazon {
136
136
  margin-top: 0px;
137
137
  }
138
138
 
139
+ div#image-table {
140
+ display: grid;
141
+ grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
142
+ align-items: end;
143
+ gap: 0.5em;
144
+ }
145
+
146
+ div#image-table img {
147
+ display: block;
148
+ max-width: 100%;
149
+ }
150
+
139
151
  /*
140
152
  calendar3 plugin
141
153
  */
@@ -273,6 +285,10 @@ draft plugin
273
285
  div.draft select {
274
286
  width: 60%;
275
287
  }
288
+ p.draft-notice {
289
+ border: solid 1px #999;
290
+ padding: 4px 8px;
291
+ }
276
292
 
277
293
  /*
278
294
  * youtube plugin
@@ -284,16 +300,30 @@ div.youtube-player-wrapper {
284
300
  }
285
301
 
286
302
  /*
287
- * editor textarea sizing
303
+ * editor textarea
288
304
  *
289
305
  * The inline margins are zeroed on purpose: themes indent textareas
290
306
  * (tdiary2 uses margin-left: 3em), which would push the editor out of
291
307
  * line with the fields above it.
308
+ * The font likewise overrides theme textarea fonts on purpose.
292
309
  */
293
310
  textarea#body {
294
311
  box-sizing: border-box;
295
312
  width: 100%;
296
313
  margin-inline: 0;
297
- height: clamp(10rem, 33dvh, 33rem);
314
+ --editor-height: clamp(10rem, 33dvh, 33rem);
315
+ height: var(--editor-height);
298
316
  resize: vertical;
317
+ font-family: inherit;
318
+ font-size: max(16px, 1rem);
319
+ line-height: 1.6;
320
+ }
321
+
322
+ @supports (field-sizing: content) {
323
+ textarea#body {
324
+ field-sizing: content;
325
+ height: auto;
326
+ min-height: var(--editor-height);
327
+ max-height: 75dvh;
328
+ }
299
329
  }
data/theme/conf.css CHANGED
@@ -5,11 +5,17 @@ Copyright (C) 2005 TADA Tadashi <sho@spc.gr.jp>
5
5
  You can redistribute it and/or modify it under GPL2 or any later version.
6
6
  */
7
7
 
8
+ html {
9
+ -webkit-text-size-adjust: 100%;
10
+ text-size-adjust: 100%;
11
+ }
12
+
8
13
  body {
9
14
  background-color: #fff;
10
15
  color: #000;
11
16
  margin: 0px;
12
17
  padding: 0px;
18
+ overflow-wrap: anywhere;
13
19
  }
14
20
 
15
21
  h1 {
@@ -138,6 +144,7 @@ form.conf p {
138
144
  form.conf pre {
139
145
  line-height: 150%;
140
146
  margin: 0px 1em 0.7em 3em;
147
+ overflow-x: auto;
141
148
  }
142
149
 
143
150
  form.conf ul {
@@ -156,6 +163,13 @@ form.conf dd {
156
163
  margin-bottom: 1em;
157
164
  }
158
165
 
166
+ form.conf input,
167
+ form.conf select,
168
+ form.conf textarea {
169
+ box-sizing: border-box;
170
+ max-width: 100%;
171
+ }
172
+
159
173
  p.message {
160
174
  text-align: center;
161
175
  font-size: large;
@@ -252,3 +266,49 @@ span.help-icon {
252
266
  span.help-icon img {
253
267
  border-width: 0px;
254
268
  }
269
+
270
+ /*
271
+ design for smart phones, below the width where the form beside the menu gets narrower than on a phone
272
+ */
273
+ @media screen and (max-width: 640px) {
274
+ div.adminmenu a {
275
+ display: inline-block;
276
+ padding: 0.5em 0.75em;
277
+ }
278
+
279
+ div.sidebar {
280
+ float: none;
281
+ width: auto;
282
+ }
283
+
284
+ div.sidebar ul {
285
+ display: flex;
286
+ flex-wrap: wrap;
287
+ gap: 0.2em 0.5em;
288
+ margin-left: 0px;
289
+ }
290
+
291
+ div.sidebar li {
292
+ margin-bottom: 0px;
293
+ padding: 0px;
294
+ }
295
+
296
+ div.sidebar li a {
297
+ display: block;
298
+ padding: 0.3em 0.5em;
299
+ }
300
+
301
+ div.sidebar li:has(> a:empty) {
302
+ display: none;
303
+ }
304
+
305
+ form.conf {
306
+ margin: 0px 16px 2em 16px;
307
+ }
308
+
309
+ input,
310
+ select,
311
+ textarea {
312
+ font-size: 16px;
313
+ }
314
+ }