mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-06 17:41:52 -04:00
fix(media): use correct MediaBackendType from commons package
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
d73dc14c5c
commit
f47915dbb3
3 changed files with 4 additions and 9 deletions
|
@ -1,5 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { MediaBackendType } from '@hedgedoc/commons';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { FileTypeResult } from 'file-type';
|
||||
import { promises as fs } from 'fs';
|
||||
|
@ -12,7 +13,6 @@ import mediaConfiguration, { MediaConfig } from '../../config/media.config';
|
|||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendType } from './backend-type.enum';
|
||||
|
||||
@Injectable()
|
||||
export class FilesystemBackend implements MediaBackend {
|
||||
|
@ -25,7 +25,7 @@ export class FilesystemBackend implements MediaBackend {
|
|||
) {
|
||||
this.logger.setContext(FilesystemBackend.name);
|
||||
// only create the backend if local filesystem is configured
|
||||
if (this.mediaConfig.backend.use !== BackendType.FILESYSTEM) {
|
||||
if (this.mediaConfig.backend.use !== MediaBackendType.FILESYSTEM) {
|
||||
this.uploadDirectory = '';
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { MediaBackendType } from '@hedgedoc/commons';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import fetch, { Response } from 'node-fetch';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
@ -14,7 +15,6 @@ import mediaConfiguration, {
|
|||
import { MediaBackendError } from '../../errors/errors';
|
||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||
import { MediaBackend } from '../media-backend.interface';
|
||||
import { BackendType } from './backend-type.enum';
|
||||
|
||||
type UploadResult = {
|
||||
data: {
|
||||
|
@ -39,7 +39,7 @@ export class ImgurBackend implements MediaBackend {
|
|||
) {
|
||||
this.logger.setContext(ImgurBackend.name);
|
||||
// only create the backend if imgur is configured
|
||||
if (this.mediaConfig.backend.use !== BackendType.IMGUR) {
|
||||
if (this.mediaConfig.backend.use !== MediaBackendType.IMGUR) {
|
||||
return;
|
||||
}
|
||||
this.config = this.mediaConfig.backend.imgur;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue