Merge branch 'develop'
This commit is contained in:
commit
af6d52e4c8
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 12.101.1 (2021/12/29)
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- SVG絵文字が表示できないのを修正
|
||||||
|
- エクスポートした絵文字の拡張子がfalseになることがあるのを修正
|
||||||
|
|
||||||
## 12.101.0 (2021/12/29)
|
## 12.101.0 (2021/12/29)
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "12.101.0",
|
"version": "12.101.1",
|
||||||
"codename": "indigo",
|
"codename": "indigo",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,47 +1,2 @@
|
||||||
export const USER_ONLINE_THRESHOLD = 1000 * 60 * 10; // 10min
|
export const USER_ONLINE_THRESHOLD = 1000 * 60 * 10; // 10min
|
||||||
export const USER_ACTIVE_THRESHOLD = 1000 * 60 * 60 * 24 * 3; // 3days
|
export const USER_ACTIVE_THRESHOLD = 1000 * 60 * 60 * 24 * 3; // 3days
|
||||||
|
|
||||||
// ブラウザで直接表示することを許可するファイルの種類のリスト
|
|
||||||
// ここに含まれないものは application/octet-stream としてレスポンスされる
|
|
||||||
// SVGはXSSを生むので許可しない
|
|
||||||
export const FILE_TYPE_BROWSERSAFE = [
|
|
||||||
// Images
|
|
||||||
'image/png',
|
|
||||||
'image/gif',
|
|
||||||
'image/jpeg',
|
|
||||||
'image/webp',
|
|
||||||
'image/apng',
|
|
||||||
'image/bmp',
|
|
||||||
'image/tiff',
|
|
||||||
'image/x-icon',
|
|
||||||
|
|
||||||
// OggS
|
|
||||||
'audio/opus',
|
|
||||||
'video/ogg',
|
|
||||||
'audio/ogg',
|
|
||||||
'application/ogg',
|
|
||||||
|
|
||||||
// ISO/IEC base media file format
|
|
||||||
'video/quicktime',
|
|
||||||
'video/mp4',
|
|
||||||
'audio/mp4',
|
|
||||||
'video/x-m4v',
|
|
||||||
'audio/x-m4a',
|
|
||||||
'video/3gpp',
|
|
||||||
'video/3gpp2',
|
|
||||||
|
|
||||||
'video/mpeg',
|
|
||||||
'audio/mpeg',
|
|
||||||
|
|
||||||
'video/webm',
|
|
||||||
'audio/webm',
|
|
||||||
|
|
||||||
'audio/aac',
|
|
||||||
'audio/x-flac',
|
|
||||||
'audio/vnd.wave',
|
|
||||||
];
|
|
||||||
/*
|
|
||||||
https://github.com/sindresorhus/file-type/blob/main/supported.js
|
|
||||||
https://github.com/sindresorhus/file-type/blob/main/core.js
|
|
||||||
https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers
|
|
||||||
*/
|
|
||||||
|
|
|
@ -65,7 +65,8 @@ export async function exportCustomEmojis(job: Bull.Job, done: () => void): Promi
|
||||||
|
|
||||||
for (const emoji of customEmojis) {
|
for (const emoji of customEmojis) {
|
||||||
const exportId = ulid().toLowerCase();
|
const exportId = ulid().toLowerCase();
|
||||||
const emojiPath = path + '/' + exportId + '.' + mime.extension(emoji.type);
|
const ext = mime.extension(emoji.type);
|
||||||
|
const emojiPath = path + '/' + exportId + (ext ? '.' + ext : '');
|
||||||
fs.writeFileSync(emojiPath, '', 'binary');
|
fs.writeFileSync(emojiPath, '', 'binary');
|
||||||
let downloaded = false;
|
let downloaded = false;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ import { detectType } from '@/misc/get-file-info';
|
||||||
import { convertToJpeg, convertToPngOrJpeg } from '@/services/drive/image-processor';
|
import { convertToJpeg, convertToPngOrJpeg } from '@/services/drive/image-processor';
|
||||||
import { GenerateVideoThumbnail } from '@/services/drive/generate-video-thumbnail';
|
import { GenerateVideoThumbnail } from '@/services/drive/generate-video-thumbnail';
|
||||||
import { StatusError } from '@/misc/fetch';
|
import { StatusError } from '@/misc/fetch';
|
||||||
import { FILE_TYPE_BROWSERSAFE } from '@/const';
|
|
||||||
|
|
||||||
//const _filename = fileURLToPath(import.meta.url);
|
//const _filename = fileURLToPath(import.meta.url);
|
||||||
const _filename = __filename;
|
const _filename = __filename;
|
||||||
|
@ -28,7 +27,6 @@ const commonReadableHandlerGenerator = (ctx: Koa.Context) => (e: Error): void =>
|
||||||
ctx.set('Cache-Control', 'max-age=300');
|
ctx.set('Cache-Control', 'max-age=300');
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
|
||||||
export default async function(ctx: Koa.Context) {
|
export default async function(ctx: Koa.Context) {
|
||||||
const key = ctx.params.key;
|
const key = ctx.params.key;
|
||||||
|
|
||||||
|
@ -83,7 +81,7 @@ export default async function(ctx: Koa.Context) {
|
||||||
|
|
||||||
const image = await convertFile();
|
const image = await convertFile();
|
||||||
ctx.body = image.data;
|
ctx.body = image.data;
|
||||||
ctx.set('Content-Type', FILE_TYPE_BROWSERSAFE.includes(image.type) ? image.type : 'application/octet-stream');
|
ctx.set('Content-Type', image.type);
|
||||||
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
serverLogger.error(`${e}`);
|
serverLogger.error(`${e}`);
|
||||||
|
@ -114,14 +112,14 @@ export default async function(ctx: Koa.Context) {
|
||||||
}).toString();
|
}).toString();
|
||||||
|
|
||||||
ctx.body = InternalStorage.read(key);
|
ctx.body = InternalStorage.read(key);
|
||||||
ctx.set('Content-Type', FILE_TYPE_BROWSERSAFE.includes(mime) ? mime : 'application/octet-stream');
|
ctx.set('Content-Type', mime);
|
||||||
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
||||||
ctx.set('Content-Disposition', contentDisposition('inline', filename));
|
ctx.set('Content-Disposition', contentDisposition('inline', filename));
|
||||||
} else {
|
} else {
|
||||||
const readable = InternalStorage.read(file.accessKey!);
|
const readable = InternalStorage.read(file.accessKey!);
|
||||||
readable.on('error', commonReadableHandlerGenerator(ctx));
|
readable.on('error', commonReadableHandlerGenerator(ctx));
|
||||||
ctx.body = readable;
|
ctx.body = readable;
|
||||||
ctx.set('Content-Type', FILE_TYPE_BROWSERSAFE.includes(file.type) ? file.type : 'application/octet-stream');
|
ctx.set('Content-Type', file.type);
|
||||||
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
ctx.set('Cache-Control', 'max-age=31536000, immutable');
|
||||||
ctx.set('Content-Disposition', contentDisposition('inline', file.name));
|
ctx.set('Content-Disposition', contentDisposition('inline', file.name));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { createTemp } from '@/misc/create-temp';
|
||||||
import { downloadUrl } from '@/misc/download-url';
|
import { downloadUrl } from '@/misc/download-url';
|
||||||
import { detectType } from '@/misc/get-file-info';
|
import { detectType } from '@/misc/get-file-info';
|
||||||
import { StatusError } from '@/misc/fetch';
|
import { StatusError } from '@/misc/fetch';
|
||||||
import { FILE_TYPE_BROWSERSAFE } from '@/const';
|
|
||||||
|
|
||||||
export async function proxyMedia(ctx: Koa.Context) {
|
export async function proxyMedia(ctx: Koa.Context) {
|
||||||
const url = 'url' in ctx.query ? ctx.query.url : 'https://' + ctx.params.url;
|
const url = 'url' in ctx.query ? ctx.query.url : 'https://' + ctx.params.url;
|
||||||
|
@ -19,7 +18,7 @@ export async function proxyMedia(ctx: Koa.Context) {
|
||||||
|
|
||||||
const { mime, ext } = await detectType(path);
|
const { mime, ext } = await detectType(path);
|
||||||
|
|
||||||
if (!FILE_TYPE_BROWSERSAFE.includes(mime)) throw 403;
|
if (!mime.startsWith('image/')) throw 403;
|
||||||
|
|
||||||
let image: IImage;
|
let image: IImage;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { isDuplicateKeyValueError } from '@/misc/is-duplicate-key-value-error';
|
||||||
import * as S3 from 'aws-sdk/clients/s3';
|
import * as S3 from 'aws-sdk/clients/s3';
|
||||||
import { getS3 } from './s3';
|
import { getS3 } from './s3';
|
||||||
import * as sharp from 'sharp';
|
import * as sharp from 'sharp';
|
||||||
import { FILE_TYPE_BROWSERSAFE } from '@/const';
|
|
||||||
|
|
||||||
const logger = driveLogger.createSubLogger('register', 'yellow');
|
const logger = driveLogger.createSubLogger('register', 'yellow');
|
||||||
|
|
||||||
|
@ -242,7 +241,6 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
|
||||||
*/
|
*/
|
||||||
async function upload(key: string, stream: fs.ReadStream | Buffer, type: string, filename?: string) {
|
async function upload(key: string, stream: fs.ReadStream | Buffer, type: string, filename?: string) {
|
||||||
if (type === 'image/apng') type = 'image/png';
|
if (type === 'image/apng') type = 'image/png';
|
||||||
if (!FILE_TYPE_BROWSERSAFE.includes(type)) type = 'application/octet-stream';
|
|
||||||
|
|
||||||
const meta = await fetchMeta();
|
const meta = await fetchMeta();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue