diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..01763e5f
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,91 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+trim_trailing_whitespace = true
+insert_final_newline = true
+indent_style = tab
+indent_size = tab
+smart_tab = true
+
+[{*.yaml,*.yml}]
+indent_style = space
+indent_size = 2
+
+[*.cs]
+# Sort using and Import directives with System.* appearing first
+dotnet_sort_system_directives_first = true
+csharp_using_directive_placement = outside_namespace:warning
+# Avoid "this." if not necessary
+dotnet_style_qualification_for_field = false:suggestion
+dotnet_style_qualification_for_property = false:suggestion
+dotnet_style_qualification_for_method = false:suggestion
+dotnet_style_qualification_for_event = false:suggestion
+# Use language keywords instead of framework type names for type references
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
+# Suggest more modern language features when available
+dotnet_style_object_initializer = true:suggestion
+dotnet_style_collection_initializer = true:suggestion
+dotnet_style_coalesce_expression = true:suggestion
+dotnet_style_null_propagation = true:suggestion
+dotnet_style_explicit_tuple_names = true:suggestion
+csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
+csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
+csharp_style_inlined_variable_declaration = true:suggestion
+csharp_style_conditional_delegate_call = true:suggestion
+dotnet_style_prefer_auto_properties = true
+dotnet_style_prefer_conditional_expression_over_assignment = true
+dotnet_style_prefer_conditional_expression_over_return = true
+# Disable strange throw.
+csharp_style_throw_expression = false:suggestion
+# Forbid "var" everywhere
+csharp_style_var_for_built_in_types = false:warning
+csharp_style_var_when_type_is_apparent = false:warning
+csharp_style_var_elsewhere = false:warning
+# Prefer method-like constructs to have a block body
+csharp_style_expression_bodied_methods = false:none
+csharp_style_expression_bodied_constructors = false:none
+csharp_style_expression_bodied_operators = false:none
+# Prefer property-like constructs to have an expression-body
+csharp_style_expression_bodied_properties = true:none
+csharp_style_expression_bodied_indexers = true:none
+csharp_style_expression_bodied_accessors = true:none
+# Newline settings
+csharp_new_line_before_open_brace = all
+csharp_new_line_before_else = true
+csharp_new_line_before_catch = true
+csharp_new_line_before_finally = true
+csharp_new_line_before_members_in_object_initializers = false
+csharp_new_line_before_members_in_anonymous_types = true
+# Indentation settings
+csharp_indent_case_contents = true
+csharp_indent_switch_labels = true
+# Modifiers
+dotnet_style_readonly_field = true:suggestion
+csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
+# Naming style
+dotnet_naming_symbols.privates.applicable_kinds = property,method,event,delegate
+dotnet_naming_symbols.privates.applicable_accessibilities = private
+dotnet_naming_style.underscore_pascal.capitalization = pascal_case
+dotnet_naming_style.underscore_pascal.required_prefix = _
+dotnet_naming_rule.privates_with_underscore.symbols = privates
+dotnet_naming_rule.privates_with_underscore.style = underscore_pascal
+dotnet_naming_rule.privates_with_underscore.severity = warning
+dotnet_diagnostic.IDE1006.severity = warning
+# ReSharper properties
+resharper_align_multiline_binary_expressions_chain = false
+resharper_csharp_empty_block_style = together_same_line
+resharper_indent_nested_foreach_stmt = true
+resharper_indent_nested_for_stmt = true
+resharper_indent_nested_while_stmt = true
+resharper_keep_existing_embedded_arrangement = false
+resharper_place_accessorholder_attribute_on_same_line = true
+resharper_place_simple_embedded_statement_on_same_line = false
+resharper_wrap_before_arrow_with_expressions = true
+resharper_xmldoc_attribute_indent = align_by_first_attribute
+resharper_xmldoc_indent_child_elements = RemoveIndent
+resharper_xmldoc_indent_text = RemoveIndent
+
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 83b3e507..a4a98525 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -35,7 +35,7 @@ jobs:
elif [[ "${{runner.os}}" == "macOS" ]]; then
brew install ffmpeg
else
- sudo apt-get update
+ sudo apt-get update
sudo apt-get install -y libavutil-dev libavcodec-dev libavformat-dev
fi
- name: Enabling windows compilations tools
@@ -45,10 +45,10 @@ jobs:
shell: bash
run: |
echo "PROJECT=$([ "${{runner.os}}" == "Windows" ] \
- && echo " -p:IncludeConsole=true Kyoo.Host.WindowsTrait" \
- || echo Kyoo.Host.Console)" >> $GITHUB_ENV
+ && echo " -p:IncludeConsole=true -p:CheckCodingStyle=false src/Kyoo.Host.WindowsTrait" \
+ || echo " -p:CheckCodingStyle=false src/Kyoo.Host.Console")" >> $GITHUB_ENV
- name: Build the app
- env:
+ env:
INCLUDE: ${{env.INCLUDE}};C:\Program Files\FFmpeg\include
LIB: ${{env.LIB}};C:\Program Files\FFmpeg\lib
LIBPATH: ${{env.LIBPATH}};C:\Program Files\FFmpeg\lib
@@ -126,7 +126,7 @@ jobs:
sudo install -Dm 644 deployment/kyoo.service -t pkg/usr/lib/systemd/system/
sudo install -Dm 644 deployment/kyoo.sysusers pkg/usr/lib/sysusers.d/kyoo.conf
sudo install -Dm 644 deployment/kyoo.tmpfiles pkg/usr/lib/tmpfiles.d/kyoo.conf
- - name: Build debian package
+ - name: Build debian package
uses: jiro4989/build-deb-action@v2
with:
package: kyoo
@@ -163,8 +163,8 @@ jobs:
with:
name: kyoo_arch
path: ${{steps.makepkg.outputs.pkgfile0}}
-
+
# new-version:
# if: startsWith(github.ref, 'refs/tags/v')
-# runs-on: ubuntu-latest
+# runs-on: ubuntu-latest
diff --git a/.github/workflows/coding-style.yml b/.github/workflows/coding-style.yml
new file mode 100644
index 00000000..4ac803f6
--- /dev/null
+++ b/.github/workflows/coding-style.yml
@@ -0,0 +1,15 @@
+name: CodingStyle
+on: [pull_request, workflow_dispatch]
+
+jobs:
+ build:
+ name: "Coding style check"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 5.0.x
+ - name: Build the app
+ run: dotnet build -p:CheckCodingStyle=true -p:TreatWarningsAsErrors=true '-p:SkipTranscoder=true;SkipWebApp=true'
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 63b6d701..30ac6e3a 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -24,7 +24,7 @@ jobs:
- name: Build
run: |
dotnet build --no-restore '-p:SkipWebApp=true;SkipTranscoder=true' -p:CopyLocalLockFileAssemblies=true
- cp ./Kyoo.Abstractions/bin/Debug/net5.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll ./tests/Kyoo.Tests/bin/Debug/net5.0/
+ cp ./src/Kyoo.Abstractions/bin/Debug/net5.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll ./tests/Kyoo.Tests/bin/Debug/net5.0/
- name: Test
run: dotnet test --no-build '-p:CollectCoverage=true;CoverletOutputFormat=opencover'
env:
@@ -33,7 +33,7 @@ jobs:
POSTGRES_PASSWORD: postgres
- name: Sanitize coverage output
if: ${{ always() }}
- run: sed -i "s'$(pwd)'.'" tests/Kyoo.Tests/coverage.opencover.xml
+ run: sed -i "s'$(pwd)'.'" tests/Kyoo.Tests/coverage.opencover.xml
- name: Upload coverage report
if: ${{ always() }}
uses: actions/upload-artifact@v2
diff --git a/.gitmodules b/.gitmodules
index 3085af6a..94ad84ec 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,8 +1,8 @@
[submodule "transcoder"]
- path = Kyoo.Transcoder
+ path = src/Kyoo.Transcoder
url = ../Kyoo.Transcoder.git
branch = master
[submodule "WebApp"]
- path = Kyoo.WebApp/Front
+ path = src/Kyoo.WebApp/Front
url = ../Kyoo.WebApp.git
branch = master
diff --git a/AUTHORS.md b/AUTHORS.md
new file mode 100644
index 00000000..b7f88d9d
--- /dev/null
+++ b/AUTHORS.md
@@ -0,0 +1,4 @@
+# Authors
+Alphabetical order by first name.
+
+* Zoe Roux ([@AnonymusRaccoon](http://github.com/AnonymusRaccoon))
diff --git a/Dockerfile b/Dockerfile
index 9158d2a0..051c3d63 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,12 +1,12 @@
FROM gcc:latest as transcoder
RUN apt-get update && apt-get install -y cmake make libavutil-dev libavcodec-dev libavformat-dev
WORKDIR /transcoder
-COPY Kyoo.Transcoder .
+COPY src/Kyoo.Transcoder .
RUN cmake . && make -j
FROM node:alpine as webapp
WORKDIR /webapp
-COPY Kyoo.WebApp .
+COPY src/Kyoo.WebApp .
WORKDIR /webapp/Front
RUN npm install
RUN npm run build -- --prod
diff --git a/Kyoo.Abstractions/Controllers/IApplication.cs b/Kyoo.Abstractions/Controllers/IApplication.cs
deleted file mode 100644
index 8e72280e..00000000
--- a/Kyoo.Abstractions/Controllers/IApplication.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace Kyoo.Abstractions.Controllers
-{
- ///
- /// An interface that allow one to interact with the host and shutdown or restart the app.
- ///
- public interface IApplication
- {
- ///
- /// Shutdown the process and stop gracefully.
- ///
- void Shutdown();
-
- ///
- /// Restart Kyoo from scratch, reload plugins, configurations and restart the web server.
- ///
- void Restart();
-
- ///
- /// Get the data directory
- ///
- /// Retrieve the data directory where runtime data should be stored
- string GetDataDirectory();
-
- ///
- /// Retrieve the path of the json configuration file
- /// (relative to the data directory, see ).
- ///
- /// The configuration file name.
- string GetConfigFile();
- }
-}
\ No newline at end of file
diff --git a/Kyoo.Abstractions/Controllers/ITranscoder.cs b/Kyoo.Abstractions/Controllers/ITranscoder.cs
deleted file mode 100644
index d076b9f2..00000000
--- a/Kyoo.Abstractions/Controllers/ITranscoder.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Kyoo.Abstractions.Models;
-using System.Threading.Tasks;
-
-namespace Kyoo.Abstractions.Controllers
-{
- public interface ITranscoder
- {
- Task