Skip to content

Commit

Permalink
Merge pull request #4 from KennethGomez/feat/custom-upload-endpoint
Browse files Browse the repository at this point in the history
Custom upload endpoint #3
  • Loading branch information
KennethGomez authored Mar 31, 2021
2 parents 8820d39 + ae613d8 commit 20b8e6e
Show file tree
Hide file tree
Showing 11 changed files with 260 additions and 65 deletions.
24 changes: 22 additions & 2 deletions LiveShot.API/Container.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,37 @@
using System.Reflection;
using LiveShot.API.Drawing;
using LiveShot.API.Upload;
using LiveShot.API.Upload.Custom;
using LiveShot.API.Upload.Imgur;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace LiveShot.API
{
public static class Container
{
public static IServiceCollection ConfigureAPI(this IServiceCollection services)
public static IServiceCollection ConfigureAPI(this IServiceCollection services, IConfiguration? configuration)
{
services.AddSingleton<IEventPipeline, EventPipeline>();
services.AddSingleton<IUploadService, ImgurService>();

if (configuration != null)
{
string? uploadType = configuration["UploadType"];

if (uploadType != null && uploadType.ToLower().Equals("imgur"))
{
services.AddSingleton<IUploadService, ImgurService>();
}
else
{
services.AddSingleton<IUploadService, CustomUploadService>();
}
}
else
{
services.AddSingleton<IUploadService, ImgurService>();
}

services.AddSingleton<ILiveShotService, LiveShotService>();

var drawingTools = Assembly
Expand Down
53 changes: 33 additions & 20 deletions LiveShot.API/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 33 additions & 20 deletions LiveShot.API/Properties/Resources.en-US.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions LiveShot.API/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,10 @@
<data name="CaptureScreen.CanvasButtons.EyeDropper" xml:space="preserve">
<value>Eye dropper</value>
</data>
<data name="Upload.Success" xml:space="preserve">
<value>Image uploaded successfully</value>
</data>
<data name="Upload.InvalidUpload.Type" xml:space="preserve">
<value>Invalid upload type in application configuration</value>
</data>
</root>
53 changes: 33 additions & 20 deletions LiveShot.API/Properties/Resources.es-ES.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions LiveShot.API/Properties/Resources.es-ES.resx
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,10 @@
<data name="CaptureScreen.CanvasButtons.EyeDropper" xml:space="preserve">
<value>Cuentagotas</value>
</data>
<data name="Upload.Success" xml:space="preserve">
<value>Imagen subida exitosamente</value>
</data>
<data name="Upload.InvalidUpload.Type" xml:space="preserve">
<value>El UploadType de la configuración ee la aplicacion es inválido</value>
</data>
</root>
6 changes: 6 additions & 0 deletions LiveShot.API/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,10 @@ CaptureScreen.CanvasButtons.Stroke</value>
<data name="CaptureScreen.CanvasButtons.EyeDropper" xml:space="preserve">
<value>CaptureScreen.CanvasButtons.EyeDropper</value>
</data>
<data name="Upload.Success" xml:space="preserve">
<value>Upload.Success</value>
</data>
<data name="Upload.InvalidUpload.Type" xml:space="preserve">
<value>Upload.InvalidUploadType</value>
</data>
</root>
Loading

0 comments on commit 20b8e6e

Please sign in to comment.