first commit

This commit is contained in:
Noor E Ilahi
2026-01-09 12:54:53 +05:30
commit 7ccf44f7da
1070 changed files with 113036 additions and 0 deletions

4
.browserslistrc Normal file
View File

@@ -0,0 +1,4 @@
> 1%
last 2 versions
not op_mob > 0
not dead

80
.dockerignore Normal file
View File

@@ -0,0 +1,80 @@
/node_modules
/public/hot
/public/js
/public/storage
/public/images
/apidoc/*
/public/apidoc
/storage/*.key
/storage/app/backups/*
/vendor
/.idea
/.vagrant
.env
.env.testing
.env.sentry
*.log
*.zip
*.tar
*.gz
*.tgz
*.lock
!composer.lock
*-lock.json
!yarn.lock
*.phar
_ide_helper.php
.phpstorm.meta.php
config/crudgenerator.php
resources/crud-generator/
coverage/
*.sql
.DS_Store
.phpunit.result.cache
.php_cs.cache
/storage/app/uploads/screenshots
modules.local.json
cghooks.lock
/storage/framework/tmp
!/storage/framework/cache/.gitkeep
/storage/framework/cache/*
/storage/app/tmp
/storage/app/reports
Modules/*
!Modules/.gitkeep
bootstrap/cache/*
!bootstrap/cache/.gitkeep
/public/vendor/
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
composer.phar
/public/dist
/resources/frontend/app/etc/modules.local.json
/resources/frontend/app/generated
/resources/template-apidoc
/public/mix-manifest.json
/public/mix-sri.json
/public/fonts
/public/images
/public/vendor
/public/sw.*
/public/workbox*
.git
Dockerfile
erd.svg

575
.editorconfig Normal file
View File

@@ -0,0 +1,575 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
trim_trailing_whitespace = true
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[*.css]
ij_css_align_closing_brace_with_properties = false
ij_css_blank_lines_around_nested_selector = 1
ij_css_blank_lines_between_blocks = 1
ij_css_brace_placement = end_of_line
ij_css_enforce_quotes_on_format = false
ij_css_hex_color_long_format = false
ij_css_hex_color_lower_case = false
ij_css_hex_color_short_format = false
ij_css_hex_color_upper_case = false
ij_css_keep_blank_lines_in_code = 2
ij_css_keep_indents_on_empty_lines = false
ij_css_keep_single_line_blocks = false
ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_css_space_after_colon = true
ij_css_space_before_opening_brace = true
ij_css_use_double_quotes = true
ij_css_value_alignment = do_not_align
[*.sass]
indent_size = 2
ij_sass_align_closing_brace_with_properties = false
ij_sass_blank_lines_around_nested_selector = 1
ij_sass_blank_lines_between_blocks = 1
ij_sass_brace_placement = 0
ij_sass_enforce_quotes_on_format = false
ij_sass_hex_color_long_format = false
ij_sass_hex_color_lower_case = false
ij_sass_hex_color_short_format = false
ij_sass_hex_color_upper_case = false
ij_sass_keep_blank_lines_in_code = 2
ij_sass_keep_indents_on_empty_lines = false
ij_sass_keep_single_line_blocks = false
ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_sass_space_after_colon = true
ij_sass_space_before_opening_brace = true
ij_sass_use_double_quotes = true
ij_sass_value_alignment = 0
[*.scss]
indent_size = 2
ij_scss_align_closing_brace_with_properties = false
ij_scss_blank_lines_around_nested_selector = 1
ij_scss_blank_lines_between_blocks = 1
ij_scss_brace_placement = 0
ij_scss_enforce_quotes_on_format = false
ij_scss_hex_color_long_format = false
ij_scss_hex_color_lower_case = false
ij_scss_hex_color_short_format = false
ij_scss_hex_color_upper_case = false
ij_scss_keep_blank_lines_in_code = 2
ij_scss_keep_indents_on_empty_lines = false
ij_scss_keep_single_line_blocks = false
ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
ij_scss_space_after_colon = true
ij_scss_space_before_opening_brace = true
ij_scss_use_double_quotes = true
ij_scss_value_alignment = 0
[*.vue]
ij_continuation_indent_size = 4
ij_visual_guides = 120
ij_vue_indent_children_of_top_level = template,script,style
ij_vue_interpolation_new_line_after_start_delimiter = false
ij_vue_interpolation_new_line_before_end_delimiter = false
ij_vue_interpolation_wrap = normal
ij_vue_keep_indents_on_empty_lines = false
ij_vue_spaces_within_interpolation_expressions = true
[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true
[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,phpunit.xml.dist}]
ij_xml_align_attributes = true
ij_xml_align_text = false
ij_xml_attribute_wrap = normal
ij_xml_block_comment_at_first_column = true
ij_xml_keep_blank_lines = 2
ij_xml_keep_indents_on_empty_lines = false
ij_xml_keep_line_breaks = true
ij_xml_keep_line_breaks_in_text = true
ij_xml_keep_whitespaces = false
ij_xml_keep_whitespaces_around_cdata = preserve
ij_xml_keep_whitespaces_inside_cdata = false
ij_xml_line_comment_at_first_column = true
ij_xml_space_after_tag_name = false
ij_xml_space_around_equals_in_attribute = false
ij_xml_space_inside_empty_tag = false
ij_xml_text_wrap = normal
[{*.bash,*.sh,*.zsh}]
indent_size = 2
tab_width = 2
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
ij_shell_use_unix_line_separator = true
[{*.cjs,*.js}]
ij_continuation_indent_size = 4
ij_javascript_align_imports = false
ij_javascript_align_multiline_array_initializer_expression = false
ij_javascript_align_multiline_binary_operation = false
ij_javascript_align_multiline_chained_methods = false
ij_javascript_align_multiline_extends_list = false
ij_javascript_align_multiline_for = true
ij_javascript_align_multiline_parameters = true
ij_javascript_align_multiline_parameters_in_calls = false
ij_javascript_align_multiline_ternary_operation = false
ij_javascript_align_object_properties = 0
ij_javascript_align_union_types = false
ij_javascript_align_var_statements = 0
ij_javascript_array_initializer_new_line_after_left_brace = false
ij_javascript_array_initializer_right_brace_on_new_line = false
ij_javascript_array_initializer_wrap = off
ij_javascript_assignment_wrap = off
ij_javascript_binary_operation_sign_on_next_line = false
ij_javascript_binary_operation_wrap = off
ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
ij_javascript_blank_lines_after_imports = 1
ij_javascript_blank_lines_around_class = 1
ij_javascript_blank_lines_around_field = 0
ij_javascript_blank_lines_around_function = 1
ij_javascript_blank_lines_around_method = 1
ij_javascript_block_brace_style = end_of_line
ij_javascript_call_parameters_new_line_after_left_paren = false
ij_javascript_call_parameters_right_paren_on_new_line = false
ij_javascript_call_parameters_wrap = off
ij_javascript_catch_on_new_line = false
ij_javascript_chained_call_dot_on_new_line = true
ij_javascript_class_brace_style = end_of_line
ij_javascript_comma_on_new_line = false
ij_javascript_do_while_brace_force = never
ij_javascript_else_on_new_line = false
ij_javascript_enforce_trailing_comma = whenmultiline
ij_javascript_extends_keyword_wrap = off
ij_javascript_extends_list_wrap = off
ij_javascript_field_prefix = _
ij_javascript_file_name_style = relaxed
ij_javascript_finally_on_new_line = false
ij_javascript_for_brace_force = never
ij_javascript_for_statement_new_line_after_left_paren = false
ij_javascript_for_statement_right_paren_on_new_line = false
ij_javascript_for_statement_wrap = off
ij_javascript_force_quote_style = false
ij_javascript_force_semicolon_style = false
ij_javascript_function_expression_brace_style = end_of_line
ij_javascript_if_brace_force = never
ij_javascript_import_merge_members = global
ij_javascript_import_prefer_absolute_path = global
ij_javascript_import_sort_members = true
ij_javascript_import_sort_module_name = false
ij_javascript_import_use_node_resolution = true
ij_javascript_imports_wrap = on_every_item
ij_javascript_indent_case_from_switch = true
ij_javascript_indent_chained_calls = true
ij_javascript_indent_package_children = 0
ij_javascript_jsx_attribute_value = braces
ij_javascript_keep_blank_lines_in_code = 2
ij_javascript_keep_first_column_comment = true
ij_javascript_keep_indents_on_empty_lines = false
ij_javascript_keep_line_breaks = true
ij_javascript_keep_simple_blocks_in_one_line = false
ij_javascript_keep_simple_methods_in_one_line = false
ij_javascript_line_comment_add_space = true
ij_javascript_line_comment_at_first_column = false
ij_javascript_method_brace_style = end_of_line
ij_javascript_method_call_chain_wrap = off
ij_javascript_method_parameters_new_line_after_left_paren = false
ij_javascript_method_parameters_right_paren_on_new_line = false
ij_javascript_method_parameters_wrap = off
ij_javascript_object_literal_wrap = on_every_item
ij_javascript_parentheses_expression_new_line_after_left_paren = false
ij_javascript_parentheses_expression_right_paren_on_new_line = false
ij_javascript_place_assignment_sign_on_next_line = false
ij_javascript_prefer_as_type_cast = false
ij_javascript_prefer_explicit_types_function_expression_returns = false
ij_javascript_prefer_explicit_types_function_returns = false
ij_javascript_prefer_explicit_types_vars_fields = false
ij_javascript_prefer_parameters_wrap = false
ij_javascript_reformat_c_style_comments = true
ij_javascript_space_after_colon = true
ij_javascript_space_after_comma = true
ij_javascript_space_after_dots_in_rest_parameter = false
ij_javascript_space_after_generator_mult = true
ij_javascript_space_after_property_colon = true
ij_javascript_space_after_quest = true
ij_javascript_space_after_type_colon = true
ij_javascript_space_after_unary_not = false
ij_javascript_space_before_async_arrow_lparen = true
ij_javascript_space_before_catch_keyword = true
ij_javascript_space_before_catch_left_brace = true
ij_javascript_space_before_catch_parentheses = true
ij_javascript_space_before_class_lbrace = true
ij_javascript_space_before_class_left_brace = true
ij_javascript_space_before_colon = true
ij_javascript_space_before_comma = false
ij_javascript_space_before_do_left_brace = true
ij_javascript_space_before_else_keyword = true
ij_javascript_space_before_else_left_brace = true
ij_javascript_space_before_finally_keyword = true
ij_javascript_space_before_finally_left_brace = true
ij_javascript_space_before_for_left_brace = true
ij_javascript_space_before_for_parentheses = true
ij_javascript_space_before_for_semicolon = false
ij_javascript_space_before_function_left_parenth = false
ij_javascript_space_before_generator_mult = false
ij_javascript_space_before_if_left_brace = true
ij_javascript_space_before_if_parentheses = true
ij_javascript_space_before_method_call_parentheses = false
ij_javascript_space_before_method_left_brace = true
ij_javascript_space_before_method_parentheses = false
ij_javascript_space_before_property_colon = false
ij_javascript_space_before_quest = true
ij_javascript_space_before_switch_left_brace = true
ij_javascript_space_before_switch_parentheses = true
ij_javascript_space_before_try_left_brace = true
ij_javascript_space_before_type_colon = false
ij_javascript_space_before_unary_not = false
ij_javascript_space_before_while_keyword = true
ij_javascript_space_before_while_left_brace = true
ij_javascript_space_before_while_parentheses = true
ij_javascript_spaces_around_additive_operators = true
ij_javascript_spaces_around_arrow_function_operator = true
ij_javascript_spaces_around_assignment_operators = true
ij_javascript_spaces_around_bitwise_operators = true
ij_javascript_spaces_around_equality_operators = true
ij_javascript_spaces_around_logical_operators = true
ij_javascript_spaces_around_multiplicative_operators = true
ij_javascript_spaces_around_relational_operators = true
ij_javascript_spaces_around_shift_operators = true
ij_javascript_spaces_around_unary_operator = false
ij_javascript_spaces_within_array_initializer_brackets = false
ij_javascript_spaces_within_brackets = false
ij_javascript_spaces_within_catch_parentheses = false
ij_javascript_spaces_within_for_parentheses = false
ij_javascript_spaces_within_if_parentheses = false
ij_javascript_spaces_within_imports = true
ij_javascript_spaces_within_interpolation_expressions = false
ij_javascript_spaces_within_method_call_parentheses = false
ij_javascript_spaces_within_method_parentheses = false
ij_javascript_spaces_within_object_literal_braces = true
ij_javascript_spaces_within_object_type_braces = true
ij_javascript_spaces_within_parentheses = false
ij_javascript_spaces_within_switch_parentheses = false
ij_javascript_spaces_within_type_assertion = false
ij_javascript_spaces_within_union_types = true
ij_javascript_spaces_within_while_parentheses = false
ij_javascript_special_else_if_treatment = true
ij_javascript_ternary_operation_signs_on_next_line = false
ij_javascript_ternary_operation_wrap = off
ij_javascript_union_types_wrap = on_every_item
ij_javascript_use_chained_calls_group_indents = true
ij_javascript_use_double_quotes = true
ij_javascript_use_path_mapping = always
ij_javascript_use_public_modifier = false
ij_javascript_use_semicolon_after_statement = true
ij_javascript_var_declaration_wrap = normal
ij_javascript_while_brace_force = never
ij_javascript_while_on_new_line = false
ij_javascript_wrap_comments = true
[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}]
ij_continuation_indent_size = 4
ij_php_align_assignments = false
ij_php_align_class_constants = false
ij_php_align_group_field_declarations = false
ij_php_align_inline_comments = false
ij_php_align_key_value_pairs = false
ij_php_align_match_arm_bodies = false
ij_php_align_multiline_array_initializer_expression = false
ij_php_align_multiline_binary_operation = false
ij_php_align_multiline_chained_methods = false
ij_php_align_multiline_extends_list = false
ij_php_align_multiline_for = true
ij_php_align_multiline_parameters = true
ij_php_align_multiline_parameters_in_calls = false
ij_php_align_multiline_ternary_operation = false
ij_php_align_named_arguments = false
ij_php_align_phpdoc_comments = false
ij_php_align_phpdoc_param_names = false
ij_php_anonymous_brace_style = end_of_line
ij_php_api_weight = 28
ij_php_array_initializer_new_line_after_left_brace = false
ij_php_array_initializer_right_brace_on_new_line = false
ij_php_array_initializer_wrap = off
ij_php_assignment_wrap = off
ij_php_attributes_wrap = off
ij_php_author_weight = 28
ij_php_binary_operation_sign_on_next_line = false
ij_php_binary_operation_wrap = off
ij_php_blank_lines_after_class_header = 0
ij_php_blank_lines_after_function = 1
ij_php_blank_lines_after_imports = 1
ij_php_blank_lines_after_opening_tag = 0
ij_php_blank_lines_after_package = 0
ij_php_blank_lines_around_class = 1
ij_php_blank_lines_around_constants = 0
ij_php_blank_lines_around_field = 0
ij_php_blank_lines_around_method = 1
ij_php_blank_lines_before_class_end = 0
ij_php_blank_lines_before_imports = 1
ij_php_blank_lines_before_method_body = 0
ij_php_blank_lines_before_package = 1
ij_php_blank_lines_before_return_statement = 0
ij_php_blank_lines_between_imports = 0
ij_php_block_brace_style = end_of_line
ij_php_call_parameters_new_line_after_left_paren = false
ij_php_call_parameters_right_paren_on_new_line = false
ij_php_call_parameters_wrap = off
ij_php_catch_on_new_line = false
ij_php_category_weight = 28
ij_php_class_brace_style = next_line
ij_php_comma_after_last_array_element = false
ij_php_concat_spaces = true
ij_php_copyright_weight = 28
ij_php_deprecated_weight = 28
ij_php_do_while_brace_force = never
ij_php_else_if_style = as_is
ij_php_else_on_new_line = false
ij_php_example_weight = 28
ij_php_extends_keyword_wrap = off
ij_php_extends_list_wrap = off
ij_php_fields_default_visibility = private
ij_php_filesource_weight = 28
ij_php_finally_on_new_line = false
ij_php_for_brace_force = never
ij_php_for_statement_new_line_after_left_paren = false
ij_php_for_statement_right_paren_on_new_line = false
ij_php_for_statement_wrap = off
ij_php_force_short_declaration_array_style = false
ij_php_getters_setters_naming_style = camel_case
ij_php_getters_setters_order_style = getters_first
ij_php_global_weight = 28
ij_php_group_use_wrap = on_every_item
ij_php_if_brace_force = never
ij_php_if_lparen_on_next_line = false
ij_php_if_rparen_on_next_line = false
ij_php_ignore_weight = 28
ij_php_import_sorting = alphabetic
ij_php_indent_break_from_case = true
ij_php_indent_case_from_switch = true
ij_php_indent_code_in_php_tags = false
ij_php_internal_weight = 28
ij_php_keep_blank_lines_after_lbrace = 2
ij_php_keep_blank_lines_before_right_brace = 2
ij_php_keep_blank_lines_in_code = 2
ij_php_keep_blank_lines_in_declarations = 2
ij_php_keep_control_statement_in_one_line = true
ij_php_keep_first_column_comment = true
ij_php_keep_indents_on_empty_lines = false
ij_php_keep_line_breaks = true
ij_php_keep_rparen_and_lbrace_on_one_line = false
ij_php_keep_simple_classes_in_one_line = false
ij_php_keep_simple_methods_in_one_line = false
ij_php_lambda_brace_style = end_of_line
ij_php_license_weight = 28
ij_php_line_comment_add_space = false
ij_php_line_comment_at_first_column = true
ij_php_link_weight = 28
ij_php_lower_case_boolean_const = false
ij_php_lower_case_keywords = true
ij_php_lower_case_null_const = false
ij_php_method_brace_style = next_line
ij_php_method_call_chain_wrap = off
ij_php_method_parameters_new_line_after_left_paren = false
ij_php_method_parameters_right_paren_on_new_line = false
ij_php_method_parameters_wrap = off
ij_php_method_weight = 28
ij_php_modifier_list_wrap = false
ij_php_multiline_chained_calls_semicolon_on_new_line = false
ij_php_namespace_brace_style = 1
ij_php_new_line_after_php_opening_tag = false
ij_php_null_type_position = in_the_end
ij_php_package_weight = 28
ij_php_param_weight = 0
ij_php_parameters_attributes_wrap = off
ij_php_parentheses_expression_new_line_after_left_paren = false
ij_php_parentheses_expression_right_paren_on_new_line = false
ij_php_phpdoc_blank_line_before_tags = false
ij_php_phpdoc_blank_lines_around_parameters = false
ij_php_phpdoc_keep_blank_lines = true
ij_php_phpdoc_param_spaces_between_name_and_description = 1
ij_php_phpdoc_param_spaces_between_tag_and_type = 1
ij_php_phpdoc_param_spaces_between_type_and_name = 1
ij_php_phpdoc_use_fqcn = false
ij_php_phpdoc_wrap_long_lines = false
ij_php_place_assignment_sign_on_next_line = false
ij_php_place_parens_for_constructor = 0
ij_php_property_read_weight = 28
ij_php_property_weight = 28
ij_php_property_write_weight = 28
ij_php_return_type_on_new_line = false
ij_php_return_weight = 1
ij_php_see_weight = 28
ij_php_since_weight = 28
ij_php_sort_phpdoc_elements = true
ij_php_space_after_colon = true
ij_php_space_after_colon_in_enum_backed_type = true
ij_php_space_after_colon_in_named_argument = true
ij_php_space_after_colon_in_return_type = true
ij_php_space_after_comma = true
ij_php_space_after_for_semicolon = true
ij_php_space_after_quest = true
ij_php_space_after_type_cast = false
ij_php_space_after_unary_not = false
ij_php_space_before_array_initializer_left_brace = false
ij_php_space_before_catch_keyword = true
ij_php_space_before_catch_left_brace = true
ij_php_space_before_catch_parentheses = true
ij_php_space_before_class_left_brace = true
ij_php_space_before_closure_left_parenthesis = true
ij_php_space_before_colon = true
ij_php_space_before_colon_in_enum_backed_type = false
ij_php_space_before_colon_in_named_argument = false
ij_php_space_before_colon_in_return_type = false
ij_php_space_before_comma = false
ij_php_space_before_do_left_brace = true
ij_php_space_before_else_keyword = true
ij_php_space_before_else_left_brace = true
ij_php_space_before_finally_keyword = true
ij_php_space_before_finally_left_brace = true
ij_php_space_before_for_left_brace = true
ij_php_space_before_for_parentheses = true
ij_php_space_before_for_semicolon = false
ij_php_space_before_if_left_brace = true
ij_php_space_before_if_parentheses = true
ij_php_space_before_method_call_parentheses = false
ij_php_space_before_method_left_brace = true
ij_php_space_before_method_parentheses = false
ij_php_space_before_quest = true
ij_php_space_before_short_closure_left_parenthesis = false
ij_php_space_before_switch_left_brace = true
ij_php_space_before_switch_parentheses = true
ij_php_space_before_try_left_brace = true
ij_php_space_before_unary_not = false
ij_php_space_before_while_keyword = true
ij_php_space_before_while_left_brace = true
ij_php_space_before_while_parentheses = true
ij_php_space_between_ternary_quest_and_colon = false
ij_php_spaces_around_additive_operators = true
ij_php_spaces_around_arrow = false
ij_php_spaces_around_assignment_in_declare = false
ij_php_spaces_around_assignment_operators = true
ij_php_spaces_around_bitwise_operators = true
ij_php_spaces_around_equality_operators = true
ij_php_spaces_around_logical_operators = true
ij_php_spaces_around_multiplicative_operators = true
ij_php_spaces_around_null_coalesce_operator = true
ij_php_spaces_around_pipe_in_union_type = false
ij_php_spaces_around_relational_operators = true
ij_php_spaces_around_shift_operators = true
ij_php_spaces_around_unary_operator = false
ij_php_spaces_around_var_within_brackets = false
ij_php_spaces_within_array_initializer_braces = false
ij_php_spaces_within_brackets = false
ij_php_spaces_within_catch_parentheses = false
ij_php_spaces_within_for_parentheses = false
ij_php_spaces_within_if_parentheses = false
ij_php_spaces_within_method_call_parentheses = false
ij_php_spaces_within_method_parentheses = false
ij_php_spaces_within_parentheses = false
ij_php_spaces_within_short_echo_tags = true
ij_php_spaces_within_switch_parentheses = false
ij_php_spaces_within_while_parentheses = false
ij_php_special_else_if_treatment = false
ij_php_subpackage_weight = 28
ij_php_ternary_operation_signs_on_next_line = false
ij_php_ternary_operation_wrap = off
ij_php_throws_weight = 2
ij_php_todo_weight = 28
ij_php_unknown_tag_weight = 28
ij_php_upper_case_boolean_const = false
ij_php_upper_case_null_const = false
ij_php_uses_weight = 28
ij_php_var_weight = 28
ij_php_variable_naming_style = mixed
ij_php_version_weight = 28
ij_php_while_brace_force = never
ij_php_while_on_new_line = false
[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,composer.lock,jest.config}]
indent_size = 2
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = true
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false
[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}]
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
ij_html_align_attributes = true
ij_html_align_text = false
ij_html_attribute_wrap = normal
ij_html_block_comment_at_first_column = true
ij_html_do_not_align_children_of_min_lines = 0
ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot
ij_html_enforce_quotes = false
ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
ij_html_keep_blank_lines = 2
ij_html_keep_indents_on_empty_lines = false
ij_html_keep_line_breaks = true
ij_html_keep_line_breaks_in_text = true
ij_html_keep_whitespaces = false
ij_html_keep_whitespaces_inside = span,pre,textarea
ij_html_line_comment_at_first_column = true
ij_html_new_line_after_last_attribute = never
ij_html_new_line_before_first_attribute = never
ij_html_quote_style = double
ij_html_remove_new_line_before_tags = br
ij_html_space_after_tag_name = false
ij_html_space_around_equality_in_attribute = false
ij_html_space_inside_empty_tag = true
ij_html_text_wrap = normal
[{*.markdown,*.md}]
ij_markdown_force_one_space_after_blockquote_symbol = true
ij_markdown_force_one_space_after_header_symbol = true
ij_markdown_force_one_space_after_list_bullet = true
ij_markdown_force_one_space_between_words = true
ij_markdown_keep_indents_on_empty_lines = false
ij_markdown_max_lines_around_block_elements = 1
ij_markdown_max_lines_around_header = 1
ij_markdown_max_lines_between_paragraphs = 1
ij_markdown_min_lines_around_block_elements = 1
ij_markdown_min_lines_around_header = 1
ij_markdown_min_lines_between_paragraphs = 1
max_line_length = off
trim_trailing_whitespace = false
[{*.yaml,*.yml}]
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

16
.env.testing.example Normal file
View File

@@ -0,0 +1,16 @@
APP_ENV=testing
APP_KEY=
APP_DEBUG=true
APP_URL=
DB_DATABASE=cattr_tests
DB_USERNAME=root
DB_PASSWORD=secret
MAIL_DRIVER=log
REQUEST_SIGNATURE=
RECAPTCHA_ENABLED=false
ALLOWED_ORIGINS=*

2
.eslintignore Normal file
View File

@@ -0,0 +1,2 @@
node_modules
resources/frontend/generated

40
.eslintrc.js Normal file
View File

@@ -0,0 +1,40 @@
module.exports = {
root: true,
env: {
node: true,
browser: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@babel/eslint-parser',
requireConfigFile: false,
},
extends: ['plugin:vue/essential', 'eslint:recommended', 'plugin:prettier/recommended'],
plugins: ['prettier'],
rules: {
'linebreak-style': ['error', 'unix'],
'prettier/prettier': 'error',
'no-console': 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': 'off',
'vue/multi-word-component-names': 'off',
'vue/attributes-order': [
'error',
{
order: [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT',
],
},
],
},
};

9
.gitattributes vendored Normal file
View File

@@ -0,0 +1,9 @@
*.png filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.eot filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.woff filter=lfs diff=lfs merge=lfs -text
*.woff2 filter=lfs diff=lfs merge=lfs -text
*.ico filter=lfs diff=lfs merge=lfs -text
*.min.js filter=lfs diff=lfs merge=lfs -text

80
.gitignore vendored Normal file
View File

@@ -0,0 +1,80 @@
/node_modules
/public/hot
/public/js
/public/storage
/public/images
/apidoc/*
/public/apidoc
/storage/*.key
/storage/app/backups/*
/vendor
/.idea
/.vagrant
.env
.env.testing
.env.sentry
*.log
*.zip
*.tar
*.gz
*.tgz
*.lock
!composer.lock
*-lock.json
!yarn.lock
*.phar
_ide_helper.php
.phpstorm.meta.php
config/crudgenerator.php
resources/crud-generator/
coverage/
*.sql
.DS_Store
.phpunit.result.cache
.php_cs.cache
/storage/app/uploads/screenshots
modules.local.json
cghooks.lock
/storage/framework/tmp
!/storage/framework/cache/.gitkeep
/storage/framework/cache/*
/storage/app/tmp
/storage/app/reports
/storage/app/attachments
Modules/*
!Modules/.gitkeep
bootstrap/cache/*
!bootstrap/cache/.gitkeep
/public/vendor/
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.pnp.*
composer.phar
/public/dist
/resources/frontend/etc/modules.local.json
/resources/frontend/generated
/public/mix-manifest.json
/public/mix-sri.json
/public/fonts
/public/images
/public/vendor
/public/sw.*
/public/workbox*
erd.svg
apidoc

108
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,108 @@
variables:
DOCKER_TLS_CERTDIR: "/certs"
stages:
- build
- pages
- test
- release
- deploy
sast:
stage: test
sentry_upload:
image: getsentry/sentry-cli:latest
stage: release
rules:
- if: $CI_COMMIT_TAG && $SENTRY_ORG
script:
- sentry-cli releases new --finalize "$CI_COMMIT_REF_NAME"
- sentry-cli releases set-commits --auto "$CI_COMMIT_REF_NAME"
build:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
stage: build
before_script:
- export APP_TAG=$(echo "$CI_COMMIT_REF_NAME" | sed 's/^v//g')
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script:
- >-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
--build-arg "SENTRY_DSN=$SENTRY_DSN"
--build-arg "APP_VERSION=$APP_TAG"
--ignore-var-run
tag_latest:
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
stage: release
only:
- tags
before_script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- crane tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME latest
pages :
stage: pages
when: manual
image: node:18-alpine
only:
- tags
before_script:
- apk add yarn
- yarn
- rm -rf public
- mkdir public
script:
- node_modules/apidoc/bin/apidoc -i app -t ./resources/template-apidoc -o
public
artifacts:
paths:
# The folder that contains the files to be exposed at the Page URL
- public
# rules:
# This ensures that only pushes to the default branch will trigger
# a pages deploy
# - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
deploy_prod:
stage: deploy
image: alpine
environment:
name: production
url: https://time.amazingcat.net
only:
- tags
when: manual
before_script:
- 'which ssh-agent || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$CI_KEY" | base64 -d | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- ssh $CI_USER@$CI_HOST 'cd /opt/services/cattr/tracker && docker compose pull'
- ssh $CI_USER@$CI_HOST 'cd /opt/services/cattr/tracker && docker compose up -d'
container_scanning:
variables:
CS_IMAGE: '$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME'
include:
- template: Security/SAST.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
- template: Security/License-Scanning.gitlab-ci.yml
- template: Security/Container-Scanning.gitlab-ci.yml
- template: Code-Quality.gitlab-ci.yml

19
.helm/Chart.yaml Normal file
View File

@@ -0,0 +1,19 @@
name: cattr-server
description: A Helm Chart for Cattr Server
version: 0.0.1
apiVersion: v2
keywords:
- cattr
- management
- time-tracker
- efficiency
- laravel
- vue
sources:
- https://git.amazingcat.net/cattr/core/app
home: https://cattr.app/
dependencies:
- name: mysql
version: 11.1.9
repository: https://charts.bitnami.com/bitnami
condition: mysql.asChart,global.mysql.asChart

View File

@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
data:
LOG_CHANNEL: "stderr"
LOG_LEVEL: "debug"
{{- range $key, $val := .Values.app.env }}
"{{ $key }}": "{{ $val }}"
{{- end }}

View File

@@ -0,0 +1,99 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-web
spec:
replicas: {{ .Values.app.replicas | default 2 }}
revisionHistoryLimit: {{ .Values.app.revisionHistoryLimit | default 2 }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}-web
template:
metadata:
labels:
app.kubernetes.io/name: {{ .Release.Name }}-web
spec:
containers:
- name: app
imagePullPolicy: {{.Values.app.image.pullPolicy}}
image: {{- printf " %s/%s:%s" .Values.app.image.registry .Values.app.image.repository .Values.app.image.tag }}
ports:
- containerPort: 80
name: http-web-svc
protocol: TCP
env:
- name: APP_ENV
value: {{ .Values.app.environment | default "dev" | quote }}
- name: S6_CMD_WAIT_FOR_SERVICES_MAXTIME
value: "180000"
volumeMounts:
- mountPath: /app/storage/app/screenshots
name: app-screenshots
- mountPath: /app/storage/app/attachments
name: app-attachments
- mountPath: /app/bootstrap/cache
name: bootstrap-cache
- mountPath: /tmp
name: app-tmp
- mountPath: /run
name: app-run
- mountPath: /var/lib/nginx/tmp
name: nginx-tmp
envFrom:
- configMapRef:
name: {{ .Release.Name }}-configmap
- secretRef:
name: {{ .Release.Name }}-secret
startupProbe:
exec:
command: ["php82", "artisan", "octane:status"]
failureThreshold: 60
periodSeconds: 5
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: http-web-svc
failureThreshold: 3
periodSeconds: 5
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: http-web-svc
failureThreshold: 3
successThreshold: 1
periodSeconds: 15
volumes:
- name: bootstrap-cache
emptyDir: {}
- name: app-tmp
emptyDir: {}
- name: storage-framework
emptyDir: {}
- name: app-run
emptyDir: {}
- name: nginx-tmp
emptyDir: {}
- name: nginx-run
emptyDir: {}
- name: app-screenshots
{{- if eq .Values.app.persistence.screenshots.enabled "true" }}
persistentVolumeClaim:
{{- if not (empty .Values.app.persistence.screenshots.existingClaim) }}
claimName: {{ .Values.app.persistence.screenshots.existingClaim }}
{{- else }}
claimName: {{ .Release.Name }}-pvc-screenshots
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: app-attachments
{{- if eq .Values.app.persistence.attachments.enabled "true" }}
persistentVolumeClaim:
{{- if not (empty .Values.app.persistence.attachments.existingClaim) }}
claimName: {{ .Values.app.persistence.attachments.existingClaim }}
{{- else }}
claimName: {{ .Release.Name }}-pvc-attachments
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}

View File

@@ -0,0 +1,20 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Release.Name }}-ingress
spec:
ingressClassName: {{.Values.ingress.class}}
rules:
- host:
- {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .Release.Name }}
port:
number: {{ .Values.app.service.port }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- if empty .Values.app.persistence.attachments.existingClaim }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: cattr-app
name: {{ .Release.Name }}-pvc-attachments
spec:
storageClassName: {{ .Values.app.persistence.attachments.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.app.persistence.attachments.size }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- if empty .Values.app.persistence.screenshots.existingClaim }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: cattr-app
name: {{ .Release.Name }}-pvc-screenshots
spec:
storageClassName: {{ .Values.app.persistence.screenshots.storageClass }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.app.persistence.screenshots.size }}
{{- end }}

View File

@@ -0,0 +1,15 @@
{{- $secret := (lookup "v1" "Secret" .Release.Namespace (printf "%s-secret" .Release.Name)) }}
{{- $appKeyValue := (printf "%s%s" "base64:" (encryptAES (randAlpha 32) "plaintext")) }}
{{- if $secret }}
{{- $appKeyValue = index $secret.data "APP_KEY" }}
{{- end -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-secret
type: Opaque
stringData:
DB_USERNAME: {{ .Values.mysql.auth.username | quote }}
DB_PASSWORD: {{ .Values.mysql.auth.password | quote }}
APP_KEY: {{ .Values.app.key | default $appKeyValue | quote }}

24
.helm/templates/svc.yaml Normal file
View File

@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}
labels:
app.kubernetes.io/component: {{ .Release.Name }}-web
spec:
type: {{ .Values.app.service.type }}
{{- if and .Values.app.service.clusterIP (eq .Values.app.service.type "ClusterIP") }}
clusterIP: {{ .Values.app.service.clusterIP }}
{{- end }}
{{- if and (eq .Values.app.service.type "LoadBalancer") (not (empty .Values.app.service.loadBalancerIP)) }}
loadBalancerIP: {{ .Values.app.service.loadBalancerIP }}
{{- end }}
ports:
- name: http-web-svc
port: {{ .Values.app.service.port }}
protocol: TCP
targetPort: http-web-svc
{{- if (and (or (eq .Values.app.service.type "NodePort") (eq .Values.app.service.type "LoadBalancer")) .Values.app.service.nodePort) }}
nodePort: {{ .Values.app.service.nodePort }}
{{- end }}
selector:
app.kubernetes.io/name: {{ .Release.Name }}-web

53
.helm/values.yaml Normal file
View File

@@ -0,0 +1,53 @@
mysql:
asChart: true
auth:
database: "cattr"
username: "cattr"
password: "password"
app:
key: ""
replicas: 1
revisionHistoryLimit: 2
environment: "production"
persistence:
screenshots:
enabled: "true"
existingClaim: ""
storageClass: ""
accessModes:
- ReadWriteMany
size: 10Gi
attachments:
enabled: "true"
existingClaim: ""
storageClass: ""
accessModes:
- ReadWriteMany
size: 10Gi
env:
DB_HOST: "db"
DB_DATABASE: "cattr"
DB_USERNAME: "cattr"
DB_PASSWORD: "password"
APP_ADMIN_EMAIL: "admin@cattr.app"
APP_ADMIN_PASSWORD: "password"
APP_ADMIN_NAME: "Admin"
service:
type: ClusterIP
clusterIP: ""
loadBalancerIP: ""
externalTrafficPolicy: Cluster
nodePort: 80
port: 80
image:
registry: registry.git.amazingcat.net
repository: cattr/core/app
tag: v4.0.0-RC49
pullPolicy: IfNotPresent
ingress:
enabled: false
host: ""
class: ""

5
.husky/post-checkout Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.\n"; exit 2; }
git lfs post-checkout "$@"

5
.husky/post-commit Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-commit.\n"; exit 2; }
git lfs post-commit "$@"

5
.husky/post-merge Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-merge.\n"; exit 2; }
git lfs post-merge "$@"

3
.husky/pre-commit Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
yarn lint

5
.husky/pre-push Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"
command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.\n"; exit 2; }
git lfs pre-push "$@"

1
.nvmrc Normal file
View File

@@ -0,0 +1 @@
18

1
.php-version Normal file
View File

@@ -0,0 +1 @@
8.2

1
.root-fs/crontab Normal file
View File

@@ -0,0 +1 @@
* * * * * php82 /app/artisan schedule:run

View File

@@ -0,0 +1,60 @@
map $http_upgrade $type {
default "web";
websocket "ws";
}
server {
listen 80 default;
server_name _;
root /app/public;
index index.php;
location / { try_files /i-should-not-exist @$type; }
location @web { try_files $uri $uri/ @octane; }
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location @ws {
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_cache_bypass $http_upgrade;
proxy_http_version 1.1;
proxy_redirect off;
proxy_pass http://127.0.0.1:8080;
}
location @octane {
proxy_send_timeout 300;
proxy_read_timeout 300;
client_max_body_size 512M;
client_body_temp_path /tmp;
proxy_set_header Host $http_host;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8090$uri?$query_string;
}
location ~ \.php$ {
proxy_send_timeout 300;
proxy_read_timeout 300;
client_max_body_size 512M;
client_body_temp_path /tmp;
proxy_set_header Host $http_host;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8090$uri?$query_string;
}
}

View File

@@ -0,0 +1,98 @@
user www;
worker_processes auto;
pcre_jit on;
pid /run/nginx.pid;
include /etc/nginx/modules/*.conf;
worker_rlimit_nofile 64000;
events {
worker_connections 8192;
multi_accept on;
use epoll;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 2000;
reset_timedout_connection on;
types_hash_max_size 2048;
client_max_body_size 512m;
proxy_buffer_size 128k;
proxy_buffers 16 128k;
proxy_busy_buffers_size 128k;
server_names_hash_bucket_size 64;
server_name_in_redirect off;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES256-SHA384;
ssl_session_timeout 1h;
ssl_session_cache shared:SSL:50m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security max-age=15768000;
##
# Logging Settings
##
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log error;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_min_length 20;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint application/x-shockwave-flash image/tiff application/x-font-ttf audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel;
open_file_cache max=200000 inactive=3600s;
open_file_cache_valid 3600s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
##
# Virtual Host Configs
##
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/conf.d/app.conf;
}

View File

@@ -0,0 +1,4 @@
post_max_size = 512M
upload_max_filesize = 512M
memory_limit = -1

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
with-contenv s6-setuidgid www php82 /app/artisan cattr:make:admin

View File

@@ -0,0 +1,6 @@
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid 10000:4
php82 /app/artisan octane:start --host=0.0.0.0 --port=8090

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1,2 @@
#!/usr/bin/execlineb -P
nginx -g "daemon off;"

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
with-contenv s6-setuidgid www php82 /app/artisan config:cache

View File

@@ -0,0 +1 @@
600000

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1 @@
with-contenv s6-envuidgid www php82 /app/artisan migrate --force --seed --seeder=InitialSeeder

View File

@@ -0,0 +1 @@
oneshot

View File

@@ -0,0 +1,9 @@
if { mkdir -p /var/lib/nginx/tmp }
if { mkdir -p /var/log/nginx }
if { mkdir -p /app/storage/logs }
if { mkdir -p /app/storage/framework/views }
if { mkdir -p /app/storage/framework/cache }
if { mkdir -p /app/storage/framework/sessions }
if { mkdir -p /app/storage/app/screenshots }
if { mkdir -p /app/storage/app/modules }
chown -R www:www /app/storage

View File

@@ -0,0 +1,6 @@
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid www
php82 /app/artisan queue:work --sleep=3

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1,6 @@
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid www
php82 /app/artisan reverb:start --host=0.0.0.0 --port=8080

View File

@@ -0,0 +1 @@
longrun

View File

@@ -0,0 +1,6 @@
#!/usr/bin/execlineb -P
with-contenv
s6-setuidgid www
/usr/bin/supercronic /crontab

View File

@@ -0,0 +1 @@
longrun

1
.testing.ini Normal file
View File

@@ -0,0 +1 @@
xdebug.mode = coverage

View File

@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-engines",
factory: function (require) {
var plugin=(()=>{var P=Object.create,f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var b=n=>f(n,"__esModule",{value:!0});var i=n=>{if(typeof require!="undefined")return require(n);throw new Error('Dynamic require of "'+n+'" is not supported')};var T=(n,e)=>{for(var r in e)f(n,r,{get:e[r],enumerable:!0})},V=(n,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of N(e))!Y.call(n,t)&&t!=="default"&&f(n,t,{get:()=>e[t],enumerable:!(r=R(e,t))||r.enumerable});return n},s=n=>V(b(f(n!=null?P(j(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var U={};T(U,{default:()=>q});var o=s(i("@yarnpkg/core")),c;(function(r){r.Yarn="Yarn",r.Console="Console"})(c||(c={}));var h=class{constructor(e){this.throwWrongEngineError=(e,r)=>{let t=this.formatErrorMessage(e,r);this.throwError(t)};this.throwError=e=>{switch(this.errorReporter){case c.Yarn:this.reportYarnError(e);break;case c.Console:default:this.reportConsoleError(e);break}};this.reportYarnError=e=>{throw new o.ReportError(o.MessageName.UNNAMED,e)};this.reportConsoleError=e=>{console.error(e),process.exit(1)};this.formatErrorMessage=(e,r)=>{let{configuration:t}=this.project,p=o.formatUtils.applyStyle(t,o.formatUtils.pretty(t,this.engine,"green"),2),g=o.formatUtils.pretty(t,e,"cyan"),d=o.formatUtils.pretty(t,r,"cyan"),w=`The current ${p} version ${g} does not satisfy the required version ${d}.`;return o.formatUtils.pretty(t,w,"red")};this.project=e.project,this.errorReporter=e.errorReporter}};var m=s(i("fs")),y=s(i("path")),l=s(i("semver")),k=s(i("@yarnpkg/fslib")),a=s(i("@yarnpkg/core"));var v=class extends h{constructor(){super(...arguments);this.resolveNvmRequiredVersion=()=>{let{configuration:e,cwd:r}=this.project,t=(0,y.resolve)(k.npath.fromPortablePath(r),".nvmrc"),p=a.formatUtils.applyStyle(e,a.formatUtils.pretty(e,this.engine,"green"),2);if(!(0,m.existsSync)(t)){this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The .nvmrc file does not exist.`,"red"));return}let g=(0,m.readFileSync)(t,"utf-8").trim();if((0,l.validRange)(g))return g;let d=a.formatUtils.pretty(e,".nvmrc","yellow");this.throwError(a.formatUtils.pretty(e,`Unable to verify the ${p} version. The ${d} file contains an invalid semver range.`,"red"))}}get engine(){return"Node"}verifyEngine(e){let r=e.node;r!=null&&(r===".nvmrc"&&(r=this.resolveNvmRequiredVersion()),(0,l.satisfies)(process.version,r,{includePrerelease:!0})||this.throwWrongEngineError(process.version.replace(/^v/i,""),r.replace(/^v/i,"")))}};var x=s(i("semver")),E=s(i("@yarnpkg/core"));var u=class extends h{get engine(){return"Yarn"}verifyEngine(e){let r=e.yarn;r!=null&&((0,x.satisfies)(E.YarnVersion,r,{includePrerelease:!0})||this.throwWrongEngineError(E.YarnVersion,r))}};var C=n=>e=>{if(process.env.PLUGIN_YARN_ENGINES_DISABLE!=null)return;let{engines:r={}}=e.getWorkspaceByCwd(e.cwd).manifest.raw,t={project:e,errorReporter:n};[new v(t),new u(t)].forEach(g=>g.verifyEngine(r))},S={hooks:{validateProject:C(c.Yarn),setupScriptEnvironment:C(c.Console)}},q=S;return U;})();
return plugin;
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

873
.yarn/releases/yarn-3.5.0.cjs vendored Normal file

File diff suppressed because one or more lines are too long

22
.yarnrc.yml Normal file
View File

@@ -0,0 +1,22 @@
nodeLinker: node-modules
npmScopes:
cattr:
npmRegistryServer: "https://git.amazingcat.net/api/v4/packages/npm/"
packageExtensions:
laravel-mix-compress@*:
dependencies:
webpack: ^5.76.2
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-engines.cjs
spec: "https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js"
yarnPath: .yarn/releases/yarn-3.5.0.cjs

103
Dockerfile Normal file
View File

@@ -0,0 +1,103 @@
# syntax=docker/dockerfile:1-labs
FROM registry.git.amazingcat.net/cattr/core/wolfi-os-image/cattr-dev:latest AS builder
ARG SENTRY_DSN
ARG APP_VERSION
ARG APP_ENV=production
ARG REVERB_SCHEME=http
ARG REVERB_PORT=8080
ARG BACKEND_MODULES="cattr/gitlab_integration-module cattr/redmine_integration-module"
ENV IMAGE_VERSION=5.0.0
ENV APP_VERSION $APP_VERSION
ENV SENTRY_DSN $SENTRY_DSN
ENV APP_ENV $APP_ENV
ENV YARN_ENABLE_GLOBAL_CACHE=true
ENV REVERB_APP_KEY="cattr"
ENV REVERB_APP_SECRET="secret"
ENV REVERB_HOST="127.0.0.1"
ENV REVERB_SCHEME $REVERB_SCHEME
ENV REVERB_PORT $REVERB_PORT
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=300000
COPY --chown=root:root .root-fs/etc/php82 /etc/php82
WORKDIR /app
COPY --chown=www:www . /app
USER www:www
RUN set -x && \
mkdir -p /tmp/composer && \
: > /tmp/gitconfig && \
unset GITHUB_TOKEN GH_TOKEN COMPOSER_AUTH COMPOSER_TOKEN COMPOSER_PREFER_SOURCE GIT_HTTP_EXTRAHEADER GIT_CONFIG_PARAMETERS GIT_CONFIG_COUNT GIT_CONFIG_KEY_0 GIT_CONFIG_VALUE_0 GIT_CONFIG_KEY_1 GIT_CONFIG_VALUE_1 GIT_CONFIG_KEY_2 GIT_CONFIG_VALUE_2 && \
export \
HOME=/tmp \
XDG_CONFIG_HOME=/tmp \
COMPOSER_HOME=/tmp/composer \
COMPOSER_AUTH='{}' \
COMPOSER_PREFER_DIST=1 \
GIT_CONFIG_GLOBAL=/tmp/gitconfig \
GIT_CONFIG_SYSTEM=/tmp/gitconfig \
GIT_CONFIG_NOSYSTEM=1 \
GIT_CONFIG_PARAMETERS= \
GIT_TERMINAL_PROMPT=0 \
GIT_ASKPASS=/bin/false \
SSH_ASKPASS=/bin/false \
GIT_CONFIG_COUNT=3 \
GIT_CONFIG_KEY_0=credential.helper \
GIT_CONFIG_VALUE_0= \
GIT_CONFIG_KEY_1=http.useNetrc \
GIT_CONFIG_VALUE_1=false \
GIT_CONFIG_KEY_2=http.https://github.com/.extraheader \
GIT_CONFIG_VALUE_2= && \
php /usr/bin/composer.phar require -n --no-ansi --no-install --no-update --no-audit --prefer-dist $BACKEND_MODULES && \
php /usr/bin/composer.phar update -n --no-autoloader --no-install --no-ansi --prefer-dist $BACKEND_MODULES && \
php /usr/bin/composer.phar install -n --no-dev --no-cache --no-ansi --no-autoloader --no-dev --prefer-dist && \
php /usr/bin/composer.phar dump-autoload -n --optimize --apcu --classmap-authoritative
RUN set -x && \
yarn && \
yarn prod && \
rm -rf node_modules
RUN set -x && \
php artisan storage:link
FROM registry.git.amazingcat.net/cattr/core/wolfi-os-image/cattr:latest AS runtime
ARG SENTRY_DSN
ARG APP_VERSION
ARG APP_ENV=production
ARG APP_KEY="base64:PU/8YRKoMdsPiuzqTpFDpFX1H8Af74nmCQNFwnHPFwY="
ARG REVERB_APP_SECRET="secret"
ARG REVERB_SCHEME=http
ARG REVERB_PORT=8080
ENV IMAGE_VERSION=5.0.0
ENV REVERB_APP_KEY="cattr"
ENV REVERB_HOST="127.0.0.1"
ENV REVERB_SCHEME $REVERB_SCHEME
ENV REVERB_PORT $REVERB_PORT
ENV REVERB_APP_SECRET $REVERB_APP_SECRET
ENV DB_CONNECTION=mysql
ENV DB_HOST=db
ENV DB_USERNAME=root
ENV DB_PASSWORD=password
ENV LOG_CHANNEL=stderr
ENV APP_VERSION $APP_VERSION
ENV SENTRY_DSN $SENTRY_DSN
ENV APP_ENV $APP_ENV
ENV APP_KEY $APP_KEY
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=300000
COPY --from=builder /app /app
COPY --chown=root:root .root-fs /
VOLUME /app/storage
#HEALTHCHECK --interval=5m --timeout=10s \
# CMD wget --spider -q "http://127.0.0.1:8090/status"
EXPOSE 80

557
LICENSE Normal file
View File

@@ -0,0 +1,557 @@
Server Side Public License
VERSION 1, OCTOBER 16, 2018
Copyright © 2018 MongoDB, Inc.
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to Server Side Public License.
“Copyright” also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in
a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a “modified version” of the
earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on
the Program.
To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through a
computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the
extent that it includes a convenient and prominently visible feature that
(1) displays an appropriate copyright notice, and (2) tells the user that
there is no warranty for the work (except to the extent that warranties
are provided), that licensees may convey the work under this License, and
how to view a copy of this License. If the interface presents a list of
user commands or options, such as a menu, a prominent item in the list
meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for
making modifications to it. “Object code” means any non-source form of a
work.
A “Standard Interface” means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that is
widely used among developers working in that language. The “System
Libraries” of an executable work include anything, other than the work as
a whole, that (a) is included in the normal form of packaging a Major
Component, but which is not part of that Major Component, and (b) serves
only to enable use of the work with that Major Component, or to implement
a Standard Interface for which an implementation is available to the
public in source code form. A “Major Component”, in this context, means a
major essential component (kernel, window system, and so on) of the
specific operating system (if any) on which the executable work runs, or
a compiler used to produce the work, or an object code interpreter used
to run it.
The “Corresponding Source” for a work in object code form means all the
source code needed to generate, install, and (for an executable work) run
the object code and to modify the work, including scripts to control
those activities. However, it does not include the work's System
Libraries, or general-purpose tools or generally available free programs
which are used unmodified in performing those activities but which are
not part of the work. For example, Corresponding Source includes
interface definition files associated with source files for the work, and
the source code for shared libraries and dynamically linked subprograms
that the work is specifically designed to require, such as by intimate
data communication or control flow between those subprograms and other
parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program, subject to section 13. The
output from running a covered work is covered by this License only if the
output, given its content, constitutes a covered work. This License
acknowledges your rights of fair use or other equivalent, as provided by
copyright law. Subject to section 13, you may make, run and propagate
covered works that you do not convey, without conditions so long as your
license otherwise remains in force. You may convey covered works to
others for the sole purpose of having them make modifications exclusively
for you, or provide you with facilities for running those works, provided
that you comply with the terms of this License in conveying all
material for which you do not control copyright. Those thus making or
running the covered works for you must do so exclusively on your
behalf, under your direction and control, on terms that prohibit them
from making any copies of your copyrighted material outside their
relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes it
unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article 11
of the WIPO copyright treaty adopted on 20 December 1996, or similar laws
prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention is
effected by exercising rights under this License with respect to the
covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's users,
your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice; keep
intact all notices stating that this License and any non-permissive terms
added in accord with section 7 apply to the code; keep intact all notices
of the absence of any warranty; and give all recipients a copy of this
License along with the Program. You may charge any price or no price for
each copy that you convey, and you may offer support or warranty
protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the terms
of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it,
and giving a relevant date.
b) The work must carry prominent notices stating that it is released
under this License and any conditions added under section 7. This
requirement modifies the requirement in section 4 to “keep intact all
notices”.
c) You must license the entire work, as a whole, under this License to
anyone who comes into possession of a copy. This License will therefore
apply, along with any applicable section 7 additional terms, to the
whole of the work, and all its parts, regardless of how they are
packaged. This License gives no permission to license the work in any
other way, but it does not invalidate such permission if you have
separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your work
need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work, and
which are not combined with it such as to form a larger program, in or on
a volume of a storage or distribution medium, is called an “aggregate” if
the compilation and its resulting copyright are not used to limit the
access or legal rights of the compilation's users beyond what the
individual works permit. Inclusion of a covered work in an aggregate does
not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium customarily
used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a written
offer, valid for at least three years and valid for as long as you
offer spare parts or customer support for that product model, to give
anyone who possesses the object code either (1) a copy of the
Corresponding Source for all the software in the product that is
covered by this License, on a durable physical medium customarily used
for software interchange, for a price no more than your reasonable cost
of physically performing this conveying of source, or (2) access to
copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This alternative is
allowed only occasionally and noncommercially, and only if you received
the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place
(gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to copy
the object code is a network server, the Corresponding Source may be on
a different server (operated by you or a third party) that supports
equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source.
Regardless of what server hosts the Corresponding Source, you remain
obligated to ensure that it is available for as long as needed to
satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you
inform other peers where the object code and Corresponding Source of
the work are being offered to the general public at no charge under
subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be included
in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, “normally used” refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as part
of a transaction in which the right of possession and use of the User
Product is transferred to the recipient in perpetuity or for a fixed term
(regardless of how the transaction is characterized), the Corresponding
Source conveyed under this section must be accompanied by the
Installation Information. But this requirement does not apply if neither
you nor any third party retains the ability to install modified object
code on the User Product (for example, the work has been installed in
ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access
to a network may be denied when the modification itself materially
and adversely affects the operation of the network or violates the
rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in
accord with this section must be in a format that is publicly documented
(and with an implementation available to the public in source code form),
and must require no special password or key for unpacking, reading or
copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall be
treated as though they were included in this License, to the extent that
they are valid under applicable law. If additional permissions apply only
to part of the Program, that part may be used separately under those
permissions, but the entire Program remains governed by this License
without regard to the additional permissions. When you convey a copy of
a covered work, you may at your option remove any additional permissions
from that copy, or from any part of it. (Additional permissions may be
written to require their own removal in certain cases when you modify the
work.) You may place additional permissions on material, added by you to
a covered work, for which you have or can give appropriate copyright
permission.
Notwithstanding any other provision of this License, for material you add
to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some trade
names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material
by anyone who conveys the material (or modified versions of it) with
contractual assumptions of liability to the recipient, for any
liability that these contractual assumptions directly impose on those
licensors and authors.
All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further restriction,
you may remove that term. If a license document contains a further
restriction but permits relicensing or conveying under this License, you
may add to a covered work material governed by the terms of that license
document, provided that the further restriction does not survive such
relicensing or conveying.
If you add terms to a covered work in accord with this section, you must
place, in the relevant source files, a statement of the additional terms
that apply to those files, or a notice indicating where to find the
applicable terms. Additional terms, permissive or non-permissive, may be
stated in the form of a separately written license, or stated as
exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or modify
it is void, and will automatically terminate your rights under this
License (including any patent licenses granted under the third paragraph
of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally terminates
your license, and (b) permanently, if the copyright holder fails to
notify you of the violation by some reasonable means prior to 60 days
after the cessation.
Moreover, your license from a particular copyright holder is reinstated
permanently if the copyright holder notifies you of the violation by some
reasonable means, this is the first time you have received notice of
violation of this License (for any work) from that copyright holder, and
you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a
copy of the Program. Ancillary propagation of a covered work occurring
solely as a consequence of using peer-to-peer transmission to receive a
copy likewise does not require acceptance. However, nothing other than
this License grants you permission to propagate or modify any covered
work. These actions infringe copyright if you do not accept this License.
Therefore, by modifying or propagating a covered work, you indicate your
acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives
a license from the original licensors, to run, modify and propagate that
work, subject to this License. You are not responsible for enforcing
compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered work
results from an entity transaction, each party to that transaction who
receives a copy of the work also receives whatever licenses to the work
the party's predecessor in interest had or could give under the previous
paragraph, plus a right to possession of the Corresponding Source of the
work from the predecessor in interest, if the predecessor has it or can
get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights
granted or affirmed under this License. For example, you may not impose a
license fee, royalty, or other charge for exercise of rights granted
under this License, and you may not initiate litigation (including a
cross-claim or counterclaim in a lawsuit) alleging that any patent claim
is infringed by making, using, selling, offering for sale, or importing
the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The work
thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or
controlled by the contributor, whether already acquired or hereafter
acquired, that would be infringed by some manner, permitted by this
License, of making, using, or selling its contributor version, but do not
include claims that would be infringed only as a consequence of further
modification of the contributor version. For purposes of this definition,
“control” includes the right to grant patent sublicenses in a manner
consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to make,
use, sell, offer for sale, import and otherwise run, modify and propagate
the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To “grant” such a patent license to a party
means to make such an agreement or commitment not to enforce a patent
against the party.
If you convey a covered work, knowingly relying on a patent license, and
the Corresponding Source of the work is not available for anyone to copy,
free of charge and under the terms of this License, through a publicly
available network server or other readily accessible means, then you must
either (1) cause the Corresponding Source to be so available, or (2)
arrange to deprive yourself of the benefit of the patent license for this
particular work, or (3) arrange, in a manner consistent with the
requirements of this License, to extend the patent license to downstream
recipients. “Knowingly relying” means you have actual knowledge that, but
for the patent license, your conveying the covered work in a country, or
your recipient's use of the covered work in a country, would infringe
one or more identifiable patents in that country that you have reason
to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties receiving
the covered work authorizing them to use, propagate, modify or convey a
specific copy of the covered work, then the patent license you grant is
automatically extended to all recipients of the covered work and works
based on it.
A patent license is “discriminatory” if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you are
a party to an arrangement with a third party that is in the business of
distributing software, under which you make payment to the third party
based on the extent of your activity of conveying the work, and under
which the third party grants, to any of the parties who would receive the
covered work from you, a discriminatory patent license (a) in connection
with copies of the covered work conveyed by you (or copies made from
those copies), or (b) primarily for and in connection with specific
products or compilations that contain the covered work, unless you
entered into that arrangement, or that patent license was granted, prior
to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any
implied license or other defenses to infringement that may otherwise be
available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot use,
propagate or convey a covered work so as to satisfy simultaneously your
obligations under this License and any other pertinent obligations, then
as a consequence you may not use, propagate or convey it at all. For
example, if you agree to terms that obligate you to collect a royalty for
further conveying from those to whom you convey the Program, the only way
you could satisfy both those terms and this License would be to refrain
entirely from conveying the Program.
13. Offering the Program as a Service.
If you make the functionality of the Program or a modified version
available to third parties as a service, you must make the Service Source
Code available via network download to everyone at no charge, under the
terms of this License. Making the functionality of the Program or
modified version available to third parties as a service includes,
without limitation, enabling third parties to interact with the
functionality of the Program or modified version remotely through a
computer network, offering a service the value of which entirely or
primarily derives from the value of the Program or modified version, or
offering a service that accomplishes for users the primary purpose of the
Program or modified version.
“Service Source Code” means the Corresponding Source for the Program or
the modified version, and the Corresponding Source for all programs that
you use to make the Program or modified version available as a service,
including, without limitation, management software, user interfaces,
application program interfaces, automation software, monitoring software,
backup software, storage software and hosting software, all such that a
user could run an instance of the service using the Service Source Code
you make available.
14. Revised Versions of this License.
MongoDB, Inc. may publish revised and/or new versions of the Server Side
Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new
problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the Server Side Public
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that numbered version or of
any later version published by MongoDB, Inc. If the Program does not
specify a version number of the Server Side Public License, you may
choose any version ever published by MongoDB, Inc.
If the Program specifies that a proxy can decide which future versions of
the Server Side Public License can be used, that proxy's public statement
of acceptance of a version permanently authorizes you to choose that
version for the Program.
Later license versions may give you additional or different permissions.
However, no additional obligations are imposed on any author or copyright
holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF
THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO
LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above
cannot be given local legal effect according to their terms, reviewing
courts shall apply local law that most closely approximates an absolute
waiver of all civil liability in connection with the Program, unless a
warranty or assumption of liability accompanies a copy of the Program in
return for a fee.
END OF TERMS AND CONDITIONS

70
README.md Normal file
View File

@@ -0,0 +1,70 @@
## About Cattr
Cattr is an open-source time tracking solution, designed to be flawlessly integrated with your infrastructure.
Superpowered with features like built-in screenshot capture and activity detection, it's a great instrument to boost
your team's performance straight to the top.
#### We have our own [Container Registry](https://git.amazingcat.net/cattr/core/app/container_registry/9?orderBy=NAME&sort=desc), the images are hosted on GitLab
### Screenshots
| Dashboard | Project report |
|:-----------------------------:|:----------------------------------:|
| ![](./examples/dashboard.jpg) | ![](./examples/project_report.jpg) |
### Demo
The demo app is available here: [demo.cattr.app](https://demo.cattr.app)
## Install Cattr
[Installation manual](https://docs.cattr.app/#/en/getting-started/?id=requirements) on the documentation website.
```
composer install
php artisan key:generate
yarn
```
After should be edited `.env` file (e.g. for DB connection), look at `.env.example` for examples
```
php artisan migrate --seed --seeder=InitialSeeder
```
App will not start without seeding of InitialSeeder
After seeding it, run `php artisan cattr:make:admin` and you will be able to login with following credentials
```
admin@cattr.app
password
```
### Run Local server
local server by default will be run as <http://127.0.0.1:8000>
```
php artisan serve
yarn dev
```
### Generate IDE helpers
```
composer dumphelpers
composer dumperd
```
## Links
https://git.amazingcat.net/cattr/desktop/desktop-application Cattr Desktop Application. You can also download the built app for
any OS from the [official site](https://cattr.app/desktop/).
### Documentation
You can find the Cattr documentation [on the website](https://docs.cattr.app).
Checkout the [Getting Started](https://docs.cattr.app/#/en/getting-started/) page for a quick overview.
### Questions
For questions and support please use the [Github Discussions](https://github.com/orgs/cattr-app/discussions).

7
apidoc.json Normal file
View File

@@ -0,0 +1,7 @@
{
"name": "Cattr",
"version": "4.0.0",
"description": "Cattr API Documentation",
"title": "Cattr API Documentation",
"url": "https://demo.cattr.app/api"
}

View File

@@ -0,0 +1,75 @@
<?php
namespace App\Console\Commands;
use App\Models\TimeInterval;
use App\Models\User;
use Carbon\Carbon;
use DB;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder;
class CalculateEfficiency extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:calculate-efficiency';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Calculate efficiency for users';
/**
* Execute the console command.
*/
public function handle()
{
$startDate = Carbon::now()->subMonth(2);
$users = User::all();
foreach ($users as $user) {
$tasks = $user->tasks()
->select(['id', 'estimate'])
->whereHas('status', static function (Builder $query) {
$query->where('active', false);
})
->whereHas('timeIntervals', static function (Builder $query) use ($startDate) {
$query
->whereNotNull('estimate')
->where('start_at', '>', $startDate);
})
->get()
->keyBy('id')
->toArray();
if (empty($tasks)) {
$user->efficiency = null;
$user->save();
continue;
}
$taskIds = array_keys($tasks);
$timeIntervals = TimeInterval::query()
->select(['user_id', 'task_id', DB::raw('SUM(TIMESTAMPDIFF(SECOND, start_at, end_at)) as duration')])
->where('start_at', '>', $startDate)
->where('user_id', $user->id)
->whereIn('task_id', $taskIds)
->groupBy(['user_id', 'task_id'])
->get();
$totalEfficiency = 0;
foreach ($timeIntervals as $timeInterval) {
$tasks[$timeInterval->task_id]['duration'] = (int)$timeInterval->duration;
$totalEfficiency += $tasks[$timeInterval->task_id]['duration'] / (float)$tasks[$timeInterval->task_id]['estimate'];
}
$user->efficiency = $totalEfficiency / count($tasks);
$user->save();
}
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Console\Commands;
use App\Jobs\ClearExpiredApps;
use App\Models\TrackedApplication;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:intervals:apps:clear-expired')]
class ClearExpiredTrackedApps extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:intervals:apps:clear-expired';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
$this->info(
sprintf(
'Found %d items for deletion',
TrackedApplication::where(
'created_at',
'<=',
now()->subDay()->toIso8601String()
)->withoutGlobalScopes()->count()
)
);
ClearExpiredApps::dispatch();
$this->info('Clearance job dispatched');
return 0;
}
}

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Console\Commands;
use App\Contracts\AttachmentService;
use App\Models\Attachment;
use App\Models\SusFiles;
use Arr;
use Illuminate\Console\Command;
use Storage;
use Str;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:attachments:find-sus-files')]
class FindSusFiles extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:attachments:find-sus-files';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Find files that exist inside attachments projects folder but not in DB';
/**
* Execute the console command.
*/
public function handle(AttachmentService $service): void
{
SusFiles::query()->delete();
$this->withProgressBar(
Storage::disk('attachments')->allFiles('projects'),
function ($filePath) use ($service) {
$fileName = Str::of($filePath)->basename()->toString();
if (Attachment::whereId($fileName)->exists() === false) {
SusFiles::create([
'path' => $filePath,
'mime_type' => $service->getMimeType($filePath),
'hash' => $service->getHashSum($filePath),
]);
}
}
);
}
}

View File

@@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Mail;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:mail:test')]
class MailTestCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:mail:test {destination}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Test mail sending';
public function handle(): void
{
$destination = $this->argument('destination');
Mail::raw('Text to e-mail', static function ($message) use ($destination) {
$message->to($destination);
});
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace App\Console\Commands;
use App\Models\User;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Validator;
use Illuminate\Validation\Rule;
use Illuminate\Contracts\Console\Isolatable;
#[AsCommand(name: 'cattr:make:admin')]
class MakeAdmin extends Command implements Isolatable
{
protected $signature = 'cattr:make:admin
{--o : Skip instance registration}
{--email= : User email}
{--name= : User name}
{--password= : User password}';
protected $description = 'Creates admin user with data from ENV or input';
public function handle(): int
{
if ($this->option('email')) {
$email = $this->option('email');
if (Validator::make([
'email' => $email
], [
'email' => ['email', Rule::unique(User::class)]
])->fails()) {
$this->error('Email is incorrect or it was already registered');
return 1;
}
}
$email = env('APP_ADMIN_EMAIL', 'admin@cattr.app');
if (Validator::make([
'email' => $email
], [
'email' => ['email', Rule::unique(User::class)]
])->fails()) {
if (env('IMAGE_VERSION', false)) {
$this->info('Admin already exists, skipping creation');
return 0;
}
$this->error('Email is incorrect or it was already registered');
return 1;
}
if ($email !== 'admin@cattr.app' && !$this->option('o') && !User::admin()->count()) {
$self = $this;
rescue(
static fn () => $self->call(
RegisterInstance::class,
[
'adminEmail' => $email
],
),
);
}
if ($this->option('password')) {
$password = $this->option('password');
if (Validator::make([
'password' => $password
], [
'password' => 'min:6'
])->fails()) {
$this->warn('Minimum length is 6 characters');
return 1;
}
}
$password = env('APP_ADMIN_PASSWORD', 'password');
if (Validator::make([
'password' => $password
], [
'password' => 'min:6'
])->fails()) {
$this->warn('Minimum length is 6 characters');
return 1;
}
User::factory()->admin()->create([
'full_name' => $this->option('name') ?: env('APP_ADMIN_NAME', 'Admin'),
'email' => $email,
'password' => $password,
'last_activity' => now(),
]);
$this->info("Administrator with email $email was created successfully");
return 0;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands;
use App\Helpers\Version;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:module:version')]
class ModuleVersion extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:module:version {module}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get version of provided module';
/**
* Execute the console command.
*/
public function handle(): void
{
$this->info((string)new Version($this->argument('module')));
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Console\Commands;
use App\Models\Task;
use App\Models\CronTaskWorkers;
use App\Models\TimeInterval;
use Carbon\Carbon;
use DB;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Settings;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:task:recreate-workers')]
class RecreateCronTaskWorkers extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:task:recreate-workers';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Recreates materialized table for CronTaskWorkers model';
/**
* Execute the console command.
*
* @return void
*/
public function handle(): void
{
$timezone = Settings::scope('core')->get('timezone');
$reportCreatedAt = Carbon::now($timezone)->format('Y-m-d H:i:s e');
$this->withProgressBar(
Task::whereNull('deleted_at')->lazyById(),
static fn(Task $task) => rescue(static function () use ($task) {
CronTaskWorkers::whereTaskId($task->id)->delete();
CronTaskWorkers::insertUsing(
['user_id', 'task_id', 'duration', 'created_by_cron'],
TimeInterval::selectRaw('user_id, task_id, SUM(TIMESTAMPDIFF(SECOND, start_at, end_at)) as duration, "1" as created_by_cron')
->where('task_id', '=', $task->id)
->groupBy(['user_id', 'task_id'])
);
})
);
Settings::scope('core.reports')->set('planned_time_report_date', $reportCreatedAt);
CronTaskWorkers::whereDoesntHave('task')
->orWhereDoesntHave('user')
->orWhereHas('task',
static fn(EloquentBuilder $query) => $query
->whereNotNull('deleted_at')
)->delete();
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace App\Console\Commands;
use App\Helpers\ModuleHelper;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Console\Command;
use JsonException;
use Exception;
use Settings;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:register')]
class RegisterInstance extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:register {adminEmail} {--i : Interactive mode}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send instance data on the statistics server';
/**
* Execute the console command.
*
* @param Client $client
*
* @return int
* @throws JsonException|GuzzleException
*/
public function handle(Client $client): int
{
if (Settings::scope('core')->get('instance')) {
echo 'Application already registered';
return 1;
}
try {
$appVersion = config('app.version');
$response = $client->post(config('app.stats_collector_url') . '/instance', [
'json' => [
'ownerEmail' => $this->argument('adminEmail'),
'version' => $appVersion,
'modules' => ModuleHelper::getModulesInfo(),
'image' => getenv('IMAGE_VERSION')
]
]);
$responseBody = json_decode(
$response->getBody()->getContents(),
true,
512,
JSON_THROW_ON_ERROR | JSON_THROW_ON_ERROR
);
if (isset($responseBody['instanceId'])) {
Settings::scope('core')->set('instance', $responseBody['instanceId']);
}
if (isset($responseBody['release']['flashMessage'])) {
$this->info($responseBody['release']['flashMessage']);
}
if (isset($responseBody['release']['lastVersion'])
&& $responseBody['release']['lastVersion'] > $appVersion
) {
$this->alert("New version is available: {$responseBody['release']['lastVersion']}");
}
if ($responseBody['release']['vulnerable']) {
if ($this->option('i')) {
// Interactive mode
return $this->confirm('You have a vulnerable version, are you sure you want to continue?');
}
$this->alert('You have a vulnerable version. Please update to the latest version.');
}
return 0;
} catch (Exception $e) {
if ($e->getResponse()) {
$error = json_decode(
$e->getResponse()->getBody(),
true,
512,
JSON_THROW_ON_ERROR | JSON_THROW_ON_ERROR
);
$this->warn($error['message']);
} else {
$this->warn('Сould not get a response from the server to check the relevance of your version.');
}
return 0;
}
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace App\Console\Commands;
use App\Models\TimeInterval;
use DB;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:intervals:dedupe')]
class RemoveDuplicateIntervals extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:intervals:dedupe';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Removes duplicates in the Time intervals table';
/**
* Execute the console command.
*/
public function handle(): void
{
$interval_ids = DB::table('time_intervals as ti1')
->join('time_intervals as ti2', static function ($join) {
$join->on('ti2.start_at', '=', 'ti1.start_at');
$join->on('ti2.end_at', '=', 'ti1.end_at');
$join->on('ti2.user_id', '=', 'ti1.user_id');
$join->on('ti2.id', '>', 'ti1.id');
})
->whereNull('ti2.deleted_at')
->pluck('ti2.id')
->unique();
TimeInterval::destroy($interval_ids->toArray());
$count = $interval_ids->count();
$this->info("Removed $count intervals.");
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace App\Console\Commands;
use Exception;
use Illuminate\Console\Command;
use DB;
use Illuminate\Database\Console\Seeds\SeedCommand;
use Nwidart\Modules\Commands\SeedCommand as ModuleSeedCommand;
use Settings;
use Storage;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:reset')]
class ResetCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:reset {--s|seed} {--f|force} {--i|images}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Cattr flush database';
protected array $protectedTables = ['migrations', 'jobs', 'failed_jobs'];
/**
* Execute the console command.
*
* @throws Exception
*/
public function handle(): int
{
if (!$this->option('force') && !$this->confirm('Are you sure want to drop data for your Cattr instance?')) {
return 0;
}
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
foreach ($tables as $table) {
if (!in_array($table, $this->protectedTables, true)) {
DB::table($table)->truncate();
}
}
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
if ($this->option('images')) {
Storage::deleteDirectory('uploads/screenshots');
}
$this->call(SeedCommand::class, [
'--class' => 'InitialSeeder',
'--force' => true
]);
if ($this->option('seed')) {
$this->call(SeedCommand::class, [
'--force' => true
]);
$this->call(ModuleSeedCommand::class, [
'--force' => true
]);
}
return 0;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Helpers\StorageCleaner;
use Illuminate\Contracts\Container\BindingResolutionException;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:screenshots:rotate')]
class RotateScreenshots extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:screenshots:rotate';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Rotate screenshots';
/**
* Execute the console command.
*
* @throws BindingResolutionException
*/
public function handle(): void
{
if (!StorageCleaner::needThinning()) {
$this->info('Time for thinning hasn\'t come');
return;
}
$this->info('For thinning available ' . StorageCleaner::countAvailableScreenshots() . ' screenshots');
$spaceBefore = StorageCleaner::getUsedSpace();
$this->info('Started thinning...');
StorageCleaner::thin();
$this->info('Totally freed ' . round(
($spaceBefore - StorageCleaner::getUsedSpace()) / 1024 / 1024,
3
) . 'MB');
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Console\Commands;
use App\Models\Property;
use Illuminate\Console\Command;
use Settings;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:set:language')]
class SetLanguage extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:set:language {language}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sets company language';
public function handle(): void
{
$language = $this->argument('language');
if (!in_array($language, config('app.languages'), true)) {
$this->error('Invalid or not supported language');
return;
}
Settings::scope('core')->set('language', $language);
$this->info(strtoupper($language) . ' language successfully set');
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands;
use App\Models\Property;
use Illuminate\Console\Command;
use Settings;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:set:timezone')]
class SetTimeZone extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:set:timezone {timezone}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Sets company timezone';
public function handle(): void
{
$timezone = $this->argument('timezone');
if (!in_array($timezone, timezone_identifiers_list(), true)) {
$this->error('Invalid time zone format');
return;
}
Settings::scope('core')->set('timezone', $timezone);
$this->info("$timezone time zone successfully set");
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Console\Commands;
use App\Contracts\AttachmentService;
use App\Models\Attachment;
use App\Models\SusFiles;
use Arr;
use Illuminate\Console\Command;
use Storage;
use Str;
use Symfony\Component\Console\Attribute\AsCommand;
use App\Jobs\VerifyAttachmentHash;
#[AsCommand(name: 'cattr:attachments:verify')]
class VerifyAttachments extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:attachments:verify';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Verify hash of all files';
/**
* Execute the console command.
*/
public function handle(AttachmentService $service): void
{
$this->withProgressBar(Attachment::lazyById(), fn($attachment) => VerifyAttachmentHash::dispatch($attachment));
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands;
use App\Helpers\Version;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cattr:version')]
class VersionCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cattr:version';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get Cattr version';
/**
* Execute the console command.
*/
public function handle(): void
{
$this->info((string)new Version());
}
}

63
app/Console/Kernel.php Normal file
View File

@@ -0,0 +1,63 @@
<?php
namespace App\Console;
use App\Console\Commands\CalculateEfficiency;
use App\Console\Commands\RecreateCronTaskWorkers;
use App\Console\Commands\FindSusFiles;
use App\Console\Commands\RotateScreenshots;
use App\Jobs\ClearExpiredApps;
use App\Console\Commands\VerifyAttachments;
use App\Models\Attachment;
use Exception;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Sentry\State\Scope;
use Settings;
use function Sentry\configureScope;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
public final function bootstrap(): void
{
parent::bootstrap();
}
/**
* Define the application's command schedule.
*
* @param Schedule $schedule
* @return void
* @throws Exception
*/
protected function schedule(Schedule $schedule): void
{
$schedule->command(RotateScreenshots::class)->weekly()->when(Settings::scope('core')->get('auto_thinning'));
$schedule->job(new ClearExpiredApps)->daily();
$schedule->command(RecreateCronTaskWorkers::class)->daily()->runInBackground()->withoutOverlapping();
$schedule->command(VerifyAttachments::class)->daily()->runInBackground()->withoutOverlapping();
$schedule->command(CalculateEfficiency::class)->daily()->runInBackground()->withoutOverlapping();
$schedule->command(FindSusFiles::class)->weekly()->runInBackground()->withoutOverlapping();
}
/**
* Register the Closure based commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__ . '/Commands');
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Contracts;
abstract class AppReport
{
final public static function init(...$arguments): self
{
return new static(...$arguments);
}
abstract public function getReportId(): string;
abstract public function getLocalizedReportName(): string;
abstract public function store(string $filePath = null, string $disk = null, string $writerType = null, $diskOptions = []);
}

View File

@@ -0,0 +1,17 @@
<?php
namespace App\Contracts;
use App\Models\Attachment;
use Illuminate\Database\Eloquent\Relations\MorphMany;
interface AttachmentAble
{
/**
* @return Attachment[]
*/
public function attachments();
public function attachmentsRelation(): MorphMany;
public function getProjectId(): int;
}

Some files were not shown because too many files have changed in this diff Show More