mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-07 09:55:43 -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
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
import { MediaBackendType } from '@hedgedoc/commons';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { FileTypeResult } from 'file-type';
|
import { FileTypeResult } from 'file-type';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
@ -12,7 +13,6 @@ import mediaConfiguration, { MediaConfig } from '../../config/media.config';
|
||||||
import { MediaBackendError } from '../../errors/errors';
|
import { MediaBackendError } from '../../errors/errors';
|
||||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||||
import { MediaBackend } from '../media-backend.interface';
|
import { MediaBackend } from '../media-backend.interface';
|
||||||
import { BackendType } from './backend-type.enum';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FilesystemBackend implements MediaBackend {
|
export class FilesystemBackend implements MediaBackend {
|
||||||
|
@ -25,7 +25,7 @@ export class FilesystemBackend implements MediaBackend {
|
||||||
) {
|
) {
|
||||||
this.logger.setContext(FilesystemBackend.name);
|
this.logger.setContext(FilesystemBackend.name);
|
||||||
// only create the backend if local filesystem is configured
|
// 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 = '';
|
this.uploadDirectory = '';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
import { MediaBackendType } from '@hedgedoc/commons';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import fetch, { Response } from 'node-fetch';
|
import fetch, { Response } from 'node-fetch';
|
||||||
import { URLSearchParams } from 'url';
|
import { URLSearchParams } from 'url';
|
||||||
|
@ -14,7 +15,6 @@ import mediaConfiguration, {
|
||||||
import { MediaBackendError } from '../../errors/errors';
|
import { MediaBackendError } from '../../errors/errors';
|
||||||
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
import { ConsoleLoggerService } from '../../logger/console-logger.service';
|
||||||
import { MediaBackend } from '../media-backend.interface';
|
import { MediaBackend } from '../media-backend.interface';
|
||||||
import { BackendType } from './backend-type.enum';
|
|
||||||
|
|
||||||
type UploadResult = {
|
type UploadResult = {
|
||||||
data: {
|
data: {
|
||||||
|
@ -39,7 +39,7 @@ export class ImgurBackend implements MediaBackend {
|
||||||
) {
|
) {
|
||||||
this.logger.setContext(ImgurBackend.name);
|
this.logger.setContext(ImgurBackend.name);
|
||||||
// only create the backend if imgur is configured
|
// only create the backend if imgur is configured
|
||||||
if (this.mediaConfig.backend.use !== BackendType.IMGUR) {
|
if (this.mediaConfig.backend.use !== MediaBackendType.IMGUR) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.config = this.mediaConfig.backend.imgur;
|
this.config = this.mediaConfig.backend.imgur;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue