Merge branch 'master' into feature/crm-migrate
This commit is contained in:
commit
8bb69dd12f
204
.editorconfig
Normal file
204
.editorconfig
Normal file
@ -0,0 +1,204 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
# Indentation and spacing
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
|
||||
# Organize usings
|
||||
dotnet_separate_import_directive_groups = true
|
||||
dotnet_sort_system_directives_first = true
|
||||
file_header_template = unset
|
||||
|
||||
# this. and Me. preferences
|
||||
dotnet_style_qualification_for_event = false:silent
|
||||
dotnet_style_qualification_for_field = false:silent
|
||||
dotnet_style_qualification_for_method = false:silent
|
||||
dotnet_style_qualification_for_property = false:silent
|
||||
|
||||
# Language keywords vs BCL types preferences
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
|
||||
dotnet_style_predefined_type_for_member_access = true:warning
|
||||
|
||||
# Parentheses preferences
|
||||
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
|
||||
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
|
||||
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
|
||||
|
||||
# Modifier preferences
|
||||
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_coalesce_expression = true:warning
|
||||
dotnet_style_collection_initializer = true:warning
|
||||
dotnet_style_explicit_tuple_names = true:warning
|
||||
dotnet_style_null_propagation = true:warning
|
||||
dotnet_style_object_initializer = true:warning
|
||||
dotnet_style_operator_placement_when_wrapping = beginning_of_line
|
||||
dotnet_style_prefer_auto_properties = true:warning
|
||||
dotnet_style_prefer_compound_assignment = true:warning
|
||||
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
|
||||
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
|
||||
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
|
||||
dotnet_style_prefer_inferred_tuple_names = true:warning
|
||||
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
|
||||
dotnet_style_prefer_simplified_boolean_expressions = true:warning
|
||||
dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
|
||||
# Field preferences
|
||||
dotnet_style_readonly_field = true:warning
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:warning
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
|
||||
# var preferences
|
||||
csharp_style_var_elsewhere = true:warning
|
||||
csharp_style_var_for_built_in_types = true:warning
|
||||
csharp_style_var_when_type_is_apparent = true:warning
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_constructors = false:silent
|
||||
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
|
||||
csharp_style_expression_bodied_methods = false:suggestion
|
||||
csharp_style_expression_bodied_operators = false:silent
|
||||
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
|
||||
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:warning
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:warning
|
||||
|
||||
# Modifier preferences
|
||||
csharp_prefer_static_local_function = true:suggestion
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
csharp_prefer_simple_using_statement = true:suggestion
|
||||
|
||||
# Expression-level preferences
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_style_deconstructed_variable_declaration = true:warning
|
||||
csharp_style_inlined_variable_declaration = true:warning
|
||||
csharp_style_pattern_local_over_anonymous_function = true:warning
|
||||
csharp_style_prefer_index_operator = true:warning
|
||||
csharp_style_prefer_range_operator = true:warning
|
||||
csharp_style_throw_expression = true:warning
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
|
||||
#### C# Formatting Rules ####
|
||||
|
||||
# New line preferences
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_case_contents_when_block = false
|
||||
csharp_indent_labels = one_less_than_current
|
||||
csharp_indent_switch_labels = true
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
dotnet_naming_symbols.interface.applicable_kinds = interface
|
||||
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.interface.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
|
||||
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.types.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
|
||||
# Default severity for analyzer diagnostics with category 'Style'
|
||||
dotnet_analyzer_diagnostic.category-Style.severity = silent
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,3 +15,5 @@
|
||||
/products/ASC.People/Data/
|
||||
Data/
|
||||
Logs/
|
||||
**/.DS_Store
|
||||
.eslintcache
|
||||
|
17
.nuget/NuGet.Config
Normal file
17
.nuget/NuGet.Config
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<solution>
|
||||
<add key="disableSourceControlIntegration" value="true" />
|
||||
</solution>
|
||||
<config>
|
||||
<add key="repositorypath" value="$\..\..\packages" />
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key="Custom NuGet Server" value="packages" />
|
||||
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True" />
|
||||
<add key="automatic" value="True" />
|
||||
</packageRestore>
|
||||
</configuration>
|
BIN
.nuget/packages/AppLimit.CloudComputing.SharpBox.1.1.0.451.nupkg
Normal file
BIN
.nuget/packages/AppLimit.CloudComputing.SharpBox.1.1.0.451.nupkg
Normal file
Binary file not shown.
BIN
.nuget/packages/Microsoft.Graph.Core.1.5.0.1.nupkg
Normal file
BIN
.nuget/packages/Microsoft.Graph.Core.1.5.0.1.nupkg
Normal file
Binary file not shown.
BIN
.nuget/packages/Microsoft.OneDriveSDK.2.0.7.5.nupkg
Normal file
BIN
.nuget/packages/Microsoft.OneDriveSDK.2.0.7.5.nupkg
Normal file
Binary file not shown.
BIN
.nuget/packages/WebSocketSharp.1.0.3-rc11.nupkg
Normal file
BIN
.nuget/packages/WebSocketSharp.1.0.3-rc11.nupkg
Normal file
Binary file not shown.
193
ASC.Tests.sln
Normal file
193
ASC.Tests.sln
Normal file
@ -0,0 +1,193 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30413.136
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Tests", "products\ASC.Files\Tests\ASC.Files.Tests.csproj", "{EFB99A37-EF25-4A0F-8D7A-786402B1554C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Api.Core", "common\ASC.Api.Core\ASC.Api.Core.csproj", "{CAA6EED2-094A-42AE-81B6-3FDF142EC277}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Common", "common\ASC.Common\ASC.Common.csproj", "{19FFE246-4270-41A6-AA8D-FB961715FB21}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Core.Common", "common\ASC.Core.Common\ASC.Core.Common.csproj", "{A51D0454-4AFA-46DE-89D4-B03D37E1816C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage", "common\ASC.Data.Storage\ASC.Data.Storage.csproj", "{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.FederatedLogin", "common\ASC.FederatedLogin\ASC.FederatedLogin.csproj", "{484E9663-B9B7-40CA-B600-D5FDCD7CB862}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.MessagingSystem", "common\ASC.MessagingSystem\ASC.MessagingSystem.csproj", "{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ElasticSearch", "common\services\ASC.ElasticSearch\ASC.ElasticSearch.csproj", "{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Core", "products\ASC.Files\Core\ASC.Files.Core.csproj", "{C277388C-E19E-4A62-A895-8AAB322A4004}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files", "products\ASC.Files\Server\ASC.Files.csproj", "{77BA2F61-6155-4283-BB39-F8E42F46A0B0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.People", "products\ASC.People\Server\ASC.People.csproj", "{DB492BA0-B072-4056-8A3D-032CD108CD82}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Core", "web\ASC.Web.Core\ASC.Web.Core.csproj", "{9A703423-594E-4851-8A0D-FF582BAF9FC9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Reassigns", "common\ASC.Data.Reassigns\ASC.Data.Reassigns.csproj", "{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Feed", "common\ASC.Feed\ASC.Feed.csproj", "{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.IPSecurity", "common\ASC.IPSecurity\ASC.IPSecurity.csproj", "{5E5496B5-5686-4415-B3E0-5F61FCD146A3}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Notify.Textile", "common\ASC.Notify.Textile\ASC.Notify.Textile.csproj", "{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Textile", "common\ASC.Textile\ASC.Textile.csproj", "{1A82BE07-0836-4620-A95D-C6D1E9327589}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.VoipService", "common\ASC.VoipService\ASC.VoipService.csproj", "{664031A4-1652-4B68-8168-FD18998700EE}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.UrlShortener.Svc", "common\services\ASC.UrlShortener.Svc\ASC.UrlShortener.Svc.csproj", "{7DC27057-7B61-4381-BF35-ACED2C9987BC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Thumbnails.Svc", "common\services\ASC.Thumbnails.Svc\ASC.Thumbnails.Svc.csproj", "{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Studio.Notify", "common\services\ASC.Studio.Notify\ASC.Studio.Notify.csproj", "{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Socket.IO.Svc", "common\services\ASC.Socket.IO.Svc\ASC.Socket.IO.Svc.csproj", "{60CB362A-72F4-426E-BBAE-9A9B7426ED04}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Notify", "common\services\ASC.Notify\ASC.Notify.csproj", "{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Feed.Aggregator", "common\services\ASC.Feed.Aggregator\ASC.Feed.Aggregator.csproj", "{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Migration", "common\services\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup", "common\services\ASC.Data.Backup\ASC.Data.Backup.csproj", "{630E2649-71B6-4C07-A2FC-C0BC05D77A78}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ApiSystem", "common\services\ASC.ApiSystem\ASC.ApiSystem.csproj", "{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Api", "web\ASC.Web.Api\ASC.Web.Api.csproj", "{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Studio", "web\ASC.Web.Studio\ASC.Web.Studio.csproj", "{9BF17F6E-04A9-4597-9273-21AD09600329}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFB99A37-EF25-4A0F-8D7A-786402B1554C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CAA6EED2-094A-42AE-81B6-3FDF142EC277}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{19FFE246-4270-41A6-AA8D-FB961715FB21}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A51D0454-4AFA-46DE-89D4-B03D37E1816C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7F459CE-9EAF-423A-B3DC-EFD107007BCE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{484E9663-B9B7-40CA-B600-D5FDCD7CB862}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB0EFA45-1DAF-42F4-9EE1-4A8EC497DE35}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE1A0E06-6CD4-4E1D-8209-22BBBD6D5652}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C277388C-E19E-4A62-A895-8AAB322A4004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C277388C-E19E-4A62-A895-8AAB322A4004}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C277388C-E19E-4A62-A895-8AAB322A4004}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C277388C-E19E-4A62-A895-8AAB322A4004}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB492BA0-B072-4056-8A3D-032CD108CD82}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9A703423-594E-4851-8A0D-FF582BAF9FC9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8682FCD3-C5C5-4946-99FA-B900E9CB68C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5A0DF88C-45C8-4FE2-8144-88E8AC8B7C45}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5E5496B5-5686-4415-B3E0-5F61FCD146A3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5FE0EDA2-1FD7-4D43-885E-DBDD858DCC86}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1A82BE07-0836-4620-A95D-C6D1E9327589}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{664031A4-1652-4B68-8168-FD18998700EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{664031A4-1652-4B68-8168-FD18998700EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{664031A4-1652-4B68-8168-FD18998700EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{664031A4-1652-4B68-8168-FD18998700EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7DC27057-7B61-4381-BF35-ACED2C9987BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{920A59BF-8EFC-4E0F-82D8-935CC6FD570A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C024C35A-D0F0-42D6-86B2-64ABF7513C4A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{60CB362A-72F4-426E-BBAE-9A9B7426ED04}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B30A0D35-7B32-4E13-9F37-B8BC59F839E5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8ACDEBBD-12DD-43DC-86CF-D66E37528ACC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E2A4FE7-5B61-4E76-B62A-3E9CC9FA647C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{630E2649-71B6-4C07-A2FC-C0BC05D77A78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{053AFC13-8EF6-43B6-9514-ED9DBBDC3093}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7C5E8A0-0A5E-4BC4-9946-B43D6682D421}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9BF17F6E-04A9-4597-9273-21AD09600329}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9BF17F6E-04A9-4597-9273-21AD09600329}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9BF17F6E-04A9-4597-9273-21AD09600329}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9BF17F6E-04A9-4597-9273-21AD09600329}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {73201867-1BA9-4F5E-AA69-AFA74662FFFC}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
93
ASC.Web.sln
93
ASC.Web.sln
@ -26,8 +26,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Core", "web\ASC.Web
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.VoipService", "common\ASC.VoipService\ASC.VoipService.csproj", "{988536C1-4B89-4649-8F77-5C16F55D95D1}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Resource.Manager", "common\ASC.Resource.Manager\ASC.Resource.Manager.csproj", "{5A4A13CC-8EDD-4FDB-8C75-29E2B14A47F2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.MessagingSystem", "common\ASC.MessagingSystem\ASC.MessagingSystem.csproj", "{BD8A18A5-60C5-4411-9719-0AA11B4BE0E9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.IPSecurity", "common\ASC.IPSecurity\ASC.IPSecurity.csproj", "{2FF2177F-2D1A-4396-84EB-51F14FD99385}"
|
||||
@ -48,7 +46,36 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ElasticSearch", "common
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files", "products\ASC.Files\Server\ASC.Files.csproj", "{77BA2F61-6155-4283-BB39-F8E42F46A0B0}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppLimit.CloudComputing.SharpBox", "thirdparty\AppLimit.CloudComputing.SharpBox\AppLimit.CloudComputing.SharpBox.csproj", "{5B53855C-4347-4402-B750-76C6295A35D3}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Service", "products\ASC.Files\Service\ASC.Files.Service.csproj", "{5D41FFFF-816C-40B2-95CD-E2DDDCB83784}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.ApiSystem", "common\services\ASC.ApiSystem\ASC.ApiSystem.csproj", "{C2BB03A0-C35B-433F-96D4-3A06CBC06AD7}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.UrlShortener.Svc", "common\services\ASC.UrlShortener.Svc\ASC.UrlShortener.Svc.csproj", "{04A56018-C41E-4634-A185-A13E9250C75A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Feed.Aggregator", "common\services\ASC.Feed.Aggregator\ASC.Feed.Aggregator.csproj", "{07CCC11F-76CB-448E-B15A-72E09FBB348B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Thumbnails.Svc", "common\services\ASC.Thumbnails.Svc\ASC.Thumbnails.Svc.csproj", "{1D2F61B2-B1F4-45F0-83CA-03370FD6E62C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup", "common\services\ASC.Data.Backup\ASC.Data.Backup.csproj", "{DE3DAF51-FB29-41FC-AF41-A4BA8D91BFB6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Core", "products\ASC.Files\Core\ASC.Files.Core.csproj", "{F0A39728-940D-4DBE-A37A-05D4EB57F342}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Socket.IO.Svc", "common\services\ASC.Socket.IO.Svc\ASC.Socket.IO.Svc.csproj", "{2DADEAD3-0FE9-4199-9817-41A32E6BF450}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Migration", "common\services\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{02356BD7-7E99-457B-BEFF-090CE4DF067D}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Encryption", "common\services\ASC.Data.Storage.Encryption\ASC.Data.Storage.Encryption.csproj", "{17A05AE2-21C8-4C1C-B422-6AB80F13F63E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.TelegramService", "common\services\ASC.TelegramService\ASC.TelegramService.csproj", "{95CE7371-17B6-4EEE-8E38-2FDE6347E955}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.AuditTrail", "common\services\ASC.AuditTrail\ASC.AuditTrail.csproj", "{2C111161-B7C5-4869-9F52-EA725E64BA40}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0E35EB77-EC53-44C2-99EB-3D845C79675D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Data.Encryption", "common\ASC.Data.Encryption\ASC.Data.Encryption.csproj", "{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -96,10 +123,6 @@ Global
|
||||
{988536C1-4B89-4649-8F77-5C16F55D95D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{988536C1-4B89-4649-8F77-5C16F55D95D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{988536C1-4B89-4649-8F77-5C16F55D95D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5A4A13CC-8EDD-4FDB-8C75-29E2B14A47F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5A4A13CC-8EDD-4FDB-8C75-29E2B14A47F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5A4A13CC-8EDD-4FDB-8C75-29E2B14A47F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5A4A13CC-8EDD-4FDB-8C75-29E2B14A47F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BD8A18A5-60C5-4411-9719-0AA11B4BE0E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BD8A18A5-60C5-4411-9719-0AA11B4BE0E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BD8A18A5-60C5-4411-9719-0AA11B4BE0E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
@ -140,10 +163,58 @@ Global
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{77BA2F61-6155-4283-BB39-F8E42F46A0B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5B53855C-4347-4402-B750-76C6295A35D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5B53855C-4347-4402-B750-76C6295A35D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5B53855C-4347-4402-B750-76C6295A35D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5B53855C-4347-4402-B750-76C6295A35D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5D41FFFF-816C-40B2-95CD-E2DDDCB83784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5D41FFFF-816C-40B2-95CD-E2DDDCB83784}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5D41FFFF-816C-40B2-95CD-E2DDDCB83784}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5D41FFFF-816C-40B2-95CD-E2DDDCB83784}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C2BB03A0-C35B-433F-96D4-3A06CBC06AD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C2BB03A0-C35B-433F-96D4-3A06CBC06AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C2BB03A0-C35B-433F-96D4-3A06CBC06AD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C2BB03A0-C35B-433F-96D4-3A06CBC06AD7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{04A56018-C41E-4634-A185-A13E9250C75A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{04A56018-C41E-4634-A185-A13E9250C75A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{04A56018-C41E-4634-A185-A13E9250C75A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{04A56018-C41E-4634-A185-A13E9250C75A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{07CCC11F-76CB-448E-B15A-72E09FBB348B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{07CCC11F-76CB-448E-B15A-72E09FBB348B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{07CCC11F-76CB-448E-B15A-72E09FBB348B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{07CCC11F-76CB-448E-B15A-72E09FBB348B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1D2F61B2-B1F4-45F0-83CA-03370FD6E62C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1D2F61B2-B1F4-45F0-83CA-03370FD6E62C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1D2F61B2-B1F4-45F0-83CA-03370FD6E62C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1D2F61B2-B1F4-45F0-83CA-03370FD6E62C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DE3DAF51-FB29-41FC-AF41-A4BA8D91BFB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DE3DAF51-FB29-41FC-AF41-A4BA8D91BFB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE3DAF51-FB29-41FC-AF41-A4BA8D91BFB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DE3DAF51-FB29-41FC-AF41-A4BA8D91BFB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2DADEAD3-0FE9-4199-9817-41A32E6BF450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2DADEAD3-0FE9-4199-9817-41A32E6BF450}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2DADEAD3-0FE9-4199-9817-41A32E6BF450}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2DADEAD3-0FE9-4199-9817-41A32E6BF450}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02356BD7-7E99-457B-BEFF-090CE4DF067D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{17A05AE2-21C8-4C1C-B422-6AB80F13F63E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17A05AE2-21C8-4C1C-B422-6AB80F13F63E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17A05AE2-21C8-4C1C-B422-6AB80F13F63E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17A05AE2-21C8-4C1C-B422-6AB80F13F63E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{95CE7371-17B6-4EEE-8E38-2FDE6347E955}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2C111161-B7C5-4869-9F52-EA725E64BA40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C4DF1A63-C9EB-4D8F-A4E5-4FD9249A5089}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
22
build/Jenkinsfile
vendored
22
build/Jenkinsfile
vendored
@ -29,7 +29,7 @@ pipeline {
|
||||
}
|
||||
}
|
||||
stage('Windows') {
|
||||
agent { label 'master' }
|
||||
agent { label 'win-core' }
|
||||
stages {
|
||||
stage('Components') {
|
||||
steps {
|
||||
@ -60,6 +60,8 @@ pipeline {
|
||||
parallel {
|
||||
stage('Unix') {
|
||||
agent { label 'net-core' }
|
||||
stages {
|
||||
stage('Components') {
|
||||
steps {
|
||||
sh "sh ./build/scripts/components.sh && cd ${env.WORKSPACE}/web/ASC.Web.Components && yarn test:coverage --ci --reporters=default --reporters=jest-junit || true"
|
||||
}
|
||||
@ -78,8 +80,17 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Files') {
|
||||
steps {
|
||||
sh "dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config && cd ${env.WORKSPACE}/products/ASC.Files/Tests/ && dotnet test ASC.Files.Tests.csproj -r linux-x64 -l \"console;verbosity=detailed\""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Windows') {
|
||||
agent { label 'master' }
|
||||
agent { label 'win-core' }
|
||||
stages {
|
||||
stage('Components') {
|
||||
steps {
|
||||
bat "sh build\\scripts\\components.sh && cd ${env.WORKSPACE}\\web\\ASC.Web.Components && yarn test:coverage --ci --reporters=default --reporters=jest-junit || true"
|
||||
}
|
||||
@ -97,6 +108,13 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Files') {
|
||||
steps {
|
||||
bat "dotnet restore ASC.Web.sln --configfile .nuget\\NuGet.Config && cd ${env.WORKSPACE}\\products\\ASC.Files\\Tests\\ && dotnet test ASC.Files.Tests.csproj"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Notify') {
|
||||
|
@ -21,8 +21,17 @@ call build\scripts\people.sh
|
||||
echo "ASC.Web.Files.Client"
|
||||
call build\scripts\files.sh
|
||||
|
||||
echo "ASC.UrlShortener"
|
||||
call build\scripts\urlshortener.sh
|
||||
|
||||
echo "ASC.Thumbnails"
|
||||
call build\scripts\thumbnails.sh
|
||||
|
||||
echo "ASC.Socket.IO"
|
||||
call build\scripts\socket.sh
|
||||
|
||||
echo "ASC.Web.sln"
|
||||
call dotnet build ASC.Web.sln /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
|
||||
call build\build.sln.bat
|
||||
|
||||
start /b call build\start\start.bat
|
||||
|
||||
|
2
build/build.sln.bat
Normal file
2
build/build.sln.bat
Normal file
@ -0,0 +1,2 @@
|
||||
PUSHD %~dp0..
|
||||
dotnet build ASC.Web.sln /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
|
75
build/install/docker/.env
Normal file
75
build/install/docker/.env
Normal file
@ -0,0 +1,75 @@
|
||||
# docker-compose tags #
|
||||
PRODUCT=onlyoffice
|
||||
REPO=${PRODUCT}
|
||||
STATUS=""
|
||||
SRV_VERSION=0.0.0
|
||||
MYSQL_VERSION=8.0.18
|
||||
ELK_VERSION=7.8.1
|
||||
SERVICE_PORT=5050
|
||||
CONTAINER_PREFIX=${PRODUCT}-
|
||||
|
||||
# zookeeper #
|
||||
ZOO_PORT=2181
|
||||
ZOO_HOST=${CONTAINER_PREFIX}zookeeper
|
||||
ZOO_SERVER=server.1=${ZOO_HOST}:2888:3888
|
||||
|
||||
# kafka #
|
||||
KAFKA_HOST=${CONTAINER_PREFIX}kafka
|
||||
KAFKA_ADVERTISED_LISTENERS=LISTENER_DOCKER_INTERNAL://${KAFKA_HOST}:9092
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME=LISTENER_DOCKER_INTERNAL
|
||||
KAFKA_ZOOKEEPER_CONNECT=${ZOO_HOST}:2181
|
||||
KAFKA_BROKER_ID=1
|
||||
KAFKA_LOG4J_LOGGERS=kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
|
||||
|
||||
# elasticsearch #
|
||||
ELK_HOST=${CONTAINER_PREFIX}elasticsearch
|
||||
|
||||
# app service environment #
|
||||
APP_DOTNET_ENV=test
|
||||
APP_CORE_BASE_DOMAIN=localhost
|
||||
APP_CORE_MACHINEKEY=your_core_machinekey
|
||||
|
||||
DOCUMENT_SERVER_JWT_SECRET=your_jwt_secret
|
||||
DOCUMENT_SERVER_JWT_HEADER=AuthorizationJwt
|
||||
DOCUMENT_SERVER_URL_PUBLIC=/ds-vpath/
|
||||
DOCUMENT_SERVER_URL_CONVERTER=/ds-vpath/ConvertService.ashx
|
||||
DOCUMENT_SERVER_HOST=${CONTAINER_PREFIX}document-server
|
||||
DOCUMENT_SERVER_URL_INTERNAL=http://${DOCUMENT_SERVER_HOST}/
|
||||
|
||||
MYSQL_ROOT_PASSWORD=my-secret-pw
|
||||
MYSQL_DATABASE=${PRODUCT}
|
||||
MYSQL_USER=${PRODUCT}_user
|
||||
MYSQL_PASSWORD=${PRODUCT}_pass
|
||||
MYSQL_HOST=${CONTAINER_PREFIX}mysql-server
|
||||
|
||||
# service host #
|
||||
API_HOST=${CONTAINER_PREFIX}api
|
||||
API_SYSTEM_HOST=${CONTAINER_PREFIX}api_system
|
||||
URLSHORTENER_HOST=${CONTAINER_PREFIX}urlshortener
|
||||
STUDIO_NOYIFY_HOST=${CONTAINER_PREFIX}studio.notify
|
||||
NOTIFY_HOST=${CONTAINER_PREFIX}notify
|
||||
PEOPLE_SERVER_HOST=${CONTAINER_PREFIX}people.server
|
||||
FILES_HOST=${CONTAINER_PREFIX}files
|
||||
FILES_SERVICES_HOST=${CONTAINER_PREFIX}files_services
|
||||
STUDIO_HOST=${CONTAINER_PREFIX}studio
|
||||
BACKUP_HOST=${CONTAINER_PREFIX}backup
|
||||
THUMBNAILS_HOST=${CONTAINER_PREFIX}thumbnails
|
||||
SOCKET_HOST=${CONTAINER_PREFIX}socket
|
||||
PROXY_HOST=${CONTAINER_PREFIX}proxy
|
||||
|
||||
# proxy upstream environment #
|
||||
SERVICE_API=${API_HOST}:${SERVICE_PORT}
|
||||
SERVICE_API_SYSTEM=${API_SYSTEM_HOST}:${SERVICE_PORT}
|
||||
SERVICE_URLSHORTENER=${URLSHORTENER_HOST}:${SERVICE_PORT}
|
||||
SERVICE_STUDIO_NOTIFY=${STUDIO_NOYIFY_HOST}:${SERVICE_PORT}
|
||||
SERVICE_PEOPLE_SERVER=${PEOPLE_SERVER_HOST}:${SERVICE_PORT}
|
||||
SERVICE_FILES=${FILES_HOST}:${SERVICE_PORT}
|
||||
SERVICE_FILES_SERVICES=${FILES_SERVICES_HOST}:${SERVICE_PORT}
|
||||
SERVICE_STUDIO=${STUDIO_HOST}:${SERVICE_PORT}
|
||||
SERVICE_BACKUP=${BACKUP_HOST}:${SERVICE_PORT}
|
||||
SERVICE_THUMBNAILS=${THUMBNAILS_HOST}:${SERVICE_PORT}
|
||||
SERVICE_SH=${URLSHORTENER_HOST}:9999
|
||||
|
||||
NETWORK_NAME=${PRODUCT}
|
@ -5,6 +5,7 @@ ARG RELEASE_DATE_SIGN=""
|
||||
ARG VERSION="8.9.0.190"
|
||||
ARG SOURCE_REPO_URL="deb http://static.teamlab.com.s3.amazonaws.com/repo/debian squeeze main"
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG GIT_BRANCH="develop"
|
||||
|
||||
LABEL onlyoffice.community.release-date="${RELEASE_DATE}" \
|
||||
onlyoffice.community.version="${VERSION}" \
|
||||
@ -15,6 +16,8 @@ ENV LANG=en_US.UTF-8 \
|
||||
LC_ALL=en_US.UTF-8
|
||||
|
||||
RUN apt-get -y update && \
|
||||
apt-get -y upgrade && \
|
||||
apt-get -y dist-upgrade && \
|
||||
apt-get -yq install gnupg2 ca-certificates && \
|
||||
apt-get install -yq sudo locales && \
|
||||
addgroup --system --gid 107 onlyoffice && \
|
||||
@ -24,6 +27,12 @@ RUN apt-get -y update && \
|
||||
locale-gen en_US.UTF-8 && \
|
||||
apt-get -y update && \
|
||||
apt-get install -yq software-properties-common wget curl cron rsyslog && \
|
||||
curl -OL http://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb && \
|
||||
echo "mysql-apt-config mysql-apt-config/repo-codename select bionic" | sudo debconf-set-selections && \
|
||||
echo "mysql-apt-config mysql-apt-config/repo-distro select ubuntu" | sudo debconf-set-selections && \
|
||||
echo "mysql-apt-config mysql-apt-config/select-server select mysql-8.0" | sudo debconf-set-selections && \
|
||||
DEBIAN_FRONTEND=noninteractive dpkg -i mysql-apt-config_0.8.15-1_all.deb && \
|
||||
rm -f mysql-apt-config_0.8.15-1_all.deb && \
|
||||
wget http://nginx.org/keys/nginx_signing.key && \
|
||||
apt-key add nginx_signing.key && \
|
||||
echo "deb http://nginx.org/packages/mainline/ubuntu/ bionic nginx" >> /etc/apt/sources.list.d/nginx.list && \
|
||||
@ -33,9 +42,9 @@ RUN apt-get -y update && \
|
||||
apt-get install -yq apt-transport-https && \
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
|
||||
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official.list && \
|
||||
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-6.x.list && \
|
||||
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-7.x.list && \
|
||||
apt-get -y update && \
|
||||
apt-get install -yq elasticsearch=6.5.0 && \
|
||||
apt-get install -yq elasticsearch=7.4.0 && \
|
||||
add-apt-repository -y ppa:certbot/certbot && \
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
@ -46,9 +55,9 @@ RUN apt-get -y update && \
|
||||
apt-get -y update && \
|
||||
apt-get install -yq nginx && \
|
||||
cd ~ && \
|
||||
wget http://www-us.apache.org/dist/kafka/2.2.1/kafka_2.12-2.2.1.tgz && \
|
||||
tar xzf kafka_2.12-2.2.1.tgz && \
|
||||
rm kafka_2.12-2.2.1.tgz && \
|
||||
wget https://downloads.apache.org/kafka/2.5.0/kafka_2.12-2.5.0.tgz && \
|
||||
tar xzf kafka_2.12-2.5.0.tgz && \
|
||||
rm kafka_2.12-2.5.0.tgz && \
|
||||
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
apt-get install -yq libgdiplus \
|
||||
python-certbot-nginx \
|
||||
@ -67,11 +76,13 @@ RUN apt-get -y update && \
|
||||
mysql-client \
|
||||
mysql-server
|
||||
|
||||
RUN git clone https://github.com/ONLYOFFICE/AppServer.git /app/onlyoffice/src/
|
||||
RUN git clone https://github.com/ONLYOFFICE/AppServer.git /app/onlyoffice/src/ && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
git checkout ${GIT_BRANCH} && \
|
||||
git pull
|
||||
|
||||
RUN cd /app/onlyoffice/src/ && \
|
||||
yarn install --cwd web/ASC.Web.Components --frozen-lockfile > build/ASC.Web.Components.log && \
|
||||
npm run build --prefix web/ASC.Web.Components && \
|
||||
yarn pack --cwd web/ASC.Web.Components
|
||||
|
||||
RUN cd /app/onlyoffice/src/ && \
|
||||
@ -79,7 +90,6 @@ RUN cd /app/onlyoffice/src/ && \
|
||||
yarn remove asc-web-components --cwd web/ASC.Web.Common --peer && \
|
||||
yarn add file:../../$component --cwd web/ASC.Web.Common --cache-folder ../../yarn --peer && \
|
||||
yarn install --cwd web/ASC.Web.Common --frozen-lockfile > build/ASC.Web.Common.log && \
|
||||
npm run build --prefix web/ASC.Web.Common && \
|
||||
yarn pack --cwd web/ASC.Web.Common
|
||||
|
||||
RUN cd /app/onlyoffice/src/ && \
|
||||
@ -99,6 +109,18 @@ RUN cd /app/onlyoffice/src/ && \
|
||||
mkdir -p /var/www/studio/client && \
|
||||
cp -rf web/ASC.Web.Client/build/* /var/www/studio/client
|
||||
|
||||
RUN cd /app/onlyoffice/src/ && \
|
||||
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
|
||||
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
|
||||
yarn remove asc-web-components asc-web-common --cwd products/ASC.Files/Client && \
|
||||
yarn add ../../../$component --cwd products/ASC.Files/Client --cache-folder ../../../yarn && \
|
||||
yarn add ../../../$common --cwd products/ASC.Files/Client --cache-folder ../../../yarn && \
|
||||
yarn install --cwd products/ASC.Files/Client --frozen-lockfile || (cd products/ASC.Files/Client && npm i && cd ../../../) && \
|
||||
npm run build --prefix products/ASC.Files/Client && \
|
||||
mkdir -p /var/www/products/ASC.Files/client && \
|
||||
cp -Rf products/ASC.Files/Client/build/* /var/www/products/ASC.Files/client && \
|
||||
mkdir -p /var/www/products/ASC.Files/client/products/files
|
||||
|
||||
RUN cd /app/onlyoffice/src/ && \
|
||||
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
|
||||
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
|
||||
@ -113,40 +135,73 @@ RUN cd /app/onlyoffice/src/ && \
|
||||
|
||||
RUN cd /app/onlyoffice/src/ && \
|
||||
rm -f /etc/nginx/conf.d/* && \
|
||||
cp -rf config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \
|
||||
mkdir -p /var/www/public/ && cp -f public/* /var/www/public/ && \
|
||||
mkdir -p /app/onlyoffice/config/ && cp -rf config/* /app/onlyoffice/config/ && \
|
||||
cp -f config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \
|
||||
mkdir -p /etc/nginx/includes/ && cp -f config/nginx/includes/onlyoffice*.conf /etc/nginx/includes/ && \
|
||||
sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config && \
|
||||
dotnet build -r linux-x64 ASC.Web.sln && \
|
||||
cd products/ASC.People/Server && \
|
||||
dotnet -d publish -o /var/www/products/ASC.People/server && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.People/server && \
|
||||
cd ../../../ && \
|
||||
cd products/ASC.Files/Server && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.Files/server && \
|
||||
cp -avrf DocStore /var/www/products/ASC.Files/server/ && \
|
||||
cd ../../../ && \
|
||||
cd products/ASC.Files/Service && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.Files/service && \
|
||||
cd ../../../ && \
|
||||
cd web/ASC.Web.Api && \
|
||||
dotnet -d publish -o /var/www/studio/api && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/studio/api && \
|
||||
cd ../../ && \
|
||||
cd web/ASC.Web.Studio && \
|
||||
dotnet -d publish -o /var/www/studio/server && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/studio/server && \
|
||||
cd ../../ && \
|
||||
cd common/services/ASC.Notify && \
|
||||
dotnet -d publish -o /var/www/services/notify && \
|
||||
cd common/services/ASC.Data.Backup && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/backup && \
|
||||
cd ../../../ && \
|
||||
cd common/services/ASC.Notify && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/notify && \
|
||||
cd ../../../ && \
|
||||
cd common/services/ASC.ApiSystem && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/apisystem && \
|
||||
cd ../../../ && \
|
||||
cd common/services/ASC.Thumbnails.Svc && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/thumb/service && \
|
||||
cd ../../../ && \
|
||||
yarn install --cwd common/ASC.Thumbnails --frozen-lockfile && \
|
||||
mkdir -p /var/www/services/thumb/client && cp -Rf common/ASC.Thumbnails/* /var/www/services/thumb/client && \
|
||||
cd common/services/ASC.UrlShortener.Svc && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/urlshortener/service && \
|
||||
cd ../../../ && \
|
||||
yarn install --cwd common/ASC.UrlShortener --frozen-lockfile && \
|
||||
mkdir -p /var/www/services/urlshortener/client && cp -Rf common/ASC.UrlShortener/* /var/www/services/urlshortener/client && \
|
||||
cd common/services/ASC.Studio.Notify && \
|
||||
dotnet -d publish -o /var/www/services/studio.notify
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/studio.notify
|
||||
|
||||
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
|
||||
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
RUN sed -i 's/172.18.0.5/localhost/' /app/onlyoffice/config/appsettings.test.json
|
||||
COPY config/createdb.sql /app/onlyoffice/createdb.sql
|
||||
COPY config/onlyoffice.sql /app/onlyoffice/onlyoffice.sql
|
||||
COPY config/onlyoffice.data.sql /app/onlyoffice/onlyoffice.data.sql
|
||||
COPY config/onlyoffice.resources.sql /app/onlyoffice/onlyoffice.resources.sql
|
||||
|
||||
RUN sed -i 's/Server=.*;Port=/Server=127.0.0.1;Port=/' /app/onlyoffice/config/appsettings.test.json
|
||||
|
||||
RUN mkdir -p /var/mysqld/ && \
|
||||
chown -R mysql:mysql /var/lib/mysql /var/run/mysqld /var/mysqld/ && \
|
||||
service mysql start && \
|
||||
sudo -u mysql bash -c "/usr/bin/pidproxy /var/mysqld/mysqld.pid /usr/bin/mysqld_safe --pid-file=/var/mysqld/mysqld.pid &" && \
|
||||
sleep 5s && \
|
||||
mysql -e "CREATE DATABASE IF NOT EXISTS onlyoffice CHARACTER SET utf8 COLLATE 'utf8_general_ci'" && \
|
||||
mysql -D "onlyoffice" < /app/onlyoffice/src/sql/app.sql && \
|
||||
mysql -D "onlyoffice" < /app/onlyoffice/src/sql/app.data.sql && \
|
||||
mysql -D "onlyoffice" < /app/onlyoffice/createdb.sql && \
|
||||
mysql -D "onlyoffice" < /app/onlyoffice/onlyoffice.sql && \
|
||||
mysql -D "onlyoffice" < /app/onlyoffice/onlyoffice.data.sql && \
|
||||
mysql -D "onlyoffice" < /app/onlyoffice/onlyoffice.resources.sql && \
|
||||
mysql -D "onlyoffice" -e 'CREATE USER IF NOT EXISTS "onlyoffice_user"@"localhost" IDENTIFIED WITH mysql_native_password BY "onlyoffice_pass";' && \
|
||||
mysql -D "onlyoffice" -e 'GRANT ALL PRIVILEGES ON *.* TO 'onlyoffice_user'@'localhost' IDENTIFIED BY "onlyoffice_pass";' && \
|
||||
mysql -D "onlyoffice" -e 'UPDATE core_user SET email = "paul.bannov@gmail.com";' && \
|
||||
mysql -D "onlyoffice" -e 'UPDATE core_usersecurity SET pwdhash = "vLFfghR5tNV3K9DKhmwArV+SbjWAcgZZzIDTnJ0JgCo=", pwdhashsha512 = "USubvPlB+ogq0Q1trcSupg==";' && \
|
||||
service mysql stop
|
||||
mysql -D "onlyoffice" -e 'GRANT ALL PRIVILEGES ON *.* TO 'onlyoffice_user'@'localhost';' && \
|
||||
killall -u mysql -n mysql
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
366
build/install/docker/Dockerfile-app
Normal file
366
build/install/docker/Dockerfile-app
Normal file
@ -0,0 +1,366 @@
|
||||
### STAGE 1: Develop ######
|
||||
FROM ubuntu:18.04 AS develop
|
||||
|
||||
ARG RELEASE_DATE="2016-06-21"
|
||||
ARG VERSION="8.9.0.190"
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG GIT_BRANCH="master"
|
||||
|
||||
LABEL onlyoffice.appserver.release-date="${RELEASE_DATE}" \
|
||||
onlyoffice.appserver.version="${VERSION}" \
|
||||
maintainer="Ascensio System SIA <support@onlyoffice.com>"
|
||||
|
||||
ENV LANG=en_US.UTF-8 \
|
||||
LANGUAGE=en_US:en \
|
||||
LC_ALL=en_US.UTF-8
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
apt-get -y update && \
|
||||
apt-get -y upgrade && \
|
||||
apt-get -y dist-upgrade && \
|
||||
apt-get install -yq sudo locales && \
|
||||
addgroup --system --gid 107 onlyoffice && \
|
||||
adduser -uid 104 --quiet --home /var/www/onlyoffice --system --gid 107 onlyoffice && \
|
||||
locale-gen en_US.UTF-8 && \
|
||||
apt-get -y update && \
|
||||
apt-get install -yq software-properties-common wget curl && \
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - && \
|
||||
apt-get install -y nodejs && \
|
||||
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - && \
|
||||
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \
|
||||
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
|
||||
dpkg -i packages-microsoft-prod.deb && \
|
||||
apt-get -y update && \
|
||||
cd ~ && \
|
||||
echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \
|
||||
apt-get install -yq git \
|
||||
yarn \
|
||||
dotnet-sdk-3.1
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
git clone --depth 1 -b ${GIT_BRANCH} https://github.com/ONLYOFFICE/AppServer.git /app/onlyoffice/src/
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
yarn install --cwd web/ASC.Web.Components --frozen-lockfile > build/ASC.Web.Components.log && \
|
||||
yarn pack --cwd web/ASC.Web.Components
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
|
||||
yarn remove asc-web-components --cwd web/ASC.Web.Common --peer && \
|
||||
yarn add file:../../$component --cwd web/ASC.Web.Common --cache-folder ../../yarn --peer && \
|
||||
yarn install --cwd web/ASC.Web.Common --frozen-lockfile > build/ASC.Web.Common.log && \
|
||||
yarn pack --cwd web/ASC.Web.Common
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
npm run build:storybook --prefix web/ASC.Web.Components && \
|
||||
mkdir -p /var/www/story/ && \
|
||||
cp -Rf web/ASC.Web.Components/storybook-static/* /var/www/story/
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
|
||||
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
|
||||
yarn remove asc-web-components asc-web-common --cwd web/ASC.Web.Client && \
|
||||
yarn add ../../$component --cwd web/ASC.Web.Client --cache-folder ../../yarn && \
|
||||
yarn add ../../$common --cwd web/ASC.Web.Client --cache-folder ../../yarn && \
|
||||
yarn install --cwd web/ASC.Web.Client --frozen-lockfile || (cd web/ASC.Web.Client && npm i && cd ../../) && \
|
||||
npm run build --prefix web/ASC.Web.Client && \
|
||||
rm -rf /var/www/studio/client/* && \
|
||||
mkdir -p /var/www/studio/client && \
|
||||
cp -rf web/ASC.Web.Client/build/* /var/www/studio/client
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
|
||||
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
|
||||
yarn remove asc-web-components asc-web-common --cwd products/ASC.Files/Client && \
|
||||
yarn add ../../../$component --cwd products/ASC.Files/Client --cache-folder ../../../yarn && \
|
||||
yarn add ../../../$common --cwd products/ASC.Files/Client --cache-folder ../../../yarn && \
|
||||
yarn install --cwd products/ASC.Files/Client --frozen-lockfile || (cd products/ASC.Files/Client && npm i && cd ../../../) && \
|
||||
npm run build --prefix products/ASC.Files/Client && \
|
||||
mkdir -p /var/www/products/ASC.Files/client && \
|
||||
cp -Rf products/ASC.Files/Client/build/* /var/www/products/ASC.Files/client && \
|
||||
mkdir -p /var/www/products/ASC.Files/client/products/files
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
component=$(ls web/ASC.Web.Components/asc-web-components-v1.*.tgz) && \
|
||||
common=$(ls web/ASC.Web.Common/asc-web-common-v1.*.tgz) && \
|
||||
yarn remove asc-web-components asc-web-common --cwd products/ASC.People/Client && \
|
||||
yarn add ../../../$component --cwd products/ASC.People/Client --cache-folder ../../../yarn && \
|
||||
yarn add ../../../$common --cwd products/ASC.People/Client --cache-folder ../../../yarn && \
|
||||
yarn install --cwd products/ASC.People/Client --frozen-lockfile || (cd products/ASC.People/Client && npm i && cd ../../../) && \
|
||||
npm run build --prefix products/ASC.People/Client && \
|
||||
mkdir -p /var/www/products/ASC.People/client && \
|
||||
cp -Rf products/ASC.People/Client/build/* /var/www/products/ASC.People/client && \
|
||||
mkdir -p /var/www/products/ASC.People/client/products/people
|
||||
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
cd /app/onlyoffice/src/ && \
|
||||
#rm -f /etc/nginx/conf.d/* && \
|
||||
mkdir -p /etc/nginx/conf.d/ && \
|
||||
mkdir -p /var/www/public/ && cp -f public/* /var/www/public/ && \
|
||||
mkdir -p /app/onlyoffice/config/ && cp -rf config/* /app/onlyoffice/config/ && \
|
||||
cp -f config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \
|
||||
mkdir -p /etc/nginx/includes/ && cp -f config/nginx/includes/onlyoffice*.conf /etc/nginx/includes/ && \
|
||||
sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config && \
|
||||
dotnet build -r linux-x64 ASC.Web.sln && \
|
||||
cd products/ASC.People/Server && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.People/server && \
|
||||
cd ../../../ && \
|
||||
cd products/ASC.Files/Server && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.Files/server && \
|
||||
cp -avrf DocStore /var/www/products/ASC.Files/server/ && \
|
||||
cd ../../../ && \
|
||||
cd products/ASC.Files/Service && \
|
||||
dotnet add ASC.Files.Service.csproj reference ../../ASC.People/Server/ASC.People.csproj ../Server/ASC.Files.csproj && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.Files/service && \
|
||||
cd ../../../ && \
|
||||
cd web/ASC.Web.Api && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/studio/api && \
|
||||
cd ../../ && \
|
||||
cd web/ASC.Web.Studio && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/studio/server && \
|
||||
cd ../../ && \
|
||||
cd common/services/ASC.Data.Backup && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/backup && \
|
||||
cd ../../../ && \
|
||||
cd common/services/ASC.Notify && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/notify && \
|
||||
cd ../../../ && \
|
||||
cd common/services/ASC.ApiSystem && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/apisystem && \
|
||||
cd ../../../ && \
|
||||
cd common/services/ASC.Thumbnails.Svc && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/thumb/service && \
|
||||
cd ../../../ && \
|
||||
yarn install --cwd common/ASC.Thumbnails --frozen-lockfile && \
|
||||
mkdir -p /var/www/services/thumb/client && cp -Rf common/ASC.Thumbnails/* /var/www/services/thumb/client && \
|
||||
|
||||
cd common/services/ASC.UrlShortener.Svc && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/urlshortener/service && \
|
||||
cd ../../../ && \
|
||||
yarn install --cwd common/ASC.UrlShortener --frozen-lockfile && \
|
||||
mkdir -p /var/www/services/urlshortener/client && cp -Rf common/ASC.UrlShortener/* /var/www/services/urlshortener/client && \
|
||||
|
||||
cd common/services/ASC.Socket.IO.Svc && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /services/socket/service && \
|
||||
cd ../../../ && \
|
||||
yarn install --cwd common/ASC.Socket.IO --frozen-lockfile && \
|
||||
mkdir -p /var/www/services/socket/client && cp -Rf common/ASC.Socket.IO/* /var/www/services/socket/client && \
|
||||
|
||||
cd common/services/ASC.Studio.Notify && \
|
||||
dotnet add ASC.Studio.Notify.csproj reference ../../../products/ASC.People/Server/ASC.People.csproj ../../../products/ASC.Files/Server/ASC.Files.csproj && \
|
||||
dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/services/studio.notify
|
||||
|
||||
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
|
||||
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
|
||||
RUN sed -i 's/Server=.*;Port=/Server=127.0.0.1;Port=/' /app/onlyoffice/config/appsettings.test.json
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
### STAGE 2: Build ###
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 as builder
|
||||
|
||||
COPY --from=develop /app/onlyoffice/config/ /app/onlyoffice/config/
|
||||
|
||||
# add defualt user and group for no-root run
|
||||
RUN mkdir -p /var/log/onlyoffice && \
|
||||
mkdir -p /app/onlyoffice/data && \
|
||||
mkdir -p /var/www/services/backup && \
|
||||
addgroup --system --gid 107 onlyoffice && \
|
||||
adduser -uid 104 --quiet --home /var/www/onlyoffice --system --gid 107 onlyoffice && \
|
||||
chown onlyoffice:onlyoffice /app/onlyoffice -R && \
|
||||
chown onlyoffice:onlyoffice /var/log -R && \
|
||||
chown onlyoffice:onlyoffice /var/www -R
|
||||
RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \
|
||||
apt-get -y update && \
|
||||
apt-get -y upgrade && \
|
||||
apt-get install -yq nano &&\
|
||||
apt-get install -yq jq &&\
|
||||
apt-get install -yq nodejs &&\
|
||||
apt-get install -yq libgdiplus
|
||||
|
||||
#USER onlyoffice
|
||||
EXPOSE 5050
|
||||
|
||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||
|
||||
### STAGE 3: Run ###
|
||||
|
||||
## NGINX ##
|
||||
FROM nginx:stable-alpine AS web
|
||||
|
||||
# Remove default nginx website
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# copy artefacts and config values for nginx
|
||||
COPY --from=develop /etc/nginx/conf.d /etc/nginx/conf.d
|
||||
COPY --from=develop /etc/nginx/includes /etc/nginx/includes
|
||||
COPY --from=develop /var/www/story /var/www/story
|
||||
COPY --from=develop /var/www/products/ASC.Files/client /var/www/products/ASC.Files/client
|
||||
COPY --from=develop /var/www/products/ASC.People/client /var/www/products/ASC.People/client
|
||||
COPY --from=develop /var/www/public /var/www/public
|
||||
COPY --from=develop /var/www/studio/client /var/www/studio/client
|
||||
COPY /config/nginx/templates/upstream.conf.template /etc/nginx/templates/upstream.conf.template
|
||||
|
||||
# add defualt user and group for no-root run
|
||||
RUN chown nginx:nginx /etc/nginx/* -R &&\
|
||||
chown nginx:nginx /docker-entrypoint.d/* &&\
|
||||
# changes for upstream configure
|
||||
sed -i 's/localhost:5000/$service_api/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5010/$service_api_system/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5004/$service_people_server/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5007/$service_files/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5003/$service_studio/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5012/$service_backup/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:9999/$service_sh/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/172.*/$document_server;/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
# configute the image nginx whith less privileged https://hub.docker.com/_/nginx
|
||||
sed -i 's/pid.*nginx.pid;/pid \/tmp\/nginx.pid;/' /etc/nginx/nginx.conf && \
|
||||
sed -i 's/http.*{/http {\n client_body_temp_path \/tmp\/client_temp;\n proxy_temp_path \/tmp\/proxy_temp_path;\n fastcgi_temp_path \/tmp\/fastcgi_temp;\n uwsgi_temp_path \/tmp\/uwsgi_temp;\n scgi_temp_path \/tmp\/scgi_temp;/' /etc/nginx/nginx.conf
|
||||
|
||||
|
||||
## backup ##
|
||||
FROM builder AS backup
|
||||
|
||||
WORKDIR /var/www/services/backup/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/backup/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
|
||||
CMD ["ASC.Data.Backup.dll", "backup", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
||||
|
||||
## api ##
|
||||
FROM builder AS api
|
||||
|
||||
WORKDIR /var/www/studio/api/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/studio/api .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
|
||||
CMD ["ASC.Web.Api.dll", "api"]
|
||||
|
||||
## api_system ##
|
||||
FROM builder AS api_system
|
||||
|
||||
WORKDIR /var/www/services/apisystem/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/apisystem/ .
|
||||
|
||||
CMD ["ASC.ApiSystem.dll", "api_system"]
|
||||
|
||||
## urlshortener ##
|
||||
FROM builder AS urlshortener
|
||||
|
||||
WORKDIR /services/urlshortener/service/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /services/urlshortener/service/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/urlshortener/client /services/urlshortener/client
|
||||
CMD ["ASC.UrlShortener.Svc.dll", "urlshortener"]
|
||||
|
||||
|
||||
## studio.notify ##
|
||||
FROM builder AS studio.notify
|
||||
|
||||
WORKDIR /var/www/services/studio.notify/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop /var/www/services/studio.notify/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
|
||||
CMD ["ASC.Studio.Notify.dll", "studio.notify", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
||||
|
||||
|
||||
## notify ##
|
||||
FROM builder AS notify
|
||||
|
||||
WORKDIR /var/www/services/notify/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop /var/www/services/notify/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
|
||||
CMD ["ASC.Notify.dll", "notify", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
||||
|
||||
## people.server ##
|
||||
FROM builder AS people.server
|
||||
|
||||
WORKDIR /var/www/products/ASC.People/server/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
|
||||
CMD ["ASC.People.dll", "people.server"]
|
||||
|
||||
## files ##
|
||||
FROM builder AS files
|
||||
|
||||
WORKDIR /var/www/products/ASC.Files/server/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
|
||||
|
||||
CMD ["ASC.Files.dll", "files"]
|
||||
|
||||
## files_services ##
|
||||
FROM builder AS files_services
|
||||
|
||||
WORKDIR /var/www/products/ASC.Files/service/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/service/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People*.dll /var/www/products/ASC.People/server/
|
||||
|
||||
CMD ["ASC.Files.Service.dll", "files_services", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
||||
|
||||
## studio ##
|
||||
FROM builder AS studio
|
||||
|
||||
WORKDIR /var/www/studio/server/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/studio/server/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.Files/server/ASC.Files*.dll /var/www/products/ASC.Files/server/
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/products/ASC.People/server/ASC.People.dll /var/www/products/ASC.People/server/
|
||||
|
||||
CMD ["ASC.Web.Studio.dll", "studio"]
|
||||
|
||||
## thumbnails ##
|
||||
FROM builder AS thumbnails
|
||||
|
||||
WORKDIR /services/thumbnails/service
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /services/thumb/service/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/thumb/client /services/thumbnails/client
|
||||
|
||||
CMD ["ASC.Thumbnails.Svc.dll", "thumbnails"]
|
||||
|
||||
## socket ##
|
||||
FROM builder AS socket
|
||||
|
||||
WORKDIR /services/socket/service
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /services/socket/service/ .
|
||||
COPY --from=develop --chown=onlyoffice:onlyoffice /var/www/services/socket/client /services/ASC.Socket.IO
|
||||
|
||||
CMD ["ASC.Socket.IO.Svc.dll", "socket"]
|
27
build/install/docker/Readme.md
Normal file
27
build/install/docker/Readme.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Getting Started
|
||||
|
||||
* Download App run: git clone git clone https://github.com/ONLYOFFICE/AppServer.git
|
||||
* cd ./AppServer/build/install/docker/
|
||||
|
||||
# Installation
|
||||
|
||||
* Build Appserver docker microservices run: docker-compose -f build.yml build
|
||||
|
||||
* In file .env check values and if it needs modify for JSON Web Token validation:
|
||||
- list of values:
|
||||
- DOCUMENT_SERVER_JWT_SECRET
|
||||
- APP_CORE_MACHINEKEY
|
||||
- DOCUMENT_SERVER_JWT_HEADER
|
||||
|
||||
* Run Appserver with Community Server:
|
||||
- check file appserver.yml before running:
|
||||
- app_data:/app/onlyoffice/data should be commented,
|
||||
- /app/onlyoffice CommunityServer/data:/app/onlyoffice/data should be uncommented
|
||||
- docker-compose -f appserver.yml up -d
|
||||
|
||||
* Run standlone Appserver:
|
||||
- check file appserver.yml before running:
|
||||
- app_data:/app/onlyoffice/data should be uncommented,
|
||||
- /app/onlyoffice CommunityServer/data:/app/onlyoffice/data should be commented
|
||||
- docker-compose -f db.yml up -d
|
||||
- docker-compose -f ds.yml -f appserver.yml up -d
|
196
build/install/docker/appserver.yml
Normal file
196
build/install/docker/appserver.yml
Normal file
@ -0,0 +1,196 @@
|
||||
version: "3.6"
|
||||
x-service:
|
||||
&x-service-base
|
||||
container_name: base
|
||||
restart: always
|
||||
expose:
|
||||
- ${SERVICE_PORT}
|
||||
environment:
|
||||
MYSQL_HOST: ${MYSQL_HOST}
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||
MYSQL_USER: ${MYSQL_USER}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
APP_DOTNET_ENV: ${APP_DOTNET_ENV}
|
||||
APP_CORE_BASE_DOMAIN: ${APP_CORE_BASE_DOMAIN}
|
||||
APP_CORE_MACHINEKEY: ${APP_CORE_MACHINEKEY}
|
||||
DOCUMENT_SERVER_JWT_SECRET: ${DOCUMENT_SERVER_JWT_SECRET}
|
||||
DOCUMENT_SERVER_JWT_HEADER: ${DOCUMENT_SERVER_JWT_HEADER}
|
||||
DOCUMENT_SERVER_URL_PUBLIC: ${DOCUMENT_SERVER_URL_PUBLIC}
|
||||
DOCUMENT_SERVER_URL_INTERNAL: ${DOCUMENT_SERVER_URL_INTERNAL}
|
||||
DOCUMENT_SERVER_URL_CONVERTER: ${DOCUMENT_SERVER_URL_CONVERTER}
|
||||
KAFKA_HOST: ${KAFKA_HOST}
|
||||
ELK_HOST: ${ELK_HOST}
|
||||
PROXY_HOST: ${PROXY_HOST}
|
||||
volumes:
|
||||
#- /app/onlyoffice/CommunityServer/data:/app/onlyoffice/data
|
||||
- app_data:/app/onlyoffice/data
|
||||
|
||||
services:
|
||||
onlyoffice-elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION}
|
||||
container_name: ${ELK_HOST}
|
||||
restart: always
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
- bootstrap.memory_lock=true
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
nofile:
|
||||
soft: 65535
|
||||
hard: 65535
|
||||
volumes:
|
||||
- es_data:/usr/share/elasticsearch/data
|
||||
expose:
|
||||
- "9200"
|
||||
- "9300"
|
||||
|
||||
onlyoffice-zookeeper:
|
||||
image: zookeeper:latest
|
||||
container_name: ${ZOO_HOST}
|
||||
restart: always
|
||||
expose:
|
||||
- "2181"
|
||||
environment:
|
||||
ZOO_MY_ID: 1
|
||||
ZOO_PORT: ${ZOO_PORT:-2181}
|
||||
ZOO_SERVER: ${ZOO_SERVER}
|
||||
volumes:
|
||||
- zoo_data:/data
|
||||
- zoo_log:/datalog
|
||||
|
||||
onlyoffice-kafka:
|
||||
image: confluentinc/cp-kafka:latest
|
||||
container_name: ${KAFKA_HOST}
|
||||
restart: always
|
||||
expose:
|
||||
- "9092"
|
||||
depends_on:
|
||||
- onlyoffice-zookeeper
|
||||
environment:
|
||||
KAFKA_ADVERTISED_LISTENERS: ${KAFKA_ADVERTISED_LISTENERS}
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: ${KAFKA_LISTENER_SECURITY_PROTOCOL_MAP}
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: ${KAFKA_INTER_BROKER_LISTENER_NAME}
|
||||
KAFKA_ZOOKEEPER_CONNECT: ${KAFKA_ZOOKEEPER_CONNECT}
|
||||
KAFKA_BROKER_ID: ${KAFKA_BROKER_ID}
|
||||
KAFKA_LOG4J_LOGGERS: ${KAFKA_LOG4J_LOGGERS}
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: ${KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR}
|
||||
volumes:
|
||||
- kafka_data:/var/lib/kafka/data
|
||||
|
||||
onlyoffice-api:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-api:${SRV_VERSION}"
|
||||
container_name: ${API_HOST}
|
||||
|
||||
onlyoffice-api_system:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-api_system:${SRV_VERSION}"
|
||||
container_name: ${API_SYSTEM_HOST}
|
||||
|
||||
onlyoffice-urlshortener:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-urlshortener:${SRV_VERSION}"
|
||||
container_name: ${URLSHORTENER_HOST}
|
||||
expose:
|
||||
- "9999"
|
||||
- ${SERVICE_PORT}
|
||||
|
||||
onlyoffice-studio.notify:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-studio.notify:${SRV_VERSION}"
|
||||
container_name: ${STUDIO_NOYIFY_HOST}
|
||||
|
||||
onlyoffice-notify:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-notify:${SRV_VERSION}"
|
||||
container_name: ${NOTIFY_HOST}
|
||||
|
||||
onlyoffice-people.server:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-people.server:${SRV_VERSION}"
|
||||
container_name: ${PEOPLE_SERVER_HOST}
|
||||
|
||||
onlyoffice-files:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-files:${SRV_VERSION}"
|
||||
container_name: ${FILES_HOST}
|
||||
|
||||
onlyoffice-files_services:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-files_services:${SRV_VERSION}"
|
||||
container_name: ${FILES_SERVICES_HOST}
|
||||
|
||||
onlyoffice-studio:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-studio:${SRV_VERSION}"
|
||||
container_name: ${STUDIO_HOST}
|
||||
|
||||
onlyoffice-backup:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
|
||||
container_name: ${BACKUP_HOST}
|
||||
|
||||
onlyoffice-thumbnails:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-thumbnails:${SRV_VERSION}"
|
||||
container_name: ${THUMBNAILS_HOST}
|
||||
|
||||
onlyoffice-socket:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-socket:${SRV_VERSION}"
|
||||
container_name: ${SOCKET_HOST}
|
||||
|
||||
onlyoffice-proxy:
|
||||
image: "${REPO}/${STATUS}appserver-proxy:${SRV_VERSION}"
|
||||
container_name: ${PROXY_HOST}
|
||||
restart: always
|
||||
expose:
|
||||
- "8081"
|
||||
- "8099"
|
||||
ports:
|
||||
- 8092:8092
|
||||
depends_on:
|
||||
- onlyoffice-api
|
||||
- onlyoffice-api_system
|
||||
- onlyoffice-urlshortener
|
||||
- onlyoffice-studio.notify
|
||||
- onlyoffice-notify
|
||||
- onlyoffice-people.server
|
||||
- onlyoffice-files
|
||||
- onlyoffice-files_services
|
||||
- onlyoffice-studio
|
||||
- onlyoffice-backup
|
||||
- onlyoffice-thumbnails
|
||||
environment:
|
||||
- SERVICE_API=${SERVICE_API}
|
||||
- SERVICE_API_SYSTEM=${SERVICE_API_SYSTEM}
|
||||
- SERVICE_URLSHORTENER=${SERVICE_URLSHORTENER}
|
||||
- SERVICE_STUDIO_NOTIFY=${SERVICE_STUDIO_NOTIFY}
|
||||
- SERVICE_PEOPLE_SERVER=${SERVICE_PEOPLE_SERVER}
|
||||
- SERVICE_FILES=${SERVICE_FILES}
|
||||
- SERVICE_FILES_SERVICES=${SERVICE_FILES_SERVICES}
|
||||
- SERVICE_STUDIO=${SERVICE_STUDIO}
|
||||
- SERVICE_BACKUP=${SERVICE_BACKUP}
|
||||
- SERVICE_THUMBNAILS=${SERVICE_THUMBNAILS}
|
||||
- SERVICE_SH=${SERVICE_SH}
|
||||
- DOCUMENT_SERVER=${DOCUMENT_SERVER_HOST}
|
||||
- SERVICE_PORT=${SERVICE_PORT}
|
||||
volumes:
|
||||
- proxy_log:/var/log/nginx
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: ${NETWORK_NAME}
|
||||
|
||||
volumes:
|
||||
kafka_data:
|
||||
zoo_data:
|
||||
zoo_log:
|
||||
proxy_log:
|
||||
app_data:
|
||||
es_data:
|
93
build/install/docker/build.yml
Normal file
93
build/install/docker/build.yml
Normal file
@ -0,0 +1,93 @@
|
||||
version: "3.6"
|
||||
|
||||
services:
|
||||
onlyoffice-api:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: api
|
||||
image: "${REPO}/${STATUS}appserver-api:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-api_system:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: api_system
|
||||
image: "${REPO}/${STATUS}appserver-api_system:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-urlshortener:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: urlshortener
|
||||
image: "${REPO}/${STATUS}appserver-urlshortener:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-studio.notify:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: studio.notify
|
||||
image: "${REPO}/${STATUS}appserver-studio.notify:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-notify:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: notify
|
||||
image: "${REPO}/${STATUS}appserver-notify:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-people.server:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: people.server
|
||||
image: "${REPO}/${STATUS}appserver-people.server:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-files:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: files
|
||||
image: "${REPO}/${STATUS}appserver-files:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-files_services:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: files_services
|
||||
image: "${REPO}/${STATUS}appserver-files_services:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-studio:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: studio
|
||||
image: "${REPO}/${STATUS}appserver-studio:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-backup:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: backup
|
||||
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-thumbnails:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: thumbnails
|
||||
image: "${REPO}/${STATUS}appserver-thumbnails:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-proxy:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: web
|
||||
image: "${REPO}/${STATUS}appserver-proxy:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-socket:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
target: socket
|
||||
image: "${REPO}/${STATUS}appserver-socket:${SRV_VERSION}"
|
4
build/install/docker/config/createdb.sql
Normal file
4
build/install/docker/config/createdb.sql
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE DATABASE IF NOT EXISTS `DB_NAME` CHARACTER SET utf8 COLLATE 'utf8_general_ci';
|
||||
use `DB_NAME`;
|
||||
set @@global.max_allowed_packet = 104857600;
|
||||
set @@global.group_concat_max_len = 20971520;
|
266362
build/install/docker/config/mysql/dotnet_dump.sql
Normal file
266362
build/install/docker/config/mysql/dotnet_dump.sql
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,61 @@
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
|
||||
map $DOCUMENT_SERVER $document_server {
|
||||
volatile;
|
||||
$DOCUMENT_SERVER $DOCUMENT_SERVER;
|
||||
}
|
||||
|
||||
map $SERVICE_API $service_api {
|
||||
volatile;
|
||||
$SERVICE_API $SERVICE_API;
|
||||
}
|
||||
|
||||
map $SERVICE_API_SYSTEM $service_api_system {
|
||||
volatile;
|
||||
$SERVICE_API_SYSTEM $SERVICE_API_SYSTEM;
|
||||
}
|
||||
|
||||
map $SERVICE_URLSHORTENER $service_urlshortener {
|
||||
volatile;
|
||||
$SERVICE_URLSHORTENER $SERVICE_URLSHORTENER;
|
||||
}
|
||||
|
||||
map $SERVICE_THUMBNAILS $service_thumbnails {
|
||||
volatile;
|
||||
$SERVICE_THUMBNAILS $SERVICE_THUMBNAILS;
|
||||
}
|
||||
|
||||
map $SERVICE_STUDIO_NOTIFY $service_studio_notify {
|
||||
volatile;
|
||||
$SERVICE_STUDIO_NOTIFY $SERVICE_STUDIO_NOTIFY;
|
||||
}
|
||||
|
||||
map $SERVICE_PEOPLE_SERVER $service_people_server {
|
||||
volatile;
|
||||
$SERVICE_PEOPLE_SERVER $SERVICE_PEOPLE_SERVER;
|
||||
}
|
||||
|
||||
map $SERVICE_FILES $service_files {
|
||||
volatile;
|
||||
$SERVICE_FILES $SERVICE_FILES;
|
||||
}
|
||||
|
||||
map $SERVICE_FILES_SERVICES $service_files_services {
|
||||
volatile;
|
||||
$SERVICE_FILES_SERVICES $SERVICE_FILES_SERVICES;
|
||||
}
|
||||
|
||||
map $SERVICE_STUDIO $service_studio {
|
||||
volatile;
|
||||
$SERVICE_STUDIO $SERVICE_STUDIO;
|
||||
}
|
||||
|
||||
map $SERVICE_BACKUP $service_backup {
|
||||
volatile;
|
||||
$SERVICE_BACKUP $SERVICE_BACKUP;
|
||||
}
|
||||
|
||||
map $SERVICE_SH $service_sh {
|
||||
volatile;
|
||||
$SERVICE_SH $SERVICE_SH;
|
||||
}
|
1901
build/install/docker/config/onlyoffice.data.sql
Normal file
1901
build/install/docker/config/onlyoffice.data.sql
Normal file
File diff suppressed because it is too large
Load Diff
41
build/install/docker/config/onlyoffice.resources.sql
Normal file
41
build/install/docker/config/onlyoffice.resources.sql
Normal file
File diff suppressed because one or more lines are too long
2430
build/install/docker/config/onlyoffice.sql
Normal file
2430
build/install/docker/config/onlyoffice.sql
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,46 +9,104 @@ environment=PATH=/usr/local/sbin:/usr/bin:/bin:/usr/local/bin
|
||||
user=mysql
|
||||
|
||||
[program:kafka]
|
||||
directory=/root/kafka_2.12-2.2.1/
|
||||
command=/root/kafka_2.12-2.2.1/bin/kafka-server-start.sh /root/kafka_2.12-2.2.1/config/server.properties
|
||||
directory=/root/kafka_2.12-2.5.0/
|
||||
command=/root/kafka_2.12-2.5.0/bin/kafka-server-start.sh /root/kafka_2.12-2.5.0/config/server.properties
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:kafka_zookeeper]
|
||||
directory=/root/kafka_2.12-2.2.1/
|
||||
command=/root/kafka_2.12-2.2.1/bin/zookeeper-server-start.sh /root/kafka_2.12-2.2.1/config/zookeeper.properties
|
||||
directory=/root/kafka_2.12-2.5.0/
|
||||
command=/root/kafka_2.12-2.5.0/bin/zookeeper-server-start.sh /root/kafka_2.12-2.5.0/config/zookeeper.properties
|
||||
autostart=true
|
||||
autorestart=true
|
||||
|
||||
[program:api]
|
||||
directory=/var/www/studio/api/
|
||||
command=dotnet ASC.Web.Api.dll --urls=http://0.0.0.0:5000 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --ENVIRONMENT=test
|
||||
command=dotnet ASC.Web.Api.dll --urls=http://0.0.0.0:5000 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=api --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:notify]
|
||||
directory=/var/www/services/notify/
|
||||
command=dotnet ASC.Notify.dll --urls=http://0.0.0.0:5005 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --ENVIRONMENT=test
|
||||
[program:api_system]
|
||||
directory=/var/www/services/apisystem
|
||||
command=dotnet ASC.ApiSystem.dll --urls=http://0.0.0.0:5010 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=apisystem --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:urlshortener]
|
||||
directory=/services/urlshortener/service
|
||||
command=dotnet ASC.UrlShortener.Svc.dll --urls=http://0.0.0.0:5015 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=urlshortener --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:thumbnails]
|
||||
directory=/services/thumbnails/service
|
||||
command=dotnet ASC.Thumbnails.Svc.dll --urls=http://0.0.0.0:5016 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=thumbnails
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:studio_notify]
|
||||
directory=/var/www/services/studio.notify/
|
||||
command=dotnet ASC.Studio.Notify.dll --urls=http://0.0.0.0:5006 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --ENVIRONMENT=test
|
||||
command=dotnet ASC.Studio.Notify.dll --urls=http://0.0.0.0:5006 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=notify.studio --core:products:folder=/var/www/products/ --core:products:subfolder=server --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:notify]
|
||||
directory=/var/www/services/notify/
|
||||
command=dotnet ASC.Notify.dll --urls=http://0.0.0.0:5005 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=notify --core:products:folder=/var/www/products/ --core:products:subfolder=server
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:people]
|
||||
directory=/var/www/products/ASC.People/server/
|
||||
command=dotnet ASC.People.dll --urls=http://0.0.0.0:5004 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --ENVIRONMENT=test
|
||||
command=dotnet ASC.People.dll --urls=http://0.0.0.0:5004 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice/ --log:name=people --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:files]
|
||||
directory=/var/www/products/ASC.Files/server/
|
||||
command=dotnet ASC.Files.dll --urls=http://0.0.0.0:5007 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice/ --log:name=files --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:files_services]
|
||||
directory=/var/www/products/ASC.Files/service
|
||||
command=dotnet ASC.Files.Service.dll --urls=http://0.0.0.0:5009 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice/ --log:name=filesservice --core:products:folder=/var/www/products --core:products:subfolder=server --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:studio]
|
||||
directory=/var/www/studio/server/
|
||||
command=dotnet ASC.Web.Studio.dll --urls=http://0.0.0.0:5003 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --ENVIRONMENT=test
|
||||
command=dotnet ASC.Web.Studio.dll --urls=http://0.0.0.0:5003 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=web --ENVIRONMENT=test
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:backup]
|
||||
directory=/var/www/studio/backup/
|
||||
command=dotnet ASC.Data.Backup.dll --urls=http://0.0.0.0:5012 --pathToConf=/app/onlyoffice/config/ --$STORAGE_ROOT=/app/onlyoffice/data/ --log:dir=/var/log/onlyoffice --log:name=backup --core:products:folder=/var/www/products/ --core:products:subfolder=server
|
||||
autostart=true
|
||||
autorestart=true
|
||||
user=root
|
||||
environment=ASPNETCORE_ENVIRONMENT=test
|
||||
|
||||
[program:nginx]
|
||||
command=/usr/sbin/nginx -g "daemon off;"
|
||||
|
39
build/install/docker/db.yml
Normal file
39
build/install/docker/db.yml
Normal file
@ -0,0 +1,39 @@
|
||||
version: "3.6"
|
||||
|
||||
services:
|
||||
|
||||
onlyoffice-mysql-server:
|
||||
|
||||
image: mysql:${MYSQL_VERSION}
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
cap_add:
|
||||
- SYS_NICE
|
||||
container_name: ${MYSQL_HOST}
|
||||
restart: always
|
||||
tty: true
|
||||
user: mysql
|
||||
expose:
|
||||
- "3306"
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||
MYSQL_USER: ${MYSQL_USER}
|
||||
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- ./config/mysql/conf.d/:/etc/mysql/conf.d
|
||||
- ./config/createdb.sql:/docker-entrypoint-initdb.d/01_createdb.sql
|
||||
- ./config/onlyoffice.sql:/docker-entrypoint-initdb.d/02_onlyoffice.sql
|
||||
- ./config/onlyoffice.data.sql:/docker-entrypoint-initdb.d/03_onlyoffice.data.sql
|
||||
- ./config/onlyoffice.resources.sql:/docker-entrypoint-initdb.d/04_onlyoffice.resources.sql
|
||||
networks:
|
||||
- ${NETWORK_NAME}
|
||||
tmpfs: /var/log/mysql/
|
||||
|
||||
networks:
|
||||
onlyoffice:
|
||||
name: ${NETWORK_NAME}
|
||||
driver: 'bridge'
|
||||
|
||||
volumes:
|
||||
mysql_data:
|
75
build/install/docker/docker-entrypoint.sh
Executable file
75
build/install/docker/docker-entrypoint.sh
Executable file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "##########################################################"
|
||||
echo "############## Run App Service ####################"
|
||||
echo "##########################################################"
|
||||
|
||||
PRODUCT=${PRODUCT:-"onlyoffice"}
|
||||
BASE_DIR="/app/${PRODUCT}"
|
||||
PARAMETERS=""
|
||||
PROXY_HOST=${PROXY_HOST:-"proxy"}
|
||||
SHEME=${SHEME:-"http"}
|
||||
SERVICE_PORT=${SERVICE_PORT:-"5050"}
|
||||
|
||||
URLS=${URLS:-"${SHEME}://0.0.0.0:${SERVICE_PORT}"}
|
||||
PATH_TO_CONF=${PATH_TO_CONF:-"${BASE_DIR}/config"}
|
||||
LOG_DIR=${LOG_DIR:-"/var/log/${PRODUCT}"}
|
||||
|
||||
MYSQL_HOST=${MYSQL_HOST:-"mysql-server"}
|
||||
MYSQL_DATABASE=${MYSQL_DATABASE:-${PRODUCT}}
|
||||
MYSQL_USER=${MYSQL_USER:-"${PRODUCT}_user"}
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-"${PRODUCT}_pass"}
|
||||
|
||||
APP_DOTNET_ENV=${APP_DOTNET_ENV:-"test"}
|
||||
APP_CORE_BASE_DOMAIN=${APP_CORE_BASE_DOMAIN:-"localhost"}
|
||||
APP_URL_PORTAL=${APP_URL_PORTAL:-"${SHEME}://${PROXY_HOST}:8092"}
|
||||
|
||||
APP_CORE_MACHINEKEY=${APP_CORE_MACHINEKEY:-"your_core_machinekey"}
|
||||
DOCUMENT_SERVER_JWT_SECRET=${DOCUMENT_SERVER_JWT_SECRET:-"your_jwt_secret"}
|
||||
DOCUMENT_SERVER_JWT_HEADER=${DOCUMENT_SERVER_JWT_HEADER:-"AuthorizationJwt"}
|
||||
DOCUMENT_SERVER_URL_PUBLIC=${DOCUMENT_SERVER_URL_PUBLIC:-"/ds-vpath/"}
|
||||
DOCUMENT_SERVER_URL_INTERNAL=${DOCUMENT_SERVER_URL_INTERNAL:-"${SHEME}://${PRODUCT}-document-server/"}
|
||||
DOCUMENT_SERVER_URL_CONVERTER=${DOCUMENT_SERVER_URL_CONVERTER:-"/ds-vpath/ConvertService.ashx"}
|
||||
VIEWED_MEDIA=${VIEWED_MEDIA:-'".aac",".flac",".m4a",".mp3",".oga",".ogg",".wav",".f4v",".m4v",".mov",".mp4",".ogv",".webm",".avi"'}
|
||||
FFMPEG_EXTS=${FFMPEG_EXTS:-'"avi", "mpeg", "mpg", "wmv"'}
|
||||
|
||||
ELK_SHEME=${ELK_SHEME:-"http"}
|
||||
ELK_HOST=${ELK_HOST:-"elasticsearch"}
|
||||
ELK_PORT=${ELK_PORT:-"9200"}
|
||||
ELK_VALUE='"elastic": { "Scheme": "'${ELK_SHEME}'", "Host": "'${ELK_HOST}'", "Port": "'${ELK_PORT}'" },'
|
||||
|
||||
KAFKA_HOST=${KAFKA_HOST:-"kafka"}":9092"
|
||||
|
||||
APP_STORAGE_ROOT=${APP_STORAGE_ROOT:-"${BASE_DIR}/data/"}
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
DOTNET_RUN="${1}";
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
DOTNET_LOG_NAME="${1}";
|
||||
shift
|
||||
fi
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
PARAMETERS="$PARAMETERS --${1}";
|
||||
shift
|
||||
done
|
||||
|
||||
sed -i "s!Server=.*;Pooling=!Server=${MYSQL_HOST};Port=3306;Database=${MYSQL_DATABASE};User ID=${MYSQL_USER};Password=${MYSQL_PASSWORD};Pooling=!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"base-domain\".*,!\"base-domain\": \"${APP_CORE_BASE_DOMAIN}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"machinekey\".*,!\"machinekey\": \"${APP_CORE_MACHINEKEY}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"public\".*,!\"public\": \"${DOCUMENT_SERVER_URL_PUBLIC}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"internal\".*,!\"internal\": \"${DOCUMENT_SERVER_URL_INTERNAL}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"portal\".*!\"portal\": \"${APP_URL_PORTAL}\",!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"viewed-media\".*!\"viewed-media\": \[${VIEWED_MEDIA}\]!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"exts\".*!\"exts\": \[ ${FFMPEG_EXTS} \]!g" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "0,/\"value\"/s!\"value\".*,!\"value\": \"${DOCUMENT_SERVER_JWT_SECRET}\",!" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
sed -i "s!\"header\".*!\"header\": \"${DOCUMENT_SERVER_JWT_HEADER}\"!" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
|
||||
grep -q "${ELK_VALUE}" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json || sed -i "s!\"files\".*!${ELK_VALUE}\n\"files\": {!" ${PATH_TO_CONF}/appsettings.${APP_DOTNET_ENV}.json
|
||||
|
||||
sed -i "s!\"BootstrapServers\".*!\"BootstrapServers\": \"${KAFKA_HOST}\"!g" ${PATH_TO_CONF}/kafka.${APP_DOTNET_ENV}.json
|
||||
|
||||
dotnet ${DOTNET_RUN} --urls=${URLS} --ENVIRONMENT=${APP_DOTNET_ENV} --'$STORAGE_ROOT'=${APP_STORAGE_ROOT} --pathToConf=${PATH_TO_CONF} --log:dir=${LOG_DIR} --log:name=${DOTNET_LOG_NAME} ${PARAMETERS}
|
21
build/install/docker/ds.yml
Normal file
21
build/install/docker/ds.yml
Normal file
@ -0,0 +1,21 @@
|
||||
version: '3.6'
|
||||
services:
|
||||
onlyoffice-document-server:
|
||||
image: "${REPO}/${STATUS}documentserver:latest"
|
||||
container_name: ${DOCUMENT_SERVER_HOST}
|
||||
# Strings below enable the JSON Web Token validation.
|
||||
environment:
|
||||
- JWT_ENABLED=true
|
||||
- JWT_SECRET=${DOCUMENT_SERVER_JWT_SECRET}
|
||||
- JWT_HEADER=${DOCUMENT_SERVER_JWT_HEADER}
|
||||
- JWT_IN_BODY=true
|
||||
expose:
|
||||
- '80'
|
||||
stdin_open: true
|
||||
restart: always
|
||||
stop_grace_period: 60s
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: ${NETWORK_NAME}
|
3
build/install/docker/hooks/build
Normal file
3
build/install/docker/hooks/build
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
export SRV_VERSION=$DOCKER_TAG
|
||||
docker-compose -f build.yml build --build-arg GIT_BRANCH=$SOURCE_BRANCH
|
3
build/install/docker/hooks/push
Normal file
3
build/install/docker/hooks/push
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
export SRV_VERSION=$DOCKER_TAG
|
||||
docker-compose -f build.yml push
|
@ -27,5 +27,10 @@ xcopy ..\products\ASC.People\Client\*.* publish\ASC.People.Client\ /E /R /Y
|
||||
echo "Publish ASC.Web.Client project"
|
||||
xcopy ..\web\ASC.Web.Client\*.* publish\ASC.Web.Client\ /E /R /Y
|
||||
|
||||
echo "Publish ASC.UrlShortener.Svc.csproj project"
|
||||
dotnet publish ..\common\services\ASC.UrlShortener.Svc\ASC.UrlShortener.Svc.csproj -c Release -o publish/ASC.UrlShortener.Svc/
|
||||
xcopy ..\common\ASC.UrlShortener\*.* publish\ASC.UrlShortener\ /E /R /Y
|
||||
if not %errorlevel% == 0 goto end
|
||||
|
||||
:end
|
||||
pause
|
@ -34,6 +34,9 @@ call yarn link "asc-web-components" --cwd products/ASC.Files/Client
|
||||
call yarn link "asc-web-common" --cwd products/ASC.Files/Client
|
||||
call yarn install --cwd products/ASC.Files/Client > build\ASC.Web.Files.Client.log
|
||||
|
||||
echo "ASC.UrlShortener"
|
||||
call yarn install --cwd common/ASC.UrlShortener > build\ASC.UrlShortener.log
|
||||
|
||||
echo "ASC.Web.sln"
|
||||
call dotnet build ASC.Web.sln /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
|
||||
|
||||
|
39
build/rebuild.frontend.bat
Normal file
39
build/rebuild.frontend.bat
Normal file
@ -0,0 +1,39 @@
|
||||
PUSHD %~dp0
|
||||
call start\stop.bat
|
||||
|
||||
PUSHD %~dp0..
|
||||
|
||||
del /s /q packages\asc-web-components
|
||||
del /s /q packages\asc-web-common
|
||||
|
||||
echo "ASC.Web.Components"
|
||||
call yarn install --cwd web/ASC.Web.Components > build\ASC.Web.Components.log
|
||||
REM xcopy web\ASC.Web.Components\node_modules packages\asc-web-components\node_modules\ /E /R /Y >> build\ASC.Web.Components.log
|
||||
call yarn install --cwd packages/asc-web-components >> build\ASC.Web.Components.log
|
||||
call yarn link --cwd packages/asc-web-components
|
||||
|
||||
echo "ASC.Web.Common"
|
||||
call yarn link "asc-web-components" --cwd web/ASC.Web.Common
|
||||
call yarn install --cwd web/ASC.Web.Common > build\ASC.Web.Common.log
|
||||
REM xcopy web\ASC.Web.Common\node_modules packages\asc-web-common\node_modules\ /E /R /Y >> build\ASC.Web.Components.log
|
||||
call yarn install --cwd packages/asc-web-common >> build\ASC.Web.Common.log
|
||||
call yarn link --cwd packages/asc-web-common
|
||||
|
||||
echo "ASC.Web.Client"
|
||||
call yarn link "asc-web-components" --cwd web/ASC.Web.Client
|
||||
call yarn link "asc-web-common" --cwd web/ASC.Web.Client
|
||||
call yarn install --cwd web/ASC.Web.Client > build\ASC.Web.Client.log
|
||||
|
||||
echo "ASC.Web.People.Client"
|
||||
call yarn link "asc-web-components" --cwd products/ASC.People/Client
|
||||
call yarn link "asc-web-common" --cwd products/ASC.People/Client
|
||||
call yarn install --cwd products/ASC.People/Client > build\ASC.Web.People.Client.log
|
||||
|
||||
echo "ASC.Web.Files.Client"
|
||||
call yarn link "asc-web-components" --cwd products/ASC.Files/Client
|
||||
call yarn link "asc-web-common" --cwd products/ASC.Files/Client
|
||||
call yarn install --cwd products/ASC.Files/Client > build\ASC.Web.Files.Client.log
|
||||
|
||||
start /b call build\start\start.bat
|
||||
|
||||
pause
|
10
build/rebuild.yarnlocks.bat
Normal file
10
build/rebuild.yarnlocks.bat
Normal file
@ -0,0 +1,10 @@
|
||||
PUSHD %~dp0..
|
||||
|
||||
del /f /q web\ASC.Web.Components\yarn.lock
|
||||
del /f /q web\ASC.Web.Common\yarn.lock
|
||||
del /f /q web\ASC.Web.Client\yarn.lock
|
||||
del /f /q products\ASC.Files\Client\yarn.lock
|
||||
del /f /q products\ASC.People\Client\yarn.lock
|
||||
|
||||
start /b call build\rebuild.frontend.bat
|
||||
|
2
build/run/ApiSystemService.bat
Normal file
2
build/run/ApiSystemService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Notify"
|
||||
call dotnet run --project ..\..\common\services\ASC.ApiSystem\ASC.ApiSystem.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=apisystem
|
2
build/run/BackupService.bat
Normal file
2
build/run/BackupService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Backup"
|
||||
call dotnet run --project ..\..\common\services\ASC.Data.Backup\ASC.Data.Backup.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=backup
|
2
build/run/EncryptionService.bat
Normal file
2
build/run/EncryptionService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Data.Storage.Encryption"
|
||||
call dotnet run --project ..\..\common\services\ASC.Data.Storage.Encryption\ASC.Data.Storage.Encryption.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=encryption
|
2
build/run/FileService.bat
Normal file
2
build/run/FileService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Files"
|
||||
call dotnet run --project ..\..\products\ASC.Files\Service\ASC.Files.Service.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=files
|
2
build/run/MigrationService.bat
Normal file
2
build/run/MigrationService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Migration"
|
||||
call dotnet run --project ..\..\common\services\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=migration
|
2
build/run/Socket.IO.bat
Normal file
2
build/run/Socket.IO.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Socket.IO.Svc"
|
||||
call dotnet run --project ..\..\common\services\ASC.Socket.IO.Svc\ASC.Socket.IO.Svc.csproj --no-build --$STORAGE_ROOT=..\..\Data --log__dir=..\..\Logs --log__name=socket
|
2
build/run/TelegramService.bat
Normal file
2
build/run/TelegramService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.TelegramService"
|
||||
call dotnet run --project ..\..\common\services\ASC.TelegramService\ASC.TelegramService.csproj --no-build --$STORAGE_ROOT=..\..\Data --log__dir=..\..\Logs --log__name=telegram
|
2
build/run/Thumbnails.bat
Normal file
2
build/run/Thumbnails.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Thumbnails.Svc"
|
||||
call dotnet run --project ..\..\common\services\ASC.Thumbnails.Svc\ASC.Thumbnails.Svc.csproj --no-build --$STORAGE_ROOT=..\..\Data --log__dir=..\..\Logs --log__name=thumbnails
|
2
build/run/UrlShortenerService.bat
Normal file
2
build/run/UrlShortenerService.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.UrlShortener.Svc"
|
||||
call dotnet run --project ..\..\common\services\ASC.UrlShortener.Svc\ASC.UrlShortener.Svc.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=urlshortener
|
1
build/scripts/socket.sh
Normal file
1
build/scripts/socket.sh
Normal file
@ -0,0 +1 @@
|
||||
yarn install --cwd common/ASC.Socket.IO --frozen-lockfile
|
1
build/scripts/thumbnails.sh
Normal file
1
build/scripts/thumbnails.sh
Normal file
@ -0,0 +1 @@
|
||||
yarn install --cwd common/ASC.Thumbnails --frozen-lockfile
|
1
build/scripts/urlshortener.sh
Normal file
1
build/scripts/urlshortener.sh
Normal file
@ -0,0 +1 @@
|
||||
yarn install --cwd common/ASC.UrlShortener --frozen-lockfile
|
14
build/start/restart.bat
Normal file
14
build/start/restart.bat
Normal file
@ -0,0 +1,14 @@
|
||||
PUSHD %~dp0..
|
||||
call runasadmin.bat "%~dpnx0"
|
||||
|
||||
if %errorlevel% == 0 (
|
||||
for /R "run\" %%f in (*.bat) do (
|
||||
call nssm stop Onlyoffice%%~nf
|
||||
)
|
||||
|
||||
for /R "run\" %%f in (*.bat) do (
|
||||
call nssm start Onlyoffice%%~nf
|
||||
)
|
||||
|
||||
call iisreset
|
||||
)
|
@ -12,10 +12,6 @@
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\web\ASC.Web.Core\ASC.Web.Core.csproj" />
|
||||
<ProjectReference Include="..\ASC.Common\ASC.Common.csproj" />
|
||||
|
@ -9,14 +9,15 @@ using System.Threading.Tasks;
|
||||
using ASC.Common;
|
||||
using ASC.Core;
|
||||
using ASC.Security.Cryptography;
|
||||
using ASC.Web.Studio.Core;
|
||||
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Core.Auth
|
||||
{
|
||||
[Scope(Additional = typeof(ConfirmAuthHandlerExtension))]
|
||||
public class ConfirmAuthHandler : AuthenticationHandler<AuthenticationSchemeOptions>
|
||||
{
|
||||
public ConfirmAuthHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
|
||||
@ -28,34 +29,22 @@ namespace ASC.Api.Core.Auth
|
||||
UrlEncoder encoder,
|
||||
ISystemClock clock,
|
||||
SecurityContext securityContext,
|
||||
EmailValidationKeyProvider emailValidationKeyProvider,
|
||||
SetupInfo setupInfo,
|
||||
TenantManager tenantManager,
|
||||
UserManager userManager,
|
||||
AuthManager authManager,
|
||||
AuthContext authContext) :
|
||||
IServiceProvider serviceProvider) :
|
||||
base(options, logger, encoder, clock)
|
||||
{
|
||||
SecurityContext = securityContext;
|
||||
EmailValidationKeyProvider = emailValidationKeyProvider;
|
||||
SetupInfo = setupInfo;
|
||||
TenantManager = tenantManager;
|
||||
UserManager = userManager;
|
||||
AuthManager = authManager;
|
||||
AuthContext = authContext;
|
||||
ServiceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public SecurityContext SecurityContext { get; }
|
||||
public EmailValidationKeyProvider EmailValidationKeyProvider { get; }
|
||||
public SetupInfo SetupInfo { get; }
|
||||
public TenantManager TenantManager { get; }
|
||||
public UserManager UserManager { get; }
|
||||
public AuthManager AuthManager { get; }
|
||||
public AuthContext AuthContext { get; }
|
||||
private SecurityContext SecurityContext { get; }
|
||||
public IServiceProvider ServiceProvider { get; }
|
||||
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
var emailValidationKeyModel = EmailValidationKeyModel.FromRequest(Context.Request);
|
||||
using var scope = ServiceProvider.CreateScope();
|
||||
|
||||
var emailValidationKeyHelper = scope.ServiceProvider.GetService<EmailValidationKeyModelHelper>();
|
||||
var emailValidationKeyModel = emailValidationKeyHelper.GetModel();
|
||||
|
||||
if (!emailValidationKeyModel.Type.HasValue)
|
||||
{
|
||||
@ -67,7 +56,7 @@ namespace ASC.Api.Core.Auth
|
||||
EmailValidationKeyProvider.ValidationResult checkKeyResult;
|
||||
try
|
||||
{
|
||||
checkKeyResult = emailValidationKeyModel.Validate(EmailValidationKeyProvider, AuthContext, TenantManager, UserManager, AuthManager);
|
||||
checkKeyResult = emailValidationKeyHelper.Validate(emailValidationKeyModel);
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
@ -108,18 +97,11 @@ namespace ASC.Api.Core.Auth
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConfirmAuthHandlerExtension
|
||||
public class ConfirmAuthHandlerExtension
|
||||
{
|
||||
public static DIHelper AddConfirmAuthHandler(this DIHelper services)
|
||||
public static void Register(DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddSecurityContextService()
|
||||
.AddEmailValidationKeyProviderService()
|
||||
.AddSetupInfo()
|
||||
.AddTenantManagerService()
|
||||
.AddUserManagerService()
|
||||
.AddAuthManager()
|
||||
.AddAuthContextService();
|
||||
services.TryAdd<EmailValidationKeyModelHelper>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using System.Security.Authentication;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core;
|
||||
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
@ -24,7 +23,7 @@ namespace ASC.Api.Core.Auth
|
||||
SecurityContext = securityContext;
|
||||
}
|
||||
|
||||
public SecurityContext SecurityContext { get; }
|
||||
private SecurityContext SecurityContext { get; }
|
||||
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
@ -38,12 +37,4 @@ namespace ASC.Api.Core.Auth
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CookieAuthHandlerExtension
|
||||
{
|
||||
public static DIHelper AddCookieAuthHandler(this DIHelper services)
|
||||
{
|
||||
return services.AddSecurityContextService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,25 +36,27 @@ using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace ASC.Api.Core
|
||||
{
|
||||
[Scope]
|
||||
public class ApiContext : ICloneable
|
||||
{
|
||||
public HttpContext HttpContext { get; set; }
|
||||
private Tenant tenant;
|
||||
public Tenant Tenant { get { return tenant ?? (tenant = TenantManager.GetCurrentTenant(HttpContext)); } }
|
||||
private static int MaxCount = 1000;
|
||||
public IHttpContextAccessor HttpContextAccessor { get; set; }
|
||||
public Tenant tenant;
|
||||
public Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor.HttpContext); } }
|
||||
|
||||
public ApiContext(IHttpContextAccessor httpContextAccessor, SecurityContext securityContext, TenantManager tenantManager)
|
||||
{
|
||||
if (httpContextAccessor == null || httpContextAccessor.HttpContext == null) return;
|
||||
HttpContext = httpContextAccessor.HttpContext;
|
||||
HttpContextAccessor = httpContextAccessor;
|
||||
|
||||
Count = 0;
|
||||
var query = HttpContext.Request.Query;
|
||||
Count = MaxCount;
|
||||
var query = HttpContextAccessor.HttpContext.Request.Query;
|
||||
//Try parse values
|
||||
var count = query.GetRequestValue("count");
|
||||
if (!string.IsNullOrEmpty(count) && ulong.TryParse(count, out var countParsed))
|
||||
{
|
||||
//Count specified and valid
|
||||
Count = (long)countParsed;
|
||||
Count = Math.Min((long)countParsed, MaxCount);
|
||||
}
|
||||
|
||||
var startIndex = query.GetRequestValue("startIndex");
|
||||
@ -188,23 +190,23 @@ namespace ASC.Api.Core
|
||||
{
|
||||
set
|
||||
{
|
||||
if (HttpContext.Items.ContainsKey(nameof(TotalCount)))
|
||||
if (HttpContextAccessor.HttpContext.Items.ContainsKey(nameof(TotalCount)))
|
||||
{
|
||||
HttpContext.Items[nameof(TotalCount)] = value;
|
||||
HttpContextAccessor.HttpContext.Items[nameof(TotalCount)] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
HttpContext.Items.Add(nameof(TotalCount), value);
|
||||
HttpContextAccessor.HttpContext.Items.Add(nameof(TotalCount), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SecurityContext SecurityContext { get; }
|
||||
public TenantManager TenantManager { get; }
|
||||
private SecurityContext SecurityContext { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
|
||||
public ApiContext SetCount(int count)
|
||||
{
|
||||
HttpContext.Items[nameof(Count)] = count;
|
||||
HttpContextAccessor.HttpContext.Items[nameof(Count)] = count;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -221,10 +223,10 @@ namespace ASC.Api.Core
|
||||
|
||||
public void AuthByClaim()
|
||||
{
|
||||
var id = HttpContext.User.Claims.FirstOrDefault(r => r.Type == ClaimTypes.Sid);
|
||||
var id = HttpContextAccessor.HttpContext.User.Claims.FirstOrDefault(r => r.Type == ClaimTypes.Sid);
|
||||
if (Guid.TryParse(id?.Value, out var userId))
|
||||
{
|
||||
_ = SecurityContext.AuthenticateMe(userId);
|
||||
SecurityContext.AuthenticateMe(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,19 +267,7 @@ namespace ASC.Api.Core
|
||||
{
|
||||
public static bool Check(this ApiContext context, string field)
|
||||
{
|
||||
return context == null || context.Fields == null || (context.Fields != null && context.Fields.Contains(field));
|
||||
}
|
||||
}
|
||||
|
||||
public static class ApiContextConfigExtension
|
||||
{
|
||||
public static DIHelper AddApiContextService(this DIHelper services)
|
||||
{
|
||||
services.TryAddScoped<ApiContext>();
|
||||
|
||||
return services
|
||||
.AddTenantManagerService()
|
||||
.AddSecurityContextService();
|
||||
return context?.Fields == null || (context.Fields != null && context.Fields.Contains(field, StringComparer.InvariantCultureIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
@ -27,18 +27,15 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ASC.Api.Core
|
||||
{
|
||||
[DataContract(Name = "date", Namespace = "")]
|
||||
[JsonConverter(typeof(ApiDateTimeConverter))]
|
||||
[TypeConverter(typeof(ApiDateTimeTypeConverter))]
|
||||
public class ApiDateTime : IComparable<ApiDateTime>, IComparable
|
||||
{
|
||||
@ -275,9 +272,9 @@ namespace ASC.Api.Core
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if (obj is DateTime)
|
||||
return CompareTo((DateTime)obj);
|
||||
return obj is ApiDateTime ? CompareTo((ApiDateTime)obj) : 0;
|
||||
if (obj is DateTime dateTime)
|
||||
return CompareTo(dateTime);
|
||||
return obj is ApiDateTime apiDateTime ? CompareTo(apiDateTime) : 0;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@ -292,8 +289,8 @@ namespace ASC.Api.Core
|
||||
|
||||
public DateTime UtcTime { get; private set; }
|
||||
public TimeSpan TimeZoneOffset { get; private set; }
|
||||
public TenantManager TenantManager { get; }
|
||||
public TimeZoneConverter TimeZoneConverter { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
private TimeZoneConverter TimeZoneConverter { get; }
|
||||
|
||||
public static ApiDateTime GetSample()
|
||||
{
|
||||
@ -312,62 +309,50 @@ namespace ASC.Api.Core
|
||||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
if (value is string @string)
|
||||
{
|
||||
return ApiDateTime.Parse((string)value, null, null);
|
||||
return ApiDateTime.Parse(@string, null, null);
|
||||
}
|
||||
if (value is DateTime)
|
||||
if (value is DateTime time)
|
||||
{
|
||||
return new ApiDateTime(null, null, (DateTime)value);
|
||||
return new ApiDateTime(null, null, time);
|
||||
}
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
}
|
||||
|
||||
public class ApiDateTimeConverter : JsonConverter
|
||||
public class ApiDateTimeConverter : JsonConverter<ApiDateTime>
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
public override ApiDateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (value is ApiDateTime)
|
||||
{
|
||||
writer.WriteValue(value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.ValueType != null)
|
||||
{
|
||||
if (reader.ValueType.Name == "String")
|
||||
{
|
||||
if (DateTime.TryParseExact(reader.Value?.ToString(), ApiDateTime.Formats, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var result))
|
||||
if (reader.TryGetDateTime(out var result))
|
||||
{
|
||||
return new ApiDateTime(result, TimeSpan.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DateTime.TryParseExact(reader.GetString(), ApiDateTime.Formats, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out var dateTime))
|
||||
{
|
||||
return new ApiDateTime(dateTime, TimeSpan.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ApiDateTime();
|
||||
}
|
||||
}
|
||||
else if (reader.ValueType.Name == "DateTime")
|
||||
}
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, ApiDateTime value, JsonSerializerOptions options)
|
||||
{
|
||||
return new ApiDateTime((DateTime)reader.Value, TimeSpan.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(ApiDateTime).IsAssignableFrom(objectType);
|
||||
writer.WriteStringValue(value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
[Scope]
|
||||
public class ApiDateTimeHelper
|
||||
{
|
||||
public TenantManager TenantManager { get; }
|
||||
public TimeZoneConverter TimeZoneConverter { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
private TimeZoneConverter TimeZoneConverter { get; }
|
||||
|
||||
public ApiDateTimeHelper(TenantManager tenantManager, TimeZoneConverter timeZoneConverter)
|
||||
{
|
||||
@ -375,17 +360,9 @@ namespace ASC.Api.Core
|
||||
TimeZoneConverter = timeZoneConverter;
|
||||
}
|
||||
|
||||
public ApiDateTime Get(DateTime? from) => ApiDateTime.FromDate(TenantManager, TimeZoneConverter, from);
|
||||
}
|
||||
|
||||
public static class ApiDateTimeHelperExtension
|
||||
public ApiDateTime Get(DateTime? from)
|
||||
{
|
||||
public static DIHelper AddApiDateTimeHelper(this DIHelper services)
|
||||
{
|
||||
services.TryAddScoped<ApiDateTimeHelper>();
|
||||
|
||||
return services
|
||||
.AddTenantManagerService();
|
||||
return ApiDateTime.FromDate(TenantManager, TimeZoneConverter, from);
|
||||
}
|
||||
}
|
||||
}
|
133
common/ASC.Api.Core/Core/BaseStartup.cs
Normal file
133
common/ASC.Api.Core/Core/BaseStartup.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using ASC.Api.Core.Auth;
|
||||
using ASC.Api.Core.Core;
|
||||
using ASC.Api.Core.Middleware;
|
||||
using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.Logging;
|
||||
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace ASC.Api.Core
|
||||
{
|
||||
public abstract class BaseStartup
|
||||
{
|
||||
public IConfiguration Configuration { get; }
|
||||
public IHostEnvironment HostEnvironment { get; }
|
||||
public virtual string[] LogParams { get; }
|
||||
public virtual JsonConverter[] Converters { get; }
|
||||
public virtual bool AddControllers { get; } = true;
|
||||
public virtual bool ConfirmAddScheme { get; } = false;
|
||||
protected DIHelper DIHelper { get; }
|
||||
|
||||
public BaseStartup(IConfiguration configuration, IHostEnvironment hostEnvironment)
|
||||
{
|
||||
Configuration = configuration;
|
||||
HostEnvironment = hostEnvironment;
|
||||
DIHelper = new DIHelper();
|
||||
}
|
||||
|
||||
public virtual void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddHttpContextAccessor();
|
||||
services.AddMemoryCache();
|
||||
|
||||
DIHelper.Configure(services);
|
||||
|
||||
if (AddControllers)
|
||||
{
|
||||
services.AddControllers()
|
||||
.AddXmlSerializerFormatters()
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.WriteIndented = false;
|
||||
options.JsonSerializerOptions.IgnoreNullValues = true;
|
||||
options.JsonSerializerOptions.Converters.Add(new ApiDateTimeConverter());
|
||||
|
||||
if (Converters != null)
|
||||
{
|
||||
foreach (var c in Converters)
|
||||
{
|
||||
options.JsonSerializerOptions.Converters.Add(c);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DIHelper.TryAdd<DisposeMiddleware>();
|
||||
DIHelper.TryAdd<CultureMiddleware>();
|
||||
DIHelper.TryAdd<IpSecurityFilter>();
|
||||
DIHelper.TryAdd<PaymentFilter>();
|
||||
DIHelper.TryAdd<ProductSecurityFilter>();
|
||||
DIHelper.TryAdd<TenantStatusFilter>();
|
||||
DIHelper.TryAdd<ConfirmAuthHandler>();
|
||||
|
||||
DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
var builder = services.AddMvcCore(config =>
|
||||
{
|
||||
var policy = new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build();
|
||||
config.Filters.Add(new AuthorizeFilter(policy));
|
||||
config.Filters.Add(new TypeFilterAttribute(typeof(TenantStatusFilter)));
|
||||
config.Filters.Add(new TypeFilterAttribute(typeof(PaymentFilter)));
|
||||
config.Filters.Add(new TypeFilterAttribute(typeof(IpSecurityFilter)));
|
||||
config.Filters.Add(new TypeFilterAttribute(typeof(ProductSecurityFilter)));
|
||||
config.Filters.Add(new CustomResponseFilterAttribute());
|
||||
config.Filters.Add(new CustomExceptionFilterAttribute());
|
||||
config.Filters.Add(new TypeFilterAttribute(typeof(FormatFilter)));
|
||||
|
||||
config.OutputFormatters.RemoveType<XmlSerializerOutputFormatter>();
|
||||
config.OutputFormatters.Add(new XmlOutputFormatter());
|
||||
});
|
||||
|
||||
|
||||
var authBuilder = services.AddAuthentication("cookie")
|
||||
.AddScheme<AuthenticationSchemeOptions, CookieAuthHandler>("cookie", a => { });
|
||||
|
||||
if (ConfirmAddScheme)
|
||||
{
|
||||
authBuilder.AddScheme<AuthenticationSchemeOptions, ConfirmAuthHandler>("confirm", a => { });
|
||||
}
|
||||
|
||||
if (LogParams != null)
|
||||
{
|
||||
LogNLogExtension.ConfigureLog(DIHelper, LogParams);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
});
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthentication();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseCultureMiddleware();
|
||||
|
||||
app.UseDisposeMiddleware();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
endpoints.MapCustom();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Core.Core
|
||||
{
|
||||
public class CustomJsonOptionsWrapper : IConfigureOptions<MvcNewtonsoftJsonOptions>
|
||||
{
|
||||
readonly IHttpContextAccessor ServiceProvider;
|
||||
public CustomJsonOptionsWrapper(IHttpContextAccessor serviceProvider)
|
||||
{
|
||||
ServiceProvider = serviceProvider;
|
||||
}
|
||||
public void Configure(MvcNewtonsoftJsonOptions options)
|
||||
{
|
||||
options.SerializerSettings.ContractResolver = new ResponseContractResolver(ServiceProvider);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,20 +23,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ASC.Api.Collections
|
||||
{
|
||||
|
||||
[DataContract]
|
||||
public class ItemKeyValuePair<TKey, TValue>
|
||||
{
|
||||
[DataMember]
|
||||
public TKey Key { get; set; }
|
||||
|
||||
|
||||
[DataMember]
|
||||
public TValue Value { get; set; }
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
|
||||
using ASC.Web.Core;
|
||||
|
||||
namespace ASC.Api.Core
|
||||
|
@ -1,118 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2018
|
||||
*
|
||||
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
||||
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
||||
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
||||
*
|
||||
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
||||
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
||||
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
||||
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
||||
* in every copy of the program you distribute.
|
||||
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace ASC.Api.Core
|
||||
{
|
||||
public class ResponseContractResolver : DefaultContractResolver
|
||||
{
|
||||
public IHttpContextAccessor Services { get; }
|
||||
|
||||
public ResponseContractResolver(IHttpContextAccessor services)
|
||||
{
|
||||
Services = services;
|
||||
NamingStrategy = new CamelCaseNamingStrategy
|
||||
{
|
||||
ProcessDictionaryKeys = true
|
||||
};
|
||||
}
|
||||
|
||||
protected override JsonProperty CreateProperty(System.Reflection.MemberInfo member, Newtonsoft.Json.MemberSerialization memberSerialization)
|
||||
{
|
||||
var property = base.CreateProperty(member, memberSerialization);
|
||||
if (property.PropertyName == "response")
|
||||
{
|
||||
property.ItemConverter = new JsonStringConverter(Services);
|
||||
}
|
||||
|
||||
return property;
|
||||
}
|
||||
}
|
||||
public class ResponseDataContractResolver : DefaultContractResolver
|
||||
{
|
||||
public List<string> Props { get; }
|
||||
public ResponseDataContractResolver(List<string> props)
|
||||
{
|
||||
NamingStrategy = new CamelCaseNamingStrategy
|
||||
{
|
||||
ProcessDictionaryKeys = true
|
||||
};
|
||||
Props = props;
|
||||
}
|
||||
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
|
||||
{
|
||||
var retval = base.CreateProperties(type, memberSerialization);
|
||||
|
||||
retval = retval.Where(p => Props.Contains(p.PropertyName.ToLower())).ToList();
|
||||
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
public class JsonStringConverter : JsonConverter
|
||||
{
|
||||
public IHttpContextAccessor HttpContextAccessor { get; }
|
||||
|
||||
public JsonStringConverter(IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
HttpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
var fields = HttpContextAccessor.HttpContext.Request.Query.GetRequestArray("fields");
|
||||
|
||||
if (fields != null)
|
||||
{
|
||||
var props = fields.Select(r => r.ToLower()).ToList();
|
||||
|
||||
var jsonSerializer = JsonSerializer.CreateDefault();
|
||||
jsonSerializer.DateParseHandling = DateParseHandling.None;
|
||||
jsonSerializer.ContractResolver = new ResponseDataContractResolver(props);
|
||||
jsonSerializer.Serialize(writer, value);
|
||||
return;
|
||||
}
|
||||
|
||||
serializer.Serialize(writer, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
using ASC.Common.Web;
|
||||
|
||||
namespace ASC.Api.Utils
|
||||
@ -55,5 +56,10 @@ namespace ASC.Api.Utils
|
||||
{
|
||||
return item.IfNull(() => { throw new ItemNotFoundException(message); });
|
||||
}
|
||||
|
||||
public static T? NullIfDefault<T>(this T item) where T : struct
|
||||
{
|
||||
return item.Equals(default(T)) ? default(T?) : item;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,14 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
[DataContract]
|
||||
public abstract class CommonApiResponse
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public int Status { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public HttpStatusCode StatusCode { get; set; }
|
||||
|
||||
protected CommonApiResponse(HttpStatusCode statusCode)
|
||||
@ -32,10 +27,8 @@ namespace ASC.Api.Core.Middleware
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class ErrorApiResponse : CommonApiResponse
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false, Order = 3)]
|
||||
public CommonApiError Error { get; set; }
|
||||
|
||||
protected internal ErrorApiResponse(HttpStatusCode statusCode, Exception error) : base(statusCode)
|
||||
@ -45,16 +38,12 @@ namespace ASC.Api.Core.Middleware
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class SuccessApiResponse : CommonApiResponse
|
||||
{
|
||||
[DataMember(EmitDefaultValue = false, Order = 0)]
|
||||
public int? Count { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Order = 1)]
|
||||
public long? Total { get; set; }
|
||||
|
||||
[DataMember(EmitDefaultValue = false, Order = 3)]
|
||||
public object Response { get; set; }
|
||||
|
||||
protected internal SuccessApiResponse(HttpStatusCode statusCode, object response, long? total = null, int? count = null) : base(statusCode)
|
||||
@ -89,33 +78,24 @@ namespace ASC.Api.Core.Middleware
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
public class CommonApiError
|
||||
{
|
||||
[DataMember]
|
||||
public string Message { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public Type Type { get; set; }
|
||||
public string Type { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public string Stack { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public int Hresult { get; set; }
|
||||
|
||||
[DataMember]
|
||||
public IDictionary Data { get; set; }
|
||||
|
||||
public static CommonApiError FromException(Exception exception)
|
||||
{
|
||||
return new CommonApiError()
|
||||
{
|
||||
Message = exception.Message,
|
||||
Type = exception.GetType(),
|
||||
Type = exception.GetType().ToString(),
|
||||
Stack = exception.StackTrace,
|
||||
Hresult = exception.HResult,
|
||||
Data = exception.Data
|
||||
Hresult = exception.HResult
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Core;
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@ -51,13 +50,5 @@ namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
return builder.UseMiddleware<CultureMiddleware>();
|
||||
}
|
||||
|
||||
public static DIHelper AddCultureMiddleware(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddAuthContextService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common.Web;
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.IPSecurity;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -12,6 +11,7 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
[Scope]
|
||||
public class IpSecurityFilter : IResourceFilter
|
||||
{
|
||||
private readonly ILog log;
|
||||
@ -26,9 +26,9 @@ namespace ASC.Api.Core.Middleware
|
||||
this.IPSecurity = IPSecurity;
|
||||
}
|
||||
|
||||
public AuthContext AuthContext { get; }
|
||||
private AuthContext AuthContext { get; }
|
||||
public IPRestrictionsSettings IPRestrictionsSettings { get; }
|
||||
public IPSecurity.IPSecurity IPSecurity { get; }
|
||||
private IPSecurity.IPSecurity IPSecurity { get; }
|
||||
|
||||
public void OnResourceExecuted(ResourceExecutedContext context)
|
||||
{
|
||||
@ -44,15 +44,4 @@ namespace ASC.Api.Core.Middleware
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class IpSecurityFilterExtension
|
||||
{
|
||||
public static DIHelper AddIpSecurityFilter(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddSettingsManagerService()
|
||||
.AddAuthContextService()
|
||||
.AddIPSecurityService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
[Scope]
|
||||
public class PaymentFilter : IResourceFilter
|
||||
{
|
||||
private readonly ILog log;
|
||||
@ -24,7 +25,7 @@ namespace ASC.Api.Core.Middleware
|
||||
TenantExtra = tenantExtra;
|
||||
}
|
||||
|
||||
public TenantExtra TenantExtra { get; }
|
||||
private TenantExtra TenantExtra { get; }
|
||||
|
||||
public void OnResourceExecuted(ResourceExecutedContext context)
|
||||
{
|
||||
@ -49,13 +50,4 @@ namespace ASC.Api.Core.Middleware
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class PaymentFilterExtension
|
||||
{
|
||||
public static DIHelper AddPaymentFilter(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddTenantExtraService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,15 +17,14 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
[Scope]
|
||||
public class ProductSecurityFilter : IResourceFilter
|
||||
{
|
||||
private static readonly IDictionary<string, Guid> products;
|
||||
private readonly ILog log;
|
||||
|
||||
public UserManager UserManager { get; }
|
||||
public TenantManager TenantManager { get; }
|
||||
public WebItemSecurity WebItemSecurity { get; }
|
||||
public AuthContext AuthContext { get; }
|
||||
private WebItemSecurity WebItemSecurity { get; }
|
||||
private AuthContext AuthContext { get; }
|
||||
|
||||
static ProductSecurityFilter()
|
||||
{
|
||||
@ -57,14 +56,10 @@ namespace ASC.Api.Core.Middleware
|
||||
|
||||
public ProductSecurityFilter(
|
||||
IOptionsMonitor<ILog> options,
|
||||
UserManager userManager,
|
||||
TenantManager tenantManager,
|
||||
WebItemSecurity webItemSecurity,
|
||||
AuthContext authContext)
|
||||
{
|
||||
log = options.CurrentValue;
|
||||
UserManager = userManager;
|
||||
TenantManager = tenantManager;
|
||||
WebItemSecurity = webItemSecurity;
|
||||
AuthContext = authContext;
|
||||
}
|
||||
@ -122,16 +117,4 @@ namespace ASC.Api.Core.Middleware
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ProductSecurityFilterExtension
|
||||
{
|
||||
public static DIHelper AddProductSecurityFilter(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddUserManagerService()
|
||||
.AddTenantManagerService()
|
||||
.AddWebItemSecurity()
|
||||
.AddAuthContextService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
|
||||
@ -8,7 +9,18 @@ namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
public override void OnException(ExceptionContext context)
|
||||
{
|
||||
context.Result = new ObjectResult(new ErrorApiResponse((HttpStatusCode)context.HttpContext.Response.StatusCode, context.Exception));
|
||||
var status = (HttpStatusCode)context.HttpContext.Response.StatusCode;
|
||||
if (status == HttpStatusCode.OK)
|
||||
{
|
||||
status = HttpStatusCode.InternalServerError;
|
||||
}
|
||||
|
||||
var result = new ObjectResult(new ErrorApiResponse(status, context.Exception))
|
||||
{
|
||||
StatusCode = (int)status
|
||||
};
|
||||
|
||||
context.Result = result; ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Api.Core.Middleware
|
||||
{
|
||||
[Scope]
|
||||
public class TenantStatusFilter : IResourceFilter
|
||||
{
|
||||
private readonly ILog log;
|
||||
@ -21,7 +22,7 @@ namespace ASC.Api.Core.Middleware
|
||||
TenantManager = tenantManager;
|
||||
}
|
||||
|
||||
public TenantManager TenantManager { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
|
||||
public void OnResourceExecuted(ResourceExecutedContext context)
|
||||
{
|
||||
@ -45,13 +46,4 @@ namespace ASC.Api.Core.Middleware
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class TenantStatusFilterExtension
|
||||
{
|
||||
public static DIHelper AddTenantStatusFilter(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddTenantManagerService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,18 +23,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ASC.Web.Api.Models
|
||||
{
|
||||
[DataContract(Name = "contact", Namespace = "")]
|
||||
public class Contact
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public string Type { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string Value { get; set; }
|
||||
|
||||
public Contact()
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
|
||||
using ASC.Api.Core;
|
||||
using ASC.Common;
|
||||
@ -36,22 +36,16 @@ using ASC.Web.Studio.Utility;
|
||||
|
||||
namespace ASC.Web.Api.Models
|
||||
{
|
||||
[DataContract(Name = "person", Namespace = "")]
|
||||
public class EmployeeWraper
|
||||
{
|
||||
[DataMember(Order = 1)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[DataMember(Order = 10)]
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
[DataMember(Order = 11, EmitDefaultValue = false)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public string AvatarSmall { get; set; }
|
||||
|
||||
[DataMember(Order = 30)]
|
||||
public string ProfileUrl { get; set; }
|
||||
|
||||
public static EmployeeWraper GetSample()
|
||||
@ -66,6 +60,7 @@ namespace ASC.Web.Api.Models
|
||||
}
|
||||
}
|
||||
|
||||
[Scope]
|
||||
public class EmployeeWraperHelper
|
||||
{
|
||||
private ApiContext HttpContext { get; }
|
||||
@ -130,18 +125,4 @@ namespace ASC.Web.Api.Models
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public static class EmployeeWraperExtension
|
||||
{
|
||||
public static DIHelper AddEmployeeWraper(this DIHelper services)
|
||||
{
|
||||
services.TryAddScoped<EmployeeWraperHelper>();
|
||||
|
||||
return services
|
||||
.AddApiContextService()
|
||||
.AddDisplayUserSettingsService()
|
||||
.AddUserPhotoManagerService()
|
||||
.AddCommonLinkUtilityService();
|
||||
}
|
||||
}
|
||||
}
|
@ -27,11 +27,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
|
||||
using ASC.Api.Core;
|
||||
using ASC.Common;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.EF;
|
||||
using ASC.Core.Users;
|
||||
using ASC.Web.Core;
|
||||
using ASC.Web.Core.Users;
|
||||
@ -39,89 +41,61 @@ using ASC.Web.Studio.Utility;
|
||||
|
||||
namespace ASC.Web.Api.Models
|
||||
{
|
||||
[DataContract(Name = "person", Namespace = "")]
|
||||
public class EmployeeWraperFull : EmployeeWraper
|
||||
{
|
||||
[DataMember(Order = 10)]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[DataMember(Order = 10)]
|
||||
public string LastName { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[DataMember(Order = 10)]
|
||||
public string Email { get; set; }
|
||||
|
||||
[DataMember(Order = 12, EmitDefaultValue = false)]
|
||||
public List<Contact> Contacts { get; set; }
|
||||
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public ApiDateTime Birthday { get; set; }
|
||||
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public string Sex { get; set; }
|
||||
|
||||
[DataMember(Order = 10)]
|
||||
public EmployeeStatus Status { get; set; }
|
||||
|
||||
[DataMember(Order = 10)]
|
||||
public EmployeeActivationStatus ActivationStatus { get; set; }
|
||||
|
||||
[DataMember(Order = 10)]
|
||||
public ApiDateTime Terminated { get; set; }
|
||||
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public string Department { get; set; }
|
||||
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public ApiDateTime WorkFrom { get; set; }
|
||||
|
||||
[DataMember(Order = 20, EmitDefaultValue = false)]
|
||||
public List<GroupWrapperSummary> Groups { get; set; }
|
||||
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public string Location { get; set; }
|
||||
|
||||
[DataMember(Order = 10, EmitDefaultValue = false)]
|
||||
public string Notes { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public string AvatarMax { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public string AvatarMedium { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public string Avatar { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public bool IsLDAP { get; set; }
|
||||
|
||||
[DataMember(Order = 20, EmitDefaultValue = false)]
|
||||
public List<string> ListAdminModules { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public bool IsOwner { get; set; }
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public bool IsVisitor { get; set; }
|
||||
|
||||
[DataMember(Order = 20, EmitDefaultValue = false)]
|
||||
public string CultureName { get; set; }
|
||||
|
||||
|
||||
[DataMember(Order = 11, EmitDefaultValue = false)]
|
||||
public string MobilePhone { get; set; }
|
||||
|
||||
[DataMember(Order = 11, EmitDefaultValue = false)]
|
||||
public MobilePhoneActivationStatus MobilePhoneActivationStatus { get; set; }
|
||||
|
||||
[DataMember(Order = 20)]
|
||||
public bool IsSSO { get; set; }
|
||||
|
||||
public new static EmployeeWraperFull GetSample()
|
||||
@ -157,6 +131,7 @@ namespace ASC.Web.Api.Models
|
||||
}
|
||||
}
|
||||
|
||||
[Scope]
|
||||
public class EmployeeWraperFullHelper : EmployeeWraperHelper
|
||||
{
|
||||
private ApiContext Context { get; }
|
||||
@ -178,6 +153,26 @@ namespace ASC.Web.Api.Models
|
||||
ApiDateTimeHelper = apiDateTimeHelper;
|
||||
}
|
||||
|
||||
public static Expression<Func<User, UserInfo>> GetExpression(ApiContext apiContext)
|
||||
{
|
||||
if (apiContext?.Fields == null) return null;
|
||||
var newExpr = Expression.New(typeof(UserInfo));
|
||||
|
||||
//i => new UserInfo { ID = i.id }
|
||||
var parameter = Expression.Parameter(typeof(User), "i");
|
||||
var bindExprs = new List<MemberAssignment>();
|
||||
|
||||
if (apiContext.Check("Id"))
|
||||
{
|
||||
bindExprs.Add(Expression.Bind(typeof(UserInfo).GetProperty("ID"), Expression.Property(parameter, typeof(User).GetProperty("Id"))));
|
||||
}
|
||||
|
||||
var body = Expression.MemberInit(newExpr, bindExprs);
|
||||
var lambda = Expression.Lambda<Func<User, UserInfo>>(body, parameter);
|
||||
|
||||
return lambda;
|
||||
}
|
||||
|
||||
public EmployeeWraperFull GetFull(UserInfo userInfo)
|
||||
{
|
||||
var result = new EmployeeWraperFull
|
||||
@ -294,19 +289,4 @@ namespace ASC.Web.Api.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class EmployeeWraperFullExtension
|
||||
{
|
||||
public static DIHelper AddEmployeeWraperFull(this DIHelper services)
|
||||
{
|
||||
services.TryAddScoped<EmployeeWraperFullHelper>();
|
||||
|
||||
return services
|
||||
.AddTenantManagerService()
|
||||
.AddWebItemSecurity()
|
||||
.AddUserManagerService()
|
||||
.AddEmployeeWraper()
|
||||
.AddApiDateTimeHelper();
|
||||
}
|
||||
}
|
||||
}
|
@ -25,13 +25,12 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
using ASC.Core;
|
||||
using ASC.Core.Users;
|
||||
|
||||
namespace ASC.Web.Api.Models
|
||||
{
|
||||
[DataContract(Name = "group", Namespace = "")]
|
||||
public class GroupWrapperSummary
|
||||
{
|
||||
public GroupWrapperSummary(GroupInfo group, UserManager userManager)
|
||||
@ -46,13 +45,10 @@ namespace ASC.Web.Api.Models
|
||||
}
|
||||
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Order = 1)]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[DataMember(Order = 9, EmitDefaultValue = true)]
|
||||
public string Manager { get; set; }
|
||||
|
||||
public static GroupWrapperSummary GetSample()
|
||||
|
@ -28,26 +28,31 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ARSoft.Tools.NetStandard.DXSdata" Version="1.0.0" />
|
||||
<PackageReference Include="Autofac" Version="5.1.2" />
|
||||
<PackageReference Include="Autofac.Configuration" Version="5.1.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Confluent.Kafka" Version="1.3.0" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.11.4" />
|
||||
<PackageReference Include="Grpc" Version="2.27.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.27.0">
|
||||
<PackageReference Include="Autofac" Version="6.0.0" />
|
||||
<PackageReference Include="Autofac.Configuration" Version="6.0.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
||||
<PackageReference Include="Confluent.Kafka" Version="1.4.3" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
|
||||
<PackageReference Include="Grpc" Version="2.32.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="JWT" Version="6.1.4" />
|
||||
<PackageReference Include="log4net" Version="2.0.8" />
|
||||
<PackageReference Include="log4net" Version="2.0.11" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.9" />
|
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="3.1.1" />
|
||||
<!-- <PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="2.9.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
@ -56,10 +61,9 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference> -->
|
||||
<PackageReference Include="MySql.Data" Version="8.0.19" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NLog" Version="4.6.8" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.0" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.21" />
|
||||
<PackageReference Include="NLog" Version="4.7.5" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.3" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NVelocity" Version="1.2.0" />
|
||||
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
|
||||
|
@ -25,17 +25,21 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Runtime.Caching;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace ASC.Common.Caching
|
||||
{
|
||||
[Singletone]
|
||||
public class AscCacheNotify
|
||||
{
|
||||
public ICacheNotify<AscCacheItem> CacheNotify { get; }
|
||||
private ICacheNotify<AscCacheItem> CacheNotify { get; }
|
||||
|
||||
public AscCacheNotify(ICacheNotify<AscCacheItem> cacheNotify)
|
||||
{
|
||||
@ -49,81 +53,69 @@ namespace ASC.Common.Caching
|
||||
CacheNotify.Publish(new AscCacheItem { Id = ByteString.CopyFrom(Guid.NewGuid().ToByteArray()) }, CacheNotifyAction.Any);
|
||||
}
|
||||
|
||||
private static void OnClearCache()
|
||||
public static void OnClearCache()
|
||||
{
|
||||
var keys = MemoryCache.Default.Select(r => r.Key).ToList();
|
||||
|
||||
foreach (var k in keys)
|
||||
{
|
||||
_ = MemoryCache.Default.Remove(k);
|
||||
MemoryCache.Default.Remove(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Singletone]
|
||||
public class AscCache : ICache
|
||||
{
|
||||
public static readonly ICache Memory;
|
||||
private IMemoryCache MemoryCache { get; }
|
||||
|
||||
static AscCache()
|
||||
{
|
||||
Memory = new AscCache();
|
||||
}
|
||||
|
||||
private AscCache()
|
||||
public AscCache(IMemoryCache memoryCache)
|
||||
{
|
||||
MemoryCache = memoryCache;
|
||||
}
|
||||
|
||||
public T Get<T>(string key) where T : class
|
||||
{
|
||||
var cache = GetCache();
|
||||
return cache.Get(key) as T;
|
||||
return MemoryCache.Get<T>(key);
|
||||
}
|
||||
|
||||
public void Insert(string key, object value, TimeSpan sligingExpiration)
|
||||
{
|
||||
var cache = GetCache();
|
||||
cache.Set(key, value, new CacheItemPolicy { SlidingExpiration = sligingExpiration });
|
||||
MemoryCache.Set(key, value, new MemoryCacheEntryOptions(){ SlidingExpiration = sligingExpiration });
|
||||
}
|
||||
|
||||
public void Insert(string key, object value, DateTime absolutExpiration)
|
||||
{
|
||||
var cache = GetCache();
|
||||
cache.Set(key, value,
|
||||
absolutExpiration == DateTime.MaxValue ? DateTimeOffset.MaxValue : new DateTimeOffset(absolutExpiration));
|
||||
MemoryCache.Set(key, value, absolutExpiration == DateTime.MaxValue ? DateTimeOffset.MaxValue : new DateTimeOffset(absolutExpiration));
|
||||
}
|
||||
|
||||
public void Remove(string key)
|
||||
{
|
||||
var cache = GetCache();
|
||||
cache.Remove(key);
|
||||
MemoryCache.Remove(key);
|
||||
}
|
||||
|
||||
public void Remove(Regex pattern)
|
||||
{
|
||||
var cache = GetCache();
|
||||
//var cache = GetCache();
|
||||
|
||||
var copy = cache.ToDictionary(p => p.Key, p => p.Value);
|
||||
//var copy = cache.ToDictionary(p => p.Key, p => p.Value);
|
||||
|
||||
var keys = copy.Select(p => p.Key).Where(k => pattern.IsMatch(k)).ToArray();
|
||||
foreach (var key in keys)
|
||||
{
|
||||
cache.Remove(key);
|
||||
}
|
||||
//var keys = copy.Select(p => p.Key).Where(k => pattern.IsMatch(k)).ToArray();
|
||||
//foreach (var key in keys)
|
||||
//{
|
||||
// cache.Remove(key);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
public IDictionary<string, T> HashGetAll<T>(string key)
|
||||
public ConcurrentDictionary<string, T> HashGetAll<T>(string key)
|
||||
{
|
||||
var cache = GetCache();
|
||||
var dic = (IDictionary<string, T>)cache.Get(key);
|
||||
return dic != null ? new Dictionary<string, T>(dic) : new Dictionary<string, T>();
|
||||
return MemoryCache.GetOrCreate(key, r=> new ConcurrentDictionary<string, T>());
|
||||
}
|
||||
|
||||
public T HashGet<T>(string key, string field)
|
||||
{
|
||||
var cache = GetCache();
|
||||
var dic = (IDictionary<string, T>)cache.Get(key);
|
||||
if (dic != null && dic.TryGetValue(field, out var value))
|
||||
if (MemoryCache.TryGetValue<ConcurrentDictionary<string, T>>(key, out var dic) && dic.TryGetValue(field, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
@ -132,34 +124,24 @@ namespace ASC.Common.Caching
|
||||
|
||||
public void HashSet<T>(string key, string field, T value)
|
||||
{
|
||||
var cache = GetCache();
|
||||
var dic = (IDictionary<string, T>)cache.Get(key);
|
||||
var dic = HashGetAll<T>(key);
|
||||
if (value != null)
|
||||
{
|
||||
if (dic == null)
|
||||
{
|
||||
dic = new Dictionary<string, T>();
|
||||
}
|
||||
dic[field] = value;
|
||||
cache.Set(key, dic, null);
|
||||
dic.AddOrUpdate(field, value, (k, v) => value);
|
||||
MemoryCache.Set(key, dic, DateTime.MaxValue);
|
||||
}
|
||||
else if (dic != null)
|
||||
{
|
||||
dic.Remove(field);
|
||||
dic.TryRemove(field, out _);
|
||||
if (dic.Count == 0)
|
||||
{
|
||||
cache.Remove(key);
|
||||
MemoryCache.Remove(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
cache.Set(key, dic, null);
|
||||
MemoryCache.Set(key, dic, DateTime.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MemoryCache GetCache()
|
||||
{
|
||||
return MemoryCache.Default;
|
||||
}
|
||||
}
|
||||
}
|
@ -25,11 +25,12 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ASC.Common.Caching
|
||||
{
|
||||
[Singletone(typeof(AscCache))]
|
||||
public interface ICache
|
||||
{
|
||||
T Get<T>(string key) where T : class;
|
||||
@ -43,7 +44,7 @@ namespace ASC.Common.Caching
|
||||
void Remove(Regex pattern);
|
||||
|
||||
|
||||
IDictionary<string, T> HashGetAll<T>(string key);
|
||||
ConcurrentDictionary<string, T> HashGetAll<T>(string key);
|
||||
|
||||
T HashGet<T>(string key, string field);
|
||||
|
||||
|
@ -25,10 +25,12 @@
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
namespace ASC.Common.Caching
|
||||
{
|
||||
[Singletone]
|
||||
public interface ICacheNotify<T> where T : IMessage<T>, new()
|
||||
{
|
||||
void Publish(T obj, CacheNotifyAction action);
|
||||
|
@ -11,13 +11,11 @@ using Confluent.Kafka;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Common.Caching
|
||||
{
|
||||
[Singletone]
|
||||
public class KafkaCache<T> : IDisposable, ICacheNotify<T> where T : IMessage<T>, new()
|
||||
{
|
||||
private ClientConfig ClientConfig { get; set; }
|
||||
@ -33,7 +31,7 @@ namespace ASC.Common.Caching
|
||||
private IProducer<AscCacheItem, T> Producer { get; set; }
|
||||
private Guid Key { get; set; }
|
||||
|
||||
public KafkaCache(IConfiguration configuration, IOptionsMonitor<ILog> options)
|
||||
public KafkaCache(ConfigurationExtension configuration, IOptionsMonitor<ILog> options)
|
||||
{
|
||||
Log = options.CurrentValue;
|
||||
Cts = new ConcurrentDictionary<string, CancellationTokenSource>();
|
||||
@ -132,11 +130,11 @@ namespace ASC.Common.Caching
|
||||
try
|
||||
{
|
||||
var cr = c.Consume(Cts[channelName].Token);
|
||||
if (cr != null && cr.Value != null && !(new Guid(cr.Key.Id.ToByteArray())).Equals(Key) && Actions.TryGetValue(channelName, out var act))
|
||||
if (cr != null && cr.Message != null && cr.Message.Value != null && !(new Guid(cr.Message.Key.Id.ToByteArray())).Equals(Key) && Actions.TryGetValue(channelName, out var act))
|
||||
{
|
||||
try
|
||||
{
|
||||
act(cr.Value);
|
||||
act(cr.Message.Value);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -240,14 +238,4 @@ namespace ASC.Common.Caching
|
||||
return $"{typeof(T).Name}{cacheNotifyAction}";
|
||||
}
|
||||
}
|
||||
|
||||
public static class KafkaExtention
|
||||
{
|
||||
public static DIHelper AddKafkaService(this DIHelper services)
|
||||
{
|
||||
services.TryAddSingleton(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
|
||||
using Confluent.Kafka;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
namespace ASC.Common.Caching
|
||||
@ -7,7 +9,9 @@ namespace ASC.Common.Caching
|
||||
public class ProtobufSerializer<T> : ISerializer<T> where T : IMessage<T>, new()
|
||||
{
|
||||
public byte[] Serialize(T data, SerializationContext context)
|
||||
=> data.ToByteArray();
|
||||
{
|
||||
return data.ToByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProtobufDeserializer<T> : IDeserializer<T> where T : IMessage<T>, new()
|
||||
@ -20,7 +24,9 @@ namespace ASC.Common.Caching
|
||||
}
|
||||
|
||||
public T Deserialize(ReadOnlySpan<byte> data, bool isNull, SerializationContext context)
|
||||
=> parser.ParseFrom(data.ToArray());
|
||||
{
|
||||
return parser.ParseFrom(data.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public static class GuidExtension
|
||||
|
@ -1,147 +1,383 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
using ASC.Common.Threading.Progress;
|
||||
using ASC.Common.Threading.Workers;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Common
|
||||
{
|
||||
public enum DIAttributeEnum
|
||||
{
|
||||
Singletone,
|
||||
Scope,
|
||||
Transient
|
||||
}
|
||||
|
||||
public class TransientAttribute : DIAttribute
|
||||
{
|
||||
public override DIAttributeEnum DIAttributeEnum { get => DIAttributeEnum.Transient; }
|
||||
|
||||
public TransientAttribute() { }
|
||||
|
||||
public TransientAttribute(Type service) : base(service) { }
|
||||
|
||||
public TransientAttribute(Type service, Type implementation) : base(service, implementation) { }
|
||||
|
||||
public override void TryAdd(IServiceCollection services, Type service, Type implementation = null)
|
||||
{
|
||||
if (implementation != null)
|
||||
{
|
||||
services.AddTransient(service, implementation);
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddTransient(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ScopeAttribute : DIAttribute
|
||||
{
|
||||
public override DIAttributeEnum DIAttributeEnum { get => DIAttributeEnum.Scope; }
|
||||
|
||||
public ScopeAttribute() { }
|
||||
|
||||
public ScopeAttribute(Type service) : base(service) { }
|
||||
|
||||
public ScopeAttribute(Type service, Type implementation) : base(service, implementation) { }
|
||||
|
||||
public override void TryAdd(IServiceCollection services, Type service, Type implementation = null)
|
||||
{
|
||||
if (implementation != null)
|
||||
{
|
||||
services.AddScoped(service, implementation);
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddScoped(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SingletoneAttribute : DIAttribute
|
||||
{
|
||||
public override DIAttributeEnum DIAttributeEnum { get => DIAttributeEnum.Singletone; }
|
||||
|
||||
public SingletoneAttribute() { }
|
||||
|
||||
public SingletoneAttribute(Type service) : base(service) { }
|
||||
|
||||
public SingletoneAttribute(Type service, Type implementation) : base(service, implementation) { }
|
||||
|
||||
public override void TryAdd(IServiceCollection services, Type service, Type implementation = null)
|
||||
{
|
||||
if (implementation != null)
|
||||
{
|
||||
services.AddSingleton(service, implementation);
|
||||
}
|
||||
else
|
||||
{
|
||||
services.AddSingleton(service);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class DIAttribute : Attribute
|
||||
{
|
||||
public abstract DIAttributeEnum DIAttributeEnum { get; }
|
||||
public Type Implementation { get; }
|
||||
public Type Service { get; }
|
||||
public Type Additional { get; set; }
|
||||
|
||||
public DIAttribute() { }
|
||||
|
||||
public DIAttribute(Type service)
|
||||
{
|
||||
Service = service;
|
||||
}
|
||||
|
||||
public DIAttribute(Type service, Type implementation)
|
||||
{
|
||||
Implementation = implementation;
|
||||
Service = service;
|
||||
}
|
||||
|
||||
public abstract void TryAdd(IServiceCollection services, Type service, Type implementation = null);
|
||||
}
|
||||
|
||||
public class DIHelper
|
||||
{
|
||||
public List<string> Singleton { get; set; }
|
||||
public List<string> Scoped { get; set; }
|
||||
public List<string> Transient { get; set; }
|
||||
public Dictionary<DIAttributeEnum, List<string>> Services { get; set; }
|
||||
public List<string> Added { get; set; }
|
||||
public List<string> Configured { get; set; }
|
||||
public IServiceCollection ServiceCollection { get; }
|
||||
public IServiceCollection ServiceCollection { get; private set; }
|
||||
|
||||
public DIHelper(IServiceCollection serviceCollection)
|
||||
public DIHelper()
|
||||
{
|
||||
Singleton = new List<string>();
|
||||
Scoped = new List<string>();
|
||||
Transient = new List<string>();
|
||||
Services = new Dictionary<DIAttributeEnum, List<string>>()
|
||||
{
|
||||
{ DIAttributeEnum.Singletone, new List<string>() },
|
||||
{ DIAttributeEnum.Scope, new List<string>() },
|
||||
{ DIAttributeEnum.Transient, new List<string>() }
|
||||
};
|
||||
Added = new List<string>();
|
||||
Configured = new List<string>();
|
||||
}
|
||||
|
||||
public DIHelper(IServiceCollection serviceCollection) : this()
|
||||
{
|
||||
ServiceCollection = serviceCollection;
|
||||
}
|
||||
|
||||
public DIHelper TryAddScoped<TService>() where TService : class
|
||||
public void Configure(IServiceCollection serviceCollection)
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}";
|
||||
if (!Scoped.Contains(serviceName))
|
||||
{
|
||||
Scoped.Add(serviceName);
|
||||
ServiceCollection.TryAddScoped<TService>();
|
||||
}
|
||||
return this;
|
||||
ServiceCollection = serviceCollection;
|
||||
}
|
||||
|
||||
public DIHelper TryAddScoped<TService, TImplementation>() where TService : class where TImplementation : class, TService
|
||||
public bool TryAdd<TService>() where TService : class
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}{typeof(TImplementation)}";
|
||||
if (!Scoped.Contains(serviceName))
|
||||
{
|
||||
Scoped.Add(serviceName);
|
||||
ServiceCollection.TryAddScoped<TService, TImplementation>();
|
||||
return TryAdd(typeof(TService));
|
||||
}
|
||||
|
||||
return this;
|
||||
public bool TryAdd<TService, TImplementation>() where TService : class
|
||||
{
|
||||
return TryAdd(typeof(TService), typeof(TImplementation));
|
||||
}
|
||||
|
||||
public DIHelper TryAddScoped<TService, TImplementation>(TService tservice, TImplementation tImplementation) where TService : Type where TImplementation : Type
|
||||
public bool TryAdd(Type service, Type implementation = null)
|
||||
{
|
||||
var serviceName = $"{tservice}{tImplementation}";
|
||||
if (!Scoped.Contains(serviceName))
|
||||
if (service.IsInterface && service.IsGenericType && implementation == null &&
|
||||
(service.GetGenericTypeDefinition() == typeof(IOptionsSnapshot<>) ||
|
||||
service.GetGenericTypeDefinition() == typeof(IOptions<>) ||
|
||||
service.GetGenericTypeDefinition() == typeof(IOptionsMonitor<>)
|
||||
))
|
||||
{
|
||||
Scoped.Add(serviceName);
|
||||
ServiceCollection.TryAddScoped(tservice, tImplementation);
|
||||
service = service.GetGenericArguments().FirstOrDefault();
|
||||
if (service == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
var serviceName = $"{service}{implementation}";
|
||||
if (Added.Contains(serviceName)) return false;
|
||||
Added.Add(serviceName);
|
||||
|
||||
var di = service.IsGenericType && (
|
||||
service.GetGenericTypeDefinition() == typeof(IConfigureOptions<>) ||
|
||||
service.GetGenericTypeDefinition() == typeof(IPostConfigureOptions<>) ||
|
||||
service.GetGenericTypeDefinition() == typeof(IOptionsMonitor<>)
|
||||
) && implementation != null ? implementation.GetCustomAttribute<DIAttribute>() : service.GetCustomAttribute<DIAttribute>();
|
||||
var isnew = false;
|
||||
|
||||
if (di != null)
|
||||
{
|
||||
if (di.Additional != null)
|
||||
{
|
||||
var m = di.Additional.GetMethod("Register", BindingFlags.Public | BindingFlags.Static);
|
||||
m.Invoke(null, new[] { this });
|
||||
}
|
||||
|
||||
public DIHelper TryAddSingleton<TService>() where TService : class
|
||||
if (!service.IsInterface || implementation != null)
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}";
|
||||
if (!Singleton.Contains(serviceName))
|
||||
{
|
||||
Singleton.Add(serviceName);
|
||||
ServiceCollection.TryAddSingleton<TService>();
|
||||
isnew = implementation != null ? Register(service, implementation) : Register(service);
|
||||
if (!isnew) return false;
|
||||
}
|
||||
|
||||
return this;
|
||||
if (service.IsInterface && implementation == null || !service.IsInterface)
|
||||
{
|
||||
if (di.Service != null)
|
||||
{
|
||||
var a = di.Service.GetInterfaces().FirstOrDefault(x => x.IsGenericType && (
|
||||
x.GetGenericTypeDefinition() == typeof(IConfigureOptions<>) ||
|
||||
x.GetGenericTypeDefinition() == typeof(IPostConfigureOptions<>) ||
|
||||
x.GetGenericTypeDefinition() == typeof(IOptionsMonitor<>)
|
||||
));
|
||||
if (a != null)
|
||||
{
|
||||
if (!a.ContainsGenericParameters)
|
||||
{
|
||||
var b = a.GetGenericArguments();
|
||||
|
||||
foreach (var g in b)
|
||||
{
|
||||
if (g != service)
|
||||
{
|
||||
TryAdd(g);
|
||||
if (service.IsInterface && di.Implementation == null)
|
||||
{
|
||||
TryAdd(service, g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TryAdd(a, di.Service);
|
||||
}
|
||||
else
|
||||
{
|
||||
Type c = null;
|
||||
var a1 = a.GetGenericTypeDefinition();
|
||||
var b = a.GetGenericArguments().FirstOrDefault();
|
||||
|
||||
if (b != null && b.IsGenericType)
|
||||
{
|
||||
var b1 = b.GetGenericTypeDefinition().MakeGenericType(service.GetGenericArguments());
|
||||
|
||||
TryAdd(b1);
|
||||
c = a1.MakeGenericType(b1);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = a1.MakeGenericType(service.GetGenericArguments());
|
||||
}
|
||||
|
||||
TryAdd(c, di.Service.MakeGenericType(service.GetGenericArguments()));
|
||||
//a, di.Service
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (di.Implementation == null)
|
||||
{
|
||||
isnew = Register(service, di.Service);
|
||||
TryAdd(di.Service);
|
||||
}
|
||||
else
|
||||
{
|
||||
Register(di.Service);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (di.Implementation != null)
|
||||
{
|
||||
var a = di.Implementation.GetInterfaces().FirstOrDefault(x => x.IsGenericType &&
|
||||
(x.GetGenericTypeDefinition() == typeof(IConfigureOptions<>) ||
|
||||
x.GetGenericTypeDefinition() == typeof(IPostConfigureOptions<>) ||
|
||||
x.GetGenericTypeDefinition() == typeof(IOptionsMonitor<>))
|
||||
);
|
||||
if (a != null)
|
||||
{
|
||||
if (!a.ContainsGenericParameters)
|
||||
{
|
||||
var b = a.GetGenericArguments();
|
||||
|
||||
foreach (var g in b)
|
||||
{
|
||||
if (g != service)
|
||||
{
|
||||
//TryAdd(g);
|
||||
if (service.IsInterface && implementation == null)
|
||||
{
|
||||
TryAdd(service, g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TryAdd(a, di.Implementation);
|
||||
}
|
||||
else
|
||||
{
|
||||
Type c = null;
|
||||
var a1 = a.GetGenericTypeDefinition();
|
||||
var b = a.GetGenericArguments().FirstOrDefault();
|
||||
|
||||
if (b != null && b.IsGenericType)
|
||||
{
|
||||
var b1 = b.GetGenericTypeDefinition().MakeGenericType(service.GetGenericArguments());
|
||||
|
||||
TryAdd(b1);
|
||||
c = a1.MakeGenericType(b1);
|
||||
}
|
||||
else
|
||||
{
|
||||
c = a1.MakeGenericType(service.GetGenericArguments());
|
||||
}
|
||||
|
||||
TryAdd(c, di.Implementation.MakeGenericType(service.GetGenericArguments()));
|
||||
//a, di.Service
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isnew = TryAdd(service, di.Implementation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isnew)
|
||||
{
|
||||
ConstructorInfo[] props = null;
|
||||
|
||||
if (!service.IsInterface)
|
||||
{
|
||||
props = service.GetConstructors();
|
||||
}
|
||||
else if (implementation != null)
|
||||
{
|
||||
props = implementation.GetConstructors();
|
||||
}
|
||||
else if (di.Service != null)
|
||||
{
|
||||
props = di.Service.GetConstructors();
|
||||
}
|
||||
|
||||
if (props != null)
|
||||
{
|
||||
var par = props.SelectMany(r => r.GetParameters()).Distinct();
|
||||
foreach (var p1 in par)
|
||||
{
|
||||
TryAdd(p1.ParameterType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isnew;
|
||||
}
|
||||
|
||||
private bool Register(Type service, Type implementation = null)
|
||||
{
|
||||
if (service.IsSubclassOf(typeof(ControllerBase))|| service.GetInterfaces().Contains(typeof(IResourceFilter)) || service.GetInterfaces().Contains(typeof(IDictionary<string, string>))) return true;
|
||||
var c = service.IsGenericType && (
|
||||
service.GetGenericTypeDefinition() == typeof(IConfigureOptions<>) ||
|
||||
service.GetGenericTypeDefinition() == typeof(IPostConfigureOptions<>) ||
|
||||
service.GetGenericTypeDefinition() == typeof(IOptionsMonitor<>)
|
||||
) && implementation != null ? implementation.GetCustomAttribute<DIAttribute>() : service.GetCustomAttribute<DIAttribute>();
|
||||
var serviceName = $"{service}{implementation}";
|
||||
|
||||
if (!Services[c.DIAttributeEnum].Contains(serviceName))
|
||||
{
|
||||
c.TryAdd(ServiceCollection, service, implementation);
|
||||
Services[c.DIAttributeEnum].Add(serviceName);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public DIHelper TryAddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory) where TService : class
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}";
|
||||
if (!Singleton.Contains(serviceName))
|
||||
if (!Services[DIAttributeEnum.Singletone].Contains(serviceName))
|
||||
{
|
||||
Singleton.Add(serviceName);
|
||||
Services[DIAttributeEnum.Singletone].Add(serviceName);
|
||||
ServiceCollection.TryAddSingleton(implementationFactory);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper TryAddSingleton<TService>(TService t) where TService : class
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}";
|
||||
if (!Singleton.Contains(serviceName))
|
||||
{
|
||||
Singleton.Add(serviceName);
|
||||
ServiceCollection.TryAddSingleton(t);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper TryAddSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}{typeof(TImplementation)}";
|
||||
if (!Singleton.Contains(serviceName))
|
||||
{
|
||||
Singleton.Add(serviceName);
|
||||
ServiceCollection.TryAddSingleton<TService, TImplementation>();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper AddSingleton<TService, TImplementation>() where TService : class where TImplementation : class, TService
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}{typeof(TImplementation)}";
|
||||
if (!Singleton.Contains(serviceName))
|
||||
{
|
||||
Singleton.Add(serviceName);
|
||||
ServiceCollection.AddSingleton<TService, TImplementation>();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper TryAddSingleton<TService, TImplementation>(TService tservice, TImplementation tImplementation) where TService : Type where TImplementation : Type
|
||||
{
|
||||
var serviceName = $"{tservice}{tImplementation}";
|
||||
if (!Singleton.Contains(serviceName))
|
||||
{
|
||||
Singleton.Add(serviceName);
|
||||
ServiceCollection.TryAddSingleton(tservice, tImplementation);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public DIHelper TryAddTransient<TService>() where TService : class
|
||||
{
|
||||
var serviceName = $"{typeof(TService)}";
|
||||
if (!Transient.Contains(serviceName))
|
||||
{
|
||||
Transient.Add(serviceName);
|
||||
ServiceCollection.TryAddTransient<TService>();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper Configure<TOptions>(Action<TOptions> configureOptions) where TOptions : class
|
||||
{
|
||||
var serviceName = $"{typeof(TOptions)}";
|
||||
@ -154,6 +390,42 @@ namespace ASC.Common
|
||||
return this;
|
||||
}
|
||||
|
||||
private void AddToConfigured<TOptions>(string type, Action<TOptions> action) where TOptions : class
|
||||
{
|
||||
if (!Configured.Contains(type))
|
||||
{
|
||||
Configured.Add(type);
|
||||
ServiceCollection.Configure(action);
|
||||
}
|
||||
}
|
||||
|
||||
public DIHelper AddWorkerQueue<T1>(int workerCount, int waitInterval, bool stopAfterFinsih, int errorCount)
|
||||
{
|
||||
void action(WorkerQueue<T1> a)
|
||||
{
|
||||
a.workerCount = workerCount;
|
||||
a.waitInterval = waitInterval;
|
||||
a.stopAfterFinsih = stopAfterFinsih;
|
||||
a.errorCount = errorCount;
|
||||
}
|
||||
AddToConfigured($"{typeof(WorkerQueue<T1>)}", (Action<WorkerQueue<T1>>)action);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper AddProgressQueue<T1>(int workerCount, int waitInterval, bool removeAfterCompleted, bool stopAfterFinsih, int errorCount) where T1 : class, IProgressItem
|
||||
{
|
||||
void action(ProgressQueue<T1> a)
|
||||
{
|
||||
a.workerCount = workerCount;
|
||||
a.waitInterval = waitInterval;
|
||||
a.stopAfterFinsih = stopAfterFinsih;
|
||||
a.errorCount = errorCount;
|
||||
a.removeAfterCompleted = removeAfterCompleted;
|
||||
}
|
||||
AddToConfigured($"{typeof(ProgressQueue<T1>)}", (Action<ProgressQueue<T1>>)action);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DIHelper Configure<TOptions>(string name, Action<TOptions> configureOptions) where TOptions : class
|
||||
{
|
||||
var serviceName = $"{typeof(TOptions)}{name}";
|
||||
|
@ -26,12 +26,12 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Data.Storage;
|
||||
|
||||
public static class StreamExtension
|
||||
{
|
||||
private const int BufferSize = 2048; //NOTE: set to 2048 to fit in minimum tcp window
|
||||
// public const int BufferSize = 2048; //NOTE: set to 2048 to fit in minimum tcp window
|
||||
|
||||
public static Stream GetBuffered(this Stream srcStream)
|
||||
{
|
||||
@ -40,7 +40,7 @@ public static class StreamExtension
|
||||
{
|
||||
//Buffer it
|
||||
var memStream = TempStream.Create();
|
||||
srcStream.StreamCopyTo(memStream);
|
||||
srcStream.CopyTo(memStream);
|
||||
memStream.Position = 0;
|
||||
return memStream;
|
||||
}
|
||||
@ -60,44 +60,4 @@ public static class StreamExtension
|
||||
mem.Read(buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public static void StreamCopyTo(this Stream srcStream, Stream dstStream)
|
||||
{
|
||||
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
|
||||
if (dstStream == null) throw new ArgumentNullException(nameof(dstStream));
|
||||
|
||||
var buffer = new byte[BufferSize];
|
||||
int readed;
|
||||
while ((readed = srcStream.Read(buffer, 0, BufferSize)) > 0)
|
||||
{
|
||||
dstStream.Write(buffer, 0, readed);
|
||||
}
|
||||
}
|
||||
public static async Task StreamCopyToAsync(this Stream srcStream, Stream dstStream)
|
||||
{
|
||||
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
|
||||
if (dstStream == null) throw new ArgumentNullException(nameof(dstStream));
|
||||
|
||||
var buffer = new byte[BufferSize];
|
||||
int readed;
|
||||
while ((readed = await srcStream.ReadAsync(buffer, 0, BufferSize)) > 0)
|
||||
{
|
||||
await dstStream.WriteAsync(buffer, 0, readed);
|
||||
}
|
||||
}
|
||||
|
||||
public static void StreamCopyTo(this Stream srcStream, Stream dstStream, int length)
|
||||
{
|
||||
if (srcStream == null) throw new ArgumentNullException(nameof(srcStream));
|
||||
if (dstStream == null) throw new ArgumentNullException(nameof(dstStream));
|
||||
|
||||
var buffer = new byte[BufferSize];
|
||||
var totalRead = 0;
|
||||
int readed;
|
||||
while ((readed = srcStream.Read(buffer, 0, length - totalRead > BufferSize ? BufferSize : length - totalRead)) > 0 && totalRead < length)
|
||||
{
|
||||
dstStream.Write(buffer, 0, readed);
|
||||
totalRead += readed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,8 @@ using System.Runtime.Loader;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Configuration;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
|
||||
namespace ASC.Common.DependencyInjection
|
||||
{
|
||||
@ -26,13 +23,15 @@ namespace ASC.Common.DependencyInjection
|
||||
|
||||
public static class AutofacExtension
|
||||
{
|
||||
public static IContainer AddAutofac(this IServiceCollection services, IConfiguration configuration, string currentDir)
|
||||
public static void Register(this ContainerBuilder builder, IConfiguration configuration, string currentDir, bool loadproducts = true, bool loadconsumers = true, params string[] intern)
|
||||
{
|
||||
var folder = configuration["core:products:folder"];
|
||||
var subfolder = configuration["core:products:subfolder"];
|
||||
string productsDir;
|
||||
|
||||
if (currentDir.EndsWith(Path.Combine(Path.GetFileName(folder), Assembly.GetCallingAssembly().GetName().Name, subfolder)))
|
||||
if (!Path.IsPathRooted(folder))
|
||||
{
|
||||
if (currentDir.EndsWith(Path.Combine(Path.GetFileName(folder), Assembly.GetEntryAssembly().GetName().Name, subfolder)))
|
||||
{
|
||||
productsDir = Path.GetFullPath(Path.Combine("..", ".."));
|
||||
}
|
||||
@ -40,33 +39,52 @@ namespace ASC.Common.DependencyInjection
|
||||
{
|
||||
productsDir = Path.GetFullPath(Path.Combine(currentDir, folder));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
productsDir = folder;
|
||||
}
|
||||
|
||||
var builder = new ContainerBuilder();
|
||||
var modules = new string[] { "autofac.json", "autofac.products.json", "autofac.consumers.json" };
|
||||
var modules = new List<(bool, string)>
|
||||
{
|
||||
(true, "autofac.json")
|
||||
};
|
||||
|
||||
if (loadproducts)
|
||||
{
|
||||
modules.Add((true, "autofac.products.json"));
|
||||
}
|
||||
|
||||
if (loadconsumers)
|
||||
{
|
||||
modules.Add((true, "autofac.consumers.json"));
|
||||
}
|
||||
|
||||
if (intern != null)
|
||||
{
|
||||
modules.AddRange(intern.Select(r => (false, r)));
|
||||
}
|
||||
|
||||
foreach (var p in modules)
|
||||
{
|
||||
var config = new ConfigurationBuilder()
|
||||
.SetBasePath(configuration["pathToConf"])
|
||||
.AddJsonFile(p);
|
||||
var config = new ConfigurationBuilder();
|
||||
if (p.Item1)
|
||||
{
|
||||
config.SetBasePath(configuration["pathToConf"]);
|
||||
}
|
||||
config.AddJsonFile(p.Item2);
|
||||
|
||||
var root = config.Build();
|
||||
var module = new ConfigurationModule(root);
|
||||
builder.RegisterModule(module);
|
||||
|
||||
if (p == "autofac.products.json")
|
||||
if (p.Item2 == "autofac.products.json")
|
||||
{
|
||||
FindAndLoad(root.GetSection("components"));
|
||||
}
|
||||
}
|
||||
|
||||
builder.Populate(services);
|
||||
|
||||
var container = builder.Build();
|
||||
|
||||
services.TryAddSingleton(container);
|
||||
|
||||
return container;
|
||||
return;
|
||||
|
||||
void FindAndLoad(IConfigurationSection sectionSettings)
|
||||
{
|
||||
@ -104,13 +122,7 @@ namespace ASC.Common.DependencyInjection
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
AssemblyLoadContext.Default.Resolving += (c, n) =>
|
||||
{
|
||||
var path = GetFullPath(n.Name);
|
||||
return path != null ?
|
||||
c.LoadFromAssemblyPath(Path.Combine(Path.GetDirectoryName(path), $"{n.Name}.dll")) :
|
||||
null;
|
||||
};
|
||||
AssemblyLoadContext.Default.Resolving += new Resolver(path).Resolving;
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,7 +132,7 @@ namespace ASC.Common.DependencyInjection
|
||||
return GetPath(Path.Combine(productPath, "bin"), n, SearchOption.AllDirectories) ?? GetPath(productPath, n, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
string GetPath(string dirPath, string dll, SearchOption searchOption)
|
||||
static string GetPath(string dirPath, string dll, SearchOption searchOption)
|
||||
{
|
||||
if (!Directory.Exists(dirPath)) return null;
|
||||
|
||||
@ -128,4 +140,23 @@ namespace ASC.Common.DependencyInjection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Resolver
|
||||
{
|
||||
private string ResolvePath { get; set; }
|
||||
|
||||
public Resolver(string assemblyPath)
|
||||
{
|
||||
ResolvePath = assemblyPath;
|
||||
}
|
||||
|
||||
public Assembly Resolving(AssemblyLoadContext context, AssemblyName assemblyName)
|
||||
{
|
||||
var path = Path.Combine(Path.GetDirectoryName(ResolvePath), $"{assemblyName.Name}.dll");
|
||||
|
||||
if (!File.Exists(path)) return null;
|
||||
|
||||
return context.LoadFromAssemblyPath(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Common.Logging
|
||||
{
|
||||
[Scope]
|
||||
public class EFLoggerFactory : ILoggerFactory
|
||||
{
|
||||
Dictionary<string, ILogger> Loggers { get; set; }
|
||||
Lazy<ILogger> Logger { get; set; }
|
||||
ILoggerProvider LoggerProvider { get; set; }
|
||||
|
||||
public EFLoggerFactory(EFLoggerProvider loggerProvider)
|
||||
{
|
||||
LoggerProvider = loggerProvider;
|
||||
Loggers = new Dictionary<string, ILogger>();
|
||||
Logger = new Lazy<ILogger>(() => LoggerProvider.CreateLogger(""));
|
||||
}
|
||||
|
||||
public void AddProvider(ILoggerProvider provider)
|
||||
@ -24,7 +27,7 @@ namespace ASC.Common.Logging
|
||||
|
||||
public ILogger CreateLogger(string categoryName)
|
||||
{
|
||||
return LoggerProvider.CreateLogger(categoryName);
|
||||
return Logger.Value;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -32,9 +35,10 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
}
|
||||
|
||||
[Scope]
|
||||
public class EFLoggerProvider : ILoggerProvider
|
||||
{
|
||||
public IOptionsMonitor<ILog> Option { get; }
|
||||
private IOptionsMonitor<ILog> Option { get; }
|
||||
|
||||
public EFLoggerProvider(IOptionsMonitor<ILog> option)
|
||||
{
|
||||
@ -59,7 +63,9 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state) { return null; }
|
||||
public bool IsEnabled(LogLevel logLevel) => logLevel switch
|
||||
public bool IsEnabled(LogLevel logLevel)
|
||||
{
|
||||
return logLevel switch
|
||||
{
|
||||
LogLevel.Trace => CustomLogger.IsTraceEnabled,
|
||||
LogLevel.Information => CustomLogger.IsInfoEnabled,
|
||||
@ -72,6 +78,7 @@ namespace ASC.Common.Logging
|
||||
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
@ -101,7 +108,8 @@ namespace ASC.Common.Logging
|
||||
new KeyValuePair<string, object>("sqlParams", parameters ?? "")
|
||||
);
|
||||
}
|
||||
string GetParam(KeyValuePair<string, object> keyValuePair, string key, string currentVal)
|
||||
|
||||
static string GetParam(KeyValuePair<string, object> keyValuePair, string key, string currentVal)
|
||||
{
|
||||
return keyValuePair.Key == key ? keyValuePair.Value.ToString() : currentVal;
|
||||
}
|
||||
@ -116,15 +124,4 @@ namespace ASC.Common.Logging
|
||||
string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LoggerExtension
|
||||
{
|
||||
public static DIHelper AddLoggerService(this DIHelper services)
|
||||
{
|
||||
services.TryAddScoped<EFLoggerFactory>();
|
||||
services.TryAddScoped<EFLoggerProvider>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ using log4net.Config;
|
||||
using log4net.Core;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using NLog;
|
||||
|
||||
namespace ASC.Common.Logging
|
||||
{
|
||||
[Singletone(typeof(ConfigureLogNLog), Additional = typeof(LogNLogExtension))]
|
||||
public interface ILog
|
||||
{
|
||||
bool IsDebugEnabled { get; }
|
||||
@ -373,20 +373,21 @@ namespace ASC.Common.Logging
|
||||
public string Dir { get; set; }
|
||||
}
|
||||
|
||||
public class ConfigureLogNLog : IConfigureOptions<LogNLog>
|
||||
[Singletone]
|
||||
public class ConfigureLogNLog : IConfigureNamedOptions<LogNLog>
|
||||
{
|
||||
public ConfigureLogNLog(IConfiguration configuration)
|
||||
private IConfiguration Configuration { get; }
|
||||
private ConfigurationExtension ConfigurationExtension { get; }
|
||||
|
||||
public ConfigureLogNLog(IConfiguration configuration, ConfigurationExtension configurationExtension)
|
||||
{
|
||||
Configuration = configuration;
|
||||
}
|
||||
ConfigurationExtension = configurationExtension;
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(Path.Combine(Configuration["pathToConf"], "nlog.config"));
|
||||
LogManager.ThrowConfigExceptions = false;
|
||||
|
||||
public void Configure(LogNLog options)
|
||||
{
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(Path.Combine(Configuration["pathToConf"], "nlog.config"), true);
|
||||
|
||||
var settings = Configuration.GetSetting<NLogSettings>("log");
|
||||
var settings = ConfigurationExtension.GetSetting<NLogSettings>("log");
|
||||
if (!string.IsNullOrEmpty(settings.Name))
|
||||
{
|
||||
LogManager.Configuration.Variables["name"] = settings.Name;
|
||||
@ -399,6 +400,16 @@ namespace ASC.Common.Logging
|
||||
|
||||
NLog.Targets.Target.Register<SelfCleaningTarget>("SelfCleaning");
|
||||
}
|
||||
|
||||
public void Configure(LogNLog options)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void Configure(string name, LogNLog options)
|
||||
{
|
||||
Configure(options);
|
||||
}
|
||||
}
|
||||
|
||||
public class LogNLog : ILog
|
||||
@ -659,7 +670,7 @@ namespace ASC.Common.Logging
|
||||
if (IsFatalEnabled) Loger.Fatal(provider, format, args);
|
||||
}
|
||||
|
||||
public string LogDirectory { get { return NLog.LogManager.Configuration.Variables["logDirectory"].Text; } }
|
||||
public string LogDirectory { get { return NLog.LogManager.Configuration.Variables["dir"].Text; } }
|
||||
|
||||
private string name;
|
||||
public string Name
|
||||
@ -847,6 +858,7 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
|
||||
|
||||
[Singletone]
|
||||
public class LogManager<T> : OptionsMonitor<T> where T : class, ILog, new()
|
||||
{
|
||||
public LogManager(IOptionsFactory<T> factory, IEnumerable<IOptionsChangeTokenSource<T>> sources, IOptionsMonitorCache<T> cache) : base(factory, sources, cache)
|
||||
@ -866,29 +878,32 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
}
|
||||
|
||||
public static class StudioNotifyHelperExtension
|
||||
public class LoggerExtension<T> where T : class, ILog, new()
|
||||
{
|
||||
public static DIHelper AddLogManager<T>(this DIHelper services, params string[] additionalLoggers) where T : class, ILog, new()
|
||||
public static void RegisterLog(DIHelper services)
|
||||
{
|
||||
const string baseName = "ASC";
|
||||
var baseSqlName = $"{baseName}.SQL";
|
||||
services.Configure<T>(r => r.Name = baseName);
|
||||
services.Configure<T>(baseName, r => r.Name = baseName);
|
||||
services.Configure<T>(baseSqlName, r => r.Name = baseSqlName);
|
||||
services.TryAdd(typeof(IOptionsMonitor<ILog>), typeof(LogManager<T>));
|
||||
}
|
||||
|
||||
public static void ConfigureLog(DIHelper services, params string[] additionalLoggers)
|
||||
{
|
||||
foreach (var l in additionalLoggers)
|
||||
{
|
||||
services.Configure<T>(l, r => r.Name = l);
|
||||
}
|
||||
|
||||
services.TryAddSingleton(typeof(IOptionsMonitor<ILog>), typeof(LogManager<T>));
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
public static DIHelper AddNLogManager(this DIHelper services, params string[] additionalLoggers)
|
||||
public class LogNLogExtension : LoggerExtension<LogNLog>
|
||||
{
|
||||
services.TryAddSingleton<IConfigureOptions<LogNLog>, ConfigureLogNLog>();
|
||||
return services.AddLogManager<LogNLog>(additionalLoggers);
|
||||
public static void Register(DIHelper services)
|
||||
{
|
||||
RegisterLog(services);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
using log4net.Appender;
|
||||
using log4net.Core;
|
||||
using log4net.Util;
|
||||
|
@ -28,6 +28,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using NLog;
|
||||
using NLog.Common;
|
||||
using NLog.Targets;
|
||||
@ -122,7 +123,17 @@ namespace ASC.Common.Logging
|
||||
Clean();
|
||||
}
|
||||
|
||||
base.Write(logEvents);
|
||||
var buffer = new List<AsyncLogEventInfo>();
|
||||
|
||||
foreach (var logEvent in logEvents)
|
||||
{
|
||||
buffer.Add(logEvent);
|
||||
if (buffer.Count < 10) continue;
|
||||
base.Write(buffer);
|
||||
buffer.Clear();
|
||||
}
|
||||
|
||||
base.Write(buffer);
|
||||
}
|
||||
|
||||
protected override void Write(LogEventInfo logEvent)
|
||||
|
@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
using log4net.Util;
|
||||
|
||||
namespace ASC.Common.Logging
|
||||
@ -73,10 +74,10 @@ namespace ASC.Common.Logging
|
||||
}
|
||||
|
||||
var val = repo.Properties[realKey];
|
||||
if (val is PatternString)
|
||||
if (val is PatternString patternString)
|
||||
{
|
||||
((PatternString)val).ActivateOptions();
|
||||
((PatternString)val).Format(writer);
|
||||
patternString.ActivateOptions();
|
||||
patternString.Format(writer);
|
||||
}
|
||||
else if (val != null)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
using ASC.Common.Security.Authorizing;
|
||||
|
||||
namespace ASC.Common.Security.Authentication
|
||||
|
@ -44,10 +44,10 @@ namespace ASC.Common.Security.Authorizing
|
||||
currObjIdAsProvider = false;
|
||||
CurrentObjectId = objectId ?? throw new ArgumentNullException(nameof(objectId));
|
||||
currSecObjProvider = secObjProvider;
|
||||
if (currSecObjProvider == null && CurrentObjectId is ISecurityObjectProvider)
|
||||
if (currSecObjProvider == null && CurrentObjectId is ISecurityObjectProvider securityObjectProvider)
|
||||
{
|
||||
currObjIdAsProvider = true;
|
||||
currSecObjProvider = (ISecurityObjectProvider)CurrentObjectId;
|
||||
currSecObjProvider = securityObjectProvider;
|
||||
}
|
||||
callContext = new SecurityCallContext();
|
||||
}
|
||||
|
@ -33,9 +33,10 @@ using ASC.Common;
|
||||
|
||||
namespace ASC.Security.Cryptography
|
||||
{
|
||||
[Singletone]
|
||||
public class InstanceCrypto
|
||||
{
|
||||
public MachinePseudoKeys MachinePseudoKeys { get; }
|
||||
private MachinePseudoKeys MachinePseudoKeys { get; }
|
||||
|
||||
public InstanceCrypto(MachinePseudoKeys machinePseudoKeys)
|
||||
{
|
||||
@ -86,14 +87,4 @@ namespace ASC.Security.Cryptography
|
||||
return MachinePseudoKeys.GetMachineConstant(32);
|
||||
}
|
||||
}
|
||||
public static class InstanceCryptoExtension
|
||||
{
|
||||
public static DIHelper AddInstanceCryptoService(this DIHelper services)
|
||||
{
|
||||
services.TryAddSingleton<InstanceCrypto>();
|
||||
|
||||
return services
|
||||
.AddMachinePseudoKeysService();
|
||||
}
|
||||
}
|
||||
}
|
@ -36,6 +36,7 @@ using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace ASC.Security.Cryptography
|
||||
{
|
||||
[Singletone]
|
||||
public class MachinePseudoKeys
|
||||
{
|
||||
private readonly byte[] confkey = null;
|
||||
@ -76,13 +77,4 @@ namespace ASC.Security.Cryptography
|
||||
return buff;
|
||||
}
|
||||
}
|
||||
public static class MachinePseudoKeysExtension
|
||||
{
|
||||
public static DIHelper AddMachinePseudoKeysService(this DIHelper services)
|
||||
{
|
||||
services.TryAddSingleton<MachinePseudoKeys>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
100
common/ASC.Common/Security/Cryptography/PasswordHasher.cs
Normal file
100
common/ASC.Common/Security/Cryptography/PasswordHasher.cs
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2018
|
||||
*
|
||||
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
||||
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
||||
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
||||
*
|
||||
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
||||
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
||||
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
||||
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
||||
* in every copy of the program you distribute.
|
||||
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using ASC.Common;
|
||||
|
||||
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace ASC.Security.Cryptography
|
||||
{
|
||||
[Singletone]
|
||||
public class PasswordHasher
|
||||
{
|
||||
public PasswordHasher(IConfiguration configuration, MachinePseudoKeys machinePseudoKeys)
|
||||
{
|
||||
if (!int.TryParse(configuration["core:password:size"], out var size)) size = 256;
|
||||
Size = size;
|
||||
|
||||
if (!int.TryParse(configuration["core.password.iterations"], out var iterations)) iterations = 100000;
|
||||
Iterations = iterations;
|
||||
|
||||
Salt = (configuration["core:password:salt"] ?? "").Trim();
|
||||
if (string.IsNullOrEmpty(Salt))
|
||||
{
|
||||
var salt = Hasher.Hash("{9450BEF7-7D9F-4E4F-A18A-971D8681722D}", HashAlg.SHA256);
|
||||
|
||||
var PasswordHashSaltBytes = KeyDerivation.Pbkdf2(
|
||||
Encoding.UTF8.GetString(machinePseudoKeys.GetMachineConstant()),
|
||||
salt,
|
||||
KeyDerivationPrf.HMACSHA256,
|
||||
Iterations,
|
||||
Size / 8);
|
||||
Salt = BitConverter.ToString(PasswordHashSaltBytes).Replace("-", string.Empty).ToLower();
|
||||
}
|
||||
}
|
||||
|
||||
public int Size
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public int Iterations
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string Salt
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public string GetClientPassword(string password)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(password)) password = Guid.NewGuid().ToString();
|
||||
|
||||
var salt = new UTF8Encoding(false).GetBytes(Salt);
|
||||
|
||||
var hashBytes = KeyDerivation.Pbkdf2(
|
||||
password,
|
||||
salt,
|
||||
KeyDerivationPrf.HMACSHA256,
|
||||
Iterations,
|
||||
Size / 8);
|
||||
|
||||
var hash = BitConverter.ToString(hashBytes).Replace("-", string.Empty).ToLower();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -27,6 +27,7 @@
|
||||
#region usings
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common.Security.Authorizing;
|
||||
|
||||
#endregion
|
||||
|
@ -27,6 +27,7 @@
|
||||
#region usings
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ASC.Common.Security.Authorizing;
|
||||
|
||||
#endregion
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
using ASC.Common.Security.Authorizing;
|
||||
|
||||
namespace ASC.Common.Security
|
||||
|
@ -27,9 +27,11 @@
|
||||
#if DEBUG
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
using log4net;
|
||||
using log4net.Appender;
|
||||
using log4net.Config;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ASC.Common.Tests.Logging
|
||||
@ -48,9 +50,9 @@ namespace ASC.Common.Tests.Logging
|
||||
[Test]
|
||||
public void CommandLineTest()
|
||||
{
|
||||
XmlConfigurator.Configure(log4net.LogManager.GetRepository(Assembly.GetCallingAssembly()));
|
||||
var appenders = LogManager.GetLogger(Assembly.GetCallingAssembly(), "ASC").Logger.Repository.GetAppenders();
|
||||
_ = ((FileAppender)appenders[0]).File;
|
||||
//XmlConfigurator.Configure(log4net.LogManager.GetRepository(Assembly.GetCallingAssembly()));
|
||||
//var appenders = LogManager.GetLogger(Assembly.GetCallingAssembly(), "ASC").Logger.Repository.GetAppenders();
|
||||
//((FileAppender)appenders[0]).File;
|
||||
//Assert.AreEqual(Path.GetTempPath() + "onlyoffice\\8.0\\bin\\Test." + DateTime.Now.ToString("MM-dd") + ".log", ((FileAppender)appenders[0]).File);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,9 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
using ASC.Security.Cryptography;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ASC.Common.Tests.Security.Cryptography
|
||||
|
@ -29,7 +29,9 @@ namespace ASC.Common.Tests.Utils
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
[TestFixture]
|
||||
|
@ -28,7 +28,9 @@
|
||||
namespace ASC.Common.Tests.Utils
|
||||
{
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
[TestFixture]
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#if DEBUG
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ASC.Common.Tests.Utils
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#if DEBUG
|
||||
using ASC.Common.Web;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ASC.Common.Tests.Web
|
||||
|
@ -26,8 +26,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ASC.Common.Threading
|
||||
{
|
||||
@ -37,7 +36,7 @@ namespace ASC.Common.Threading
|
||||
|
||||
public DistributedTaskCache DistributedTaskCache { get; internal set; }
|
||||
|
||||
public string InstanceId
|
||||
public int InstanceId
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -45,7 +44,7 @@ namespace ASC.Common.Threading
|
||||
}
|
||||
set
|
||||
{
|
||||
DistributedTaskCache.InstanceId = value?.ToString() ?? "";
|
||||
DistributedTaskCache.InstanceId = value;
|
||||
}
|
||||
}
|
||||
public string Id
|
||||
@ -99,9 +98,11 @@ namespace ASC.Common.Threading
|
||||
|
||||
public T GetProperty<T>(string name)
|
||||
{
|
||||
return DistributedTaskCache.Props.Any(r => r.Key == name) ?
|
||||
JsonConvert.DeserializeObject<T>(DistributedTaskCache.Props.Single(r => r.Key == name).Value) :
|
||||
default;
|
||||
var prop = DistributedTaskCache.Props.FirstOrDefault(r => r.Key == name);
|
||||
|
||||
if (prop == null) return default;
|
||||
|
||||
return JsonSerializer.Deserialize<T>(prop.Value);
|
||||
}
|
||||
|
||||
public void SetProperty(string name, object value)
|
||||
@ -109,7 +110,7 @@ namespace ASC.Common.Threading
|
||||
var prop = new DistributedTaskCache.Types.DistributedTaskCacheProp()
|
||||
{
|
||||
Key = name,
|
||||
Value = JsonConvert.SerializeObject(value)
|
||||
Value = JsonSerializer.Serialize(value)
|
||||
};
|
||||
|
||||
var current = DistributedTaskCache.Props.SingleOrDefault(r => r.Key == name);
|
||||
|
@ -36,6 +36,7 @@ using ASC.Common.Caching;
|
||||
|
||||
namespace ASC.Common.Threading
|
||||
{
|
||||
[Singletone]
|
||||
public class DistributedTaskCacheNotify
|
||||
{
|
||||
public ConcurrentDictionary<string, CancellationTokenSource> Cancelations { get; }
|
||||
@ -43,11 +44,14 @@ namespace ASC.Common.Threading
|
||||
private readonly ICacheNotify<DistributedTaskCancelation> notify;
|
||||
private readonly ICacheNotify<DistributedTaskCache> notifyCache;
|
||||
|
||||
public DistributedTaskCacheNotify(ICacheNotify<DistributedTaskCancelation> notify, ICacheNotify<DistributedTaskCache> notifyCache)
|
||||
public DistributedTaskCacheNotify(
|
||||
ICacheNotify<DistributedTaskCancelation> notify,
|
||||
ICacheNotify<DistributedTaskCache> notifyCache,
|
||||
ICache cache)
|
||||
{
|
||||
Cancelations = new ConcurrentDictionary<string, CancellationTokenSource>();
|
||||
|
||||
Cache = AscCache.Memory;
|
||||
Cache = cache;
|
||||
|
||||
this.notify = notify;
|
||||
|
||||
@ -90,18 +94,18 @@ namespace ASC.Common.Threading
|
||||
|
||||
public class DistributedTaskQueue
|
||||
{
|
||||
public static readonly string InstanceId;
|
||||
public static readonly int InstanceId;
|
||||
|
||||
private readonly string key;
|
||||
private readonly ICache cache;
|
||||
private readonly TaskScheduler scheduler;
|
||||
private readonly ConcurrentDictionary<string, CancellationTokenSource> cancelations;
|
||||
|
||||
public DistributedTaskCacheNotify DistributedTaskCacheNotify { get; }
|
||||
private DistributedTaskCacheNotify DistributedTaskCacheNotify { get; }
|
||||
|
||||
static DistributedTaskQueue()
|
||||
{
|
||||
InstanceId = Process.GetCurrentProcess().Id.ToString();
|
||||
InstanceId = Process.GetCurrentProcess().Id;
|
||||
}
|
||||
|
||||
|
||||
@ -120,7 +124,7 @@ namespace ASC.Common.Threading
|
||||
key = name + GetType().Name;
|
||||
scheduler = maxThreadsCount <= 0
|
||||
? TaskScheduler.Default
|
||||
: new LimitedConcurrencyLevelTaskScheduler(maxThreadsCount);
|
||||
: new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, maxThreadsCount).ConcurrentScheduler;
|
||||
DistributedTaskCacheNotify = distributedTaskCacheNotify;
|
||||
cancelations = DistributedTaskCacheNotify.Cancelations;
|
||||
cache = DistributedTaskCacheNotify.Cache;
|
||||
@ -140,7 +144,7 @@ namespace ASC.Common.Threading
|
||||
var token = cancelation.Token;
|
||||
cancelations[distributedTask.Id] = cancelation;
|
||||
|
||||
var task = new Task(() => action(distributedTask, token), token, TaskCreationOptions.LongRunning);
|
||||
var task = new Task(() => { action(distributedTask, token); }, token, TaskCreationOptions.LongRunning);
|
||||
task
|
||||
.ConfigureAwait(false)
|
||||
.GetAwaiter()
|
||||
@ -159,7 +163,7 @@ namespace ASC.Common.Threading
|
||||
|
||||
public IEnumerable<DistributedTask> GetTasks()
|
||||
{
|
||||
var tasks = cache.HashGetAll<DistributedTaskCache>(key).Values.Select(r => new DistributedTask(r)).ToList();
|
||||
var tasks = cache.HashGetAll<DistributedTaskCache>(key).Select(r => new DistributedTask(r.Value)).ToList();
|
||||
tasks.ForEach(t =>
|
||||
{
|
||||
if (t.Publication == null)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user