diff options
| author | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2023-03-09 18:37:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-10 02:37:44 +0900 |
| commit | e0b7633a7adb6f2744e1142637bbbd6ac6624031 (patch) | |
| tree | dab693ed58c315cc0d4ea3ab2348512b72ccba67 /packages/backend/src/server/FileServerService.ts | |
| parent | fix(client): Solve the problem of not automatically jumping to /admin/overvie... (diff) | |
| download | sharkey-e0b7633a7adb6f2744e1142637bbbd6ac6624031.tar.gz sharkey-e0b7633a7adb6f2744e1142637bbbd6ac6624031.tar.bz2 sharkey-e0b7633a7adb6f2744e1142637bbbd6ac6624031.zip | |
enhance(backend): restore OpenAPI endpoints (#10281)
* enhance(backend): restore OpenAPI endpoints
* Update CHANGELOG.md
* version
* set max-age
* update redoc
* follow redoc documentation
---------
Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Diffstat (limited to 'packages/backend/src/server/FileServerService.ts')
| -rw-r--r-- | packages/backend/src/server/FileServerService.ts | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/packages/backend/src/server/FileServerService.ts b/packages/backend/src/server/FileServerService.ts index 835657b625..6db9a9672c 100644 --- a/packages/backend/src/server/FileServerService.ts +++ b/packages/backend/src/server/FileServerService.ts @@ -2,7 +2,6 @@ import * as fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import { dirname } from 'node:path'; import { Inject, Injectable } from '@nestjs/common'; -import fastifyStatic from '@fastify/static'; import rename from 'rename'; import type { Config } from '@/config.js'; import type { DriveFile, DriveFilesRepository } from '@/models/index.js'; @@ -60,11 +59,6 @@ export class FileServerService { done(); }); - fastify.register(fastifyStatic, { - root: _dirname, - serve: false, - }); - fastify.get('/files/app-default.jpg', (request, reply) => { const file = fs.createReadStream(`${_dirname}/assets/dummy.png`); reply.header('Content-Type', 'image/jpeg'); @@ -311,20 +305,20 @@ export class FileServerService { .linear(1.75, -(128 * 1.75) + 128) // 1.75x contrast .flatten({ background: '#000' }) .toColorspace('b-w'); - + const stats = await mask.clone().stats(); - + if (stats.entropy < 0.1) { // エントロピーがあまりない場合は404にする throw new StatusError('Skip to provide badge', 404); } - + const data = sharp({ create: { width: 96, height: 96, channels: 4, background: { r: 0, g: 0, b: 0, alpha: 0 } }, }) .pipelineColorspace('b-w') .boolean(await mask.png().toBuffer(), 'eor'); - + image = { data: await data.png().toBuffer(), ext: 'png', @@ -396,7 +390,7 @@ export class FileServerService { const { filename } = await this.downloadService.downloadUrl(url, path); const { mime, ext } = await this.fileInfoService.detectType(path); - + return { state: 'remote', mime, ext, |