From c67e3467a5fa53a8c783c0fef6f89308a86841d5 Mon Sep 17 00:00:00 2001 From: rubikscraft Date: Sun, 5 Jun 2022 12:20:16 +0200 Subject: [PATCH] Format everything --- README.md | 4 +- backend/.prettierrc | 2 +- .../collections/image-db/image-db.service.ts | 2 +- .../preference-common.service.ts | 7 ++-- .../sys-preference-db.service.ts | 6 +-- .../usr-preference-db.service.ts | 6 +-- .../src/collections/role-db/role-db.module.ts | 2 +- .../collections/role-db/role-db.service.ts | 4 +- .../collections/user-db/user-db.service.ts | 6 +-- .../src/config/early/auth.config.service.ts | 5 ++- .../early/serve-static.config.service.ts | 2 +- .../decorators/image-id/image-full-id.pipe.ts | 2 +- .../decorators/image-id/image-id.decorator.ts | 6 +-- .../src/decorators/image-id/image-id.pipe.ts | 2 +- .../multipart/multipart.decorator.ts | 3 +- .../decorators/multipart/multipart.pipe.ts | 4 +- .../src/decorators/multipart/postfile.pipe.ts | 10 ++--- .../src/decorators/permissions.decorator.ts | 2 +- .../src/layers/exception/exception.filter.ts | 2 +- .../src/layers/success/success.interceptor.ts | 11 +++-- .../src/layers/validate/zod-validator.pipe.ts | 2 +- backend/src/main.ts | 4 +- backend/src/managers/auth/auth.module.ts | 5 ++- .../src/managers/auth/guards/main.guard.ts | 10 +++-- .../managers/image/image-converter.service.ts | 2 +- .../managers/image/image-processor.service.ts | 2 +- backend/src/managers/image/universal-sharp.ts | 5 +-- backend/src/models/entities/image.entity.ts | 2 +- .../models/transformers/user.transformer.ts | 7 +--- backend/src/routes/api/api.module.ts | 2 +- .../src/routes/api/info/info.controller.ts | 4 +- .../routes/api/pref/sys-pref.controller.ts | 26 ++++++------ .../routes/api/pref/usr-pref.controller.ts | 10 +++-- .../src/routes/api/roles/roles.controller.ts | 40 +++++++++---------- .../routes/api/user/user-manage.controller.ts | 6 +-- .../src/routes/api/user/user.controller.ts | 6 +-- .../routes/image/image-manage.controller.ts | 6 +-- backend/src/routes/image/image.controller.ts | 4 +- backend/src/workers/sharp.wrapper.ts | 4 +- backend/src/workers/sharp/sharp.message.ts | 3 +- backend/src/workers/sharp/sharp.worker.ts | 4 +- frontend/src/app/app.animation.ts | 8 ++-- frontend/src/app/app.component.ts | 2 +- .../copy-field/copy-field.component.ts | 4 +- .../speed-dial/speed-dial-option.directive.ts | 2 +- .../fab/speed-dial/speed-dial.animation.ts | 2 +- .../components/footer/footer.component.html | 2 +- .../app/components/header/header.component.ts | 2 +- .../app/components/header/header.module.ts | 2 +- .../masonry/masonry-item.directive.ts | 2 +- .../components/masonry/masonry.component.html | 7 +++- .../components/masonry/masonry.component.ts | 2 +- .../picsur-img/picsur-img.component.ts | 8 ++-- .../pref-option/pref-option.component.ts | 11 ++--- .../src/app/components/range/range.pipe.ts | 2 +- .../values-picker/values-picker.component.ts | 2 +- frontend/src/app/guards/permission.guard.ts | 12 +++--- .../src/app/models/forms/login.control.ts | 2 +- .../src/app/models/forms/register.control.ts | 2 +- .../app/models/forms/update-user.control.ts | 7 +++- .../models/validators/compare.validator.ts | 2 +- .../app/models/validators/role.validator.ts | 2 +- .../app/models/validators/user.validator.ts | 5 +-- .../src/app/routes/images/images.component.ts | 6 +-- .../routes/processing/processing.component.ts | 2 +- .../routes/processing/processing.module.ts | 6 +-- .../general/settings-general.module.ts | 6 +-- .../settings-roles-edit.component.html | 2 +- .../settings-roles-edit.component.ts | 8 ++-- .../roles/settings-roles.component.ts | 4 +- .../settings/roles/settings-roles.module.ts | 2 +- .../roles/settings-roles.routing.module.ts | 2 +- .../sidebar/settings-sidebar.component.ts | 12 +++--- .../sys-pref/settings-sys-pref.module.ts | 6 +-- .../settings-users-edit.component.html | 4 +- .../settings-users-edit.component.ts | 10 ++--- .../users/settings-users.component.ts | 12 +++--- .../users/settings-users.routing.module.ts | 2 +- .../app/routes/upload/upload.component.scss | 4 +- .../src/app/routes/upload/upload.component.ts | 4 +- .../app/routes/user/login/login.component.ts | 4 +- .../user/register/register.component.ts | 15 ++++--- .../customize-dialog.component.ts | 4 +- .../src/app/routes/view/view.component.ts | 14 +++---- frontend/src/app/services/api/api.service.ts | 18 ++++----- .../src/app/services/api/image.service.ts | 20 +++++----- frontend/src/app/services/api/info.service.ts | 4 +- .../app/services/api/permission.service.ts | 8 ++-- .../src/app/services/api/roles.service.ts | 10 ++--- .../app/services/api/static-info.service.ts | 8 ++-- .../src/app/services/api/sys-pref.service.ts | 26 ++++++------ .../app/services/api/user-manage.service.ts | 14 +++---- frontend/src/app/services/api/user.service.ts | 8 ++-- .../src/app/services/api/usr-pref.service.ts | 18 ++++----- .../services/logger/global-logger.service.ts | 4 +- frontend/src/app/util/qoi/qoi-decode.ts | 8 ++-- .../src/app/util/qoi/qoi-encode.exclude.ts | 6 +-- frontend/src/app/util/throttle.ts | 3 +- .../app/util/util-module/api-error.service.ts | 2 +- .../confirm-dialog.component.scss | 1 - .../download-dialog.component.ts | 1 - .../src/app/util/util-module/util.module.ts | 2 +- .../src/app/util/util-module/util.service.ts | 16 ++++---- frontend/src/app/workers/qoi-worker.dto.ts | 5 ++- frontend/src/app/workers/qoi.job.ts | 4 +- frontend/src/assets/css/normalize.css | 38 +++++++++--------- frontend/src/main.ts | 4 +- frontend/src/scss/bootstrap.scss | 2 +- frontend/src/scss/fab.scss | 2 +- frontend/src/scss/fonts.scss | 16 ++++---- frontend/src/scss/index.scss | 17 ++++---- .../scss/material/material-theme-custom.scss | 11 +++-- .../scss/material/material-theme.legacy.scss | 32 +++++++-------- .../src/scss/material/material-theme.scss | 12 +++--- frontend/src/styles.scss | 2 +- frontend/tsconfig.app.json | 10 +++-- frontend/tsconfig.worker.json | 2 +- shared/src/dto/api/roles.dto.ts | 20 ++++++---- shared/src/dto/api/user-manage.dto.ts | 20 ++++++---- shared/src/dto/api/user.dto.ts | 12 ++++-- shared/src/dto/usr-preferences.dto.ts | 2 - shared/src/index.ts | 3 +- shared/src/util/common-regex.ts | 3 +- shared/src/util/decorator.ts | 10 +++-- shared/src/util/parse-mime.ts | 7 +++- .../src/validators/permissions.validator.ts | 1 - shared/src/validators/role.validators.ts | 3 +- shared/src/validators/user.validators.ts | 3 +- support/build.sh | 2 +- support/dev.docker-compose.yml | 6 +-- support/picsur.docker-compose.yml | 4 +- support/setversion.sh | 6 +-- tsconfig.base.json | 4 +- 133 files changed, 466 insertions(+), 435 deletions(-) diff --git a/README.md b/README.md index d09b63c..1e8b187 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ If you like this project, don't forget to give it a star. It tells me that I'm n You easily run this service yourself via Docker. Here is an example docker-compose file: ```yaml -version: "3" +version: '3' services: picsur: image: ghcr.io/rubikscraft/picsur:latest container_name: picsur ports: - - "8080:8080" + - '8080:8080' environment: # PICSUR_HOST: '0.0.0.0' # PICSUR_PORT: 8080 diff --git a/backend/.prettierrc b/backend/.prettierrc index dcb7279..a20502b 100644 --- a/backend/.prettierrc +++ b/backend/.prettierrc @@ -1,4 +1,4 @@ { "singleQuote": true, "trailingComma": "all" -} \ No newline at end of file +} diff --git a/backend/src/collections/image-db/image-db.service.ts b/backend/src/collections/image-db/image-db.service.ts index 013b2ec..94062f3 100644 --- a/backend/src/collections/image-db/image-db.service.ts +++ b/backend/src/collections/image-db/image-db.service.ts @@ -68,7 +68,7 @@ export class ImageDBService { }); if (found === undefined) return Fail('Images not found'); - + return { results: found, totalResults: amount, diff --git a/backend/src/collections/preference-db/preference-common.service.ts b/backend/src/collections/preference-db/preference-common.service.ts index fc93940..8fa5fd9 100644 --- a/backend/src/collections/preference-db/preference-common.service.ts +++ b/backend/src/collections/preference-db/preference-common.service.ts @@ -1,13 +1,14 @@ import { Injectable, Logger } from '@nestjs/common'; import { - DecodedPref, PrefValueType, - PrefValueTypeStrings + DecodedPref, + PrefValueType, + PrefValueTypeStrings, } from 'picsur-shared/dist/dto/preferences.dto'; import { AsyncFailable, Fail, Failable, - HasFailed + HasFailed, } from 'picsur-shared/dist/types'; type Enum = Record; diff --git a/backend/src/collections/preference-db/sys-preference-db.service.ts b/backend/src/collections/preference-db/sys-preference-db.service.ts index 003ea3d..b80796b 100644 --- a/backend/src/collections/preference-db/sys-preference-db.service.ts +++ b/backend/src/collections/preference-db/sys-preference-db.service.ts @@ -3,18 +3,18 @@ import { InjectRepository } from '@nestjs/typeorm'; import { DecodedSysPref, PrefValueType, - PrefValueTypeStrings + PrefValueTypeStrings, } from 'picsur-shared/dist/dto/preferences.dto'; import { SysPreference } from 'picsur-shared/dist/dto/sys-preferences.dto'; import { AsyncFailable, Fail, HasFailed } from 'picsur-shared/dist/types'; import { Repository } from 'typeorm'; import { SysPreferenceList, - SysPreferenceValueTypes + SysPreferenceValueTypes, } from '../../models/constants/syspreferences.const'; import { ESysPreferenceBackend, - ESysPreferenceSchema + ESysPreferenceSchema, } from '../../models/entities/sys-preference.entity'; import { MutexFallBack } from '../../models/util/mutex-fallback'; import { PreferenceCommonService } from './preference-common.service'; diff --git a/backend/src/collections/preference-db/usr-preference-db.service.ts b/backend/src/collections/preference-db/usr-preference-db.service.ts index dc1c2ea..7870654 100644 --- a/backend/src/collections/preference-db/usr-preference-db.service.ts +++ b/backend/src/collections/preference-db/usr-preference-db.service.ts @@ -3,18 +3,18 @@ import { InjectRepository } from '@nestjs/typeorm'; import { DecodedUsrPref, PrefValueType, - PrefValueTypeStrings + PrefValueTypeStrings, } from 'picsur-shared/dist/dto/preferences.dto'; import { UsrPreference } from 'picsur-shared/dist/dto/usr-preferences.dto'; import { AsyncFailable, Fail, HasFailed } from 'picsur-shared/dist/types'; import { Repository } from 'typeorm'; import { UsrPreferenceList, - UsrPreferenceValueTypes + UsrPreferenceValueTypes, } from '../../models/constants/usrpreferences.const'; import { EUsrPreferenceBackend, - EUsrPreferenceSchema + EUsrPreferenceSchema, } from '../../models/entities/usr-preference.entity'; import { MutexFallBack } from '../../models/util/mutex-fallback'; import { PreferenceCommonService } from './preference-common.service'; diff --git a/backend/src/collections/role-db/role-db.module.ts b/backend/src/collections/role-db/role-db.module.ts index 1daaff2..ef2a0f4 100644 --- a/backend/src/collections/role-db/role-db.module.ts +++ b/backend/src/collections/role-db/role-db.module.ts @@ -6,7 +6,7 @@ import { HostConfigService } from '../../config/early/host.config.service'; import { ImmutableRolesList, SystemRoleDefaults, - UndeletableRolesList + UndeletableRolesList, } from '../../models/constants/roles.const'; import { ERoleBackend } from '../../models/entities/role.entity'; import { RolesService } from './role-db.service'; diff --git a/backend/src/collections/role-db/role-db.service.ts b/backend/src/collections/role-db/role-db.service.ts index 4252dc6..73fbe41 100644 --- a/backend/src/collections/role-db/role-db.service.ts +++ b/backend/src/collections/role-db/role-db.service.ts @@ -5,14 +5,14 @@ import { AsyncFailable, Fail, HasFailed, - HasSuccess + HasSuccess, } from 'picsur-shared/dist/types'; import { makeUnique } from 'picsur-shared/dist/util/unique'; import { In, Repository } from 'typeorm'; import { Permissions } from '../../models/constants/permissions.const'; import { ImmutableRolesList, - UndeletableRolesList + UndeletableRolesList, } from '../../models/constants/roles.const'; import { ERoleBackend } from '../../models/entities/role.entity'; diff --git a/backend/src/collections/user-db/user-db.service.ts b/backend/src/collections/user-db/user-db.service.ts index 8ef720c..3e064f7 100644 --- a/backend/src/collections/user-db/user-db.service.ts +++ b/backend/src/collections/user-db/user-db.service.ts @@ -6,7 +6,7 @@ import { AsyncFailable, Fail, HasFailed, - HasSuccess + HasSuccess, } from 'picsur-shared/dist/types'; import { FindResult } from 'picsur-shared/dist/types/find-result'; import { makeUnique } from 'picsur-shared/dist/util/unique'; @@ -14,12 +14,12 @@ import { Repository } from 'typeorm'; import { Permissions } from '../../models/constants/permissions.const'; import { DefaultRolesList, - SoulBoundRolesList + SoulBoundRolesList, } from '../../models/constants/roles.const'; import { ImmutableUsersList, LockedLoginUsersList, - UndeletableUsersList + UndeletableUsersList, } from '../../models/constants/special-users.const'; import { EUserBackend } from '../../models/entities/user.entity'; import { GetCols } from '../../models/util/collection'; diff --git a/backend/src/config/early/auth.config.service.ts b/backend/src/config/early/auth.config.service.ts index 0db87da..ee54d7f 100644 --- a/backend/src/config/early/auth.config.service.ts +++ b/backend/src/config/early/auth.config.service.ts @@ -7,6 +7,9 @@ export class AuthConfigService { constructor(private configService: ConfigService) {} public getDefaultAdminPassword(): string { - return this.configService.get(`${EnvPrefix}ADMIN_PASSWORD`, 'admin'); + return this.configService.get( + `${EnvPrefix}ADMIN_PASSWORD`, + 'admin', + ); } } diff --git a/backend/src/config/early/serve-static.config.service.ts b/backend/src/config/early/serve-static.config.service.ts index 9ab0dfd..5fa3c78 100644 --- a/backend/src/config/early/serve-static.config.service.ts +++ b/backend/src/config/early/serve-static.config.service.ts @@ -2,7 +2,7 @@ import { Injectable, Logger } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { ServeStaticModuleOptions, - ServeStaticModuleOptionsFactory + ServeStaticModuleOptionsFactory, } from '@nestjs/serve-static'; import { join } from 'path'; import { EnvPrefix, PackageRoot } from '../config.static'; diff --git a/backend/src/decorators/image-id/image-full-id.pipe.ts b/backend/src/decorators/image-id/image-full-id.pipe.ts index a769c47..850119f 100644 --- a/backend/src/decorators/image-id/image-full-id.pipe.ts +++ b/backend/src/decorators/image-id/image-full-id.pipe.ts @@ -2,7 +2,7 @@ import { ArgumentMetadata, BadRequestException, Injectable, - PipeTransform + PipeTransform, } from '@nestjs/common'; import { Ext2Mime } from 'picsur-shared/dist/dto/mimes.dto'; import { UUIDRegex } from 'picsur-shared/dist/util/common-regex'; diff --git a/backend/src/decorators/image-id/image-id.decorator.ts b/backend/src/decorators/image-id/image-id.decorator.ts index 2ae47d9..9c8fb24 100644 --- a/backend/src/decorators/image-id/image-id.decorator.ts +++ b/backend/src/decorators/image-id/image-id.decorator.ts @@ -1,8 +1,4 @@ -import { - Param, - PipeTransform, - Type -} from '@nestjs/common'; +import { Param, PipeTransform, Type } from '@nestjs/common'; import { ImageIdPipe } from './image-id.pipe'; export const ImageIdParam = ( diff --git a/backend/src/decorators/image-id/image-id.pipe.ts b/backend/src/decorators/image-id/image-id.pipe.ts index c776b46..206903d 100644 --- a/backend/src/decorators/image-id/image-id.pipe.ts +++ b/backend/src/decorators/image-id/image-id.pipe.ts @@ -2,7 +2,7 @@ import { ArgumentMetadata, BadRequestException, Injectable, - PipeTransform + PipeTransform, } from '@nestjs/common'; import { UUIDRegex } from 'picsur-shared/dist/util/common-regex'; diff --git a/backend/src/decorators/multipart/multipart.decorator.ts b/backend/src/decorators/multipart/multipart.decorator.ts index 7f17c22..91056a0 100644 --- a/backend/src/decorators/multipart/multipart.decorator.ts +++ b/backend/src/decorators/multipart/multipart.decorator.ts @@ -4,5 +4,4 @@ import { PostFilePipe } from './postfile.pipe'; export const PostFile = () => InjectRequest(PostFilePipe); -export const MultiPart = () => - InjectRequest(MultiPartPipe); +export const MultiPart = () => InjectRequest(MultiPartPipe); diff --git a/backend/src/decorators/multipart/multipart.pipe.ts b/backend/src/decorators/multipart/multipart.pipe.ts index 4529def..e0805ae 100644 --- a/backend/src/decorators/multipart/multipart.pipe.ts +++ b/backend/src/decorators/multipart/multipart.pipe.ts @@ -6,7 +6,7 @@ import { InternalServerErrorException, Logger, PipeTransform, - Scope + Scope, } from '@nestjs/common'; import { FastifyRequest } from 'fastify'; import { HasFailed } from 'picsur-shared/dist/types'; @@ -14,7 +14,7 @@ import { ZodDtoStatic } from 'picsur-shared/dist/util/create-zod-dto'; import { MultipartConfigService } from '../../config/early/multipart.config.service'; import { CreateMultiPartFieldDto, - CreateMultiPartFileDto + CreateMultiPartFileDto, } from '../../models/dto/multipart.dto'; @Injectable({ scope: Scope.REQUEST }) diff --git a/backend/src/decorators/multipart/postfile.pipe.ts b/backend/src/decorators/multipart/postfile.pipe.ts index 1c4c03d..7225029 100644 --- a/backend/src/decorators/multipart/postfile.pipe.ts +++ b/backend/src/decorators/multipart/postfile.pipe.ts @@ -1,10 +1,10 @@ import { Multipart } from '@fastify/multipart'; import { - BadRequestException, - Injectable, - Logger, - PipeTransform, - Scope + BadRequestException, + Injectable, + Logger, + PipeTransform, + Scope, } from '@nestjs/common'; import { FastifyRequest } from 'fastify'; import { MultipartConfigService } from '../../config/early/multipart.config.service'; diff --git a/backend/src/decorators/permissions.decorator.ts b/backend/src/decorators/permissions.decorator.ts index f408c98..e2e0be1 100644 --- a/backend/src/decorators/permissions.decorator.ts +++ b/backend/src/decorators/permissions.decorator.ts @@ -2,7 +2,7 @@ import { createParamDecorator, ExecutionContext, SetMetadata, - UseGuards + UseGuards, } from '@nestjs/common'; import { CombineFCDecorators } from 'picsur-shared/dist/util/decorator'; import { LocalAuthGuard } from '../managers/auth/guards/local-auth.guard'; diff --git a/backend/src/layers/exception/exception.filter.ts b/backend/src/layers/exception/exception.filter.ts index bab2ac8..201d8d2 100644 --- a/backend/src/layers/exception/exception.filter.ts +++ b/backend/src/layers/exception/exception.filter.ts @@ -3,7 +3,7 @@ import { Catch, ExceptionFilter, HttpException, - Logger + Logger, } from '@nestjs/common'; import { FastifyReply, FastifyRequest } from 'fastify'; import { ApiErrorResponse } from 'picsur-shared/dist/dto/api/api.dto'; diff --git a/backend/src/layers/success/success.interceptor.ts b/backend/src/layers/success/success.interceptor.ts index 9d52414..494f7a6 100644 --- a/backend/src/layers/success/success.interceptor.ts +++ b/backend/src/layers/success/success.interceptor.ts @@ -5,7 +5,7 @@ import { InternalServerErrorException, Logger, NestInterceptor, - Optional + Optional, } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; import { ApiAnySuccessResponse } from 'picsur-shared/dist/dto/api/api.dto'; @@ -66,7 +66,9 @@ export class SuccessInterceptor implements NestInterceptor { const parseResult = schema.safeParse(data); if (!parseResult.success) { this.logger.warn( - `Function ${context.getHandler().name} failed validation: ${parseResult.error}`, + `Function ${context.getHandler().name} failed validation: ${ + parseResult.error + }`, ); throw new InternalServerErrorException( 'Server produced invalid response', @@ -76,7 +78,10 @@ export class SuccessInterceptor implements NestInterceptor { return parseResult.data; } - private createResponse(context: ExecutionContext, data: unknown): ApiAnySuccessResponse { + private createResponse( + context: ExecutionContext, + data: unknown, + ): ApiAnySuccessResponse { const status = context.switchToHttp().getResponse().statusCode; const response = { success: true as true, // really typescript diff --git a/backend/src/layers/validate/zod-validator.pipe.ts b/backend/src/layers/validate/zod-validator.pipe.ts index cd6a7f0..87965db 100644 --- a/backend/src/layers/validate/zod-validator.pipe.ts +++ b/backend/src/layers/validate/zod-validator.pipe.ts @@ -8,7 +8,7 @@ import { BadRequestException, Injectable, Optional, - PipeTransform + PipeTransform, } from '@nestjs/common'; import { ZodDtoStatic } from 'picsur-shared/dist/util/create-zod-dto'; diff --git a/backend/src/main.ts b/backend/src/main.ts index adaa8eb..d0cca55 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -2,8 +2,8 @@ import fastifyHelmet from '@fastify/helmet'; import * as multipart from '@fastify/multipart'; import { NestFactory, Reflector } from '@nestjs/core'; import { - FastifyAdapter, - NestFastifyApplication + FastifyAdapter, + NestFastifyApplication, } from '@nestjs/platform-fastify'; import { AppModule } from './app.module'; import { UsersService } from './collections/user-db/user-db.service'; diff --git a/backend/src/managers/auth/auth.module.ts b/backend/src/managers/auth/auth.module.ts index f842825..c79ac58 100644 --- a/backend/src/managers/auth/auth.module.ts +++ b/backend/src/managers/auth/auth.module.ts @@ -3,7 +3,10 @@ import { JwtModule } from '@nestjs/jwt'; import { PassportModule } from '@nestjs/passport'; import { PreferenceModule } from '../../collections/preference-db/preference-db.module'; import { UsersModule } from '../../collections/user-db/user-db.module'; -import { JwtConfigService, JwtSecretProvider } from '../../config/late/jwt.config.service'; +import { + JwtConfigService, + JwtSecretProvider, +} from '../../config/late/jwt.config.service'; import { LateConfigModule } from '../../config/late/late-config.module'; import { AuthManagerService } from './auth.service'; import { GuestStrategy } from './guards/guest.strategy'; diff --git a/backend/src/managers/auth/guards/main.guard.ts b/backend/src/managers/auth/guards/main.guard.ts index 6db9c64..cfdd467 100644 --- a/backend/src/managers/auth/guards/main.guard.ts +++ b/backend/src/managers/auth/guards/main.guard.ts @@ -3,7 +3,7 @@ import { ForbiddenException, Injectable, InternalServerErrorException, - Logger + Logger, } from '@nestjs/common'; import { Reflector } from '@nestjs/core'; import { AuthGuard } from '@nestjs/passport'; @@ -47,14 +47,18 @@ export class MainAuthGuard extends AuthGuard(['jwt', 'guest']) { // These are the permissions required to access the route const permissions = this.extractPermissions(context); if (HasFailed(permissions)) { - this.logger.error('Fetching route permission failed: ' + permissions.getReason()); + this.logger.error( + 'Fetching route permission failed: ' + permissions.getReason(), + ); throw new InternalServerErrorException(); } // These are the permissions the user has const userPermissions = await this.usersService.getPermissions(user.id); if (HasFailed(userPermissions)) { - this.logger.warn('Fetching user permissions failed: ' + userPermissions.getReason()); + this.logger.warn( + 'Fetching user permissions failed: ' + userPermissions.getReason(), + ); throw new InternalServerErrorException(); } diff --git a/backend/src/managers/image/image-converter.service.ts b/backend/src/managers/image/image-converter.service.ts index e668547..2b0352c 100644 --- a/backend/src/managers/image/image-converter.service.ts +++ b/backend/src/managers/image/image-converter.service.ts @@ -3,7 +3,7 @@ import ms from 'ms'; import { ImageRequestParams } from 'picsur-shared/dist/dto/api/image.dto'; import { FullMime, - SupportedMimeCategory + SupportedMimeCategory, } from 'picsur-shared/dist/dto/mimes.dto'; import { SysPreference } from 'picsur-shared/dist/dto/sys-preferences.dto'; import { AsyncFailable, Fail, HasFailed } from 'picsur-shared/dist/types'; diff --git a/backend/src/managers/image/image-processor.service.ts b/backend/src/managers/image/image-processor.service.ts index 16f6949..d74df26 100644 --- a/backend/src/managers/image/image-processor.service.ts +++ b/backend/src/managers/image/image-processor.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { FullMime, ImageMime, - SupportedMimeCategory + SupportedMimeCategory, } from 'picsur-shared/dist/dto/mimes.dto'; import { AsyncFailable, Fail } from 'picsur-shared/dist/types'; import { QOIColorSpace, QOIencode } from 'qoi-img'; diff --git a/backend/src/managers/image/universal-sharp.ts b/backend/src/managers/image/universal-sharp.ts index 5200629..bf1e6ae 100644 --- a/backend/src/managers/image/universal-sharp.ts +++ b/backend/src/managers/image/universal-sharp.ts @@ -10,11 +10,10 @@ export function UniversalSharp( ): Sharp { // if (mime.mime === ImageMime.ICO) { // return icoSharp(image, options); - // } else + // } else if (mime.mime === ImageMime.BMP) { return bmpSharp(image, options); - } else - if (mime.mime === ImageMime.QOI) { + } else if (mime.mime === ImageMime.QOI) { return qoiSharp(image, options); } else { return sharp(image, options); diff --git a/backend/src/models/entities/image.entity.ts b/backend/src/models/entities/image.entity.ts index bf19f21..e57b61e 100644 --- a/backend/src/models/entities/image.entity.ts +++ b/backend/src/models/entities/image.entity.ts @@ -12,7 +12,7 @@ export class EImageBackend implements EImage { user_id: string; @Column({ - nullable: false + nullable: false, }) created: Date; } diff --git a/backend/src/models/transformers/user.transformer.ts b/backend/src/models/transformers/user.transformer.ts index 783accc..0c0cbac 100644 --- a/backend/src/models/transformers/user.transformer.ts +++ b/backend/src/models/transformers/user.transformer.ts @@ -1,11 +1,8 @@ import { EUser } from 'picsur-shared/dist/entities/user.entity'; import { EUserBackend } from '../entities/user.entity'; -export function EUserBackend2EUser( - eUser: EUserBackend, -): EUser { - if (eUser.hashed_password === undefined) - return eUser as EUser; +export function EUserBackend2EUser(eUser: EUserBackend): EUser { + if (eUser.hashed_password === undefined) return eUser as EUser; return { ...eUser, diff --git a/backend/src/routes/api/api.module.ts b/backend/src/routes/api/api.module.ts index 770330a..9e5aa8c 100644 --- a/backend/src/routes/api/api.module.ts +++ b/backend/src/routes/api/api.module.ts @@ -12,6 +12,6 @@ import { UserApiModule } from './user/user.module'; ExperimentModule, InfoModule, RolesApiModule, - ] + ], }) export class PicsurApiModule {} diff --git a/backend/src/routes/api/info/info.controller.ts b/backend/src/routes/api/info/info.controller.ts index 8e5c7d3..209664a 100644 --- a/backend/src/routes/api/info/info.controller.ts +++ b/backend/src/routes/api/info/info.controller.ts @@ -2,11 +2,11 @@ import { Controller, Get } from '@nestjs/common'; import { AllFormatsResponse, AllPermissionsResponse, - InfoResponse + InfoResponse, } from 'picsur-shared/dist/dto/api/info.dto'; import { AnimMime2ExtMap, - ImageMime2ExtMap + ImageMime2ExtMap, } from 'picsur-shared/dist/dto/mimes.dto'; import { HostConfigService } from '../../../config/early/host.config.service'; import { NoPermissions } from '../../../decorators/permissions.decorator'; diff --git a/backend/src/routes/api/pref/sys-pref.controller.ts b/backend/src/routes/api/pref/sys-pref.controller.ts index c633949..df793bd 100644 --- a/backend/src/routes/api/pref/sys-pref.controller.ts +++ b/backend/src/routes/api/pref/sys-pref.controller.ts @@ -1,17 +1,17 @@ import { - Body, - Controller, - Get, - InternalServerErrorException, - Logger, - Param, - Post + Body, + Controller, + Get, + InternalServerErrorException, + Logger, + Param, + Post, } from '@nestjs/common'; import { - GetPreferenceResponse, - MultiplePreferencesResponse, - UpdatePreferenceRequest, - UpdatePreferenceResponse + GetPreferenceResponse, + MultiplePreferencesResponse, + UpdatePreferenceRequest, + UpdatePreferenceResponse, } from 'picsur-shared/dist/dto/api/pref.dto'; import { HasFailed } from 'picsur-shared/dist/types'; import { SysPreferenceService } from '../../../collections/preference-db/sys-preference-db.service'; @@ -43,9 +43,7 @@ export class SysPrefController { @Get(':key') @Returns(GetPreferenceResponse) - async getSysPref( - @Param('key') key: string, - ): Promise { + async getSysPref(@Param('key') key: string): Promise { const pref = await this.prefService.getPreference(key); if (HasFailed(pref)) { this.logger.warn(pref.getReason()); diff --git a/backend/src/routes/api/pref/usr-pref.controller.ts b/backend/src/routes/api/pref/usr-pref.controller.ts index ab37b43..1815f5a 100644 --- a/backend/src/routes/api/pref/usr-pref.controller.ts +++ b/backend/src/routes/api/pref/usr-pref.controller.ts @@ -5,13 +5,13 @@ import { InternalServerErrorException, Logger, Param, - Post + Post, } from '@nestjs/common'; import { GetPreferenceResponse, MultiplePreferencesResponse, UpdatePreferenceRequest, - UpdatePreferenceResponse + UpdatePreferenceResponse, } from 'picsur-shared/dist/dto/api/pref.dto'; import { HasFailed } from 'picsur-shared/dist/types'; import { UsrPreferenceService } from '../../../collections/preference-db/usr-preference-db.service'; @@ -29,7 +29,9 @@ export class UsrPrefController { @Get() @Returns(MultiplePreferencesResponse) - async getAllSysPrefs(@ReqUserID() userid: string): Promise { + async getAllSysPrefs( + @ReqUserID() userid: string, + ): Promise { const prefs = await this.prefService.getAllPreferences(userid); if (HasFailed(prefs)) { this.logger.warn(prefs.getReason()); @@ -46,7 +48,7 @@ export class UsrPrefController { @Returns(GetPreferenceResponse) async getSysPref( @Param('key') key: string, - @ReqUserID() userid: string + @ReqUserID() userid: string, ): Promise { const pref = await this.prefService.getPreference(userid, key); if (HasFailed(pref)) { diff --git a/backend/src/routes/api/roles/roles.controller.ts b/backend/src/routes/api/roles/roles.controller.ts index 42c4add..5e76aba 100644 --- a/backend/src/routes/api/roles/roles.controller.ts +++ b/backend/src/routes/api/roles/roles.controller.ts @@ -1,22 +1,22 @@ import { - Body, - Controller, - Get, - InternalServerErrorException, - Logger, - Post + Body, + Controller, + Get, + InternalServerErrorException, + Logger, + Post, } from '@nestjs/common'; import { - RoleCreateRequest, - RoleCreateResponse, - RoleDeleteRequest, - RoleDeleteResponse, - RoleInfoRequest, - RoleInfoResponse, - RoleListResponse, - RoleUpdateRequest, - RoleUpdateResponse, - SpecialRolesResponse + RoleCreateRequest, + RoleCreateResponse, + RoleDeleteRequest, + RoleDeleteResponse, + RoleInfoRequest, + RoleInfoResponse, + RoleListResponse, + RoleUpdateRequest, + RoleUpdateResponse, + SpecialRolesResponse, } from 'picsur-shared/dist/dto/api/roles.dto'; import { HasFailed } from 'picsur-shared/dist/types'; import { RolesService } from '../../../collections/role-db/role-db.service'; @@ -25,10 +25,10 @@ import { RequiredPermissions } from '../../../decorators/permissions.decorator'; import { Returns } from '../../../decorators/returns.decorator'; import { Permission } from '../../../models/constants/permissions.const'; import { - DefaultRolesList, - ImmutableRolesList, - SoulBoundRolesList, - UndeletableRolesList + DefaultRolesList, + ImmutableRolesList, + SoulBoundRolesList, + UndeletableRolesList, } from '../../../models/constants/roles.const'; import { isPermissionsArray } from '../../../models/validators/permissions.validator'; diff --git a/backend/src/routes/api/user/user-manage.controller.ts b/backend/src/routes/api/user/user-manage.controller.ts index 3b4cbfc..96e4184 100644 --- a/backend/src/routes/api/user/user-manage.controller.ts +++ b/backend/src/routes/api/user/user-manage.controller.ts @@ -4,7 +4,7 @@ import { Get, InternalServerErrorException, Logger, - Post + Post, } from '@nestjs/common'; import { GetSpecialUsersResponse, @@ -17,7 +17,7 @@ import { UserListRequest, UserListResponse, UserUpdateRequest, - UserUpdateResponse + UserUpdateResponse, } from 'picsur-shared/dist/dto/api/user-manage.dto'; import { HasFailed } from 'picsur-shared/dist/types'; import { UsersService } from '../../../collections/user-db/user-db.service'; @@ -27,7 +27,7 @@ import { Permission } from '../../../models/constants/permissions.const'; import { ImmutableUsersList, LockedLoginUsersList, - UndeletableUsersList + UndeletableUsersList, } from '../../../models/constants/special-users.const'; import { EUserBackend2EUser } from '../../../models/transformers/user.transformer'; diff --git a/backend/src/routes/api/user/user.controller.ts b/backend/src/routes/api/user/user.controller.ts index e9ec641..fbd833a 100644 --- a/backend/src/routes/api/user/user.controller.ts +++ b/backend/src/routes/api/user/user.controller.ts @@ -4,14 +4,14 @@ import { Get, InternalServerErrorException, Logger, - Post + Post, } from '@nestjs/common'; import { UserLoginResponse, UserMePermissionsResponse, UserMeResponse, UserRegisterRequest, - UserRegisterResponse + UserRegisterResponse, } from 'picsur-shared/dist/dto/api/user.dto'; import type { EUser } from 'picsur-shared/dist/entities/user.entity'; import { HasFailed } from 'picsur-shared/dist/types'; @@ -19,7 +19,7 @@ import { UsersService } from '../../../collections/user-db/user-db.service'; import { NoPermissions, RequiredPermissions, - UseLocalAuth + UseLocalAuth, } from '../../../decorators/permissions.decorator'; import { ReqUser, ReqUserID } from '../../../decorators/request-user.decorator'; import { Returns } from '../../../decorators/returns.decorator'; diff --git a/backend/src/routes/image/image-manage.controller.ts b/backend/src/routes/image/image-manage.controller.ts index 13946be..1473f5c 100644 --- a/backend/src/routes/image/image-manage.controller.ts +++ b/backend/src/routes/image/image-manage.controller.ts @@ -4,21 +4,21 @@ import { Controller, InternalServerErrorException, Logger, - Post + Post, } from '@nestjs/common'; import { ImageDeleteRequest, ImageDeleteResponse, ImageListRequest, ImageListResponse, - ImageUploadResponse + ImageUploadResponse, } from 'picsur-shared/dist/dto/api/image-manage.dto'; import { Permission } from 'picsur-shared/dist/dto/permissions.dto'; import { HasFailed } from 'picsur-shared/dist/types'; import { MultiPart } from '../../decorators/multipart/multipart.decorator'; import { HasPermission, - RequiredPermissions + RequiredPermissions, } from '../../decorators/permissions.decorator'; import { ReqUserID } from '../../decorators/request-user.decorator'; import { Returns } from '../../decorators/returns.decorator'; diff --git a/backend/src/routes/image/image.controller.ts b/backend/src/routes/image/image.controller.ts index 2bb2e98..97bfd07 100644 --- a/backend/src/routes/image/image.controller.ts +++ b/backend/src/routes/image/image.controller.ts @@ -6,12 +6,12 @@ import { Logger, NotFoundException, Query, - Res + Res, } from '@nestjs/common'; import type { FastifyReply } from 'fastify'; import { ImageMetaResponse, - ImageRequestParams + ImageRequestParams, } from 'picsur-shared/dist/dto/api/image.dto'; import { HasFailed } from 'picsur-shared/dist/types'; import { UsersService } from '../../collections/user-db/user-db.service'; diff --git a/backend/src/workers/sharp.wrapper.ts b/backend/src/workers/sharp.wrapper.ts index 643e592..d6b09d8 100644 --- a/backend/src/workers/sharp.wrapper.ts +++ b/backend/src/workers/sharp.wrapper.ts @@ -7,7 +7,7 @@ import { AsyncFailable, Fail, Failable, - HasFailed + HasFailed, } from 'picsur-shared/dist/types'; import { Sharp } from 'sharp'; import { @@ -16,7 +16,7 @@ import { SharpWorkerRecieveMessage, SharpWorkerResultMessage, SharpWorkerSendMessage, - SupportedSharpWorkerFunctions + SupportedSharpWorkerFunctions, } from './sharp/sharp.message'; import { SharpResult } from './sharp/universal-sharp'; diff --git a/backend/src/workers/sharp/sharp.message.ts b/backend/src/workers/sharp/sharp.message.ts index 5ec2c6e..e92c173 100644 --- a/backend/src/workers/sharp/sharp.message.ts +++ b/backend/src/workers/sharp/sharp.message.ts @@ -21,7 +21,8 @@ export type SupportedSharpWorkerFunctions = | 'negate' | 'greyscale'; -export type SharpWorkerOperation = MapSharpFunctions; +export type SharpWorkerOperation = + MapSharpFunctions; export interface SharpWorkerFinishOptions { quality?: number; diff --git a/backend/src/workers/sharp/sharp.worker.ts b/backend/src/workers/sharp/sharp.worker.ts index 12b888f..95d3d63 100644 --- a/backend/src/workers/sharp/sharp.worker.ts +++ b/backend/src/workers/sharp/sharp.worker.ts @@ -7,7 +7,7 @@ import { SharpWorkerInitMessage, SharpWorkerOperationMessage, SharpWorkerRecieveMessage, - SharpWorkerSendMessage + SharpWorkerSendMessage, } from './sharp.message'; import { UniversalSharpIn, UniversalSharpOut } from './universal-sharp'; @@ -25,7 +25,7 @@ export class SharpWorker { } const memoryLimit = parseInt(process.env['MEMORY_LIMIT_MB'] ?? ''); - + if (isNaN(memoryLimit) || memoryLimit <= 0) { return this.purge('MEMORY_LIMIT_MB environment variable is not set'); } diff --git a/frontend/src/app/app.animation.ts b/frontend/src/app/app.animation.ts index b431392..e22af1e 100644 --- a/frontend/src/app/app.animation.ts +++ b/frontend/src/app/app.animation.ts @@ -3,7 +3,7 @@ import { query, style, transition, - trigger + trigger, } from '@angular/animations'; // This shit worked so beautifully on firefox, but then chrome and angular had to come along and fuck it up @@ -40,7 +40,7 @@ export const RouteTransitionAnimations = trigger('mainAnimation', [ ], { optional: true, - } + }, ), query( @@ -55,7 +55,7 @@ export const RouteTransitionAnimations = trigger('mainAnimation', [ display: 'none', }), ], - { optional: true } + { optional: true }, ), query( @@ -69,7 +69,7 @@ export const RouteTransitionAnimations = trigger('mainAnimation', [ }), animate('.1s', style({ opacity: 1 })), ], - { optional: true } + { optional: true }, ), ]), ]); diff --git a/frontend/src/app/app.component.ts b/frontend/src/app/app.component.ts index df9d2dd..8e87521 100644 --- a/frontend/src/app/app.component.ts +++ b/frontend/src/app/app.component.ts @@ -34,7 +34,7 @@ export class AppComponent implements OnInit { private router: Router, private activatedRoute: ActivatedRoute, private utilService: UtilService, - private bootstrapService: BootstrapService + private bootstrapService: BootstrapService, ) {} public getRouteAnimData() { diff --git a/frontend/src/app/components/copy-field/copy-field.component.ts b/frontend/src/app/components/copy-field/copy-field.component.ts index 6865e58..fbda32b 100644 --- a/frontend/src/app/components/copy-field/copy-field.component.ts +++ b/frontend/src/app/components/copy-field/copy-field.component.ts @@ -1,6 +1,6 @@ import { Clipboard } from '@angular/cdk/clipboard'; import { Component, Input } from '@angular/core'; -import { SnackBarType } from "src/app/models/dto/snack-bar-type.dto"; +import { SnackBarType } from 'src/app/models/dto/snack-bar-type.dto'; import { UtilService } from 'src/app/util/util-module/util.service'; @Component({ @@ -23,7 +23,7 @@ export class CopyFieldComponent { return this.utilService.showSnackBar( 'Copying to clipboard failed', - SnackBarType.Error + SnackBarType.Error, ); } } diff --git a/frontend/src/app/components/fab/speed-dial/speed-dial-option.directive.ts b/frontend/src/app/components/fab/speed-dial/speed-dial-option.directive.ts index 071ad41..206abad 100644 --- a/frontend/src/app/components/fab/speed-dial/speed-dial-option.directive.ts +++ b/frontend/src/app/components/fab/speed-dial/speed-dial-option.directive.ts @@ -8,7 +8,7 @@ import { MatTooltip } from '@angular/material/tooltip'; export class SpeedDialOptionDirective { constructor( @Host() @Optional() tooltip?: MatTooltip, - @Host() @Optional() button?: MatButton + @Host() @Optional() button?: MatButton, ) { if (tooltip) tooltip.position = 'left'; if (button) button.color = 'primary'; diff --git a/frontend/src/app/components/fab/speed-dial/speed-dial.animation.ts b/frontend/src/app/components/fab/speed-dial/speed-dial.animation.ts index d388b7b..1f41aa1 100644 --- a/frontend/src/app/components/fab/speed-dial/speed-dial.animation.ts +++ b/frontend/src/app/components/fab/speed-dial/speed-dial.animation.ts @@ -4,7 +4,7 @@ import { stagger, style, transition, - trigger + trigger, } from '@angular/animations'; export const SpeedDialAnimation = trigger('speedDialAnimation', [ diff --git a/frontend/src/app/components/footer/footer.component.html b/frontend/src/app/components/footer/footer.component.html index c36f6dc..baa120e 100644 --- a/frontend/src/app/components/footer/footer.component.html +++ b/frontend/src/app/components/footer/footer.component.html @@ -9,7 +9,7 @@ >Rubikscraft - {{ isDemo ? " - Demo Version" : "" }} + {{ isDemo ? ' - Demo Version' : '' }} diff --git a/frontend/src/app/components/header/header.component.ts b/frontend/src/app/components/header/header.component.ts index fa4d9de..6201cee 100644 --- a/frontend/src/app/components/header/header.component.ts +++ b/frontend/src/app/components/header/header.component.ts @@ -37,7 +37,7 @@ export class HeaderComponent implements OnInit { private router: Router, private userService: UserService, private permissionService: PermissionService, - private utilService: UtilService + private utilService: UtilService, ) {} ngOnInit(): void { diff --git a/frontend/src/app/components/header/header.module.ts b/frontend/src/app/components/header/header.module.ts index 22948a7..ef0eef7 100644 --- a/frontend/src/app/components/header/header.module.ts +++ b/frontend/src/app/components/header/header.module.ts @@ -16,7 +16,7 @@ import { HeaderComponent } from './header.component'; RouterModule, MatIconModule, MatMenuModule, - MatTooltipModule + MatTooltipModule, ], declarations: [HeaderComponent], exports: [HeaderComponent], diff --git a/frontend/src/app/components/masonry/masonry-item.directive.ts b/frontend/src/app/components/masonry/masonry-item.directive.ts index 8be01f8..c10e1d7 100644 --- a/frontend/src/app/components/masonry/masonry-item.directive.ts +++ b/frontend/src/app/components/masonry/masonry-item.directive.ts @@ -27,7 +27,7 @@ export class MasonryItemDirective { constructor( private element: ElementRef, @Inject(ResizeObserverService) - resize: Observable + resize: Observable, ) { this.resizeObserver = resize.pipe(map((entries) => entries[0])); this.subscribeResize(); diff --git a/frontend/src/app/components/masonry/masonry.component.html b/frontend/src/app/components/masonry/masonry.component.html index a6cb881..949af2b 100644 --- a/frontend/src/app/components/masonry/masonry.component.html +++ b/frontend/src/app/components/masonry/masonry.component.html @@ -1,3 +1,6 @@ -
-
+
diff --git a/frontend/src/app/components/masonry/masonry.component.ts b/frontend/src/app/components/masonry/masonry.component.ts index 52ae802..b9ca029 100644 --- a/frontend/src/app/components/masonry/masonry.component.ts +++ b/frontend/src/app/components/masonry/masonry.component.ts @@ -6,7 +6,7 @@ import { Input, OnDestroy, QueryList, - ViewChildren + ViewChildren, } from '@angular/core'; import { AutoUnsubscribe } from 'ngx-auto-unsubscribe-decorator'; import { combineLatest, Subscription } from 'rxjs'; diff --git a/frontend/src/app/components/picsur-img/picsur-img.component.ts b/frontend/src/app/components/picsur-img/picsur-img.component.ts index 22fca12..624b516 100644 --- a/frontend/src/app/components/picsur-img/picsur-img.component.ts +++ b/frontend/src/app/components/picsur-img/picsur-img.component.ts @@ -6,7 +6,7 @@ import { Input, OnChanges, SimpleChanges, - ViewChild + ViewChild, } from '@angular/core'; import { FullMime, SupportedMime } from 'picsur-shared/dist/dto/mimes.dto'; import { AsyncFailable, HasFailed } from 'picsur-shared/dist/types'; @@ -27,7 +27,7 @@ enum PicsurImgState { selector: 'picsur-img', templateUrl: './picsur-img.component.html', styleUrls: ['./picsur-img.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush, }) export class PicsurImgComponent implements OnChanges { private readonly logger = new Logger('ZodImgComponent'); @@ -43,7 +43,7 @@ export class PicsurImgComponent implements OnChanges { constructor( private qoiWorker: QoiWorkerService, private apiService: ApiService, - private changeDetector: ChangeDetectorRef + private changeDetector: ChangeDetectorRef, ) {} ngOnChanges(changes: SimpleChanges): void { @@ -66,8 +66,6 @@ export class PicsurImgComponent implements OnChanges { } }) .catch((e) => this.logger.error); - - } private async update(url: string): AsyncFailable { diff --git a/frontend/src/app/components/pref-option/pref-option.component.ts b/frontend/src/app/components/pref-option/pref-option.component.ts index ed72895..838c7df 100644 --- a/frontend/src/app/components/pref-option/pref-option.component.ts +++ b/frontend/src/app/components/pref-option/pref-option.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { AutoUnsubscribe } from 'ngx-auto-unsubscribe-decorator'; import { DecodedPref, - PrefValueType + PrefValueType, } from 'picsur-shared/dist/dto/preferences.dto'; import { AsyncFailable, HasFailed } from 'picsur-shared/dist/types'; import { Subject } from 'rxjs'; @@ -20,7 +20,7 @@ export class PrefOptionComponent implements OnInit { @Input() @Required pref: DecodedPref; @Input('update') @Required updateFunction: ( key: string, - pref: PrefValueType + pref: PrefValueType, ) => AsyncFailable; @Input() @Required translator: { [key in string]: string; @@ -87,14 +87,11 @@ export class PrefOptionComponent implements OnInit { ? `Enabled ${this.name}` : `Disabled ${this.name}` : ''; - this.utilService.showSnackBar( - message, - SnackBarType.Success - ); + this.utilService.showSnackBar(message, SnackBarType.Success); } else { this.utilService.showSnackBar( `Failed to update ${this.name}`, - SnackBarType.Error + SnackBarType.Error, ); } } diff --git a/frontend/src/app/components/range/range.pipe.ts b/frontend/src/app/components/range/range.pipe.ts index 49f12ca..fe05dce 100644 --- a/frontend/src/app/components/range/range.pipe.ts +++ b/frontend/src/app/components/range/range.pipe.ts @@ -16,7 +16,7 @@ export class RangePipe implements PipeTransform { ) { return Array.from( { length: length[1] + 1 - length[0] }, - (_, i) => i + length[0] + (_, i) => i + length[0], ); } diff --git a/frontend/src/app/components/values-picker/values-picker.component.ts b/frontend/src/app/components/values-picker/values-picker.component.ts index edbcf24..6046df0 100644 --- a/frontend/src/app/components/values-picker/values-picker.component.ts +++ b/frontend/src/app/components/values-picker/values-picker.component.ts @@ -85,7 +85,7 @@ export class ValuesPickerComponent implements OnInit, OnChanges { private updateSelectable() { const selected: string[] = this.myControl.value; const available = this.fullSelection.filter( - (s) => !this.isDisabled(s) && !selected.includes(s) + (s) => !this.isDisabled(s) && !selected.includes(s), ); this.selectableSubject.next(available); diff --git a/frontend/src/app/guards/permission.guard.ts b/frontend/src/app/guards/permission.guard.ts index 3b7d721..719a467 100644 --- a/frontend/src/app/guards/permission.guard.ts +++ b/frontend/src/app/guards/permission.guard.ts @@ -4,7 +4,7 @@ import { CanActivate, CanActivateChild, Router, - RouterStateSnapshot + RouterStateSnapshot, } from '@angular/router'; import { isPermissionsArray } from 'picsur-shared/dist/validators/permissions.validator'; import { PRouteData } from '../models/dto/picsur-routes.dto'; @@ -22,7 +22,7 @@ export class PermissionGuard implements CanActivate, CanActivateChild { constructor( private permissionService: PermissionService, private staticInfo: StaticInfoService, - private router: Router + private router: Router, ) { this.setupAllPermissions().catch(this.logger.error); } @@ -33,7 +33,7 @@ export class PermissionGuard implements CanActivate, CanActivateChild { async canActivateChild( childRoute: ActivatedRouteSnapshot, - state: RouterStateSnapshot + state: RouterStateSnapshot, ) { return await this.can(childRoute, state); } @@ -52,14 +52,14 @@ export class PermissionGuard implements CanActivate, CanActivateChild { !isPermissionsArray(requiredPermissions, this.allPermissionsArray) ) { this.logger.error( - `Permissions array is invalid: "${requiredPermissions}" (available: ${this.allPermissionsArray})` + `Permissions array is invalid: "${requiredPermissions}" (available: ${this.allPermissionsArray})`, ); return false; } const ourPermissions = await this.permissionService.getLoadedSnapshot(); const weHavePermission = requiredPermissions.every((permission) => - ourPermissions.includes(permission) + ourPermissions.includes(permission), ); if (!weHavePermission) @@ -78,7 +78,7 @@ export class PermissionGuard implements CanActivate, CanActivateChild { } if (route.firstChild) { permissions = permissions.concat( - this.nestedPermissions(route.firstChild) + this.nestedPermissions(route.firstChild), ); } return permissions; diff --git a/frontend/src/app/models/forms/login.control.ts b/frontend/src/app/models/forms/login.control.ts index aa2a433..6c770ea 100644 --- a/frontend/src/app/models/forms/login.control.ts +++ b/frontend/src/app/models/forms/login.control.ts @@ -5,7 +5,7 @@ import { CreatePasswordError, CreateUsernameError, PasswordValidators, - UsernameValidators + UsernameValidators, } from '../validators/user.validator'; export class LoginControl { diff --git a/frontend/src/app/models/forms/register.control.ts b/frontend/src/app/models/forms/register.control.ts index 8cfc402..2839a2a 100644 --- a/frontend/src/app/models/forms/register.control.ts +++ b/frontend/src/app/models/forms/register.control.ts @@ -6,7 +6,7 @@ import { CreatePasswordError, CreateUsernameError, PasswordValidators, - UsernameValidators + UsernameValidators, } from '../validators/user.validator'; export class RegisterControl { diff --git a/frontend/src/app/models/forms/update-user.control.ts b/frontend/src/app/models/forms/update-user.control.ts index 126770b..3841d09 100644 --- a/frontend/src/app/models/forms/update-user.control.ts +++ b/frontend/src/app/models/forms/update-user.control.ts @@ -1,10 +1,13 @@ import { FormControl } from '@angular/forms'; -import { UserCreateRequest, UserUpdateRequest } from 'picsur-shared/dist/dto/api/user-manage.dto'; +import { + UserCreateRequest, + UserUpdateRequest, +} from 'picsur-shared/dist/dto/api/user-manage.dto'; import { CreatePasswordError, CreateUsernameError, PasswordValidators, - UsernameValidators + UsernameValidators, } from '../validators/user.validator'; export class UpdateUserControl { diff --git a/frontend/src/app/models/validators/compare.validator.ts b/frontend/src/app/models/validators/compare.validator.ts index b1f20eb..0b11bfa 100644 --- a/frontend/src/app/models/validators/compare.validator.ts +++ b/frontend/src/app/models/validators/compare.validator.ts @@ -2,7 +2,7 @@ import { AbstractControl, FormControl, ValidationErrors, - ValidatorFn + ValidatorFn, } from '@angular/forms'; export function Compare(compareTo: FormControl): ValidatorFn { diff --git a/frontend/src/app/models/validators/role.validator.ts b/frontend/src/app/models/validators/role.validator.ts index 2bb6ec2..bb12173 100644 --- a/frontend/src/app/models/validators/role.validator.ts +++ b/frontend/src/app/models/validators/role.validator.ts @@ -8,7 +8,7 @@ export const RoleNameValidators = [ ]; export const CreateRoleNameError = ( - errors: ValidationErrors | null + errors: ValidationErrors | null, ): string => { const error = errorsToError(errors); switch (error) { diff --git a/frontend/src/app/models/validators/user.validator.ts b/frontend/src/app/models/validators/user.validator.ts index e028f9e..2fdbd0c 100644 --- a/frontend/src/app/models/validators/user.validator.ts +++ b/frontend/src/app/models/validators/user.validator.ts @@ -11,7 +11,7 @@ export const UsernameValidators = [ ]; export const CreateUsernameError = ( - errors: ValidationErrors | null + errors: ValidationErrors | null, ): string => { const error = errorsToError(errors); switch (error) { @@ -34,7 +34,7 @@ export const PasswordValidators = [ ]; export const CreatePasswordError = ( - errors: ValidationErrors | null + errors: ValidationErrors | null, ): string => { const error = errorsToError(errors); switch (error) { @@ -50,4 +50,3 @@ export const CreatePasswordError = ( return 'Invalid password'; } }; - diff --git a/frontend/src/app/routes/images/images.component.ts b/frontend/src/app/routes/images/images.component.ts index eb0e0c0..f1168d4 100644 --- a/frontend/src/app/routes/images/images.component.ts +++ b/frontend/src/app/routes/images/images.component.ts @@ -9,7 +9,7 @@ import { ImageService } from 'src/app/services/api/image.service'; import { Logger } from 'src/app/services/logger/logger.service'; import { BootstrapService, - BSScreenSize + BSScreenSize, } from 'src/app/util/util-module/bootstrap.service'; import { UtilService } from 'src/app/util/util-module/util.service'; @@ -31,7 +31,7 @@ export class ImagesComponent implements OnInit { private readonly router: Router, private readonly bootstrapService: BootstrapService, private readonly utilService: UtilService, - private readonly imageService: ImageService + private readonly imageService: ImageService, ) {} ngOnInit() { @@ -101,7 +101,7 @@ export class ImagesComponent implements OnInit { if (HasFailed(result)) { this.utilService.showSnackBar( 'Failed to delete image', - SnackBarType.Error + SnackBarType.Error, ); } else { this.utilService.showSnackBar('Image deleted', SnackBarType.Success); diff --git a/frontend/src/app/routes/processing/processing.component.ts b/frontend/src/app/routes/processing/processing.component.ts index 73f754e..3ed75c6 100644 --- a/frontend/src/app/routes/processing/processing.component.ts +++ b/frontend/src/app/routes/processing/processing.component.ts @@ -12,7 +12,7 @@ export class ProcessingComponent implements OnInit { constructor( private router: Router, private imageService: ImageService, - private utilService: UtilService + private utilService: UtilService, ) {} async ngOnInit() { diff --git a/frontend/src/app/routes/processing/processing.module.ts b/frontend/src/app/routes/processing/processing.module.ts index bbfc2d6..1dca312 100644 --- a/frontend/src/app/routes/processing/processing.module.ts +++ b/frontend/src/app/routes/processing/processing.module.ts @@ -6,10 +6,6 @@ import { ProcessingRoutingModule } from './processing.routing.module'; @NgModule({ declarations: [ProcessingComponent], - imports: [ - CommonModule, - ProcessingRoutingModule, - MatProgressSpinnerModule, - ], + imports: [CommonModule, ProcessingRoutingModule, MatProgressSpinnerModule], }) export class ProcessingRouteModule {} diff --git a/frontend/src/app/routes/settings/general/settings-general.module.ts b/frontend/src/app/routes/settings/general/settings-general.module.ts index 69250c5..6c23a58 100644 --- a/frontend/src/app/routes/settings/general/settings-general.module.ts +++ b/frontend/src/app/routes/settings/general/settings-general.module.ts @@ -6,10 +6,6 @@ import { SettingsGeneralRoutingModule } from './settings-general.routing.module' @NgModule({ declarations: [SettingsGeneralComponent], - imports: [ - CommonModule, - SettingsGeneralRoutingModule, - PrefOptionModule - ], + imports: [CommonModule, SettingsGeneralRoutingModule, PrefOptionModule], }) export class SettingsGeneralRouteModule {} diff --git a/frontend/src/app/routes/settings/roles/settings-roles-edit/settings-roles-edit.component.html b/frontend/src/app/routes/settings/roles/settings-roles-edit/settings-roles-edit.component.html index 1e60dbc..3f1ed47 100644 --- a/frontend/src/app/routes/settings/roles/settings-roles-edit/settings-roles-edit.component.html +++ b/frontend/src/app/routes/settings/roles/settings-roles-edit/settings-roles-edit.component.html @@ -40,7 +40,7 @@