Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop

This commit is contained in:
syuilo 2023-07-06 15:04:42 +09:00
commit 165c53a547
6 changed files with 41 additions and 32 deletions

View file

@ -23,6 +23,7 @@
- Fix: sparkle内にリンクを入れるとクリック不能になる問題の修正 - Fix: sparkle内にリンクを入れるとクリック不能になる問題の修正
- deck UIのカラムのメニューからアンテナとリストの編集画面を開けるように - deck UIのカラムのメニューからアンテナとリストの編集画面を開けるように
- ドライブファイルのメニューで画像をクロップできるように - ドライブファイルのメニューで画像をクロップできるように
- 画像を動画と同様に簡単に隠せるように
### Server ### Server
- JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました - JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました

View file

@ -121,10 +121,8 @@ export class NoteDeleteService {
} }
@bindThis @bindThis
private async findCascadingNotes(note: Note) { private async findCascadingNotes(note: Note): Promise<Note[]> {
const cascadingNotes: Note[] = []; const recursive = async (noteId: string): Promise<Note[]> => {
const recursive = async (noteId: string) => {
const query = this.notesRepository.createQueryBuilder('note') const query = this.notesRepository.createQueryBuilder('note')
.where('note.replyId = :noteId', { noteId }) .where('note.replyId = :noteId', { noteId })
.orWhere(new Brackets(q => { .orWhere(new Brackets(q => {
@ -133,12 +131,14 @@ export class NoteDeleteService {
})) }))
.leftJoinAndSelect('note.user', 'user'); .leftJoinAndSelect('note.user', 'user');
const replies = await query.getMany(); const replies = await query.getMany();
for (const reply of replies) {
cascadingNotes.push(reply); return [
await recursive(reply.id); replies,
} ...await Promise.all(replies.map(reply => recursive(reply.id))),
].flat();
}; };
await recursive(note.id);
const cascadingNotes: Note[] = await recursive(note.id);
return cascadingNotes.filter(note => note.userHost === null); // filter out non-local users return cascadingNotes.filter(note => note.userHost === null); // filter out non-local users
} }

View file

@ -1,5 +1,4 @@
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common'; import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
import escapeRegexp from 'escape-regexp';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/index.js'; import type { NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
@ -56,25 +55,18 @@ export class ApDbResolverService implements OnApplicationShutdown {
@bindThis @bindThis
public parseUri(value: string | IObject): UriParseResult { public parseUri(value: string | IObject): UriParseResult {
const uri = getApId(value); const separator = '/';
// the host part of a URL is case insensitive, so use the 'i' flag. const uri = new URL(getApId(value));
const localRegex = new RegExp('^' + escapeRegexp(this.config.url) + '/(\\w+)/(\\w+)(?:\/(.+))?', 'i'); if (uri.origin !== this.config.url) return { local: false, uri: uri.href };
const matchLocal = uri.match(localRegex);
const [, type, id, ...rest] = uri.pathname.split(separator);
if (matchLocal) { return {
return { local: true,
local: true, type,
type: matchLocal[1], id,
id: matchLocal[2], rest: rest.length === 0 ? undefined : rest.join(separator),
rest: matchLocal[3], };
};
} else {
return {
local: false,
uri,
};
}
} }
/** /**

View file

@ -47,4 +47,4 @@ html
header#banner(style=`background-image: url(${meta.bannerUrl})`) header#banner(style=`background-image: url(${meta.bannerUrl})`)
div#title= meta.name || host div#title= meta.name || host
div#content div#content
div#description= meta.description div#description!= meta.description

View file

@ -108,7 +108,7 @@ function waitForDecode() {
.then(() => { .then(() => {
loaded = true; loaded = true;
}, error => { }, error => {
console.error('Error occured during decoding image', img.value, error); console.error('Error occurred during decoding image', img.value, error);
throw Error(error); throw Error(error);
}); });
} else { } else {
@ -180,7 +180,7 @@ async function draw() {
render(props.hash, work); render(props.hash, work);
drawImage(work); drawImage(work);
} catch (error) { } catch (error) {
console.error('Error occured during drawing blurhash', error); console.error('Error occurred during drawing blurhash', error);
} }
} }
} }

View file

@ -33,6 +33,7 @@
<div v-if="image.isSensitive" :class="$style.indicator" style="color: var(--warn);">NSFW</div> <div v-if="image.isSensitive" :class="$style.indicator" style="color: var(--warn);">NSFW</div>
</div> </div>
<button :class="$style.menu" class="_button" @click.stop="showMenu"><i class="ti ti-dots" style="vertical-align: middle;"></i></button> <button :class="$style.menu" class="_button" @click.stop="showMenu"><i class="ti ti-dots" style="vertical-align: middle;"></i></button>
<i class="ti ti-eye-off" :class="$style.hide" @click.stop="hide = true"></i>
</template> </template>
</div> </div>
</template> </template>
@ -113,6 +114,21 @@ function showMenu(ev: MouseEvent) {
align-items: center; align-items: center;
} }
.hide {
display: block;
position: absolute;
border-radius: 6px;
background-color: var(--fg);
color: var(--accentLighten);
font-size: 14px;
opacity: .5;
padding: 3px 6px;
text-align: center;
cursor: pointer;
top: 12px;
right: 12px;
}
.hiddenTextWrapper { .hiddenTextWrapper {
display: table-cell; display: table-cell;
text-align: center; text-align: center;