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.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/Gemfile.lock +61 -59
- data/doc/HOWTO-authenticate-in-rack.md +3 -3
- data/doc/HOWTO-make-theme.md +3 -3
- data/js/00default.js +22 -12
- data/js/caretposition.js +1 -0
- data/js/draft.js +228 -51
- data/js/image.js +126 -29
- data/js/preview.js +12 -50
- data/js/update.js +54 -0
- data/js/update_preview.js +79 -0
- data/lib/aws/pa_api.rb +7 -7
- data/lib/tdiary/admin.rb +66 -3
- data/lib/tdiary/cli.rb +14 -10
- data/lib/tdiary/core_ext.rb +46 -8
- data/lib/tdiary/dispatcher/update_main.rb +6 -0
- data/lib/tdiary/io/plugin_pstore.rb +2 -1
- data/lib/tdiary/plugin/00default.rb +3 -0
- data/lib/tdiary/rack/auth/basic.rb +72 -9
- data/lib/tdiary/tasks/auth.rake +2 -4
- data/lib/tdiary/tasks/release.rake +5 -4
- data/lib/tdiary/version.rb +1 -1
- data/lib/tdiary.rb +3 -0
- data/misc/plugin/amazon.rb +48 -11
- data/misc/plugin/amazon_rakuten.rb +79 -0
- data/misc/plugin/draft.rb +83 -0
- data/misc/plugin/en/image.rb +5 -0
- data/misc/plugin/en/makerss.rb +4 -0
- data/misc/plugin/en/preview.rb +0 -2
- data/misc/plugin/image.rb +19 -13
- data/misc/plugin/ja/makerss.rb +3 -0
- data/misc/plugin/ja/preview.rb +0 -2
- data/misc/plugin/makerss.rb +5 -4
- data/misc/plugin/my-sequel.rb +1 -0
- data/misc/plugin/preview.rb +0 -8
- data/theme/base.css +32 -2
- data/theme/conf.css +60 -0
- data/theme/default/default.css +33 -8
- data/vendor/bundle/ruby/3.4.0/cache/bcrypt-3.1.22.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/date-3.6.0.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/fastimage-2.4.3.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-imap-0.6.8.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-protocol-0.4.0.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-smtp-0.5.2.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/pstore-0.3.0.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/rack-3.2.8.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/bcrypt-3.1.22/bcrypt_ext.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/bcrypt-3.1.22/gem_make.out +28 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/cgi-0.5.2/cgi/escape.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/cgi-0.5.2/gem_make.out +6 -6
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/date_core.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/gem.build_complete +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/gem_make.out +26 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.6.0/mkmf.log +140 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/CHANGELOG +127 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/COPYING +28 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/README.md +192 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/jruby/bcrypt_jruby/BCrypt.java +926 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/Makefile +273 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/bcrypt_ext.c +125 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt.c +57 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt.h +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_blowfish.c +903 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_blowfish.h +27 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_gensalt.c +124 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/crypt_gensalt.h +30 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/extconf.rb +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/ow-crypt.h +43 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/wrapper.c +554 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/ext/mri/x86.S +203 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt/engine.rb +134 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt/error.rb +22 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt/password.rb +106 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt.rb +16 -0
- data/vendor/bundle/ruby/3.4.0/gems/bcrypt-3.1.22/lib/bcrypt_ext.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/cgi-0.5.2/ext/cgi/escape/Makefile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/cgi-0.5.2/lib/cgi/escape.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/Makefile +4 -4
- data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_core.c +293 -77
- data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_parse.c +14 -4
- data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_strptime.c +13 -13
- data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/extconf.rb +6 -0
- data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/lib/date.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/gems/date-3.6.0/lib/date_core.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/avif.rb +1 -0
- 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
- data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/heic.rb +1 -0
- 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
- data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/jxl.rb +1 -0
- data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/version.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/Gemfile +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.8/README.md +103 -0
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.8/Rakefile +74 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.8/lib/net/imap/utils.rb +49 -0
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/lib/net/imap.rb +195 -46
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/rdoc.rake +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/lib/net/protocol.rb +38 -23
- data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/lib/net/smtp.rb +5 -8
- data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/lib/pstore.rb +52 -31
- data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/pstore.gemspec +1 -0
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/CHANGELOG.md +34 -0
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart/parser.rb +7 -2
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart/uploaded_file.rb +1 -0
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/request.rb +5 -2
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/static.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/version.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/specifications/bcrypt-3.1.22.gemspec +33 -0
- data/vendor/bundle/ruby/3.4.0/specifications/{date-3.5.1.gemspec → date-3.6.0.gemspec} +3 -3
- data/vendor/bundle/ruby/3.4.0/specifications/{fastimage-2.4.1.gemspec → fastimage-2.4.3.gemspec} +3 -3
- data/vendor/bundle/ruby/3.4.0/specifications/{net-imap-0.6.6.gemspec → net-imap-0.6.8.gemspec} +3 -3
- data/vendor/bundle/ruby/3.4.0/specifications/{net-protocol-0.3.0.gemspec → net-protocol-0.4.0.gemspec} +2 -2
- data/vendor/bundle/ruby/3.4.0/specifications/{net-smtp-0.5.1.gemspec → net-smtp-0.5.2.gemspec} +4 -4
- data/vendor/bundle/ruby/3.4.0/specifications/{pstore-0.2.1.gemspec → pstore-0.3.0.gemspec} +3 -2
- data/vendor/bundle/ruby/3.4.0/specifications/{rack-3.2.7.gemspec → rack-3.2.8.gemspec} +2 -2
- data/views/preview.rhtml +2 -1
- data/views/preview.rhtml.en +2 -1
- data/views/update.rhtml +10 -1
- data/views/update.rhtml.en +10 -1
- metadata +242 -200
- data/misc/plugin/amp.rb +0 -118
- data/vendor/bundle/ruby/3.4.0/cache/date-3.5.1.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/fastimage-2.4.1.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-imap-0.6.6.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-protocol-0.3.0.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-smtp-0.5.1.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/pstore-0.2.1.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/rack-3.2.7.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/date_core.so +0 -0
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/gem_make.out +0 -24
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/mkmf.log +0 -93
- data/vendor/bundle/ruby/3.4.0/gems/date-3.5.1/lib/date_core.so +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.6/README.md +0 -77
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.6/Rakefile +0 -24
- data/views/amp.rhtml +0 -34
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/BSDL +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/COPYING +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_strftime.c +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/date_tmx.h +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/prereq.mk +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/zonetab.h +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{date-3.5.1 → date-3.6.0}/ext/date/zonetab.list +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/bmp.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/exif.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/gif.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/ico.rb +0 -0
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/jpeg.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/jxlc.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/png.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/psd.rb +0 -0
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/svg.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/tiff.rb +0 -0
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage/fastimage_parsing/webp.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{fastimage-2.4.1 → fastimage-2.4.3}/lib/fastimage.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/BSDL +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/COPYING +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/docs/styles.css +0 -0
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/net-imap.gemspec +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/benchmarks.rake +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/rfcs.rake +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/rakelib/saslprep.rake +0 -0
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.6.6 → net-imap-0.6.8}/sample/net-imap.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/BSDL +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/COPYING +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.3.0 → net-protocol-0.4.0}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/NEWS.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/README.md +0 -0
- /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
- /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
- /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
- /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
- /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
- /data/vendor/bundle/ruby/3.4.0/gems/{net-smtp-0.5.1 → net-smtp-0.5.2}/net-smtp.gemspec +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/BSDL +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/COPYING +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/Gemfile +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/Rakefile +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/bin/console +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{pstore-0.2.1 → pstore-0.3.0}/bin/setup +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/CONTRIBUTING.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/SPEC.rdoc +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/auth/abstract/handler.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/auth/abstract/request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/auth/basic.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/bad_request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/body_proxy.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/builder.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/cascade.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/common_logger.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/conditional_get.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/config.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/constants.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/content_length.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/content_type.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/deflater.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/directory.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/etag.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/events.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/files.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/head.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/headers.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/lint.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/lock.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/media_type.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/method_override.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mime.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mock.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mock_request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/mock_response.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart/generator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/multipart.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/null_logger.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/query_parser.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/recursive.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/reloader.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/response.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/rewindable_input.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/runtime.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/sendfile.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/show_exceptions.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/show_status.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/tempfile_reaper.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/urlmap.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack/utils.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.7 → rack-3.2.8}/lib/rack.rb +0 -0
data/js/update.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* update.js: keep the text in the diary update form from being lost
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026 by SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
|
5
|
+
* You can distribute it under GPL2 or any later version.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
$(function() {
|
|
9
|
+
var body = $('#body');
|
|
10
|
+
var form = body.closest('form');
|
|
11
|
+
if (form.length == 0) { return; }
|
|
12
|
+
var title = form.find('#title');
|
|
13
|
+
|
|
14
|
+
// Enter in the title presses the first submit button, "edit this day",
|
|
15
|
+
// which loads the saved diary over what was typed
|
|
16
|
+
title.on('keydown', function(e) {
|
|
17
|
+
if (e.key == 'Enter' && !e.originalEvent.isComposing && e.keyCode != 229) {
|
|
18
|
+
e.preventDefault();
|
|
19
|
+
body.focus();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
var saving = false;
|
|
24
|
+
var unsaved = function() {
|
|
25
|
+
return form.data('unsaved') ||
|
|
26
|
+
title.val() != title.prop('defaultValue') ||
|
|
27
|
+
body.val() != body.prop('defaultValue');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
$(window).on('beforeunload', function(e) {
|
|
31
|
+
if (!saving && unsaved()) {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
e.originalEvent.returnValue = '';
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// a second press while the first post is on its way appends the text twice.
|
|
38
|
+
// A post stopped by the author brings no pageshow, so the guard also ends by
|
|
39
|
+
// time instead of blocking every later post and the question on leaving.
|
|
40
|
+
form.on('submit', function(e) {
|
|
41
|
+
var submitter = e.originalEvent && e.originalEvent.submitter;
|
|
42
|
+
if (submitter && submitter.name == 'edit') { return; }
|
|
43
|
+
if (saving) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
saving = true;
|
|
48
|
+
setTimeout(function() { saving = false; }, 10 * 1000);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
$(window).on('pageshow', function() {
|
|
52
|
+
saving = false;
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* update_preview.js: preview the diary without leaving the update form
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2026 by SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
|
5
|
+
* You can distribute it under GPL2 or any later version.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
(function() {
|
|
9
|
+
var form = function() { return $('#body').closest('form'); };
|
|
10
|
+
var button = function() {
|
|
11
|
+
return form().find('input[name=appendpreview], input[name=replacepreview]');
|
|
12
|
+
};
|
|
13
|
+
// the diary shown above the update form, where preview.rhtml puts it
|
|
14
|
+
var day = function(root) {
|
|
15
|
+
return root.find('div.update').prevAll('div.day').first();
|
|
16
|
+
};
|
|
17
|
+
var shown = function() {
|
|
18
|
+
var current = day($(document));
|
|
19
|
+
return current.length > 0 && current.css('display') != 'none';
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// a response is dropped once a newer request is sent or the preview is hidden
|
|
23
|
+
var latest = 0;
|
|
24
|
+
|
|
25
|
+
var load = function(explicit) {
|
|
26
|
+
var data = new URLSearchParams(form().serialize());
|
|
27
|
+
data.append(button().attr('name'), button().val());
|
|
28
|
+
var id = ++latest;
|
|
29
|
+
return fetch(form().prop('action'), { method: 'POST', body: data })
|
|
30
|
+
.then(function(response) { return response.text(); })
|
|
31
|
+
.then(function(html) {
|
|
32
|
+
if (id != latest) { return; }
|
|
33
|
+
var rendered = day($(new DOMParser().parseFromString(html, 'text/html')));
|
|
34
|
+
if (rendered.length == 0) { throw new Error('no preview in the response'); }
|
|
35
|
+
var current = day($(document));
|
|
36
|
+
if (current.length == 0) {
|
|
37
|
+
current = rendered.insertBefore('div.update');
|
|
38
|
+
} else {
|
|
39
|
+
current.attr('class', rendered.attr('class')).empty().append(rendered.contents()).show();
|
|
40
|
+
}
|
|
41
|
+
if (explicit) { current[0].scrollIntoView(); }
|
|
42
|
+
})
|
|
43
|
+
.catch(function() {
|
|
44
|
+
// the preview page shows what went wrong
|
|
45
|
+
if (explicit && id == latest) { form()[0].requestSubmit(button()[0]); }
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var hide = function() {
|
|
50
|
+
latest++;
|
|
51
|
+
day($(document)).hide();
|
|
52
|
+
$('#body').focus();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
$tDiary.preview = {
|
|
56
|
+
refresh: function() {
|
|
57
|
+
if (shown()) { return load(false); }
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
$(function() {
|
|
62
|
+
if (button().length == 0) { return; }
|
|
63
|
+
|
|
64
|
+
// cancelling the click keeps the form from being submitted at all, so
|
|
65
|
+
// the scripts that take a submit for posting the diary are not run
|
|
66
|
+
button().on('click', function(e) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
load(true);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
$(document).on('keydown', function(e) {
|
|
72
|
+
if ((e.metaKey || e.ctrlKey) && e.shiftKey && !e.altKey &&
|
|
73
|
+
e.key.toLowerCase() == 'p' && !e.originalEvent.isComposing) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
if (shown()) { hide(); } else { load(true); }
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
})();
|
data/lib/aws/pa_api.rb
CHANGED
|
@@ -22,12 +22,18 @@ module AWS
|
|
|
22
22
|
us: Market.new('webservices.amazon.com', 'us-east-1'),
|
|
23
23
|
}.freeze
|
|
24
24
|
|
|
25
|
+
# Returns the ISBN-10 of an ISBN-13 starting with 978.
|
|
26
|
+
def self.isbn13to10(isbn13)
|
|
27
|
+
sum, = isbn13[3, 9].split(//).map(&:to_i).reduce([0,10]){|s,d|[s[0] + d * s[1], s[1]-1]}
|
|
28
|
+
return isbn13[3, 9] + %w(0 1 2 3 4 5 6 7 8 9 X 0)[11 - sum % 11]
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
def initialize(access_key, secret_key, partner_tag)
|
|
26
32
|
@access_key, @secret_key, @partner_tag = access_key, secret_key, partner_tag
|
|
27
33
|
end
|
|
28
34
|
|
|
29
35
|
def get_items(asin, locale)
|
|
30
|
-
asin = isbn13to10(asin) if asin.length == 13
|
|
36
|
+
asin = PAAPI.isbn13to10(asin) if asin.length == 13
|
|
31
37
|
payload = {
|
|
32
38
|
"PartnerTag" => @partner_tag,
|
|
33
39
|
"PartnerType" => "Associates",
|
|
@@ -66,11 +72,5 @@ module AWS
|
|
|
66
72
|
response.value # raise on errors
|
|
67
73
|
return response.body
|
|
68
74
|
end
|
|
69
|
-
|
|
70
|
-
private
|
|
71
|
-
def isbn13to10(isbn13)
|
|
72
|
-
sum, = isbn13[3, 9].split(//).map(&:to_i).reduce([0,10]){|s,d|[s[0] + d * s[1], s[1]-1]}
|
|
73
|
-
return isbn13[3, 9] + %w(0 1 2 3 4 5 6 7 8 9 X 0)[11 - sum % 11]
|
|
74
|
-
end
|
|
75
75
|
end
|
|
76
76
|
end
|
data/lib/tdiary/admin.rb
CHANGED
|
@@ -7,11 +7,18 @@ module TDiary
|
|
|
7
7
|
def initialize( cgi, rhtml, conf )
|
|
8
8
|
super
|
|
9
9
|
|
|
10
|
+
ymd = %w(year month day).map {|key| @request.param( key ) }
|
|
10
11
|
begin
|
|
11
|
-
|
|
12
|
-
rescue
|
|
13
|
-
raise
|
|
12
|
+
y, m, d = ymd.map( &:to_i )
|
|
13
|
+
rescue NameError
|
|
14
|
+
raise BadDateError, 'bad date'
|
|
14
15
|
end
|
|
16
|
+
# Time::local would roll 2/30 over into March, and the data files
|
|
17
|
+
# are named after a four digit year
|
|
18
|
+
unless (1000..9999).cover?( y ) and Date.valid_date?( y, m, d )
|
|
19
|
+
raise BadDateError, ymd.join( '-' )
|
|
20
|
+
end
|
|
21
|
+
@date = Time::local( y, m, d )
|
|
15
22
|
end
|
|
16
23
|
end
|
|
17
24
|
|
|
@@ -135,6 +142,8 @@ module TDiary
|
|
|
135
142
|
begin
|
|
136
143
|
super
|
|
137
144
|
rescue TDiaryError
|
|
145
|
+
# a post without a date goes to today, a wrong date to nowhere
|
|
146
|
+
raise if %w(year month day).any? {|key| @request.valid?( key ) }
|
|
138
147
|
@date = newdate
|
|
139
148
|
end
|
|
140
149
|
|
|
@@ -165,6 +174,7 @@ module TDiary
|
|
|
165
174
|
def initialize( cgi, rhtm, conf )
|
|
166
175
|
super
|
|
167
176
|
old_date = @request.param('old')
|
|
177
|
+
conflict = false
|
|
168
178
|
|
|
169
179
|
@io.transaction( @date ) do |diaries|
|
|
170
180
|
@diaries = diaries
|
|
@@ -173,6 +183,10 @@ module TDiary
|
|
|
173
183
|
if @date.strftime( '%Y%m%d' ) != old_date then
|
|
174
184
|
@diary.append( @body, @append )
|
|
175
185
|
@diary.set_title( @title ) if @title.length > 0
|
|
186
|
+
elsif @request.valid?( 'last_modified' ) and @request.param( 'last_modified' ).to_i != @diary.last_modified.to_i then
|
|
187
|
+
# saved from another browser after this form was opened
|
|
188
|
+
conflict = true
|
|
189
|
+
next DIRTY_NONE
|
|
176
190
|
else
|
|
177
191
|
@diary.replace( @date, @title, @body )
|
|
178
192
|
end
|
|
@@ -183,6 +197,55 @@ module TDiary
|
|
|
183
197
|
self << @diary
|
|
184
198
|
DIRTY_DIARY
|
|
185
199
|
end
|
|
200
|
+
raise ConflictError if conflict
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
#
|
|
205
|
+
# class TDiaryRetry
|
|
206
|
+
# show the update form again with the text that was not saved
|
|
207
|
+
#
|
|
208
|
+
class TDiaryRetry < TDiaryAuthorOnlyBase
|
|
209
|
+
def initialize( request, rhtml, conf, rejected )
|
|
210
|
+
super( request, rhtml, conf )
|
|
211
|
+
@rejected = rejected
|
|
212
|
+
|
|
213
|
+
y, m, d = @request.param( 'old' ).to_s.scan( /\A(\d{4})(\d\d)(\d\d)\z/ )[0]
|
|
214
|
+
if y and Date.valid_date?( y.to_i, m.to_i, d.to_i ) then
|
|
215
|
+
@date = Time::local( y.to_i, m.to_i, d.to_i )
|
|
216
|
+
else
|
|
217
|
+
@date = Time::now + (@conf.hour_offset * 3600).to_i
|
|
218
|
+
end
|
|
219
|
+
title = @conf.to_native( @request.param( 'title' ) || '' )
|
|
220
|
+
body = @conf.to_native( @request.param( 'body' ) || '' )
|
|
221
|
+
|
|
222
|
+
@io.transaction( @date ) do |diaries|
|
|
223
|
+
@diaries = diaries
|
|
224
|
+
diary = self[@date]
|
|
225
|
+
@conf.style = diary.style if diary
|
|
226
|
+
@diary = @io.diary_factory( @date, title, body, @conf.style )
|
|
227
|
+
@diary.show( @request.param( 'hide' ) != 'true' )
|
|
228
|
+
# once the conflict is shown, sending the text again overwrites
|
|
229
|
+
# the other update
|
|
230
|
+
if diary and ( @rejected.kind_of?( ConflictError ) or not @request.valid?( 'last_modified' ) ) then
|
|
231
|
+
@diary.last_modified = diary.last_modified
|
|
232
|
+
else
|
|
233
|
+
@diary.last_modified = Time::at( @request.param( 'last_modified' ).to_i )
|
|
234
|
+
end
|
|
235
|
+
DIRTY_NONE
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
protected
|
|
240
|
+
|
|
241
|
+
# plugins add their parts of the form by mode, so keep the one the
|
|
242
|
+
# rejected form had
|
|
243
|
+
def mode
|
|
244
|
+
if @request.valid?( 'append' ) or @request.valid?( 'appendpreview' ) then
|
|
245
|
+
'form'
|
|
246
|
+
else
|
|
247
|
+
'edit'
|
|
248
|
+
end
|
|
186
249
|
end
|
|
187
250
|
end
|
|
188
251
|
|
data/lib/tdiary/cli.rb
CHANGED
|
@@ -10,6 +10,10 @@ module TDiary
|
|
|
10
10
|
File.expand_path('../../..', __FILE__)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def self.exit_on_failure?
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
desc "new DIR_NAME", "Create a new tDiary directory"
|
|
14
18
|
method_option "skip-bundle", type: :boolean, banner:
|
|
15
19
|
"don't run bundle and .htpasswd generation"
|
|
@@ -20,9 +24,10 @@ module TDiary
|
|
|
20
24
|
template('misc/templates/Gemfile.local.erb', File.join(target, 'Gemfile.local'))
|
|
21
25
|
|
|
22
26
|
unless options[:'skip-bundle']
|
|
23
|
-
Bundler.
|
|
27
|
+
Bundler.with_unbundled_env do
|
|
24
28
|
inside(target) do
|
|
25
|
-
run('bundle
|
|
29
|
+
run('bundle config set --local without test:development')
|
|
30
|
+
run('bundle install')
|
|
26
31
|
run('bundle exec tdiary htpasswd')
|
|
27
32
|
end
|
|
28
33
|
end
|
|
@@ -46,9 +51,10 @@ module TDiary
|
|
|
46
51
|
deploy(target)
|
|
47
52
|
|
|
48
53
|
unless options[:'skip-bundle']
|
|
49
|
-
Bundler.
|
|
54
|
+
Bundler.with_unbundled_env do
|
|
50
55
|
inside(target) do
|
|
51
|
-
run('bundle
|
|
56
|
+
run('bundle config set --local without test:development')
|
|
57
|
+
run('bundle install')
|
|
52
58
|
end
|
|
53
59
|
end
|
|
54
60
|
end
|
|
@@ -74,11 +80,11 @@ module TDiary
|
|
|
74
80
|
def test
|
|
75
81
|
target = File.join(Dir.pwd, 'tmp/test')
|
|
76
82
|
deploy(target)
|
|
77
|
-
append_to_file(File.join(target, 'Gemfile'), "path '#{CLI::source_root}'")
|
|
83
|
+
append_to_file(File.join(target, 'Gemfile'), "gem 'tdiary', path: '#{CLI::source_root}'")
|
|
78
84
|
directory('spec', File.join(target, 'spec'))
|
|
79
85
|
directory('test', File.join(target, 'test'))
|
|
80
86
|
|
|
81
|
-
Bundler.
|
|
87
|
+
Bundler.with_unbundled_env do
|
|
82
88
|
inside(target) do
|
|
83
89
|
run('bundle install')
|
|
84
90
|
run('bundle exec rake spec')
|
|
@@ -132,7 +138,7 @@ module TDiary
|
|
|
132
138
|
|
|
133
139
|
desc "htpasswd", "Create a .htpasswd file"
|
|
134
140
|
def htpasswd
|
|
135
|
-
require '
|
|
141
|
+
require 'tdiary/rack/auth/basic'
|
|
136
142
|
say "Input your username/password"
|
|
137
143
|
print 'Username: '
|
|
138
144
|
ARGV.replace([])
|
|
@@ -148,9 +154,7 @@ module TDiary
|
|
|
148
154
|
if password != password2
|
|
149
155
|
raise StandardError, 'password verification error'
|
|
150
156
|
end
|
|
151
|
-
|
|
152
|
-
htpasswd.set_passwd(nil, username, password)
|
|
153
|
-
htpasswd.flush
|
|
157
|
+
TDiary::Rack::Auth::Basic.write_password(ENV['HTPASSWD'] || '.htpasswd', username, password)
|
|
154
158
|
end
|
|
155
159
|
|
|
156
160
|
desc "version", "Prints the tDiary's version information"
|
data/lib/tdiary/core_ext.rb
CHANGED
|
@@ -68,6 +68,11 @@ module TDiary
|
|
|
68
68
|
env['REMOTE_USER']
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
# true when TDiary::Rack::Auth::Basic accepted a DES crypt password
|
|
72
|
+
def legacy_password?
|
|
73
|
+
env['tdiary.legacy_password'] ? true : false
|
|
74
|
+
end
|
|
75
|
+
|
|
71
76
|
def https?
|
|
72
77
|
return true if env['HTTP_X_FORWARDED_PROTO'] == 'https'
|
|
73
78
|
return false if env['HTTPS'].nil? or /off/i =~ env['HTTPS'] or env['HTTPS'] == ''
|
|
@@ -97,11 +102,41 @@ module TDiary
|
|
|
97
102
|
|
|
98
103
|
private
|
|
99
104
|
|
|
105
|
+
# the interface cgi.rb gave to an uploaded file in a multipart request
|
|
106
|
+
module CGIMultipartFile
|
|
107
|
+
attr_reader :original_filename, :content_type
|
|
108
|
+
|
|
109
|
+
def local_path
|
|
110
|
+
path
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# cgi.rb returned the other parts of a multipart request as Strings
|
|
115
|
+
# responding to read, so plugins call params[key][0].read on them
|
|
116
|
+
module CGIMultipartValue
|
|
117
|
+
def read
|
|
118
|
+
self
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def original_filename
|
|
122
|
+
''
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def content_type
|
|
126
|
+
''
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
100
130
|
def build_cgi_params
|
|
131
|
+
multipart = false
|
|
101
132
|
source =
|
|
102
133
|
if env['REQUEST_METHOD'] == 'POST'
|
|
103
|
-
if
|
|
104
|
-
|
|
134
|
+
if media_type == 'multipart/form-data'
|
|
135
|
+
multipart = true
|
|
136
|
+
# Rack::Request#POST nests 'a[b]' and keeps only the last of
|
|
137
|
+
# duplicated names; form_pairs, which POST is built from, keeps
|
|
138
|
+
# them flat like CGI (image.js posts several files under one name)
|
|
139
|
+
form_pairs
|
|
105
140
|
else
|
|
106
141
|
# Rack's nested query parser behind Rack::Request#POST keeps
|
|
107
142
|
# only the last of duplicated keys; CGI collects all of them.
|
|
@@ -116,7 +151,7 @@ module TDiary
|
|
|
116
151
|
params = {}
|
|
117
152
|
source.each do |key, value|
|
|
118
153
|
values = value.kind_of?( Array ) ? value : [value]
|
|
119
|
-
params[key]
|
|
154
|
+
( params[key] ||= [] ).concat( values.map {|v| normalize_cgi_value( v, multipart ) } )
|
|
120
155
|
end
|
|
121
156
|
params.default = []
|
|
122
157
|
params
|
|
@@ -133,13 +168,16 @@ module TDiary
|
|
|
133
168
|
body || ''
|
|
134
169
|
end
|
|
135
170
|
|
|
136
|
-
def normalize_cgi_value( value )
|
|
171
|
+
def normalize_cgi_value( value, multipart = false )
|
|
137
172
|
if value.kind_of?( Hash ) and value[:tempfile]
|
|
138
|
-
# Rack multipart file upload:
|
|
139
|
-
|
|
140
|
-
value[:
|
|
173
|
+
# Rack multipart file upload: restore the cgi.rb interface
|
|
174
|
+
file = value[:tempfile]
|
|
175
|
+
file.instance_variable_set( :@original_filename, value[:filename].to_s )
|
|
176
|
+
file.instance_variable_set( :@content_type, value[:type].to_s )
|
|
177
|
+
file.extend( CGIMultipartFile )
|
|
141
178
|
else
|
|
142
|
-
repair_encoding( value.to_s )
|
|
179
|
+
str = repair_encoding( value.to_s )
|
|
180
|
+
multipart ? str.dup.extend( CGIMultipartValue ) : str
|
|
143
181
|
end
|
|
144
182
|
end
|
|
145
183
|
|
|
@@ -58,6 +58,12 @@ module TDiary
|
|
|
58
58
|
else
|
|
59
59
|
tdiary = TDiary::TDiaryForm::new( request, 'update.rhtml', conf )
|
|
60
60
|
end
|
|
61
|
+
rescue TDiary::BadDateError, TDiary::ConflictError
|
|
62
|
+
if %w(append replace appendpreview replacepreview).any? {|key| params[key] }
|
|
63
|
+
tdiary = TDiary::TDiaryRetry::new( request, 'update.rhtml', conf, $! )
|
|
64
|
+
else
|
|
65
|
+
tdiary = TDiary::TDiaryForm::new( request, 'update.rhtml', conf )
|
|
66
|
+
end
|
|
61
67
|
rescue TDiary::TDiaryError
|
|
62
68
|
tdiary = TDiary::TDiaryForm::new( request, 'update.rhtml', conf )
|
|
63
69
|
end
|
|
@@ -367,6 +367,7 @@ end
|
|
|
367
367
|
|
|
368
368
|
enable_js( '00default.js', async: false )
|
|
369
369
|
add_js_setting( '$tDiary.style', "'#{@conf.style.downcase.sub( /\Ablog/, '' )}'" )
|
|
370
|
+
enable_js( 'update.js' ) if /^(form|edit|preview|showcomment|formplugin)$/ =~ @mode
|
|
370
371
|
|
|
371
372
|
def script_tag_query_string
|
|
372
373
|
"?#{TDIARY_VERSION}#{Time::now.strftime('%Y%m%d')}"
|
|
@@ -559,6 +560,8 @@ def preview_command
|
|
|
559
560
|
end
|
|
560
561
|
end
|
|
561
562
|
|
|
563
|
+
enable_js( 'update_preview.js' ) if /\A(form|edit|preview|showcomment|formplugin)\z/ =~ @mode
|
|
564
|
+
|
|
562
565
|
#
|
|
563
566
|
# make comment form
|
|
564
567
|
#
|
|
@@ -1,30 +1,93 @@
|
|
|
1
1
|
require 'rack'
|
|
2
|
-
require 'webrick/httpauth/htpasswd'
|
|
3
2
|
|
|
4
3
|
module TDiary
|
|
5
4
|
module Rack
|
|
6
5
|
class Auth
|
|
7
6
|
class PasswordFileNotFound < StandardError; end
|
|
7
|
+
class UnsupportedPasswordFile < StandardError; end
|
|
8
8
|
|
|
9
9
|
class Basic
|
|
10
|
+
BCRYPT = /\A\$2[aby]\$\d{2}\$.{53}\z/
|
|
11
|
+
# DES crypt(3), still verified by String#crypt until it leaves Ruby
|
|
12
|
+
# (Feature #14915); RequestExtension#legacy_password? tells the
|
|
13
|
+
# update form to ask for a bcrypt password instead
|
|
14
|
+
CRYPT = %r{\A[a-zA-Z0-9./]{13}\z}
|
|
15
|
+
RECREATE = 'Please remove it and create it again by `tdiary htpasswd` or `htpasswd -cB`.'
|
|
16
|
+
|
|
17
|
+
# rewrites only the line of +user+, so the other lines keep their format
|
|
18
|
+
def self.write_password(file, user, pass)
|
|
19
|
+
require 'bcrypt'
|
|
20
|
+
require 'tempfile'
|
|
21
|
+
lines = File.exist?(file) ? File.readlines(file, chomp: true) : []
|
|
22
|
+
# below the bcrypt default of 12, since every request to update.rb verifies it
|
|
23
|
+
entry = "#{user}:#{BCrypt::Password.create(pass, cost: 10)}"
|
|
24
|
+
if (i = lines.index {|line| line.split(':', 2).first == user })
|
|
25
|
+
lines[i] = entry
|
|
26
|
+
else
|
|
27
|
+
lines << entry
|
|
28
|
+
end
|
|
29
|
+
Tempfile.create('htpasswd', File.dirname(file)) do |tmp|
|
|
30
|
+
tmp.puts(lines)
|
|
31
|
+
tmp.close
|
|
32
|
+
File.rename(tmp.path, file)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
10
36
|
def initialize(app, file = '.htpasswd')
|
|
11
|
-
@
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
37
|
+
@file = file
|
|
38
|
+
mark_legacy = lambda do |env|
|
|
39
|
+
env['tdiary.legacy_password'] = true if CRYPT.match?(stored_password(env['REMOTE_USER']))
|
|
40
|
+
app.call(env)
|
|
41
|
+
end
|
|
42
|
+
@authenticator = ::Rack::Auth::Basic.new(mark_legacy) do |user, pass|
|
|
43
|
+
authenticate(user, pass)
|
|
18
44
|
end
|
|
19
45
|
end
|
|
20
46
|
|
|
21
47
|
def call(env)
|
|
22
48
|
begin
|
|
23
49
|
@authenticator.call(env)
|
|
24
|
-
rescue PasswordFileNotFound => e
|
|
50
|
+
rescue PasswordFileNotFound, UnsupportedPasswordFile => e
|
|
25
51
|
[403, {"content-type" => "text/plain"}, [e.message]]
|
|
26
52
|
end
|
|
27
53
|
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def authenticate(user, pass)
|
|
58
|
+
# bcrypt and String#crypt raise on it, and no password file holds one
|
|
59
|
+
return false if pass.include?("\0")
|
|
60
|
+
case hashed = stored_password(user)
|
|
61
|
+
when nil
|
|
62
|
+
false
|
|
63
|
+
when BCRYPT
|
|
64
|
+
begin
|
|
65
|
+
require 'bcrypt'
|
|
66
|
+
rescue LoadError
|
|
67
|
+
raise UnsupportedPasswordFile.new("#{@file} has a bcrypt password, but the bcrypt gem cannot be loaded. Please remove rack from BUNDLE_WITHOUT and run bundle install.")
|
|
68
|
+
end
|
|
69
|
+
BCrypt::Password.new(hashed) == pass
|
|
70
|
+
when CRYPT
|
|
71
|
+
begin
|
|
72
|
+
pass.crypt(hashed) == hashed
|
|
73
|
+
rescue NoMethodError, NotImplementedError, SystemCallError
|
|
74
|
+
raise UnsupportedPasswordFile.new("This Ruby cannot verify the CRYPT password in #{@file}. #{RECREATE}")
|
|
75
|
+
end
|
|
76
|
+
else
|
|
77
|
+
raise UnsupportedPasswordFile.new("#{@file} has a password in an unsupported format. #{RECREATE}")
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def stored_password(user)
|
|
82
|
+
unless File.exist?(@file)
|
|
83
|
+
raise PasswordFileNotFound.new("#{@file} is not found. Please create it by htpasswd program.")
|
|
84
|
+
end
|
|
85
|
+
File.foreach(@file, chomp: true) do |line|
|
|
86
|
+
name, hashed = line.split(':', 2)
|
|
87
|
+
return hashed if name == user
|
|
88
|
+
end
|
|
89
|
+
nil
|
|
90
|
+
end
|
|
28
91
|
end
|
|
29
92
|
end
|
|
30
93
|
end
|
data/lib/tdiary/tasks/auth.rake
CHANGED
|
@@ -2,7 +2,7 @@ namespace :auth do
|
|
|
2
2
|
namespace :password do
|
|
3
3
|
desc "create password"
|
|
4
4
|
task :create do
|
|
5
|
-
require '
|
|
5
|
+
require 'tdiary/rack/auth/basic'
|
|
6
6
|
puts 'create .htpasswd file'
|
|
7
7
|
print 'Username: '
|
|
8
8
|
ARGV.replace([])
|
|
@@ -18,9 +18,7 @@ namespace :auth do
|
|
|
18
18
|
if password != password2
|
|
19
19
|
raise StandardError, 'password verification error'
|
|
20
20
|
else
|
|
21
|
-
|
|
22
|
-
htpasswd.set_passwd(nil, username, password)
|
|
23
|
-
htpasswd.flush
|
|
21
|
+
TDiary::Rack::Auth::Basic.write_password('.htpasswd', username, password)
|
|
24
22
|
puts "Adding password for user #{username}"
|
|
25
23
|
end
|
|
26
24
|
end
|
|
@@ -51,7 +51,7 @@ def vendor_pure_ruby_gems
|
|
|
51
51
|
|
|
52
52
|
Bundler.with_unbundled_env do
|
|
53
53
|
ENV['BUNDLE_PATH'] = build_dir
|
|
54
|
-
ENV['BUNDLE_WITHOUT'] = 'development:test'
|
|
54
|
+
ENV['BUNDLE_WITHOUT'] = 'development:test:rack'
|
|
55
55
|
ENV['BUNDLE_FROZEN'] = 'true'
|
|
56
56
|
sh 'bundle install'
|
|
57
57
|
end
|
|
@@ -84,10 +84,11 @@ def vendor_pure_ruby_gems
|
|
|
84
84
|
rm_rf dir unless %w(lib data).include?(File.basename(dir))
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
# Ship a bundler config that excludes dev/test
|
|
88
|
-
# bundler/setup resolves the vendored gems
|
|
87
|
+
# Ship a bundler config that excludes dev/test and the native gems of the
|
|
88
|
+
# rack group but sets no path, so bundler/setup resolves the vendored gems
|
|
89
|
+
# from GEM_PATH at runtime.
|
|
89
90
|
mkdir_p '.bundle'
|
|
90
|
-
File.write('.bundle/config', %Q(---\nBUNDLE_WITHOUT: "development:test"\n))
|
|
91
|
+
File.write('.bundle/config', %Q(---\nBUNDLE_WITHOUT: "development:test:rack"\n))
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def make_tarball( repo, version = nil )
|
data/lib/tdiary/version.rb
CHANGED
data/lib/tdiary.rb
CHANGED
|
@@ -78,6 +78,7 @@ module TDiary
|
|
|
78
78
|
autoload :TDiaryEdit, 'tdiary/admin'
|
|
79
79
|
autoload :TDiaryPreview, 'tdiary/admin'
|
|
80
80
|
autoload :TDiaryUpdate, 'tdiary/admin'
|
|
81
|
+
autoload :TDiaryRetry, 'tdiary/admin'
|
|
81
82
|
autoload :TDiaryAppend, 'tdiary/admin'
|
|
82
83
|
autoload :TDiaryReplace, 'tdiary/admin'
|
|
83
84
|
autoload :TDiaryShowComment, 'tdiary/admin'
|
|
@@ -102,6 +103,8 @@ module TDiary
|
|
|
102
103
|
class PluginError < TDiaryError; end
|
|
103
104
|
class BadStyleError < TDiaryError; end
|
|
104
105
|
class NotFound < TDiaryError; end
|
|
106
|
+
class BadDateError < TDiaryError; end
|
|
107
|
+
class ConflictError < TDiaryError; end
|
|
105
108
|
|
|
106
109
|
# class ForceRedirect
|
|
107
110
|
# force redirect to another page
|