tdiary 5.5.1 → 5.6.1
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/ChangeLog +2 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +39 -40
- data/doc/HOWTO-make-theme.md +3 -3
- data/doc/UPGRADE.md +1 -1
- data/js/draft.js +152 -52
- data/js/image.js +127 -28
- data/lib/tdiary/admin.rb +11 -13
- data/lib/tdiary/application.rb +2 -7
- data/lib/tdiary/author_only_base.rb +78 -9
- data/lib/tdiary/base.rb +2 -2
- data/lib/tdiary/cgi_adapter.rb +7 -5
- data/lib/tdiary/cgi_compat.rb +27 -97
- data/lib/tdiary/configuration.rb +4 -0
- data/lib/tdiary/core_ext.rb +146 -1
- data/lib/tdiary/dispatcher/index_main.rb +5 -23
- data/lib/tdiary/dispatcher/update_main.rb +2 -17
- data/lib/tdiary/dispatcher.rb +29 -15
- data/lib/tdiary/filter/default.rb +2 -2
- data/lib/tdiary/filter/spam.rb +2 -2
- data/lib/tdiary/filter.rb +1 -1
- data/lib/tdiary/plugin/00default.rb +18 -3
- data/lib/tdiary/plugin/en/00default.rb +15 -0
- data/lib/tdiary/plugin/ja/00default.rb +15 -0
- data/lib/tdiary/plugin.rb +1 -1
- data/lib/tdiary/rack/error_handler.rb +36 -0
- data/lib/tdiary/rack.rb +1 -0
- data/lib/tdiary/request.rb +3 -2
- data/lib/tdiary/server.rb +25 -3
- data/lib/tdiary/version.rb +1 -1
- data/lib/tdiary/view.rb +33 -28
- data/lib/tdiary/view_helper.rb +10 -2
- data/lib/tdiary.rb +6 -1
- data/misc/plugin/amazon.rb +37 -11
- data/misc/plugin/amazon_rakuten.rb +75 -0
- data/misc/plugin/draft.rb +75 -0
- data/misc/plugin/en/image.rb +5 -0
- data/misc/plugin/en/makerss.rb +4 -0
- data/misc/plugin/image.rb +15 -4
- data/misc/plugin/ja/makerss.rb +3 -0
- data/misc/plugin/makerss.rb +6 -5
- data/tdiary.conf.sample +8 -0
- data/tdiary.conf.sample-en +8 -0
- data/theme/default/default.css +33 -8
- 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/rack-3.2.7.gem +0 -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.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 +6 -6
- data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/date-3.5.1/mkmf.log +4 -4
- 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/ext/date/Makefile +3 -3
- 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.5.15 → net-imap-0.6.6}/Gemfile +3 -4
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/README.md +1 -1
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.6/Rakefile +24 -0
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/command_data.rb +62 -92
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/config/attr_accessors.rb +8 -9
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/config/attr_inheritance.rb +64 -1
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/config/attr_version_defaults.rb +1 -4
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/config.rb +209 -35
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/connection_state.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/data_encoding.rb +127 -27
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.6.6/lib/net/imap/errors.rb +372 -0
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/esearch_result.rb +6 -0
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/response_data.rb +90 -11
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/response_parser/parser_utils.rb +14 -23
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/response_parser.rb +41 -26
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/response_reader.rb +16 -21
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/scram_authenticator.rb +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/search_result.rb +11 -1
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sequence_set.rb +620 -312
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/uidplus_data.rb +2 -63
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap.rb +279 -162
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/net-imap.gemspec +1 -1
- data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/rakelib/rdoc.rake +1 -18
- data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.2.2/LICENSE.txt → net-protocol-0.3.0/BSDL} +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/net-protocol-0.3.0/COPYING +56 -0
- data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.2.2 → net-protocol-0.3.0}/lib/net/protocol.rb +58 -4
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/CHANGELOG.md +54 -1
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/utils.rb +3 -3
- data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/version.rb +1 -1
- data/vendor/bundle/ruby/3.4.0/specifications/{net-imap-0.5.15.gemspec → net-imap-0.6.6.gemspec} +4 -4
- data/vendor/bundle/ruby/3.4.0/specifications/{net-protocol-0.2.2.gemspec → net-protocol-0.3.0.gemspec} +5 -5
- data/vendor/bundle/ruby/3.4.0/specifications/{rack-3.2.6.gemspec → rack-3.2.7.gemspec} +3 -3
- data/views/tdiary.rconf +2 -0
- metadata +128 -133
- data/misc/plugin/amp.rb +0 -118
- data/vendor/bundle/ruby/3.4.0/cache/net-imap-0.5.15.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/net-protocol-0.2.2.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/cache/rack-3.2.6.gem +0 -0
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.5.15/Rakefile +0 -13
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.5.15/lib/net/imap/data_lite.rb +0 -226
- data/vendor/bundle/ruby/3.4.0/gems/net-imap-0.5.15/lib/net/imap/errors.rb +0 -118
- data/vendor/bundle/ruby/3.4.0/gems/net-protocol-0.2.2/Gemfile +0 -7
- data/vendor/bundle/ruby/3.4.0/gems/net-protocol-0.2.2/Rakefile +0 -10
- data/vendor/bundle/ruby/3.4.0/gems/net-protocol-0.2.2/bin/console +0 -14
- data/vendor/bundle/ruby/3.4.0/gems/net-protocol-0.2.2/bin/setup +0 -8
- data/vendor/bundle/ruby/3.4.0/gems/net-protocol-0.2.2/net-protocol.gemspec +0 -33
- data/views/amp.rhtml +0 -34
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/BSDL +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/COPYING +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/LICENSE.txt +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/docs/styles.css +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/authenticators.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/config/attr_type_coercion.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/deprecated_client_options.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/fetch_data.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/flags.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/anonymous_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/authentication_exchange.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/authenticators.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/client_adapter.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/cram_md5_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/digest_md5_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/external_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/gs2_header.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/login_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/oauthbearer_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/plain_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/protocol_adapters.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/scram_algorithm.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/stringprep.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl/xoauth2_authenticator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/sasl_adapter.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/stringprep/nameprep.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/stringprep/saslprep.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/stringprep/saslprep_tables.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/stringprep/tables.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/stringprep/trace.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/stringprep.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/lib/net/imap/vanished_data.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/rakelib/benchmarks.rake +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/rakelib/rfcs.rake +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/rakelib/saslprep.rake +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/rakelib/string_prep_tables_generator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-imap-0.5.15 → net-imap-0.6.6}/sample/net-imap.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{net-protocol-0.2.2 → net-protocol-0.3.0}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/CONTRIBUTING.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/MIT-LICENSE +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/README.md +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/SPEC.rdoc +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/auth/abstract/handler.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/auth/abstract/request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/auth/basic.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/bad_request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/body_proxy.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/builder.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/cascade.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/common_logger.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/conditional_get.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/config.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/constants.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/content_length.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/content_type.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/deflater.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/directory.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/etag.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/events.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/files.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/head.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/headers.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/lint.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/lock.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/media_type.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/method_override.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/mime.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/mock.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/mock_request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/mock_response.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/multipart/generator.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/multipart/parser.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/multipart/uploaded_file.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/multipart.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/null_logger.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/query_parser.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/recursive.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/reloader.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/request.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/response.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/rewindable_input.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/runtime.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/sendfile.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/show_exceptions.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/show_status.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/static.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/tempfile_reaper.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack/urlmap.rb +0 -0
- /data/vendor/bundle/ruby/3.4.0/gems/{rack-3.2.6 → rack-3.2.7}/lib/rack.rb +0 -0
data/lib/tdiary/view.rb
CHANGED
|
@@ -7,12 +7,12 @@ module TDiary
|
|
|
7
7
|
def initialize( cgi, rhtml, conf )
|
|
8
8
|
super
|
|
9
9
|
|
|
10
|
-
unless referer_filter( @
|
|
11
|
-
|
|
10
|
+
unless referer_filter( @request.referer )
|
|
11
|
+
@request.hide_referer!
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# save referer to latest
|
|
15
|
-
if (!@conf.referer_day_only or (@
|
|
15
|
+
if (!@conf.referer_day_only or (@request.param('date') and @request.param('date').length == 8)) and @request.referer then
|
|
16
16
|
ym = latest_month
|
|
17
17
|
@date = ym ? Time::local( ym[0], ym[1] ) : Time::now
|
|
18
18
|
@io.transaction( @date ) do |diaries|
|
|
@@ -23,7 +23,7 @@ module TDiary
|
|
|
23
23
|
break if @diary.visible?
|
|
24
24
|
end
|
|
25
25
|
if @diary then
|
|
26
|
-
@diary.add_referer( @
|
|
26
|
+
@diary.add_referer( @request.referer )
|
|
27
27
|
dirty = DIRTY_REFERER
|
|
28
28
|
end
|
|
29
29
|
dirty
|
|
@@ -121,7 +121,7 @@ module TDiary
|
|
|
121
121
|
|
|
122
122
|
begin
|
|
123
123
|
# time is noon for easy to calc leap second.
|
|
124
|
-
@date = Time::local( *@
|
|
124
|
+
@date = Time::local( *@request.param('date').scan( /^(\d{4})(\d\d)(\d\d)$/ )[0] ) + 12*60*60
|
|
125
125
|
load( @date )
|
|
126
126
|
rescue ArgumentError, NameError
|
|
127
127
|
raise TDiaryError, 'bad date'
|
|
@@ -149,8 +149,8 @@ module TDiary
|
|
|
149
149
|
@diaries = diaries
|
|
150
150
|
dirty = DIRTY_NONE
|
|
151
151
|
@diary = self[date]
|
|
152
|
-
if @diary and @
|
|
153
|
-
@diary.add_referer( @
|
|
152
|
+
if @diary and @request.referer then
|
|
153
|
+
@diary.add_referer( @request.referer )
|
|
154
154
|
dirty = DIRTY_REFERER
|
|
155
155
|
end
|
|
156
156
|
dirty
|
|
@@ -161,11 +161,11 @@ module TDiary
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
def cookie_name
|
|
164
|
-
@
|
|
164
|
+
@request.cgi_cookies['tdiary'][0] or ''
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
def cookie_mail
|
|
168
|
-
@
|
|
168
|
+
@request.cgi_cookies['tdiary'][1] or ''
|
|
169
169
|
end
|
|
170
170
|
end
|
|
171
171
|
|
|
@@ -189,9 +189,9 @@ module TDiary
|
|
|
189
189
|
|
|
190
190
|
def load( date )
|
|
191
191
|
@date = date
|
|
192
|
-
@name = @
|
|
193
|
-
@mail = @
|
|
194
|
-
@body = @
|
|
192
|
+
@name = @request.param('name')
|
|
193
|
+
@mail = @request.param('mail')
|
|
194
|
+
@body = @request.param('body')
|
|
195
195
|
@name = @conf.to_native( @name )
|
|
196
196
|
@body = @conf.to_native( @body )
|
|
197
197
|
@comment = Comment::new( @name, @mail, @body )
|
|
@@ -203,13 +203,18 @@ module TDiary
|
|
|
203
203
|
if @diary and comment_filter( @diary, @comment ) then
|
|
204
204
|
@diary.add_comment( @comment )
|
|
205
205
|
dirty = DIRTY_COMMENT
|
|
206
|
-
|
|
206
|
+
script_name = @request.script_name
|
|
207
|
+
cookie_path = script_name.empty? ? '/' : File::dirname( script_name )
|
|
207
208
|
cookie_path += '/' if cookie_path !~ /\/$/
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
# the escaped 'name&mail' multi-value format must be kept;
|
|
210
|
+
# CGI::Cookie.parse on the reading side splits on '&'
|
|
211
|
+
@cookies << ::Rack::Utils.set_cookie_header( 'tdiary', {
|
|
212
|
+
value: [@name, @mail],
|
|
213
|
+
path: cookie_path,
|
|
214
|
+
expires: Time::now.gmtime + 90*24*60*60, # 90days
|
|
215
|
+
secure: @request.ssl?,
|
|
216
|
+
http_only: true,
|
|
217
|
+
same_site: :lax
|
|
213
218
|
} )
|
|
214
219
|
@io.clear_cache( /(latest|#{@date.strftime( '%Y%m' )})/ )
|
|
215
220
|
else
|
|
@@ -254,7 +259,7 @@ module TDiary
|
|
|
254
259
|
super
|
|
255
260
|
|
|
256
261
|
begin
|
|
257
|
-
date = Time::local( *@
|
|
262
|
+
date = Time::local( *@request.param('date').scan( /^(\d{4})(\d\d)$/ )[0] )
|
|
258
263
|
d1 = @date.dup.gmtime if @date
|
|
259
264
|
d2 = date.dup.gmtime
|
|
260
265
|
if not @date or d1.year != d2.year or d1.month != d2.month then
|
|
@@ -280,7 +285,7 @@ module TDiary
|
|
|
280
285
|
super
|
|
281
286
|
|
|
282
287
|
@diaries = {}
|
|
283
|
-
month, day = @
|
|
288
|
+
month, day = @request.param('date').scan(/^(\d\d)(\d\d)$/)[0]
|
|
284
289
|
nyear(month).each do |y, m|
|
|
285
290
|
@date = Time::local(y, m)
|
|
286
291
|
@io.transaction(@date) do |diaries|
|
|
@@ -318,8 +323,8 @@ module TDiary
|
|
|
318
323
|
def initialize( cgi, rhtml, conf )
|
|
319
324
|
super
|
|
320
325
|
|
|
321
|
-
if @
|
|
322
|
-
ym = [@
|
|
326
|
+
if @request.param('date') then
|
|
327
|
+
ym = [@request.param('date')[0,4].to_i, @request.param('date')[4,2].to_i]
|
|
323
328
|
@date = nil
|
|
324
329
|
else
|
|
325
330
|
ym = latest_month
|
|
@@ -329,8 +334,8 @@ module TDiary
|
|
|
329
334
|
@date = ym ? Time::local( ym[0], ym[1] ) : Time::now
|
|
330
335
|
@io.transaction( @date ) do |diaries|
|
|
331
336
|
@diaries = diaries
|
|
332
|
-
if @
|
|
333
|
-
@diary = @diaries[@
|
|
337
|
+
if @request.param('date') then
|
|
338
|
+
@diary = @diaries[@request.param('date')[0,8]]
|
|
334
339
|
@date = @diary.date if @diary
|
|
335
340
|
end
|
|
336
341
|
unless @diary then
|
|
@@ -442,16 +447,16 @@ module TDiary
|
|
|
442
447
|
end
|
|
443
448
|
|
|
444
449
|
def start_date
|
|
445
|
-
if @
|
|
446
|
-
@
|
|
450
|
+
if @request.param('date') then
|
|
451
|
+
@request.param('date')[0,8]
|
|
447
452
|
else
|
|
448
453
|
'99999999' # max of date string
|
|
449
454
|
end
|
|
450
455
|
end
|
|
451
456
|
|
|
452
457
|
def limit_size( default_limit )
|
|
453
|
-
if @
|
|
454
|
-
date = @
|
|
458
|
+
if @request.param('date') then
|
|
459
|
+
date = @request.param('date')
|
|
455
460
|
limit = date[9,date.length-9].to_i
|
|
456
461
|
limit = 30 if limit > 30
|
|
457
462
|
limit
|
data/lib/tdiary/view_helper.rb
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
module TDiary
|
|
2
2
|
module ViewHelper
|
|
3
3
|
def bot?
|
|
4
|
-
@conf.bot =~
|
|
4
|
+
@conf.bot =~ view_helper_request.user_agent
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
def base_url
|
|
8
8
|
if @conf.options['base_url'] && @conf.options['base_url'].length > 0
|
|
9
9
|
@conf.options['base_url']
|
|
10
10
|
else
|
|
11
|
-
|
|
11
|
+
view_helper_request.tdiary_base_url
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
# plugins include this helper into objects that hold only the @cgi
|
|
18
|
+
# facade (misc/plugin/makerss.rb); fall back to its wrapped request
|
|
19
|
+
def view_helper_request
|
|
20
|
+
@request || @cgi.request
|
|
21
|
+
end
|
|
14
22
|
end
|
|
15
23
|
end
|
data/lib/tdiary.rb
CHANGED
|
@@ -16,6 +16,12 @@ $:.unshift File.join(File::dirname(__FILE__), '../misc/lib')
|
|
|
16
16
|
Dir[File.join(File.dirname(__FILE__), path)].each {|dir| $:.unshift dir }
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Set up the bundle before requiring anything that ships as a default gem.
|
|
20
|
+
# A CGI process starts without RUBYOPT or BUNDLE_GEMFILE (WEBrick's CGI runner
|
|
21
|
+
# wipes the environment), so requiring 'cgi' first activates the version bundled
|
|
22
|
+
# with Ruby and Bundler then fails on the version the Gemfile asks for.
|
|
23
|
+
require 'tdiary/environment'
|
|
24
|
+
|
|
19
25
|
gem 'cgi' if RUBY_VERSION >= '4.0'
|
|
20
26
|
require 'cgi'
|
|
21
27
|
require 'uri'
|
|
@@ -23,7 +29,6 @@ require 'fileutils'
|
|
|
23
29
|
require 'pstore'
|
|
24
30
|
require 'json'
|
|
25
31
|
require 'erb'
|
|
26
|
-
require 'tdiary/environment'
|
|
27
32
|
require 'tdiary/core_ext'
|
|
28
33
|
|
|
29
34
|
#
|
data/misc/plugin/amazon.rb
CHANGED
|
@@ -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
|
-
|
|
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,18 @@ 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
|
+
# Books Amazon doesn't answer for are asked of a plugin defining amazon_book_item(isbn), like amazon_rakuten.rb.
|
|
143
|
+
def amazon_book_json(item_id)
|
|
144
|
+
return nil unless defined?(amazon_book_item) && /\A(?:\d{9}[\dX]|97[89]\d{10})\z/i =~ item_id
|
|
145
|
+
item = amazon_book_item(item_id)
|
|
146
|
+
{'ItemsResult' => {'Items' => [item]}}.to_json if item
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def amazon_dp_link(asin, label)
|
|
150
|
+
url = "https://www.amazon.co.jp/dp/#{asin}"
|
|
151
|
+
%Q|<a href="#{h url}">#{h(label || url)}</a>|
|
|
152
|
+
end
|
|
153
|
+
|
|
141
154
|
def amazon_get(asin, with_image = true, label = nil, pos = 'amazon')
|
|
142
155
|
asin = asin.to_s.strip.gsub(/-/, '')
|
|
143
156
|
country, item_id = asin.scan(/\A(..):(.*)/).flatten
|
|
@@ -149,16 +162,31 @@ def amazon_get(asin, with_image = true, label = nil, pos = 'amazon')
|
|
|
149
162
|
begin
|
|
150
163
|
cache = "#{@cache_path}/amazon"
|
|
151
164
|
Dir::mkdir( cache ) unless File::directory?( cache )
|
|
165
|
+
file = "#{cache}/#{country}#{item_id}.json"
|
|
152
166
|
begin
|
|
153
|
-
json = File::read(
|
|
167
|
+
json = File::read(file)
|
|
168
|
+
raise Errno::ENOENT if json.empty?
|
|
154
169
|
rescue Errno::ENOENT
|
|
155
170
|
access_key = @conf['amazon.access_key']
|
|
156
171
|
secret_key = @conf['amazon.secret_key']
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
if access_key && secret_key && !File::exist?(file)
|
|
173
|
+
begin
|
|
174
|
+
partner_tag = @conf['amazon.aid']
|
|
175
|
+
paapi = AWS::PAAPI.new(access_key, secret_key, partner_tag)
|
|
176
|
+
json = paapi.get_items(item_id, country.to_sym)
|
|
177
|
+
rescue Net::HTTPExceptions => e
|
|
178
|
+
# An empty cache records a 403, which PA-API keeps answering, so the item isn't asked about again until the cache is cleared
|
|
179
|
+
File::write(file, '') if e.response.code == '403'
|
|
180
|
+
json = amazon_book_json(item_id)
|
|
181
|
+
raise unless json
|
|
182
|
+
end
|
|
183
|
+
else
|
|
184
|
+
json = amazon_book_json(item_id)
|
|
185
|
+
unless json
|
|
186
|
+
return File::exist?(file) ? amazon_dp_link(asin, label) : asin
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
File::open(file, 'wb'){|f| f.write(json)}
|
|
162
190
|
end
|
|
163
191
|
item = JSON.parse(json)["ItemsResult"]["Items"][0]
|
|
164
192
|
if pos == 'detail' then
|
|
@@ -185,9 +213,7 @@ def amazon_get(asin, with_image = true, label = nil, pos = 'amazon')
|
|
|
185
213
|
message = ''
|
|
186
214
|
# Handle 429 "Too Many Requests" and 403 "Forbidden"
|
|
187
215
|
if /^429|^403/ =~ e.message then
|
|
188
|
-
|
|
189
|
-
label ||= url
|
|
190
|
-
message << %Q|<a href="#{h url}">#{h label}</a>|
|
|
216
|
+
message << amazon_dp_link(asin, label)
|
|
191
217
|
end
|
|
192
218
|
if @mode == 'preview' then
|
|
193
219
|
message << %Q|<span class="message">(#{h e.message})</span>|
|
|
@@ -0,0 +1,75 @@
|
|
|
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 link to Rakuten Books as its terms require.
|
|
8
|
+
#
|
|
9
|
+
# options:
|
|
10
|
+
# @options['rakuten.app_id'] : application ID of Rakuten Web Service
|
|
11
|
+
# @options['rakuten.access_key'] : access key of the application
|
|
12
|
+
# @options['rakuten.affiliate_id'] : Rakuten Affiliate ID for the links (optional)
|
|
13
|
+
#
|
|
14
|
+
# Register the application as an API/backend service allowing the IP
|
|
15
|
+
# address of the server. Rakuten requires the credit this plugin puts in
|
|
16
|
+
# the footer.
|
|
17
|
+
#
|
|
18
|
+
# Copyright (c) 2026 Hiroshi SHIBATA <hsbt@ruby-lang.org>
|
|
19
|
+
# Distributed under the GPL2 or any later version.
|
|
20
|
+
#
|
|
21
|
+
require 'json'
|
|
22
|
+
require 'net/http'
|
|
23
|
+
|
|
24
|
+
def amazon_book_item(isbn)
|
|
25
|
+
app_id = @conf['rakuten.app_id']
|
|
26
|
+
access_key = @conf['rakuten.access_key']
|
|
27
|
+
return nil unless app_id && access_key
|
|
28
|
+
|
|
29
|
+
uri = URI('https://openapi.rakuten.co.jp/services/api/BooksBook/Search/20170404')
|
|
30
|
+
params = {applicationId: app_id, accessKey: access_key, isbn: isbn, outOfStockFlag: 1, formatVersion: 2}
|
|
31
|
+
params[:affiliateId] = @conf['rakuten.affiliate_id'] if @conf['rakuten.affiliate_id']
|
|
32
|
+
uri.query = URI.encode_www_form(params)
|
|
33
|
+
# Rakuten answers 429 to more than one request a second
|
|
34
|
+
sleep 1 if @amazon_rakuten_requested
|
|
35
|
+
@amazon_rakuten_requested = true
|
|
36
|
+
response = Net::HTTP.get_response(uri)
|
|
37
|
+
response.value
|
|
38
|
+
book = JSON.parse(response.body)['Items'][0]
|
|
39
|
+
return nil unless book
|
|
40
|
+
|
|
41
|
+
{
|
|
42
|
+
'DetailPageURL' => book['affiliateUrl'].to_s.empty? ? book['itemUrl'] : book['affiliateUrl'],
|
|
43
|
+
'ItemInfo' => {
|
|
44
|
+
'Title' => {'DisplayValue' => book['title']},
|
|
45
|
+
'ByLineInfo' => {
|
|
46
|
+
'Contributors' => [{'Name' => book['author'][%r{[^/]*}]}],
|
|
47
|
+
'Manufacturer' => {'DisplayValue' => book['publisherName']}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
'Images' => {
|
|
51
|
+
'Primary' => {
|
|
52
|
+
'Small' => {'URL' => book['smallImageUrl']},
|
|
53
|
+
'Medium' => {'URL' => book['mediumImageUrl']},
|
|
54
|
+
'Large' => {'URL' => book['largeImageUrl']}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
'OffersV2' => {
|
|
58
|
+
'Listings' => [{'Price' => {'Money' => {'DisplayAmount' => "¥#{book['itemPrice'].to_s.gsub(/(\d)(?=(\d{3})+\z)/, '\1,')}"}}}]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
rescue => e
|
|
62
|
+
@logger.error "amazon_rakuten.rb: #{e.message}"
|
|
63
|
+
nil
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
add_footer_proc do
|
|
67
|
+
%Q|<div class="footer"><a href="https://developers.rakuten.com/">Supported by Rakuten Developers</a></div>|
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Local Variables:
|
|
71
|
+
# mode: ruby
|
|
72
|
+
# indent-tabs-mode: t
|
|
73
|
+
# tab-width: 3
|
|
74
|
+
# ruby-indent-level: 3
|
|
75
|
+
# End:
|
data/misc/plugin/draft.rb
CHANGED
|
@@ -1,11 +1,85 @@
|
|
|
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?
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def draft_sync( items )
|
|
33
|
+
transaction( 'draft' ) do |db|
|
|
34
|
+
drafts, deleted = draft_restore( db )
|
|
35
|
+
items.each do |item|
|
|
36
|
+
# a draft submitted as a diary must not come back from another browser
|
|
37
|
+
next if !draft_valid?( item ) or deleted.include?( item['id'] )
|
|
38
|
+
stored = drafts.find {|d| d['id'] == item['id'] }
|
|
39
|
+
if !stored
|
|
40
|
+
drafts << item.slice( 'id', 'date', 'value' )
|
|
41
|
+
elsif stored['date'] < item['date']
|
|
42
|
+
stored.update( item.slice( 'date', 'value' ) )
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
db.set( 'drafts', drafts.sort_by {|d| d['date'] }.last( draft_max_count ).to_json )
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def draft_delete( id )
|
|
50
|
+
transaction( 'draft' ) do |db|
|
|
51
|
+
drafts, deleted = draft_restore( db )
|
|
52
|
+
db.set( 'drafts', drafts.reject {|d| d['id'] == id }.to_json )
|
|
53
|
+
db.set( 'deleted', (deleted - [id] + [id]).last( 100 ).to_json )
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
7
57
|
if /\A(form|edit|preview|showcomment)\z/ === @mode then
|
|
8
58
|
enable_js('draft.js')
|
|
59
|
+
server = nil
|
|
60
|
+
transaction( 'draft' ) do |db|
|
|
61
|
+
drafts, deleted = draft_restore( db )
|
|
62
|
+
server = { 'drafts' => drafts, 'deleted' => deleted, 'max' => draft_max_count }
|
|
63
|
+
end
|
|
64
|
+
add_js_setting( '$tDiary.plugin.draft' )
|
|
65
|
+
# keep the drafts from closing the script element
|
|
66
|
+
add_js_setting( '$tDiary.plugin.draft.server', server.to_json.gsub( '<', '\\u003c' ) )
|
|
67
|
+
add_js_setting( '$tDiary.plugin.draft.interval', (@conf['draft.sync_interval'] || 300).to_i )
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
if @mode == 'formplugin' and @cgi.params['plugin_draft_sync'][0] then
|
|
71
|
+
begin
|
|
72
|
+
items = JSON.parse( @cgi.params['plugin_draft_sync'][0] )
|
|
73
|
+
draft_sync( items ) if items.kind_of?( Array )
|
|
74
|
+
rescue JSON::ParserError
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
add_update_proc do
|
|
79
|
+
id = @cgi.params['plugin_draft_id'][0]
|
|
80
|
+
if /\A(append|replace)\z/ =~ @mode and draft_id?( id ) then
|
|
81
|
+
draft_delete( id )
|
|
82
|
+
end
|
|
9
83
|
end
|
|
10
84
|
|
|
11
85
|
add_edit_proc do
|
|
@@ -14,6 +88,7 @@ add_edit_proc do
|
|
|
14
88
|
下書き:
|
|
15
89
|
<select name="drafts"></select>
|
|
16
90
|
<button type="button" id="draft_load">読み込み</button>
|
|
91
|
+
<input type="hidden" name="plugin_draft_id" value="">
|
|
17
92
|
</div>
|
|
18
93
|
EOS
|
|
19
94
|
end
|
data/misc/plugin/en/image.rb
CHANGED
|
@@ -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
|
data/misc/plugin/en/makerss.rb
CHANGED
|
@@ -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>
|
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' )
|
|
@@ -101,7 +105,7 @@ end
|
|
|
101
105
|
#
|
|
102
106
|
# initialize
|
|
103
107
|
#
|
|
104
|
-
@image_dir = (@options && @options['image.dir']) || File.join(TDiary.server_root, @cgi.
|
|
108
|
+
@image_dir = (@options && @options['image.dir']) || File.join(TDiary.server_root, @cgi.static_assets? ? 'images' : 'public/images')
|
|
105
109
|
@image_dir.chop! if /\/$/ =~ @image_dir
|
|
106
110
|
FileUtils.mkdir_p @image_dir unless File.exist?(@image_dir)
|
|
107
111
|
|
|
@@ -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
|
-
|
|
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
|
|
@@ -204,7 +215,7 @@ add_form_proc do |date|
|
|
|
204
215
|
images.each_with_index do |img,id|
|
|
205
216
|
next unless img
|
|
206
217
|
_, 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>]
|
|
218
|
+
r << %Q[<td><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) )}"></td>]
|
|
208
219
|
img_info = ''
|
|
209
220
|
if img_w && img_h
|
|
210
221
|
img_info << %Q|<span class="image-width">#{img_w}</span> x <span class="image-height">#{img_h}</span>|
|
data/misc/plugin/ja/makerss.rb
CHANGED
|
@@ -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>
|
data/misc/plugin/makerss.rb
CHANGED
|
@@ -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
|
#
|
|
@@ -177,10 +178,10 @@ class MakeRssFull
|
|
|
177
178
|
end
|
|
178
179
|
|
|
179
180
|
def document_root
|
|
180
|
-
if @cgi.
|
|
181
|
-
File.join(TDiary.server_root, 'public')
|
|
182
|
-
else
|
|
181
|
+
if @cgi.static_assets?
|
|
183
182
|
TDiary.server_root
|
|
183
|
+
else
|
|
184
|
+
File.join(TDiary.server_root, 'public')
|
|
184
185
|
end
|
|
185
186
|
end
|
|
186
187
|
end
|
|
@@ -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
|
data/tdiary.conf.sample
CHANGED
|
@@ -75,6 +75,14 @@
|
|
|
75
75
|
# 必要です。blog-category プラグイン利用時は自動的に無効になります。
|
|
76
76
|
#@options['plugin.cache'] = true
|
|
77
77
|
|
|
78
|
+
# 静的アセットの配信元URL【オプション】
|
|
79
|
+
# テーマやJavaScriptなどの静的ファイルを、CDNや別ホストなど任意のURLから
|
|
80
|
+
# 配信する場合に指定します。指定すると、Rack・CGI・FCGIのどの実行形態でも
|
|
81
|
+
# このURLを元にテーマやJavaScriptのURLを生成します。配信元には、Rackアプ
|
|
82
|
+
# リのassets配下と同じ構成(jsディレクトリとthemeディレクトリの内容をひと
|
|
83
|
+
# つのディレクトリにまとめた構成)でファイルを配置してください。
|
|
84
|
+
#@options['assets_url'] = 'https://assets.example.org/tdiary'
|
|
85
|
+
|
|
78
86
|
# プラグインに渡すオプション【オプション】
|
|
79
87
|
# プラグインによっては、tdiary.conf経由でオプションを渡すことで挙動を
|
|
80
88
|
# 変更できるものがあります。@optionsはそのオプションを指定する時に使う
|
data/tdiary.conf.sample-en
CHANGED
|
@@ -62,6 +62,14 @@
|
|
|
62
62
|
# any directory for cache files by this variable.
|
|
63
63
|
#@cache_path = 'path of cache files'
|
|
64
64
|
|
|
65
|
+
# base URL of static assets. (optional)
|
|
66
|
+
# Set this to serve theme and JavaScript files from another URL, such
|
|
67
|
+
# as a CDN. When set, every hosting mode (Rack, CGI and FCGI) builds
|
|
68
|
+
# theme and JavaScript URLs from it. The serving location must use the
|
|
69
|
+
# same merged layout as the assets/ mount of the Rack application (the
|
|
70
|
+
# contents of the js and theme directories under one root).
|
|
71
|
+
#@options['assets_url'] = 'https://assets.example.org/tdiary'
|
|
72
|
+
|
|
65
73
|
# options for plugins. (optional)
|
|
66
74
|
# Some plugins can receive options from tdiary.conf.
|
|
67
75
|
# ex: a option "foo" of plugin "sample".
|