diff --git a/src/Squidex/Config/Web/WebUsages.cs b/src/Squidex/Config/Web/WebUsages.cs new file mode 100644 index 000000000..4b74771f7 --- /dev/null +++ b/src/Squidex/Config/Web/WebUsages.cs @@ -0,0 +1,40 @@ +// ========================================================================== +// WebUsages.cs +// Squidex Headless CMS +// ========================================================================== +// Copyright (c) Squidex Group +// All rights reserved. +// ========================================================================== + +using System; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; +using Microsoft.Net.Http.Headers; +// ReSharper disable InvertIf + +namespace Squidex.Config.Web +{ + public static class WebUsages + { + public static void UseMyCachedStaticFiles(this IApplicationBuilder app) + { + app.UseStaticFiles(new StaticFileOptions + { + OnPrepareResponse = context => + { + var response = context.Context.Response; + + if (!string.Equals(response.ContentType, "text/html", StringComparison.OrdinalIgnoreCase)) + { + var headers = response.GetTypedHeaders(); + + headers.CacheControl = new CacheControlHeaderValue + { + MaxAge = TimeSpan.FromDays(60) + }; + } + } + }); + } + } +} diff --git a/src/Squidex/Config/Web/WebpackUsage.cs b/src/Squidex/Config/Web/WebpackUsage.cs index 738657b45..a4d218631 100644 --- a/src/Squidex/Config/Web/WebpackUsage.cs +++ b/src/Squidex/Config/Web/WebpackUsage.cs @@ -14,7 +14,6 @@ namespace Squidex.Config.Web { public static class WebpackExtensions { - public static IApplicationBuilder UseWebpackBuilder(this IApplicationBuilder app) { app.ApplicationServices.GetRequiredService().Execute(); diff --git a/src/Squidex/Startup.cs b/src/Squidex/Startup.cs index 41396cb36..0f34095de 100644 --- a/src/Squidex/Startup.cs +++ b/src/Squidex/Startup.cs @@ -17,7 +17,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Microsoft.Net.Http.Headers; using Squidex.Config; using Squidex.Config.Domain; using Squidex.Config.EventStore; @@ -26,8 +25,6 @@ using Squidex.Config.Swagger; using Squidex.Config.Web; using Squidex.Pipeline; using Squidex.Store.MongoDb; -// ReSharper disable InvertIf - // ReSharper disable ConvertClosureToMethodGroup // ReSharper disable AccessToModifiedClosure @@ -178,23 +175,7 @@ namespace Squidex }); } - app.UseStaticFiles(new StaticFileOptions - { - OnPrepareResponse = context => - { - var response = context.Context.Response; - - if (!string.Equals(response.ContentType, "text/html", StringComparison.OrdinalIgnoreCase)) - { - var headers = response.GetTypedHeaders(); - - headers.CacheControl = new CacheControlHeaderValue - { - MaxAge = TimeSpan.FromDays(60) - }; - } - } - }); + app.UseMyCachedStaticFiles(); } private static bool IsIdentityRequest(HttpContext context) diff --git a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts index 20b11c299..4e34829da 100644 --- a/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts +++ b/src/Squidex/app/features/settings/pages/contributors/contributors-page.component.ts @@ -6,7 +6,6 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; import { diff --git a/src/Squidex/app/framework/angular/autocomplete.component.ts b/src/Squidex/app/framework/angular/autocomplete.component.ts index 9fbcc8a84..03a9ac2ec 100644 --- a/src/Squidex/app/framework/angular/autocomplete.component.ts +++ b/src/Squidex/app/framework/angular/autocomplete.component.ts @@ -7,7 +7,6 @@ import * as Ng2 from '@angular/core'; import * as Ng2Forms from '@angular/forms'; - import { Observable, Subscription } from 'rxjs'; export interface AutocompleteSource { diff --git a/src/Squidex/app/shared/services/common.ts b/src/Squidex/app/framework/angular/http-utils.ts similarity index 99% rename from src/Squidex/app/shared/services/common.ts rename to src/Squidex/app/framework/angular/http-utils.ts index cf5999b23..81296f314 100644 --- a/src/Squidex/app/shared/services/common.ts +++ b/src/Squidex/app/framework/angular/http-utils.ts @@ -6,7 +6,6 @@ */ import * as Ng2Http from '@angular/http'; - import { Observable } from 'rxjs'; export class EntityCreatedDto { diff --git a/src/Squidex/app/framework/declarations.ts b/src/Squidex/app/framework/declarations.ts index 970a8a4a0..fe7b3a046 100644 --- a/src/Squidex/app/framework/declarations.ts +++ b/src/Squidex/app/framework/declarations.ts @@ -16,6 +16,7 @@ export * from './angular/date-time.pipes'; export * from './angular/drag-model.directive'; export * from './angular/focus-on-change.directive'; export * from './angular/focus-on-init.directive'; +export * from './angular/http-utils'; export * from './angular/image-drop.directive'; export * from './angular/modal-view.directive'; export * from './angular/money.pipe'; diff --git a/src/Squidex/app/framework/services/clipboard.service.ts b/src/Squidex/app/framework/services/clipboard.service.ts index ff3675ca2..cbbc3e182 100644 --- a/src/Squidex/app/framework/services/clipboard.service.ts +++ b/src/Squidex/app/framework/services/clipboard.service.ts @@ -6,7 +6,6 @@ */ import * as Ng2 from '@angular/core'; - import { BehaviorSubject, Observable } from 'rxjs'; export const ClipboardServiceFactory = () => { diff --git a/src/Squidex/app/framework/services/drag.service.ts b/src/Squidex/app/framework/services/drag.service.ts index 38024ab2d..02e954012 100644 --- a/src/Squidex/app/framework/services/drag.service.ts +++ b/src/Squidex/app/framework/services/drag.service.ts @@ -6,7 +6,6 @@ */ import * as Ng2 from '@angular/core'; - import { Observable, Subject } from 'rxjs'; import { Vec2 } from './../utils/vec2'; diff --git a/src/Squidex/app/framework/services/notification.service.ts b/src/Squidex/app/framework/services/notification.service.ts index 10b6f8523..cc184d30b 100644 --- a/src/Squidex/app/framework/services/notification.service.ts +++ b/src/Squidex/app/framework/services/notification.service.ts @@ -6,7 +6,6 @@ */ import * as Ng2 from '@angular/core'; - import { Observable, Subject } from 'rxjs'; export const NotificationServiceFactory = () => { diff --git a/src/Squidex/app/framework/services/panel.service.ts b/src/Squidex/app/framework/services/panel.service.ts index ff170921d..1fa000482 100644 --- a/src/Squidex/app/framework/services/panel.service.ts +++ b/src/Squidex/app/framework/services/panel.service.ts @@ -6,7 +6,6 @@ */ import * as Ng2 from '@angular/core'; - import { Observable, Subject } from 'rxjs'; export const PanelServiceFactory = () => { diff --git a/src/Squidex/app/shared/components/app-form.component.ts b/src/Squidex/app/shared/components/app-form.component.ts index 61f190f08..152935be3 100644 --- a/src/Squidex/app/shared/components/app-form.component.ts +++ b/src/Squidex/app/shared/components/app-form.component.ts @@ -8,11 +8,11 @@ import * as Ng2 from '@angular/core'; import * as Ng2Forms from '@angular/forms'; +import { fadeAnimation } from 'framework'; + import { AppsStoreService } from './../services/apps-store.service'; import { AppDto, CreateAppDto } from './../services/apps.service'; -import { fadeAnimation } from 'framework'; - const FALLBACK_NAME = 'my-app'; @Ng2.Component({ diff --git a/src/Squidex/app/shared/declarations.ts b/src/Squidex/app/shared/declarations.ts index b18f3d669..89537e0f7 100644 --- a/src/Squidex/app/shared/declarations.ts +++ b/src/Squidex/app/shared/declarations.ts @@ -18,7 +18,6 @@ export * from './services/app-languages.service'; export * from './services/apps-store.service'; export * from './services/apps.service'; export * from './services/auth.service'; -export * from './services/common'; export * from './services/languages.service'; export * from './services/users-provider.service'; export * from './services/users.service'; diff --git a/src/Squidex/app/shared/guards/app-must-exist.guard.spec.ts b/src/Squidex/app/shared/guards/app-must-exist.guard.spec.ts index f11098b39..b5430a65d 100644 --- a/src/Squidex/app/shared/guards/app-must-exist.guard.spec.ts +++ b/src/Squidex/app/shared/guards/app-must-exist.guard.spec.ts @@ -8,6 +8,7 @@ import * as TypeMoq from 'typemoq'; import { AppsStoreService } from 'shared'; + import { AppMustExistGuard } from './app-must-exist.guard'; import { RouterMockup } from './router-mockup'; diff --git a/src/Squidex/app/shared/guards/must-be-authenticated.guard.spec.ts b/src/Squidex/app/shared/guards/must-be-authenticated.guard.spec.ts index 5b719b8ea..7ee21b703 100644 --- a/src/Squidex/app/shared/guards/must-be-authenticated.guard.spec.ts +++ b/src/Squidex/app/shared/guards/must-be-authenticated.guard.spec.ts @@ -8,6 +8,7 @@ import * as TypeMoq from 'typemoq'; import { AuthService } from 'shared'; + import { MustBeAuthenticatedGuard } from './must-be-authenticated.guard'; import { RouterMockup } from './router-mockup'; diff --git a/src/Squidex/app/shared/guards/must-be-not-authenticated.guard.spec.ts b/src/Squidex/app/shared/guards/must-be-not-authenticated.guard.spec.ts index ffd30ea13..725710754 100644 --- a/src/Squidex/app/shared/guards/must-be-not-authenticated.guard.spec.ts +++ b/src/Squidex/app/shared/guards/must-be-not-authenticated.guard.spec.ts @@ -8,6 +8,7 @@ import * as TypeMoq from 'typemoq'; import { AuthService } from 'shared'; + import { MustBeNotAuthenticatedGuard } from './must-be-not-authenticated.guard'; import { RouterMockup } from './router-mockup'; diff --git a/src/Squidex/app/shared/services/app-clients.service.ts b/src/Squidex/app/shared/services/app-clients.service.ts index fac8d05b8..f5d6dfa2b 100644 --- a/src/Squidex/app/shared/services/app-clients.service.ts +++ b/src/Squidex/app/shared/services/app-clients.service.ts @@ -7,13 +7,15 @@ import * as Ng2 from '@angular/core'; import * as Ng2Http from '@angular/http'; - import { Observable } from 'rxjs'; -import { ApiUrlConfig, DateTime } from 'framework'; -import { AuthService } from './auth.service'; +import { + ApiUrlConfig, + DateTime, + handleError +} from 'framework'; -import { handleError } from './common'; +import { AuthService } from './auth.service'; export class AppClientDto { constructor( diff --git a/src/Squidex/app/shared/services/app-contributors.service.ts b/src/Squidex/app/shared/services/app-contributors.service.ts index 062a8fc5a..de82cd59e 100644 --- a/src/Squidex/app/shared/services/app-contributors.service.ts +++ b/src/Squidex/app/shared/services/app-contributors.service.ts @@ -6,13 +6,11 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; -import { ApiUrlConfig } from 'framework'; -import { AuthService } from './auth.service'; +import { ApiUrlConfig, handleError } from 'framework'; -import { handleError } from './common'; +import { AuthService } from './auth.service'; export class AppContributorDto { constructor( diff --git a/src/Squidex/app/shared/services/app-languages.service.ts b/src/Squidex/app/shared/services/app-languages.service.ts index c424f1baa..bc6a05fab 100644 --- a/src/Squidex/app/shared/services/app-languages.service.ts +++ b/src/Squidex/app/shared/services/app-languages.service.ts @@ -6,13 +6,11 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; -import { ApiUrlConfig } from 'framework'; -import { AuthService } from './auth.service'; +import { ApiUrlConfig, handleError } from 'framework'; -import { handleError } from './common'; +import { AuthService } from './auth.service'; export class AppLanguageDto { constructor( diff --git a/src/Squidex/app/shared/services/apps-store.service.ts b/src/Squidex/app/shared/services/apps-store.service.ts index ca26907c4..e33ef164f 100644 --- a/src/Squidex/app/shared/services/apps-store.service.ts +++ b/src/Squidex/app/shared/services/apps-store.service.ts @@ -13,14 +13,14 @@ import { Subject } from 'rxjs'; +import { DateTime } from 'framework'; + import { AppDto, AppsService, CreateAppDto } from './apps.service'; -import { DateTime } from 'framework'; - import { AuthService } from './auth.service'; @Ng2.Injectable() diff --git a/src/Squidex/app/shared/services/apps.service.ts b/src/Squidex/app/shared/services/apps.service.ts index f075718db..823835bc5 100644 --- a/src/Squidex/app/shared/services/apps.service.ts +++ b/src/Squidex/app/shared/services/apps.service.ts @@ -8,10 +8,14 @@ import * as Ng2 from '@angular/core'; import { Observable } from 'rxjs'; -import { ApiUrlConfig, DateTime } from 'framework'; -import { AuthService } from './auth.service'; +import { + ApiUrlConfig, + DateTime, + EntityCreatedDto, + handleError +} from 'framework'; -import { EntityCreatedDto, handleError } from './common'; +import { AuthService } from './auth.service'; export class AppDto { constructor( diff --git a/src/Squidex/app/shared/services/auth.service.ts b/src/Squidex/app/shared/services/auth.service.ts index f9b69202e..dfc85334f 100644 --- a/src/Squidex/app/shared/services/auth.service.ts +++ b/src/Squidex/app/shared/services/auth.service.ts @@ -8,6 +8,7 @@ import * as Ng2 from '@angular/core'; import * as Ng2Http from '@angular/http'; import * as Ng2Router from '@angular/router'; +import { Observable, Subject } from 'rxjs'; import { Log, @@ -15,8 +16,6 @@ import { UserManager } from 'oidc-client'; -import { Observable, Subject } from 'rxjs'; - import { ApiUrlConfig } from 'framework'; export class Profile { diff --git a/src/Squidex/app/shared/services/languages.service.ts b/src/Squidex/app/shared/services/languages.service.ts index 85ca3b085..fe962deff 100644 --- a/src/Squidex/app/shared/services/languages.service.ts +++ b/src/Squidex/app/shared/services/languages.service.ts @@ -6,13 +6,11 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; -import { ApiUrlConfig } from 'framework'; -import { AuthService } from './auth.service'; +import { ApiUrlConfig, handleError } from 'framework'; -import { handleError } from './common'; +import { AuthService } from './auth.service'; export class LanguageDto { constructor( diff --git a/src/Squidex/app/shared/services/schemas.service.ts b/src/Squidex/app/shared/services/schemas.service.ts index d13b67f45..39d416c53 100644 --- a/src/Squidex/app/shared/services/schemas.service.ts +++ b/src/Squidex/app/shared/services/schemas.service.ts @@ -6,13 +6,15 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; -import { ApiUrlConfig, DateTime } from 'framework'; -import { AuthService } from './auth.service'; +import { + ApiUrlConfig, + DateTime, + handleError +} from 'framework'; -import { handleError } from './common'; +import { AuthService } from './auth.service'; export class SchemaDto { constructor( @@ -50,7 +52,7 @@ export abstract class FieldPropertiesDto { public readonly label: string, public readonly hints: string, public readonly placeholder: string, - public readonly isRequired: boolean, + public readonly isRequired: boolean ) { } } diff --git a/src/Squidex/app/shared/services/users-provider.service.ts b/src/Squidex/app/shared/services/users-provider.service.ts index 9431fc039..bcfc45289 100644 --- a/src/Squidex/app/shared/services/users-provider.service.ts +++ b/src/Squidex/app/shared/services/users-provider.service.ts @@ -6,7 +6,6 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; import { UserDto, UsersService } from './users.service'; diff --git a/src/Squidex/app/shared/services/users.service.ts b/src/Squidex/app/shared/services/users.service.ts index 337776128..881d31999 100644 --- a/src/Squidex/app/shared/services/users.service.ts +++ b/src/Squidex/app/shared/services/users.service.ts @@ -6,10 +6,10 @@ */ import * as Ng2 from '@angular/core'; - import { Observable } from 'rxjs'; import { ApiUrlConfig } from 'framework'; + import { AuthService } from './auth.service'; export class UserDto {