Compare commits
13 Commits
77d501937a
...
853852751f
Author | SHA1 | Date | |
---|---|---|---|
853852751f | |||
d110c2168e | |||
f3a9bfc465 | |||
4d9a09b0e1 | |||
b5cfa87aa9 | |||
9e2743368b | |||
c4e904a7a9 | |||
9526609196 | |||
7cc73c9a4e | |||
dfaac4e407 | |||
8696ed665c | |||
c731c9413c | |||
12fe4ede50 |
12
.classpath
12
.classpath
@ -12,6 +12,12 @@
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar"/>
|
||||
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-cli-1.4.jar"/>
|
||||
@ -29,15 +35,11 @@
|
||||
<classpathentry kind="lib" path="lib/twitter4j-core-4.0.4.jar" sourcepath="lib/twitter4j-core-4.0.4-src.zip"/>
|
||||
<classpathentry kind="lib" path="lib/twitter4j-media-support-4.0.4.jar" sourcepath="lib/twitter4j-media-support-4.0.4-src.zip"/>
|
||||
<classpathentry kind="lib" path="lib/twitter4j-stream-4.0.4.jar" sourcepath="lib/twitter4j-stream-4.0.4-src.zip"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/devinsy-strings-0.8.2.jar" sourcepath="lib/devinsy-strings-0.8.2-sources.zip"/>
|
||||
<classpathentry kind="lib" path="lib/commons-lang3-3.8.jar" sourcepath="lib/commons-lang3-3.8-sources.jar"/>
|
||||
<classpathentry kind="lib" path="lib/json-simple-1.1.1.jar" sourcepath="lib/json-simple-1.1.1-source.zip"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -17,9 +17,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=11
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
@ -33,6 +33,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
@ -76,6 +77,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
@ -108,8 +110,10 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=11
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||
@ -117,17 +121,20 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
@ -213,11 +220,12 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||
@ -248,6 +256,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||
@ -272,13 +282,17 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||
@ -326,6 +340,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do no
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||
@ -362,9 +378,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||
@ -390,7 +409,11 @@ org.eclipse.jdt.core.formatter.tabulation.char=space
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=4
|
||||
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
|
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
|
||||
|
@ -13,28 +13,38 @@ cleanup.always_use_this_for_non_static_field_access=true
|
||||
cleanup.always_use_this_for_non_static_method_access=false
|
||||
cleanup.convert_functional_interfaces=false
|
||||
cleanup.convert_to_enhanced_for_loop=false
|
||||
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
|
||||
cleanup.correct_indentation=false
|
||||
cleanup.format_source_code=true
|
||||
cleanup.format_source_code_changes_only=false
|
||||
cleanup.insert_inferred_type_arguments=false
|
||||
cleanup.lazy_logical_operator=false
|
||||
cleanup.make_local_variable_final=false
|
||||
cleanup.make_parameters_final=true
|
||||
cleanup.make_private_fields_final=false
|
||||
cleanup.make_type_abstract_if_missing_method=false
|
||||
cleanup.make_variable_declarations_final=true
|
||||
cleanup.merge_conditional_blocks=false
|
||||
cleanup.never_use_blocks=false
|
||||
cleanup.never_use_parentheses_in_expressions=true
|
||||
cleanup.number_suffix=false
|
||||
cleanup.objects_equals=false
|
||||
cleanup.organize_imports=false
|
||||
cleanup.precompile_regex=false
|
||||
cleanup.push_down_negation=false
|
||||
cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_with_declaring_class=true
|
||||
cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
cleanup.remove_private_constructors=true
|
||||
cleanup.remove_redundant_type_arguments=true
|
||||
cleanup.remove_redundant_modifiers=false
|
||||
cleanup.remove_redundant_semicolons=false
|
||||
cleanup.remove_redundant_type_arguments=false
|
||||
cleanup.remove_trailing_whitespaces=true
|
||||
cleanup.remove_trailing_whitespaces_all=true
|
||||
cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
cleanup.remove_unnecessary_array_creation=false
|
||||
cleanup.remove_unnecessary_casts=true
|
||||
cleanup.remove_unnecessary_nls_tags=true
|
||||
cleanup.remove_unused_imports=true
|
||||
@ -43,11 +53,14 @@ cleanup.remove_unused_private_fields=true
|
||||
cleanup.remove_unused_private_members=false
|
||||
cleanup.remove_unused_private_methods=true
|
||||
cleanup.remove_unused_private_types=true
|
||||
cleanup.simplify_lambda_expression_and_method_ref=false
|
||||
cleanup.sort_members=true
|
||||
cleanup.sort_members_all=false
|
||||
cleanup.use_anonymous_class_creation=false
|
||||
cleanup.use_autoboxing=false
|
||||
cleanup.use_blocks=true
|
||||
cleanup.use_blocks_only_for_return_and_throw=false
|
||||
cleanup.use_directly_map_method=false
|
||||
cleanup.use_lambda=true
|
||||
cleanup.use_parentheses_in_expressions=false
|
||||
cleanup.use_this_for_non_static_field_access=true
|
||||
@ -55,6 +68,8 @@ cleanup.use_this_for_non_static_field_access_only_if_necessary=false
|
||||
cleanup.use_this_for_non_static_method_access=false
|
||||
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
cleanup.use_type_arguments=false
|
||||
cleanup.use_unboxing=false
|
||||
cleanup.use_var=false
|
||||
cleanup_profile=_Hebdobot
|
||||
cleanup_settings_version=2
|
||||
eclipse.preferences.version=1
|
||||
@ -62,6 +77,7 @@ editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
||||
formatter_profile=_Hebdobot
|
||||
formatter_settings_version=12
|
||||
jautodoc.cleanup.add_header=false
|
||||
jautodoc.cleanup.javadoc=false
|
||||
jautodoc.cleanup.replace_header=false
|
||||
org.eclipse.jdt.ui.exception.name=exception
|
||||
org.eclipse.jdt.ui.gettersetter.use.is=true
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="java" version="11"/>
|
||||
</faceted-project>
|
||||
|
@ -1,3 +1,3 @@
|
||||
#Build Number for ANT. Do not edit!
|
||||
#Fri May 03 17:33:54 CEST 2019
|
||||
build.number=20
|
||||
build.number=0
|
||||
|
@ -1,3 +1,3 @@
|
||||
product.name=hebdobot
|
||||
product.revision.major=2
|
||||
product.revision.minor=0
|
||||
product.revision.minor=11
|
||||
|
6
build.sh
6
build.sh
@ -41,11 +41,11 @@ function build_snapshot
|
||||
|
||||
# Java version check.
|
||||
javaVersionCheck=`javac -version 2>&1`
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then
|
||||
echo "Java 8 version requirement..... OK"
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
|
||||
echo "Java 11 version requirement..... OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Java 8 version requirement..... MISSING"
|
||||
echo "Java 11 version requirement..... MISSING"
|
||||
fi
|
||||
|
||||
if [ "$okCount" == 3 ]; then
|
||||
|
BIN
lib/json-simple-1.1.1-source.zip
Normal file
BIN
lib/json-simple-1.1.1-source.zip
Normal file
Binary file not shown.
BIN
lib/json-simple-1.1.1.jar
Normal file
BIN
lib/json-simple-1.1.1.jar
Normal file
Binary file not shown.
@ -15,8 +15,8 @@ irc.channel=#april-test
|
||||
irc.identify.nick=
|
||||
irc.identify.password=
|
||||
|
||||
# Pastebin settings.
|
||||
#pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
# Privatebin settings.
|
||||
#privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
# Twitter settings.
|
||||
#twitter.consumerKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
@ -14,11 +14,11 @@ fi
|
||||
|
||||
# Java version check.
|
||||
javaVersionCheck=`java -version 2>&1`
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 1.8 ]]; then
|
||||
echo "Java 8 version requirement..... OK"
|
||||
if [[ "$javaVersionCheck" =~ ^.*\ 11. ]]; then
|
||||
echo "Java 11 version requirement..... OK"
|
||||
let "okCount+=1"
|
||||
else
|
||||
echo "Java 8 version requirement..... MISSING"
|
||||
echo "Java 11 version requirement..... MISSING"
|
||||
fi
|
||||
|
||||
if [ "$okCount" == 2 ]; then
|
||||
|
@ -27,6 +27,7 @@ import java.time.LocalTime;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.april.hebdobot.HebdobotException;
|
||||
import org.april.hebdobot.bot.hooks.BadCommandHook;
|
||||
import org.april.hebdobot.bot.hooks.CancelPreviousInputHook;
|
||||
import org.april.hebdobot.bot.hooks.CollectiveSubjectHook;
|
||||
import org.april.hebdobot.bot.hooks.CommentHook;
|
||||
import org.april.hebdobot.bot.hooks.CurrentHook;
|
||||
@ -46,15 +47,17 @@ import org.april.hebdobot.bot.hooks.StatsHook;
|
||||
import org.april.hebdobot.bot.hooks.StatusHook;
|
||||
import org.april.hebdobot.bot.hooks.StopReviewHook;
|
||||
import org.april.hebdobot.bot.hooks.ThanksHook;
|
||||
import org.april.hebdobot.bot.hooks.TimekeeperHook;
|
||||
import org.april.hebdobot.bot.hooks.VersionHook;
|
||||
import org.april.hebdobot.bot.review.Message;
|
||||
import org.april.hebdobot.bot.review.Review;
|
||||
import org.april.hebdobot.cron.CronManager;
|
||||
import org.april.hebdobot.cron.CronSettings;
|
||||
import org.april.hebdobot.identica.IdenticaSettings;
|
||||
import org.april.hebdobot.pastebin.PastebinSettings;
|
||||
import org.april.hebdobot.privatebin.PrivatebinSettings;
|
||||
import org.april.hebdobot.twitter.TwitterClient;
|
||||
import org.april.hebdobot.twitter.TwitterSettings;
|
||||
import org.april.hebdobot.util.Timekeeper;
|
||||
import org.jibble.pircbot.IrcException;
|
||||
import org.jibble.pircbot.NickAlreadyInUseException;
|
||||
import org.jibble.pircbot.PircBot;
|
||||
@ -81,8 +84,9 @@ public class Hebdobot extends PircBot
|
||||
private String reviewFileSuffix;
|
||||
private LocalTime reviewWaitTime;
|
||||
private Review review;
|
||||
private Timekeeper timekeeper;
|
||||
private IdenticaSettings identicaSettings;
|
||||
private PastebinSettings pastebinSettings;
|
||||
private PrivatebinSettings privatebinSettings;
|
||||
private TwitterSettings twitterSettings;
|
||||
private CronSettings cronSettings;
|
||||
private UserAliases aliases;
|
||||
@ -123,9 +127,10 @@ public class Hebdobot extends PircBot
|
||||
this.reviewFileSuffix = null;
|
||||
this.reviewWaitTime = null;
|
||||
this.review = null;
|
||||
this.timekeeper = new Timekeeper();
|
||||
|
||||
this.identicaSettings = new IdenticaSettings();
|
||||
this.pastebinSettings = new PastebinSettings();
|
||||
this.privatebinSettings = new PrivatebinSettings();
|
||||
this.twitterSettings = new TwitterSettings();
|
||||
this.cronSettings = new CronSettings();
|
||||
this.aliases = new UserAliases();
|
||||
@ -147,7 +152,9 @@ public class Hebdobot extends PircBot
|
||||
this.hooker.add(new StopReviewHook());
|
||||
this.hooker.add(new StatsHook());
|
||||
this.hooker.add(new StatusHook());
|
||||
this.hooker.add(new CancelPreviousInputHook());
|
||||
|
||||
this.hooker.add(new TimekeeperHook());
|
||||
this.hooker.add(new DateHook());
|
||||
this.hooker.add(new HelloHook());
|
||||
this.hooker.add(new LicenseHook());
|
||||
@ -214,13 +221,13 @@ public class Hebdobot extends PircBot
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pastebin settings.
|
||||
* Gets the privatebin settings.
|
||||
*
|
||||
* @return the pastebin settings
|
||||
* @return the privatebin settings
|
||||
*/
|
||||
public PastebinSettings getPastebinSettings()
|
||||
public PrivatebinSettings getPrivatebinSettings()
|
||||
{
|
||||
return this.pastebinSettings;
|
||||
return this.privatebinSettings;
|
||||
}
|
||||
|
||||
public Review getReview()
|
||||
@ -243,6 +250,11 @@ public class Hebdobot extends PircBot
|
||||
return this.reviewWaitTime;
|
||||
}
|
||||
|
||||
public Timekeeper getTimekeeper()
|
||||
{
|
||||
return this.timekeeper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the twitter settings.
|
||||
*
|
||||
|
@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.bot.hooks;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.april.hebdobot.bot.Hebdobot;
|
||||
import org.april.hebdobot.bot.review.Topic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The Class CancelPreviousInputHook.
|
||||
*/
|
||||
public class CancelPreviousInputHook extends Hook
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(CancelPreviousInputHook.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
|
||||
final String message)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if (StringUtils.equalsIgnoreCase(message, "!cancelprevious"))
|
||||
{
|
||||
logger.info("!cancelprevious caught.");
|
||||
|
||||
// Missing.
|
||||
if (bot.getReview() == null)
|
||||
{
|
||||
bot.sendMessage(sender + ", pas de revue en cours.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Topic topic = bot.getReview().getCurrentTopic();
|
||||
if (topic == null)
|
||||
{
|
||||
bot.sendMessage("Pas de sujet en cours.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bot.getReview().getParticipants().contains(sender))
|
||||
{
|
||||
topic.cancelPreviousMessage(sender);
|
||||
}
|
||||
else
|
||||
{
|
||||
bot.sendMessage("Vous n'avez pas d'entrée en cours.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
@ -53,13 +53,15 @@ public class CollectiveSubjectHook extends Hook
|
||||
if (!bot.getReview().isEmpty())
|
||||
{
|
||||
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
|
||||
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
|
||||
bot.sendMessage(String.format("%% +%s %s, on va passer à la suite : %s", bot.getTimekeeper().format(), participants,
|
||||
topic.getTitle()));
|
||||
}
|
||||
bot.getReview().begin(topic);
|
||||
bot.sendMessage("Sujet collectif : " + topic.getTitle());
|
||||
bot.sendMessage("% 1 minute max");
|
||||
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
|
||||
bot.sendMessage("% quand vous avez fini vous le dites par % fini");
|
||||
bot.getTimekeeper().start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -33,8 +33,7 @@ import org.april.hebdobot.bot.stats.ReviewData;
|
||||
import org.april.hebdobot.bot.stats.ReviewDatas;
|
||||
import org.april.hebdobot.bot.stats.ReviewDatasFile;
|
||||
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
|
||||
import org.april.hebdobot.pastebin.PastebinClient;
|
||||
import org.april.hebdobot.pastebin.Private;
|
||||
import org.april.hebdobot.privatebin.PrivatebinClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -83,6 +82,8 @@ public class FinishReviewHook extends Hook
|
||||
// End the review.
|
||||
bot.getReview().endReview();
|
||||
|
||||
bot.sendMessage("%% +%01d:%02d", bot.getTimekeeper().format());
|
||||
|
||||
// Load and update review statistics.
|
||||
ReviewDatas datas;
|
||||
try
|
||||
@ -113,14 +114,14 @@ public class FinishReviewHook extends Hook
|
||||
|
||||
// Pastebin the review text.
|
||||
String pastebinUrl;
|
||||
if (bot.getPastebinSettings().isValid())
|
||||
if (bot.getPrivatebinSettings().isValid())
|
||||
{
|
||||
logger.info("Pastebin the review.");
|
||||
try
|
||||
{
|
||||
PastebinClient pastebinClient = new PastebinClient(bot.getPastebinSettings().getApiKey());
|
||||
PrivatebinClient pastebinClient = new PrivatebinClient(bot.getPrivatebinSettings());
|
||||
|
||||
pastebinUrl = pastebinClient.paste(reviewText, "Revue APRIL " + date, Private.UNLISTED);
|
||||
pastebinUrl = pastebinClient.paste(reviewText);
|
||||
}
|
||||
catch (final Exception exception)
|
||||
{
|
||||
|
@ -53,12 +53,14 @@ public class IndividualSubjectHook extends Hook
|
||||
if (!bot.getReview().isEmpty())
|
||||
{
|
||||
String participants = StringUtils.join(bot.getReview().getParticipants(), " ");
|
||||
bot.sendMessage(String.format("%% %s, on va passer à la suite : %s", participants, topic.getTitle()));
|
||||
bot.sendMessage(String.format("%% +%s %s, on va passer à la suite : %s", bot.getTimekeeper().format(), participants,
|
||||
topic.getTitle()));
|
||||
}
|
||||
bot.getReview().begin(topic);
|
||||
bot.sendMessage("Sujet individuel : " + topic.getTitle());
|
||||
bot.sendMessage("% si rien à signaler vous pouvez écrire % ras");
|
||||
bot.sendMessage("% quand vous avez fini vous le dites par % fini");
|
||||
bot.getTimekeeper().start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,12 +53,12 @@ public class StatusHook extends Hook
|
||||
{
|
||||
bot.sendMessage(sender, " animateur revue : " + bot.getReview().getOwner());
|
||||
}
|
||||
bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size()));
|
||||
bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid()));
|
||||
bot.sendMessage(sender, " Pastebin settings : " + (bot.getPastebinSettings().isValid()));
|
||||
bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid()));
|
||||
bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size()));
|
||||
bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime()));
|
||||
bot.sendMessage(sender, " Alias settings : " + (bot.getAliases().size()));
|
||||
bot.sendMessage(sender, " Identica settings : " + (bot.getIdenticaSettings().isValid()));
|
||||
bot.sendMessage(sender, " Privatebin settings : " + bot.getPrivatebinSettings().toString());
|
||||
bot.sendMessage(sender, " Twitter settings : " + (bot.getTwitterSettings().isValid()));
|
||||
bot.sendMessage(sender, " Cron settings : " + (bot.getCronSettings().size()));
|
||||
bot.sendMessage(sender, " Review Wait Time : " + (bot.getReviewWaitTime()));
|
||||
|
||||
result = true;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -16,65 +16,42 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
package org.april.hebdobot.bot.hooks;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.april.hebdobot.bot.Hebdobot;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* The Class PatebinSettings.
|
||||
* The Class TimekeeperHook.
|
||||
*/
|
||||
public class PastebinSettings
|
||||
public class TimekeeperHook extends Hook
|
||||
{
|
||||
private String apiKey;
|
||||
private static final Logger logger = LoggerFactory.getLogger(TimekeeperHook.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new pastebin settings.
|
||||
/* (non-Javadoc)
|
||||
* @see org.april.hebdobot.bot.hooks.Hook#attemptProcess(org.april.hebdobot.bot.Hebdobot, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
|
||||
*/
|
||||
public PastebinSettings()
|
||||
{
|
||||
this.apiKey = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new pastebin settings.
|
||||
*
|
||||
* @param apiKey
|
||||
* the api key
|
||||
*/
|
||||
public PastebinSettings(final String apiKey)
|
||||
{
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public String getApiKey()
|
||||
{
|
||||
return this.apiKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is valid.
|
||||
*
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid()
|
||||
@Override
|
||||
public boolean attemptProcess(final Hebdobot bot, final String channel, final String sender, final String login, final String hostname,
|
||||
final String message)
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if ((StringUtils.isBlank(this.apiKey)) || (StringUtils.containsOnly(this.apiKey, 'X')))
|
||||
if (StringUtils.equalsAnyIgnoreCase(message, "!timekeeper", "!chrono"))
|
||||
{
|
||||
result = false;
|
||||
logger.info("!chrono caught.");
|
||||
bot.sendMessage(bot.getTimekeeper().format());
|
||||
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
result = false;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setApiKey(final String apiKey)
|
||||
{
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
}
|
@ -52,6 +52,19 @@ public class CollectiveTopic extends Topic
|
||||
this.messages.add(message);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.april.hebdobot.bot.review.Topic#cancelPrevious(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void cancelPreviousMessage(final String author)
|
||||
{
|
||||
Message previousMessage = this.messages.getByAuthor(author).getLast();
|
||||
if (previousMessage != null)
|
||||
{
|
||||
this.messages.remove(previousMessage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the messages.
|
||||
*
|
||||
|
@ -58,6 +58,19 @@ public class IndividualTopic extends Topic
|
||||
this.messages.get(author).add(message);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.april.hebdobot.bot.review.Topic#cancelPrevious(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void cancelPreviousMessage(final String participant)
|
||||
{
|
||||
Messages authorMessages = this.messages.get(participant);
|
||||
if (authorMessages != null)
|
||||
{
|
||||
authorMessages.removeLast();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the messages.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -20,6 +20,8 @@ package org.april.hebdobot.bot.review;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* The Class MessageLinkedList.
|
||||
*/
|
||||
@ -34,4 +36,29 @@ public class Messages extends LinkedList<Message>
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the by author.
|
||||
*
|
||||
* @param author
|
||||
* the author
|
||||
* @return the by author
|
||||
*/
|
||||
public Messages getByAuthor(final String author)
|
||||
{
|
||||
Messages result;
|
||||
|
||||
result = new Messages();
|
||||
|
||||
for (Message message : this)
|
||||
{
|
||||
if (StringUtils.equals(message.getAuthor(), author))
|
||||
{
|
||||
result.add(message);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,14 @@ public abstract class Topic
|
||||
*/
|
||||
public abstract void add(Message message);
|
||||
|
||||
/**
|
||||
* Cancel previous.
|
||||
*
|
||||
* @param participant
|
||||
* the participant
|
||||
*/
|
||||
public abstract void cancelPreviousMessage(final String participant);
|
||||
|
||||
/**
|
||||
* Gets the participants.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2019 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -102,7 +102,7 @@ public class ReviewStatsReporter
|
||||
{
|
||||
double result;
|
||||
|
||||
result = percent(new Double(a).doubleValue(), new Double(b).doubleValue());
|
||||
result = percent(Double.valueOf(a).doubleValue(), Double.valueOf(b).doubleValue());
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
@ -209,7 +209,7 @@ public class HebdobotCLI
|
||||
|
||||
//
|
||||
logger.info("Bot configuring…");
|
||||
bot.getPastebinSettings().setApiKey(config.getPastebinApiKey());
|
||||
bot.getPrivatebinSettings().setServerUrl(config.getPrivatebinUrl());
|
||||
bot.getIdenticaSettings().setApiKey(config.getIdenticaApiKey());
|
||||
bot.getIdenticaSettings().setApiSecret(config.getIdenticaApiSecret());
|
||||
bot.getTwitterSettings().setConsumerKey(config.getTwitterConsumerKey());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -21,6 +21,8 @@ package org.april.hebdobot.cli;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Properties;
|
||||
@ -332,15 +334,23 @@ public class HebdobotConfigFile extends Properties
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the pastebin api key.
|
||||
* Gets the private bin url.
|
||||
*
|
||||
* @return the pastebin api key
|
||||
* @return the private bin url
|
||||
*/
|
||||
public String getPastebinApiKey()
|
||||
public URL getPrivatebinUrl()
|
||||
{
|
||||
String result;
|
||||
URL result;
|
||||
|
||||
result = getProperty("pastebin.apiKey");
|
||||
try
|
||||
{
|
||||
String value = getProperty("privatebin.url");
|
||||
result = new URL(value);
|
||||
}
|
||||
catch (MalformedURLException exception)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
|
@ -1,52 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
|
||||
public class APIException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = 1852384776503676687L;
|
||||
|
||||
/**
|
||||
* Instantiates a new API exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
private APIException(final String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw if error.
|
||||
*
|
||||
* @param content
|
||||
* the content
|
||||
* @throws APIException
|
||||
* the API exception
|
||||
*/
|
||||
public static void throwIfError(final String content) throws APIException
|
||||
{
|
||||
if (content.contains(PastebinClient.API_ERROR))
|
||||
{
|
||||
throw new APIException(content.replaceFirst(PastebinClient.API_ERROR, ""));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,493 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.april.hebdobot.HebdobotException;
|
||||
|
||||
/**
|
||||
* The Class PastebinClient.
|
||||
*/
|
||||
public class PastebinClient
|
||||
{
|
||||
private static final String API_LOGIN_URL = "https://pastebin.com/api/api_login.php";
|
||||
private static final String API_POST_URL = "https://pastebin.com/api/api_post.php";
|
||||
|
||||
private static final String API_DEV_KEY = "api_dev_key";
|
||||
private static final String API_USER_KEY = "api_user_key";
|
||||
private static final String API_USER_NAME = "api_user_name";
|
||||
private static final String API_USER_PASSWORD = "api_user_password";
|
||||
private static final String API_OPTION = "api_option";
|
||||
private static final String API_PASTE_PRIVATE = "api_paste_private";
|
||||
private static final String API_PASTE_NAME = "api_paste_name";
|
||||
private static final String API_PASTE_EXPIRATION = "api_paste_expire_date";
|
||||
private static final String API_PASTE_FORMAT = "api_paste_format";
|
||||
private static final String API_PASTE_CODE = "api_paste_code";
|
||||
public static final String API_ERROR = "Bad API request,";
|
||||
|
||||
private String apiKey;
|
||||
private String apiUserKey;
|
||||
private HttpClient httpClient;
|
||||
|
||||
/**
|
||||
* Instantiates a new pastebin client.
|
||||
*
|
||||
* @param apiKey
|
||||
* the api key
|
||||
*/
|
||||
public PastebinClient(final String apiKey)
|
||||
{
|
||||
this.apiKey = apiKey;
|
||||
this.httpClient = new DefaultHttpClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* Login.
|
||||
*
|
||||
* @param name
|
||||
* the name
|
||||
* @param password
|
||||
* the password
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public void login(final String name, final String password) throws HebdobotException
|
||||
{
|
||||
try
|
||||
{
|
||||
final List<NameValuePair> params = new LinkedList<>();
|
||||
setParameter(params, API_DEV_KEY, this.apiKey);
|
||||
setParameter(params, API_USER_NAME, name);
|
||||
setParameter(params, API_USER_PASSWORD, password);
|
||||
|
||||
final HttpPost request = new HttpPost(API_LOGIN_URL);
|
||||
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
|
||||
|
||||
final HttpResponse response = this.httpClient.execute(request);
|
||||
final String content = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||
APIException.throwIfError(content);
|
||||
this.apiUserKey = content;
|
||||
}
|
||||
catch (UnsupportedEncodingException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (ClientProtocolException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (APIException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, Format.NONE, Private.PUBLIC, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param expiration
|
||||
* the expiration
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Expiration expiration) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, Format.NONE, Private.PUBLIC, expiration);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param format
|
||||
* the format
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Format format) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, format, Private.PUBLIC, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param format
|
||||
* the format
|
||||
* @param expiration
|
||||
* the expiration
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Format format, final Expiration expiration) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, format, Private.PUBLIC, expiration);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param format
|
||||
* the format
|
||||
* @param privat
|
||||
* the privat
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Format format, final Private privat) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, format, privat, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param format
|
||||
* the format
|
||||
* @param privat
|
||||
* the privat
|
||||
* @param expiration
|
||||
* the expiration
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Format format, final Private privat, final Expiration expiration) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, format, privat, expiration);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param privat
|
||||
* the privat
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Private privat) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, Format.NONE, privat, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param privat
|
||||
* the privat
|
||||
* @param expiration
|
||||
* the expiration
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final Private privat, final Expiration expiration) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, null, Format.NONE, privat, expiration);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param name
|
||||
* the name
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final String name) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, name, Format.NONE, Private.PUBLIC, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param name
|
||||
* the name
|
||||
* @param format
|
||||
* the format
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final String name, final Format format) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, name, format, Private.PUBLIC, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param name
|
||||
* the name
|
||||
* @param format
|
||||
* the format
|
||||
* @param expiration
|
||||
* the expiration
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final String name, final Format format, final Expiration expiration) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, name, format, Private.PUBLIC, expiration);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param name
|
||||
* the name
|
||||
* @param format
|
||||
* the format
|
||||
* @param privat
|
||||
* the privat
|
||||
* @return the string
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final String name, final Format format, final Private privat) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, name, format, privat, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param name
|
||||
* the name
|
||||
* @param format
|
||||
* the format
|
||||
* @param privat
|
||||
* the privat
|
||||
* @param expiration
|
||||
* the expiration
|
||||
* @return the pastebin URL
|
||||
* @throws HebdobotException
|
||||
* the exception
|
||||
*/
|
||||
public String paste(final String code, final String name, final Format format, final Private privat, final Expiration expiration)
|
||||
throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
try
|
||||
{
|
||||
List<NameValuePair> params = new LinkedList<>();
|
||||
setParameter(params, API_DEV_KEY, this.apiKey);
|
||||
setParameter(params, API_USER_KEY, this.apiUserKey);
|
||||
setParameter(params, API_OPTION, Option.PASTE.getValue());
|
||||
setParameter(params, API_PASTE_PRIVATE, privat.getValue());
|
||||
setParameter(params, API_PASTE_NAME, name);
|
||||
setParameter(params, API_PASTE_EXPIRATION, expiration.getValue());
|
||||
setParameter(params, API_PASTE_FORMAT, format.getValue());
|
||||
setParameter(params, API_PASTE_CODE, code);
|
||||
|
||||
final HttpPost request = new HttpPost(API_POST_URL);
|
||||
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
|
||||
|
||||
final HttpResponse response = this.httpClient.execute(request);
|
||||
result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||
APIException.throwIfError(result);
|
||||
}
|
||||
catch (UnsupportedEncodingException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (ClientProtocolException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
catch (APIException exception)
|
||||
{
|
||||
throw new HebdobotException(exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param code
|
||||
* the code
|
||||
* @param name
|
||||
* the name
|
||||
* @param privat
|
||||
* the privat
|
||||
* @return the pastebin URL
|
||||
* @throws HebdobotException
|
||||
* the hebdobot exception
|
||||
*/
|
||||
public String paste(final String code, final String name, final Private privat) throws HebdobotException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.paste(code, name, Format.NONE, privat, Expiration.DAY_1);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parameter.
|
||||
*
|
||||
* @param params
|
||||
* the params
|
||||
* @param name
|
||||
* the name
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
private static void setParameter(final List<NameValuePair> params, final String name, final String value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
params.add(new BasicNameValuePair(name, value));
|
||||
}
|
||||
}
|
||||
}
|
208
src/org/april/hebdobot/privatebin/Base58.java
Normal file
208
src/org/april/hebdobot/privatebin/Base58.java
Normal file
@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright 2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright 2020 Dr Ian Preston ianopolous
|
||||
* Copyright 2018 Andreas Schildbach
|
||||
* Copyright 2011 Google Inc.
|
||||
*
|
||||
* From:
|
||||
* https://github.com/multiformats/java-multibase/blob/master/src/main/java/io/ipfs/multibase/Base58.java
|
||||
* https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Base58.java
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Base58 is a way to encode Bitcoin addresses (or arbitrary data) as
|
||||
* alphanumeric strings.
|
||||
* <p>
|
||||
* Note that this is not the same base58 as used by Flickr, which you may find
|
||||
* referenced around the Internet.
|
||||
* <p>
|
||||
* Satoshi explains: why base-58 instead of standard base-64 encoding?
|
||||
* <ul>
|
||||
* <li>Don't want 0OIl characters that look the same in some fonts and could be
|
||||
* used to create visually identical looking account numbers.</li>
|
||||
* <li>A string with non-alphanumeric characters is not as easily accepted as an
|
||||
* account number.</li>
|
||||
* <li>E-mail usually won't line-break if there's no punctuation to break
|
||||
* at.</li>
|
||||
* <li>Doubleclicking selects the whole number as one word if it's all
|
||||
* alphanumeric.</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* However, note that the encoding/decoding runs in O(n²) time, so it is
|
||||
* not useful for large data.
|
||||
* <p>
|
||||
* The basic idea of the encoding is to treat the data bytes as a large number
|
||||
* represented using base-256 digits, convert the number to be represented using
|
||||
* base-58 digits, preserve the exact number of leading zeros (which are
|
||||
* otherwise lost during the mathematical operations on the numbers), and
|
||||
* finally represent the resulting base-58 digits as alphanumeric ASCII
|
||||
* characters.
|
||||
*/
|
||||
public class Base58
|
||||
{
|
||||
public static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
|
||||
private static final char ENCODED_ZERO = ALPHABET[0];
|
||||
private static final int[] INDEXES = new int[128];
|
||||
static
|
||||
{
|
||||
Arrays.fill(INDEXES, -1);
|
||||
for (int i = 0; i < ALPHABET.length; i++)
|
||||
{
|
||||
INDEXES[ALPHABET[i]] = i;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the given base58 string into the original data bytes.
|
||||
*
|
||||
* @param input
|
||||
* the base58-encoded string to decode
|
||||
* @return the decoded data bytes
|
||||
*/
|
||||
public static byte[] decode(final String input)
|
||||
{
|
||||
if (input.length() == 0)
|
||||
{
|
||||
return new byte[0];
|
||||
}
|
||||
// Convert the base58-encoded ASCII chars to a base58 byte sequence
|
||||
// (base58 digits).
|
||||
byte[] input58 = new byte[input.length()];
|
||||
for (int i = 0; i < input.length(); ++i)
|
||||
{
|
||||
char c = input.charAt(i);
|
||||
int digit = c < 128 ? INDEXES[c] : -1;
|
||||
if (digit < 0)
|
||||
{
|
||||
throw new IllegalStateException("InvalidCharacter in base 58");
|
||||
}
|
||||
input58[i] = (byte) digit;
|
||||
}
|
||||
// Count leading zeros.
|
||||
int zeros = 0;
|
||||
while (zeros < input58.length && input58[zeros] == 0)
|
||||
{
|
||||
++zeros;
|
||||
}
|
||||
// Convert base-58 digits to base-256 digits.
|
||||
byte[] decoded = new byte[input.length()];
|
||||
int outputStart = decoded.length;
|
||||
for (int inputStart = zeros; inputStart < input58.length;)
|
||||
{
|
||||
decoded[--outputStart] = divmod(input58, inputStart, 58, 256);
|
||||
if (input58[inputStart] == 0)
|
||||
{
|
||||
++inputStart; // optimization - skip leading zeros
|
||||
}
|
||||
}
|
||||
// Ignore extra leading zeroes that were added during the calculation.
|
||||
while (outputStart < decoded.length && decoded[outputStart] == 0)
|
||||
{
|
||||
++outputStart;
|
||||
}
|
||||
// Return decoded data (including original number of leading zeros).
|
||||
return Arrays.copyOfRange(decoded, outputStart - zeros, decoded.length);
|
||||
}
|
||||
|
||||
public static BigInteger decodeToBigInteger(final String input)
|
||||
{
|
||||
return new BigInteger(1, decode(input));
|
||||
}
|
||||
|
||||
/**
|
||||
* Divides a number, represented as an array of bytes each containing a
|
||||
* single digit in the specified base, by the given divisor. The given
|
||||
* number is modified in-place to contain the quotient, and the return value
|
||||
* is the remainder.
|
||||
*
|
||||
* @param number
|
||||
* the number to divide
|
||||
* @param firstDigit
|
||||
* the index within the array of the first non-zero digit (this
|
||||
* is used for optimization by skipping the leading zeros)
|
||||
* @param base
|
||||
* the base in which the number's digits are represented (up to
|
||||
* 256)
|
||||
* @param divisor
|
||||
* the number to divide by (up to 256)
|
||||
* @return the remainder of the division operation
|
||||
*/
|
||||
private static byte divmod(final byte[] number, final int firstDigit, final int base, final int divisor)
|
||||
{
|
||||
// this is just long division which accounts for the base of the input
|
||||
// digits
|
||||
int remainder = 0;
|
||||
for (int i = firstDigit; i < number.length; i++)
|
||||
{
|
||||
int digit = number[i] & 0xFF;
|
||||
int temp = remainder * base + digit;
|
||||
number[i] = (byte) (temp / divisor);
|
||||
remainder = temp % divisor;
|
||||
}
|
||||
return (byte) remainder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodes the given bytes as a base58 string (no checksum is appended).
|
||||
*
|
||||
* @param input
|
||||
* the bytes to encode
|
||||
* @return the base58-encoded string
|
||||
*/
|
||||
public static String encode(byte[] input)
|
||||
{
|
||||
if (input.length == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
// Count leading zeros.
|
||||
int zeros = 0;
|
||||
while (zeros < input.length && input[zeros] == 0)
|
||||
{
|
||||
++zeros;
|
||||
}
|
||||
// Convert base-256 digits to base-58 digits (plus conversion to ASCII
|
||||
// characters)
|
||||
input = Arrays.copyOf(input, input.length); // since we modify it
|
||||
// in-place
|
||||
char[] encoded = new char[input.length * 2]; // upper bound
|
||||
int outputStart = encoded.length;
|
||||
for (int inputStart = zeros; inputStart < input.length;)
|
||||
{
|
||||
encoded[--outputStart] = ALPHABET[divmod(input, inputStart, 256, 58)];
|
||||
if (input[inputStart] == 0)
|
||||
{
|
||||
++inputStart; // optimization - skip leading zeros
|
||||
}
|
||||
}
|
||||
// Preserve exactly as many leading encoded zeros in output as there
|
||||
// were leading zeros in input.
|
||||
while (outputStart < encoded.length && encoded[outputStart] == ENCODED_ZERO)
|
||||
{
|
||||
++outputStart;
|
||||
}
|
||||
while (--zeros >= 0)
|
||||
{
|
||||
encoded[--outputStart] = ENCODED_ZERO;
|
||||
}
|
||||
// Return encoded string (including encoded leading zeros).
|
||||
return new String(encoded, outputStart, encoded.length - outputStart);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -17,37 +16,42 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
/**
|
||||
* The Enum Private.
|
||||
* The Enum Option.
|
||||
*/
|
||||
public enum Private
|
||||
public enum BurnAfterReading
|
||||
{
|
||||
PUBLIC("0"),
|
||||
UNLISTED("1"),
|
||||
PRIVATE("2");
|
||||
ON("1"),
|
||||
OFF("0");
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* Instantiates a new private.
|
||||
* Instantiates a new option.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
private Private(final String value)
|
||||
private BurnAfterReading(final String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
* To string.
|
||||
*
|
||||
* @return the value
|
||||
* @return the string
|
||||
*/
|
||||
String getValue()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.value;
|
||||
String result;
|
||||
|
||||
result = this.value;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
57
src/org/april/hebdobot/privatebin/Compression.java
Normal file
57
src/org/april/hebdobot/privatebin/Compression.java
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
/**
|
||||
* The Enum Compression.
|
||||
*/
|
||||
public enum Compression
|
||||
{
|
||||
NONE("none"),
|
||||
ZLIB("zlib");
|
||||
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* Instantiates a new option.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
private Compression(final String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = this.value;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
@ -17,18 +17,21 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
/**
|
||||
* The Enum Expiration.
|
||||
*/
|
||||
public enum Expiration
|
||||
{
|
||||
NEVER(null),
|
||||
MINUTE_10("10M"),
|
||||
HOUR_1("1H"),
|
||||
DAY_1("1D"),
|
||||
MONTH_1("1M");
|
||||
MINUTE_5("5min"),
|
||||
MINUTE_10("10min"),
|
||||
HOUR_1("1hour"),
|
||||
DAY_1("1day"),
|
||||
WEEK_1("1week"),
|
||||
MONTH_1("1month"),
|
||||
YEAR_1("1year"),
|
||||
NEVER("never");
|
||||
|
||||
private final String value;
|
||||
|
||||
@ -44,12 +47,18 @@ public enum Expiration
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
* To string.
|
||||
*
|
||||
* @return the value
|
||||
* @return the string
|
||||
*/
|
||||
public String getValue()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.value;
|
||||
String result;
|
||||
|
||||
result = this.value;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -17,18 +16,16 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
/**
|
||||
* The Enum Format.
|
||||
* The Enum Formatter.
|
||||
*/
|
||||
public enum Format
|
||||
public enum Formatter
|
||||
{
|
||||
NONE(null),
|
||||
C("c"),
|
||||
CPP("cpp"),
|
||||
JAVA("java"),
|
||||
JAVA_5("java5");
|
||||
PLAINTEXT("plaintext"),
|
||||
SYNTAXHIGHLIGHTING("syntaxhighlighting"),
|
||||
MARKDOWN("markdown");
|
||||
|
||||
private final String value;
|
||||
|
||||
@ -38,18 +35,24 @@ public enum Format
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
private Format(final String value)
|
||||
private Formatter(final String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
* To string.
|
||||
*
|
||||
* @return the value
|
||||
* @return the string
|
||||
*/
|
||||
public String getValue()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.value;
|
||||
String result;
|
||||
|
||||
result = this.value;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
@ -17,14 +16,15 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
/**
|
||||
* The Enum Option.
|
||||
*/
|
||||
public enum Option
|
||||
public enum OpenDiscussion
|
||||
{
|
||||
PASTE("paste");
|
||||
ON("1"),
|
||||
OFF("0");
|
||||
|
||||
private final String value;
|
||||
|
||||
@ -34,18 +34,24 @@ public enum Option
|
||||
* @param value
|
||||
* the value
|
||||
*/
|
||||
private Option(final String value)
|
||||
private OpenDiscussion(final String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value.
|
||||
* To string.
|
||||
*
|
||||
* @return the value
|
||||
* @return the string
|
||||
*/
|
||||
public String getValue()
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.value;
|
||||
String result;
|
||||
|
||||
result = this.value;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
253
src/org/april/hebdobot/privatebin/PrivatebinClient.java
Normal file
253
src/org/april/hebdobot/privatebin/PrivatebinClient.java
Normal file
@ -0,0 +1,253 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.KeySpec;
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
import java.util.Random;
|
||||
import java.util.zip.Deflater;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
||||
/**
|
||||
* The Class PastebinClient.
|
||||
*/
|
||||
public class PrivatebinClient extends PrivatebinSettings
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(PrivatebinClient.class);
|
||||
|
||||
/**
|
||||
* Instantiates a new privatebin client.
|
||||
*
|
||||
* @param settings
|
||||
* the settings
|
||||
*/
|
||||
public PrivatebinClient(final PrivatebinSettings settings)
|
||||
{
|
||||
super(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new privatebin client.
|
||||
*
|
||||
* @param url
|
||||
* the url
|
||||
*/
|
||||
public PrivatebinClient(final URL url)
|
||||
{
|
||||
super();
|
||||
setServerUrl(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste.
|
||||
*
|
||||
* @param text
|
||||
* the text
|
||||
* @return the string
|
||||
* @throws PrivatebinException
|
||||
* the privatebin exception
|
||||
*/
|
||||
public String paste(final String text) throws PrivatebinException
|
||||
{
|
||||
String result;
|
||||
|
||||
result = null;
|
||||
try
|
||||
{
|
||||
// Note: the following code is based on:
|
||||
// https://github.com/PrivateBin/PrivateBin/wiki/API
|
||||
// https://github.com/kkingsley-BF/PrivateBin-Groovy/blob/master/Paste.groovy
|
||||
|
||||
// Build message to encrypt.
|
||||
JSONObject pasteDataJson = new JSONObject();
|
||||
pasteDataJson.put("paste", text);
|
||||
String pasteData = pasteDataJson.toJSONString();
|
||||
// logger.debug("pasteData={}", pasteData);
|
||||
|
||||
// Compression.
|
||||
byte[] pasteDataBytes;
|
||||
if (this.compression == Compression.ZLIB)
|
||||
{
|
||||
Deflater zipDeflater = new Deflater();
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
zipDeflater.setInput(pasteData.getBytes());
|
||||
zipDeflater.finish();
|
||||
byte[] buffer = new byte[1024];
|
||||
while (!zipDeflater.finished())
|
||||
{
|
||||
int count = zipDeflater.deflate(buffer);
|
||||
stream.write(buffer, 0, count);
|
||||
}
|
||||
byte[] output;
|
||||
output = stream.toByteArray();
|
||||
stream.close();
|
||||
zipDeflater.end();
|
||||
// Need to remove the header
|
||||
pasteDataBytes = Arrays.copyOfRange(output, 2, output.length - 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
pasteDataBytes = pasteData.getBytes();
|
||||
}
|
||||
|
||||
// Generate password.
|
||||
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
|
||||
keyGen.init(192);
|
||||
String randomPassword = Base64.getEncoder().encodeToString(keyGen.generateKey().getEncoded());
|
||||
String customPassword = randomPassword + this.password;
|
||||
|
||||
// Generate IV.
|
||||
byte[] cipherIVBytes = new byte[16];
|
||||
new Random().nextBytes(cipherIVBytes);
|
||||
String cipherIVEncoded = Base64.getEncoder().encodeToString(cipherIVBytes);
|
||||
|
||||
// Generate salt.
|
||||
byte[] kdfSaltBytes = new byte[8];
|
||||
new Random().nextBytes(kdfSaltBytes);
|
||||
String kdfSaltEncoded = Base64.getEncoder().encodeToString(kdfSaltBytes);
|
||||
|
||||
// Generate secret key for cipher.
|
||||
SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
|
||||
KeySpec passwordBasedEncryptionKeySpec = new PBEKeySpec(customPassword.toCharArray(), kdfSaltBytes, 100000, 256);
|
||||
SecretKey secret = new SecretKeySpec(factory.generateSecret(passwordBasedEncryptionKeySpec).getEncoded(), "AES");
|
||||
|
||||
// Cipher AAD.
|
||||
StringList gcmTagString = new StringList();
|
||||
gcmTagString.append("[");
|
||||
gcmTagString.append("[");
|
||||
gcmTagString.append("\"").append(cipherIVEncoded).append("\"").append(",");
|
||||
gcmTagString.append("\"").append(kdfSaltEncoded).append("\"").append(",");
|
||||
gcmTagString.append("100000,256,128,");
|
||||
gcmTagString.append("\"").append("aes").append("\"").append(",");
|
||||
gcmTagString.append("\"").append("gcm").append("\"").append(",");
|
||||
gcmTagString.append("\"").append(this.compression.toString()).append("\"");
|
||||
gcmTagString.append("]");
|
||||
gcmTagString.append(",");
|
||||
gcmTagString.append("\"").append(this.formatter.toString()).append("\"").append(",");
|
||||
gcmTagString.append(this.openDiscussion.toString()).append(",");
|
||||
gcmTagString.append(this.burnAfterReading.toString());
|
||||
gcmTagString.append("]");
|
||||
byte[] gcmBytes = gcmTagString.toString().getBytes();
|
||||
|
||||
// Generate cipher text.
|
||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||
GCMParameterSpec spec = new GCMParameterSpec(128, cipherIVBytes);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secret, spec);
|
||||
cipher.updateAAD(gcmBytes);
|
||||
byte[] cipherTextBytes = cipher.doFinal(pasteDataBytes);
|
||||
String cipherText = Base64.getEncoder().encodeToString(cipherTextBytes);
|
||||
// logger.debug("cipherText={}", cipherText);
|
||||
|
||||
// Create POST payload.
|
||||
StringList payload = new StringList();
|
||||
payload.append("{");
|
||||
payload.append("\"v\":2,");
|
||||
payload.append("\"adata\":").append(gcmTagString.toString()).append(",");
|
||||
payload.append("\"ct\":\"").append(cipherText).append("\",");
|
||||
payload.append("\"meta\":{\"expire\":\"").append(this.expiration).append("\"}");
|
||||
payload.append("}");
|
||||
// logger.debug("PAYLOAD={}", payload.toString());
|
||||
|
||||
// POST Request.
|
||||
HttpsURLConnection pasteRequest = (HttpsURLConnection) this.serverUrl.openConnection();
|
||||
pasteRequest.setRequestMethod("POST");
|
||||
pasteRequest.setDoOutput(true);
|
||||
pasteRequest.setRequestProperty("X-Requested-With", "JSONHttpRequest");
|
||||
pasteRequest.getOutputStream().write(payload.toString().getBytes());
|
||||
|
||||
// Server response.
|
||||
int responseCode = pasteRequest.getResponseCode();
|
||||
logger.debug("Server response: {}", responseCode);
|
||||
if (responseCode == 200)
|
||||
{
|
||||
String out = IOUtils.toString(pasteRequest.getInputStream(), "UTF-8");
|
||||
logger.info("===> {}", out);
|
||||
|
||||
JSONObject parser = (JSONObject) new JSONParser().parse(out);
|
||||
String status = parser.get("status").toString();
|
||||
if (StringUtils.equals(status, "0"))
|
||||
{
|
||||
String id = parser.get("id").toString();
|
||||
String pasteURL = parser.get("url").toString();
|
||||
String deleteToken = parser.get("deletetoken").toString();
|
||||
String finalURL = this.serverUrl + pasteURL + "#" + Base58.encode(randomPassword.getBytes());
|
||||
String deleteURL = this.serverUrl + pasteURL + "&deletetoken=" + deleteToken;
|
||||
logger.info("Pastebin SUCESS");
|
||||
logger.debug("Paste URL: {}", finalURL);
|
||||
logger.debug("Delete URL: {}", deleteURL);
|
||||
result = finalURL;
|
||||
}
|
||||
else
|
||||
{
|
||||
String output = parser.get("message").toString();
|
||||
logger.warn("message={}", output);
|
||||
throw new PrivatebinException(out);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (BadPaddingException | IllegalBlockSizeException | InvalidAlgorithmParameterException | InvalidKeyException | InvalidKeySpecException
|
||||
| NoSuchAlgorithmException | NoSuchPaddingException | ParseException | UnsupportedEncodingException |
|
||||
|
||||
ClientProtocolException exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
throw new PrivatebinException(exception);
|
||||
}
|
||||
catch (IOException exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
throw new PrivatebinException(exception);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
70
src/org/april/hebdobot/privatebin/PrivatebinException.java
Normal file
70
src/org/april/hebdobot/privatebin/PrivatebinException.java
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
/**
|
||||
* The Class PrivateBinException.
|
||||
*/
|
||||
public class PrivatebinException extends Exception
|
||||
{
|
||||
private static final long serialVersionUID = -1113543017171098521L;
|
||||
|
||||
/**
|
||||
* Instantiates a new private bin exception.
|
||||
*/
|
||||
public PrivatebinException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new private bin exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public PrivatebinException(final String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new private bin exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the cause
|
||||
*/
|
||||
public PrivatebinException(final String message, final Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new private bin exception.
|
||||
*
|
||||
* @param cause
|
||||
* the cause
|
||||
*/
|
||||
public PrivatebinException(final Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
}
|
203
src/org/april/hebdobot/privatebin/PrivatebinSettings.java
Normal file
203
src/org/april/hebdobot/privatebin/PrivatebinSettings.java
Normal file
@ -0,0 +1,203 @@
|
||||
/**
|
||||
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* The Class PrivatebinSettings
|
||||
*/
|
||||
public class PrivatebinSettings
|
||||
{
|
||||
protected URL serverUrl;
|
||||
protected Compression compression;
|
||||
protected Expiration expiration;
|
||||
protected BurnAfterReading burnAfterReading;
|
||||
protected OpenDiscussion openDiscussion;
|
||||
protected Formatter formatter;
|
||||
protected String password;
|
||||
|
||||
/**
|
||||
* Instantiates a new Privatebin settings.
|
||||
*/
|
||||
public PrivatebinSettings()
|
||||
{
|
||||
this.serverUrl = null;
|
||||
this.compression = Compression.ZLIB;
|
||||
this.expiration = Expiration.DAY_1;
|
||||
this.burnAfterReading = BurnAfterReading.OFF;
|
||||
this.openDiscussion = OpenDiscussion.OFF;
|
||||
this.formatter = Formatter.PLAINTEXT;
|
||||
this.password = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new privatebin settings.
|
||||
*
|
||||
* @param settings
|
||||
* the settings
|
||||
*/
|
||||
public PrivatebinSettings(final PrivatebinSettings settings)
|
||||
{
|
||||
this.serverUrl = settings.serverUrl;
|
||||
this.compression = settings.compression;
|
||||
this.expiration = settings.expiration;
|
||||
this.burnAfterReading = settings.burnAfterReading;
|
||||
this.openDiscussion = settings.openDiscussion;
|
||||
this.formatter = settings.formatter;
|
||||
this.password = settings.password;
|
||||
}
|
||||
|
||||
public BurnAfterReading getBurnAfterReading()
|
||||
{
|
||||
return this.burnAfterReading;
|
||||
}
|
||||
|
||||
public Compression getCompression()
|
||||
{
|
||||
return this.compression;
|
||||
}
|
||||
|
||||
public Expiration getExpiration()
|
||||
{
|
||||
return this.expiration;
|
||||
}
|
||||
|
||||
public Formatter getFormatter()
|
||||
{
|
||||
return this.formatter;
|
||||
}
|
||||
|
||||
public OpenDiscussion getOpenDiscussion()
|
||||
{
|
||||
return this.openDiscussion;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public URL getServerUrl()
|
||||
{
|
||||
return this.serverUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is valid.
|
||||
*
|
||||
* @return true, if is valid
|
||||
*/
|
||||
public boolean isValid()
|
||||
{
|
||||
boolean result;
|
||||
|
||||
if (this.serverUrl == null)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
else if ((this.burnAfterReading == BurnAfterReading.ON) && (this.openDiscussion == OpenDiscussion.ON))
|
||||
{
|
||||
// Burn after reading cannot be active if opendiscussion is.
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setBurnAfterReading(final BurnAfterReading burnAfterReading)
|
||||
{
|
||||
if (burnAfterReading != null)
|
||||
{
|
||||
this.burnAfterReading = burnAfterReading;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCompression(final Compression compression)
|
||||
{
|
||||
if (compression != null)
|
||||
{
|
||||
this.compression = compression;
|
||||
}
|
||||
}
|
||||
|
||||
public void setExpiration(final Expiration expiration)
|
||||
{
|
||||
if (expiration != null)
|
||||
{
|
||||
this.expiration = expiration;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFormatter(final Formatter formatter)
|
||||
{
|
||||
if (formatter != null)
|
||||
{
|
||||
this.formatter = formatter;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOpenDiscussion(final OpenDiscussion openDiscussion)
|
||||
{
|
||||
if (openDiscussion != null)
|
||||
{
|
||||
this.openDiscussion = openDiscussion;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPassword(final String password)
|
||||
{
|
||||
if (password == null)
|
||||
{
|
||||
this.password = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
}
|
||||
|
||||
public void setServerUrl(final URL serverUrl)
|
||||
{
|
||||
this.serverUrl = serverUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
String result;
|
||||
|
||||
result = String.format("valid=%b, url=%s, formatter=%s, compression=%s, expiration=%s, burnafterreading=%s, opendiscussion=%s, password=%s",
|
||||
isValid(), this.serverUrl, this.formatter, this.compression, this.expiration, this.burnAfterReading, this.openDiscussion,
|
||||
this.password);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
71
src/org/april/hebdobot/util/Timekeeper.java
Normal file
71
src/org/april/hebdobot/util/Timekeeper.java
Normal file
@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Copyright (C) 2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.util;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* The Class TimeKeeper.
|
||||
*/
|
||||
public class Timekeeper
|
||||
{
|
||||
private LocalDateTime start;
|
||||
|
||||
/**
|
||||
* Instantiates a new time keeper.
|
||||
*/
|
||||
public Timekeeper()
|
||||
{
|
||||
this.start = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public String format()
|
||||
{
|
||||
String result;
|
||||
|
||||
if (this.start == null)
|
||||
{
|
||||
result = "n/a";
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalDateTime end = LocalDateTime.now();
|
||||
Duration duration = Duration.between(this.start, end);
|
||||
|
||||
result = String.format("%1d:%02d", duration.getSeconds() / 60, duration.getSeconds() % 60);
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start.
|
||||
*/
|
||||
public void start()
|
||||
{
|
||||
this.start = LocalDateTime.now();
|
||||
}
|
||||
}
|
@ -12,8 +12,8 @@ irc.port=6667
|
||||
irc.name=Hebdobot
|
||||
irc.channel=#april-test
|
||||
|
||||
# Pastebin settings.
|
||||
pastebin.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
# Privatebin settings.
|
||||
privatebin.url=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
# Ident.ca settings.
|
||||
identica.apiKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2017-2018 Christian Pierre MOMON <cmomon@april.org>
|
||||
* Copyright (C) 2011-2013 Nicolas Vinot <aeris@imirhil.fr>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.pastebin;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The Class PastebinClientTest.
|
||||
*/
|
||||
public class PastebinClientTest
|
||||
{
|
||||
private final PastebinClient client = new PastebinClient("b95ea42d539ec9dca02a7da1f5b229c7");
|
||||
|
||||
/**
|
||||
* Test paste.
|
||||
*
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
@Test
|
||||
public void testPaste() throws Exception
|
||||
{
|
||||
System.out.println(this.client.paste("ééé", Expiration.MINUTE_10));
|
||||
}
|
||||
}
|
@ -0,0 +1,416 @@
|
||||
================================================================================
|
||||
Revue de la semaine en cours
|
||||
|
||||
Vendredi 02 avril 2021
|
||||
================================================================================
|
||||
|
||||
|
||||
================================================================================
|
||||
|
||||
--------------------------------- Participants ---------------------------------
|
||||
* IIIIIIIII IIII (cccccccccc)
|
||||
* aaaa (aaaa)
|
||||
* Cccccccccc P. Mmmmmm (cccc_cccccc)
|
||||
* Pppppp (Pppppp)
|
||||
|
||||
================================================================================
|
||||
|
||||
------------------------- IIIIIIIII IIII (cccccccccc) --------------------------
|
||||
|
||||
=== 1/ Actions passées ou en cours ===
|
||||
|
||||
* dépilage courriels suite au congé
|
||||
* ca@ : suivi divers
|
||||
* participation à point d'équipe/dossiers
|
||||
* suivi courriels sur secretaire@
|
||||
* suivi nouvelles adhésions
|
||||
* suivi relances personnes morales en retard de cotisation
|
||||
* relectures diverses
|
||||
* réu sensibilisation hebdo : orga, annonces, animation
|
||||
* rdv « tâches importantes » : orga, annonces, présence
|
||||
* intervention à la 100e de Libre à vous !
|
||||
* divers fournisseurs
|
||||
* divers en vente libre
|
||||
* divers formulaire de contact
|
||||
* divers régie lav !
|
||||
* test imprimante
|
||||
* divers pour rediffusion d'une émission mardi 06/04
|
||||
* suivi tâches admins me concernant
|
||||
* maj diverses pad d'orga LAV !
|
||||
* ventilation temps par catégories LAV !
|
||||
* divers membres en bounce
|
||||
|
||||
=== 2/ Actions à venir ===
|
||||
|
||||
* divers lef 2021 : remerciements, bilan, maj diverses
|
||||
* divers refonte graphique libre en fête
|
||||
* divers projets sensi
|
||||
* divers lav !
|
||||
* suite dépilage courriels
|
||||
* suivi dossiers administratifs divers
|
||||
* divers en vente libre
|
||||
* recherche personnes intervenantes pour sujet long∕chronique à venir lav !
|
||||
* rdv « tâches importantes » : orga, annonces, présence
|
||||
* revue hebdomadaire : génération de la synthèse
|
||||
* divers en fonction du temps
|
||||
|
||||
================================================================================
|
||||
|
||||
--------------------------------- aaaa (aaaa) ----------------------------------
|
||||
|
||||
=== 2/ Actions à venir ===
|
||||
|
||||
* Participation à reunion chatons
|
||||
* Participation à réunion chapril
|
||||
* Modération et animation chapril xmpp
|
||||
* Mise en place de mon serveur physique \o/
|
||||
|
||||
================================================================================
|
||||
|
||||
----------------------- Cccccccccc P. Mmmmmm (cccc_cccccc) ------------------------
|
||||
|
||||
=== 1/ Actions passées ou en cours ===
|
||||
|
||||
* CA : courant
|
||||
* Gdt:adminsys : supervision SI
|
||||
* Gdt:adminsys : tâches sprint
|
||||
* Gdt:adminsys : réunion de sprint mensuel adminsys
|
||||
* Gdt:adminsys : Mettre à jour Gitea/forge.chapril.org en 1.13.6 (#5290)
|
||||
* Gdt:chapril : supervision SI
|
||||
* Gdt:chapril : upgrades
|
||||
* Gdt:chapril : reboot SI
|
||||
* Gdt:chapril : suivi CHATONS
|
||||
* Gdt:chapril : jardinage tickets
|
||||
* Gdt:chapril : réunion CHATONS ChatonsInfos
|
||||
* Gdt:chapril : dev ChaprilInfos
|
||||
* Gdt:chapril : dev gestion logs
|
||||
* Gdt:chapril : permanence du samedi matin
|
||||
* Gdt:chapril : Mettre à jour Gitea/forge.chapril.org en 1.13.6 (#5291)
|
||||
* Gdt:chapril : modération pouet.chapril.org
|
||||
* Gdt:chapril : réponse demande de stage
|
||||
* Libreàvous! : écoute de l'émission
|
||||
* Libreàvous! : participation avec une capsule pour la 100e
|
||||
* Décryptualité : écoute de l'émission
|
||||
* Transcription : relecture émission n°94
|
||||
* Virus : suivi, grrrr…
|
||||
* Divers
|
||||
* Sensibilisation : participation réunion Boussole du Libre
|
||||
|
||||
=== 2/ Actions à venir ===
|
||||
|
||||
* CA : courant
|
||||
* Gdt:adminsys : supervision SI
|
||||
* Gdt:adminsys : tâches de sprint
|
||||
* Gdt:chapril : supervision SI
|
||||
* Gdt:chapril : gestion gdt Chapril
|
||||
* Gdt:chapril : préparation réunion animateurs (annonce, pad, stats…)
|
||||
* Gdt:chapril : animation de réunion mensuelle de sprint
|
||||
* Gdt:chapril : tâches post réunion mensuelle Chapril (tickets, pad…)
|
||||
* Gdt:chapril : CHATONS, suivi forum
|
||||
* Gdt:chapril : dev ChatonsInfos
|
||||
* Gdt:chapril : dév ChaprilInfos
|
||||
* Gdt:chapril : réunion ChatonsInfos
|
||||
* Gdt:chapril : point modération Mastodon
|
||||
* Libreàvous! : écoute de l'émission
|
||||
* Décryptualité : écoute de l'émission
|
||||
* Galerie photos : fin traitement photos AGO
|
||||
|
||||
================================================================================
|
||||
|
||||
-------------------------------- Pppppp (Pppppp) ---------------------------------
|
||||
|
||||
=== 1/ Actions passées ou en cours ===
|
||||
|
||||
* ca: suivi divres
|
||||
* tresorerie: suivi divers
|
||||
* adminsys: suivi divers, maj du cluster + redémarrage, nettoyage de icinga
|
||||
* siteweb: activation de l'index fulltext pour des mots de 3 lettres
|
||||
* mails: passage au karsher des domaines en erreur
|
||||
* adminsys: réunion de sprint fructueuse
|
||||
* adminsys: maj de matomo et piwik
|
||||
|
||||
=== 2/ Actions à venir ===
|
||||
|
||||
* rapport d'activité format pdf
|
||||
|
||||
================================================================================
|
||||
3/ Points de blocage / points en retard corrigés cette semaine
|
||||
================================================================================
|
||||
|
||||
* aaaa : Écouter LAV 100 🤣😅
|
||||
|
||||
================================================================================
|
||||
4/ Points de blocage existants / points en retard à traiter
|
||||
================================================================================
|
||||
|
||||
* Pppppp : rapport d'activité version pdf :)
|
||||
* cccccccccc : mise en vente t-shirt
|
||||
* cccccccccc : divers comm' et sensi
|
||||
|
||||
================================================================================
|
||||
5/ Points forts de la semaine
|
||||
================================================================================
|
||||
|
||||
* cccc_cccccc : La centième de Libre à vous ! \o/
|
||||
* cccccccccc : lav ! a fêté 100 émissions \o/
|
||||
* cccc_cccccc : Réunion adminsys
|
||||
* aaaa : Je vois le bout du tunnel ovh
|
||||
* cccccccccc : visite surprise de booky à la fin de la réu sensi
|
||||
* cccccccccc : veste légère pour sortir :)
|
||||
* cccc_cccccc : réunion sensibilisation en visio
|
||||
|
||||
================================================================================
|
||||
6/ Points de vigilance de la semaine
|
||||
================================================================================
|
||||
|
||||
* Pppppp : la covid nous prive de notre DG
|
||||
* aaaa : Trop
|
||||
* cccc_cccccc : garder le rythme et continuer à faire attention
|
||||
* cccccccccc : l'avalanche de courriels qu'on peut retrouver dans sa bal en
|
||||
rentrant de congé :)
|
||||
|
||||
================================================================================
|
||||
7/ Points forts de la réunion
|
||||
================================================================================
|
||||
|
||||
* aaaa : On est là avec Pppppp
|
||||
* cccc_cccccc : Polux avec nous \O/
|
||||
* cccccccccc : elle a lieu, en petit comité, mais elle a lieu :)
|
||||
* cccc_cccccc : continuité assurée
|
||||
* cccccccccc : plein d'actions
|
||||
|
||||
================================================================================
|
||||
8/ Points de vigilance de la réunion
|
||||
================================================================================
|
||||
|
||||
* cccc_cccccc : Pensée pour les covidés
|
||||
* cccccccccc : +1
|
||||
* cccccccccc : abus de postage de notes de la part de l'animatrice
|
||||
* aaaa : Connexion internet pourrie
|
||||
|
||||
Log IRC brut
|
||||
|
||||
* Hebdobot : % Début de la réunion hebdomadaire
|
||||
* Hebdobot : % rappel : toute ligne commençant par % sera considérée comme un
|
||||
commentaire et non prise en compte dans la synthèse
|
||||
* Hebdobot : % pour connaître le point courant, taper !courant
|
||||
* cccccccccc : # 1/ Actions passées ou en cours
|
||||
* Hebdobot : Sujet individuel : 1/ Actions passées ou en cours
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* Pppppp : ca: suivi divres
|
||||
* cccc_cccccc : CA : courant
|
||||
* cccc_cccccc : Gdt:adminsys : supervision SI
|
||||
* cccccccccc : dépilage courriels suite au congé
|
||||
* Pppppp : tresorerie: suivi divers
|
||||
* cccc_cccccc : Gdt:adminsys : tâches sprint
|
||||
* cccc_cccccc : Gdt:adminsys : réunion de sprint mensuel adminsys
|
||||
* cccccccccc : ca@ : suivi divers
|
||||
* cccc_cccccc : Gdt:adminsys : Mettre à jour Gitea/forge.chapril.org en 1.13.6
|
||||
(#5290)
|
||||
* cccc_cccccc : Gdt:chapril : supervision SI
|
||||
* cccc_cccccc : Gdt:chapril : upgrades
|
||||
* cccc_cccccc : Gdt:chapril : reboot SI
|
||||
* cccccccccc : participation à point d'équipe/dossiers
|
||||
* cccc_cccccc : Gdt:chapril : suivi CHATONS
|
||||
* Pppppp : adminsys: suivi divers, maj du cluster + redémarrage, nettoyage de
|
||||
icinga
|
||||
* cccc_cccccc : Gdt:chapril : jardinage tickets
|
||||
* cccc_cccccc : Gdt:chapril : réunion CHATONS ChatonsInfos
|
||||
* cccc_cccccc : Gdt:chapril : dev ChaprilInfos
|
||||
* cccc_cccccc : Gdt:chapril : dev gestion logs
|
||||
* cccccccccc : suivi courriels sur secretaire@
|
||||
* cccc_cccccc : Gdt:chapril : permanence du samedi matin
|
||||
* cccc_cccccc : Gdt:chapril : Mettre à jour Gitea/forge.chapril.org en 1.13.6
|
||||
(#5291)
|
||||
* cccc_cccccc : Gdt:chapril : modération pouet.chapril.org
|
||||
* cccccccccc : suivi nouvelles adhésions
|
||||
* cccc_cccccc : Gdt:chapril : réponse demande de stage
|
||||
* cccc_cccccc : Libreàvous! : écoute de l'émission
|
||||
* cccccccccc : suivi relances personnes morales en retard de cotisation
|
||||
* cccc_cccccc : Libreàvous! : participation avec une capsule pour la 100e
|
||||
* Pppppp : siteweb: activation de l'index fulltext pour des mots de 3 lettres
|
||||
* cccc_cccccc : Décryptualité : écoute de l'émission
|
||||
* cccccccccc : relectures diverses
|
||||
* cccccccccc : réu sensibilisation hebdo : orga, annonces, animation
|
||||
* cccccccccc : rdv « tâches importantes » : orga, annonces, présence
|
||||
* cccc_cccccc : Transcription : relecture émission n°94
|
||||
* cccc_cccccc : Virus : suivi, grrrr…
|
||||
* cccc_cccccc : Divers
|
||||
* Pppppp : mails: passage au karsher des domaines en erreur
|
||||
* cccccccccc : intervention à la 100e de Libre à vous !
|
||||
* cccc_cccccc : %fnii
|
||||
* Pppppp : adminsys: réunion de sprint fructueuse
|
||||
* cccccccccc : divers fournisseurs
|
||||
* cccccccccc : divers en vente libre
|
||||
* cccc_cccccc : Sensibilisation : participation réunion Boussole du Libre
|
||||
* Pppppp : adminsys: maj de matomo et piwik
|
||||
* cccc_cccccc : % fini
|
||||
* cccccccccc : divers formulaire de contact
|
||||
* Pppppp : %fini
|
||||
* cccccccccc : divers régie lav !
|
||||
* cccccccccc : test imprimante
|
||||
* cccccccccc : divers pour rediffusion d'une émission mardi 06/04
|
||||
* cccccccccc : suivi tâches admins me concernant
|
||||
* cccccccccc : maj diverses pad d'orga LAV !
|
||||
* cccc_cccccc : !courant
|
||||
* Hebdobot : % Sujet individuel en cours : 1/ Actions passées ou en cours
|
||||
* cccccccccc : ventilation temps par catégories LAV !
|
||||
* cccccccccc : divers membres en bounce
|
||||
* cccccccccc : %fini
|
||||
* cccccccccc : % on va passer à la suite : Actions à venir
|
||||
* cccccccccc : # 2/ Actions à venir
|
||||
* Hebdobot : % cccccccccc cccc_cccccc Pppppp, on va passer à la suite : 2/ Actions
|
||||
à venir
|
||||
* Hebdobot : Sujet individuel : 2/ Actions à venir
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* cccccccccc : divers lef 2021 : remerciements, bilan, maj diverses
|
||||
* cccc_cccccc : CA : courant
|
||||
* cccc_cccccc : Gdt:adminsys : supervision SI
|
||||
* cccc_cccccc : Gdt:adminsys : tâches de sprint
|
||||
* cccc_cccccc : Gdt:chapril : supervision SI
|
||||
* cccc_cccccc : Gdt:chapril : gestion gdt Chapril
|
||||
* cccc_cccccc : Gdt:chapril : préparation réunion animateurs (annonce, pad,
|
||||
stats…)
|
||||
* cccc_cccccc : Gdt:chapril : animation de réunion mensuelle de sprint
|
||||
* cccccccccc : divers refonte graphique libre en fête
|
||||
* cccc_cccccc : Gdt:chapril : tâches post réunion mensuelle Chapril (tickets,
|
||||
pad…)
|
||||
* cccc_cccccc : Gdt:chapril : CHATONS, suivi forum
|
||||
* cccc_cccccc : Gdt:chapril : dev ChatonsInfos
|
||||
* cccccccccc : divers projets sensi
|
||||
* cccc_cccccc : Gdt:chapril : dév ChaprilInfos
|
||||
* Pppppp : rapport d'activité format pdf
|
||||
* cccccccccc : divers lav !
|
||||
* cccc_cccccc : Gdt:chapril : réunion ChatonsInfos
|
||||
* cccccccccc : suite dépilage courriels
|
||||
* cccc_cccccc : Gdt:chapril : point modération Mastodon
|
||||
* cccc_cccccc : Libreàvous! : écoute de l'émission
|
||||
* cccc_cccccc : Décryptualité : écoute de l'émission
|
||||
* cccccccccc : suivi dossiers administratifs divers
|
||||
* cccc_cccccc : Galerie photos : fin traitement photos AGO
|
||||
* cccccccccc : divers en vente libre
|
||||
* cccccccccc : recherche personnes intervenantes pour sujet long∕chronique à
|
||||
venir lav !
|
||||
* aaaa : !courant
|
||||
* Hebdobot : % Sujet individuel en cours : 2/ Actions à venir
|
||||
* cccccccccc : rdv « tâches importantes » : orga, annonces, présence
|
||||
* aaaa : Participation à reunion chatons
|
||||
* cccccccccc : revue hebdomadaire : génération de la synthèse
|
||||
* aaaa : Participation à réunion chapril
|
||||
* cccccccccc : divers en fonction du temps
|
||||
* aaaa : Modération et animation chapril xmpp
|
||||
* aaaa : Mise en place de mon serveur physique \o/
|
||||
* aaaa : %fini
|
||||
* cccccccccc : %cccc_cccccc: fini ?
|
||||
* cccccccccc : %on va passer à la suite : Points de blocage / points en retard
|
||||
* cccccccccc : ## 3/ Points de blocage / points en retard corrigés cette semaine
|
||||
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 3/
|
||||
Points de blocage / points en retard corrigés cette semaine
|
||||
* Hebdobot : Sujet collectif : 3/ Points de blocage / points en retard corrigés
|
||||
cette semaine
|
||||
* Hebdobot : % 1 minute max
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* aaaa : % cccccccccc : en action passées, modération chapril xmpp ;)
|
||||
* Pppppp : %ras
|
||||
* cccc_cccccc : %ras
|
||||
* cccccccccc : %aaaa : ok
|
||||
* aaaa : Écouter LAV 100 🤣😅
|
||||
* cccccccccc : %ras
|
||||
* aaaa : %fini
|
||||
* cccccccccc : % ♪ ♫ ♬ ♭
|
||||
* cccccccccc : %on va passer à la suite : Points de blocage / points en retard
|
||||
existants à traiter
|
||||
* cccccccccc : ## 4/ Points de blocage existants / points en retard à traiter
|
||||
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 4/
|
||||
Points de blocage existants / points en retard à traiter
|
||||
* Hebdobot : Sujet collectif : 4/ Points de blocage existants / points en retard
|
||||
à traiter
|
||||
* Hebdobot : % 1 minute max
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* Pppppp : rapport d'activité version pdf :)
|
||||
* aaaa : %ras
|
||||
* cccc_cccccc : %nspp
|
||||
* cccccccccc : %bravo Pppppp :)
|
||||
* cccccccccc : mise en vente t-shirt
|
||||
* cccccccccc : divers comm' et sensi
|
||||
* cccccccccc : %fini
|
||||
* cccccccccc : % on va passer à la suite : Points Forts et Points de Vigilance de
|
||||
la semaine
|
||||
* cccccccccc : ## 5/ Points forts de la semaine
|
||||
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 5/
|
||||
Points forts de la semaine
|
||||
* Hebdobot : Sujet collectif : 5/ Points forts de la semaine
|
||||
* Hebdobot : % 1 minute max
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* cccc_cccccc : La centième de Libre à vous ! \o/
|
||||
* cccccccccc : lav ! a fêté 100 émissions \o/
|
||||
* cccc_cccccc : Réunion adminsys
|
||||
* aaaa : Je vois le bout du tunnel ovh
|
||||
* cccccccccc : visite surprise de booky à la fin de la réu sensi
|
||||
* cccccccccc : veste légère pour sortir :)
|
||||
* cccc_cccccc : réunion sensibilisation en visio
|
||||
* cccccccccc : % on va passer à la suite : Points de Vigilance de la semaine
|
||||
* cccccccccc : ## 6/ Points de vigilance de la semaine
|
||||
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 6/
|
||||
Points de vigilance de la semaine
|
||||
* Hebdobot : Sujet collectif : 6/ Points de vigilance de la semaine
|
||||
* Hebdobot : % 1 minute max
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* Pppppp : la covid nous prive de notre DG
|
||||
* aaaa : Trop
|
||||
* cccc_cccccc : garder le rythme et continuer à faire attention
|
||||
* cccccccccc : l'avalanche de courriels qu'on peut retrouver dans sa bal en
|
||||
rentrant de congé :)
|
||||
* cccccccccc : % ♪ ♫ ♬ ♭
|
||||
* cccccccccc : % on va passer à la suite : Points Forts et Points de Vigilance de
|
||||
la réunion
|
||||
* cccccccccc : ## 7/ Points forts de la réunion
|
||||
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 7/
|
||||
Points forts de la réunion
|
||||
* Hebdobot : Sujet collectif : 7/ Points forts de la réunion
|
||||
* Hebdobot : % 1 minute max
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* aaaa : On est là avec Pppppp
|
||||
* cccc_cccccc : Polux avec nous \O/
|
||||
* cccccccccc : elle a lieu, en petit comité, mais elle a lieu :)
|
||||
* cccc_cccccc : continuité assurée
|
||||
* cccccccccc : plein d'actions
|
||||
* cccccccccc : % on va passer à la suite : Points de Vigilance de la réunion
|
||||
* cccccccccc : ## 8/ Points de vigilance de la réunion
|
||||
* Hebdobot : % cccccccccc aaaa cccc_cccccc Pppppp, on va passer à la suite : 8/
|
||||
Points de vigilance de la réunion
|
||||
* Hebdobot : Sujet collectif : 8/ Points de vigilance de la réunion
|
||||
* Hebdobot : % 1 minute max
|
||||
* Hebdobot : % si rien à signaler vous pouvez écrire % ras
|
||||
* Hebdobot : % quand vous avez fini vous le dites par % fini
|
||||
* cccc_cccccc : Pensée pour les covidés
|
||||
* cccccccccc : +1
|
||||
* cccc_cccccc : %fnin
|
||||
* cccccccccc : %fini
|
||||
* cccccccccc : % ♪ ♫ ♬ ♭
|
||||
* cccccccccc : abus de postage de notes de la part de l'animatrice
|
||||
* cccccccccc : % ♪ ♫ ♬ ♭
|
||||
* aaaa : Connexion internet pourrie
|
||||
* cccccccccc : % Fin de la revue hebdomadaire, merci à vous
|
||||
* cccccccccc : !fin
|
||||
|
||||
Statistiques
|
||||
|
||||
C'était la 459e revue hebdomadaire de l'April, la 13e de l'année 2021.
|
||||
Horaire de début de la revue : 12h00
|
||||
Horaire de fin de la revue : 12h15
|
||||
Durée de la revue : 16 minutes
|
||||
Nombre de personnes participantes : 4
|
||||
Le dernier record de participation est de 14 personnes le vendredi 14 décembre
|
||||
2012.
|
||||
Statistiques sur la participation à la revue (4 personnes) : position 11 (min.=2,
|
||||
moy.=6,6, max.=14), fréquence 42/459 (9 %)
|
||||
Statistiques sur la durée de la revue (16 min) : position 5 (min.=7 min,
|
||||
moy.=15,7 min, max.=20 min), fréquence 33/161 (21 %)
|
78
test/org/april/hebdobot/privatebin/PrivatebinClientTest.java
Normal file
78
test/org/april/hebdobot/privatebin/PrivatebinClientTest.java
Normal file
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Copyright (C) 2019-2021 Christian Pierre MOMON <cmomon@april.org>
|
||||
*
|
||||
* This file is part of (April) Hebdobot.
|
||||
*
|
||||
* Hebdobot is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Hebdobot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
package org.april.hebdobot.privatebin;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The Class PrivatebinClientTest.
|
||||
*/
|
||||
public class PrivatebinClientTest
|
||||
{
|
||||
/**
|
||||
* Test paste.
|
||||
*
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
@Test
|
||||
public void testPaste00() throws Exception
|
||||
{
|
||||
PrivatebinClient client = new PrivatebinClient(new URL("https://cpaste.org/"));
|
||||
// PrivatebinClient client = new
|
||||
// PrivatebinClient("https://paste.chapril.org/");
|
||||
|
||||
String text = "This is a test.\ntoto";
|
||||
|
||||
client.setExpiration(Expiration.MINUTE_5);
|
||||
String result = client.paste(text);
|
||||
|
||||
System.out.println("result:" + result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test paste 01.
|
||||
*
|
||||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
@Test
|
||||
public void testPaste01() throws Exception
|
||||
{
|
||||
BasicConfigurator.configure();
|
||||
|
||||
PrivatebinClient client = new PrivatebinClient(new URL("https://cpaste.org/"));
|
||||
// PrivatebinClient client = new
|
||||
// PrivatebinClient("https://paste.chapril.org/");
|
||||
|
||||
// String text = FileUtils.readFileToString(new
|
||||
// File("./test/org/april/hebdobot/privatebin/20210305-log-irc-revue-hebdomadaire.txt"));
|
||||
String text = FileUtils.readFileToString(new File("./test/org/april/hebdobot/privatebin/20210402-log-irc-revue-hebdomadaire.txt"));
|
||||
|
||||
client.setExpiration(Expiration.MINUTE_5);
|
||||
String result = client.paste(text);
|
||||
|
||||
System.out.println("result:" + result);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user