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

This commit is contained in:
NoriDev 2023-07-06 19:36:34 +09:00
commit b0df25d28b
9 changed files with 52 additions and 36 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 { MessagingMessagesRepository, NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/index.js'; import type { MessagingMessagesRepository, NotesRepository, UserPublickeysRepository, UsersRepository } from '@/models/index.js';
import type { Config } from '@/config.js'; import type { Config } from '@/config.js';
@ -60,25 +59,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);
if (matchLocal) { const [, type, id, ...rest] = uri.pathname.split(separator);
return { return {
local: true, local: true,
type: matchLocal[1], type,
id: matchLocal[2], id,
rest: matchLocal[3], rest: rest.length === 0 ? undefined : rest.join(separator),
}; };
} 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

@ -110,7 +110,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 {
@ -182,7 +182,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: 12px;
opacity: .5;
padding: 5px 8px;
text-align: center;
cursor: pointer;
top: 12px;
right: 12px;
}
.hiddenTextWrapper { .hiddenTextWrapper {
display: table-cell; display: table-cell;
text-align: center; text-align: center;
@ -137,8 +153,8 @@ function showMenu(ev: MouseEvent) {
backdrop-filter: var(--blur, blur(15px)); backdrop-filter: var(--blur, blur(15px));
color: #fff; color: #fff;
font-size: 0.8em; font-size: 0.8em;
width: 32px; width: 28px;
height: 32px; height: 28px;
text-align: center; text-align: center;
bottom: 10px; bottom: 10px;
right: 10px; right: 10px;

View file

@ -115,6 +115,8 @@ onMounted(() => {
imageClickAction: 'close', imageClickAction: 'close',
tapAction: 'toggle-controls', tapAction: 'toggle-controls',
bgOpacity: 1, bgOpacity: 1,
showAnimationDuration: 100,
hideAnimationDuration: 100,
pswpModule: PhotoSwipe, pswpModule: PhotoSwipe,
}); });

View file

@ -188,6 +188,7 @@ watch(queue, (a, b) => {
}, { deep: true }); }, { deep: true });
async function init(): Promise<void> { async function init(): Promise<void> {
items.value = new Map();
queue.value = new Map(); queue.value = new Map();
fetching.value = true; fetching.value = true;
const params = props.pagination.params ? isRef(props.pagination.params) ? props.pagination.params.value : props.pagination.params : {}; const params = props.pagination.params ? isRef(props.pagination.params) ? props.pagination.params.value : props.pagination.params : {};
@ -219,8 +220,6 @@ async function init(): Promise<void> {
} }
const reload = (): Promise<void> => { const reload = (): Promise<void> => {
items.value = new Map();
queue.value = new Map();
return init(); return init();
}; };

View file

@ -251,6 +251,12 @@ const patronsWithIconWithMisskey = [{
}, { }, {
name: 'spinlock', name: 'spinlock',
icon: 'https://misskey-hub.net/patrons/6a1cebc819d540a78bf20e9e3115baa8.jpg', icon: 'https://misskey-hub.net/patrons/6a1cebc819d540a78bf20e9e3115baa8.jpg',
}, {
name: 'じゅくま',
icon: 'https://misskey-hub.net/patrons/3e56bdac69dd42f7a06e0f12cf2fc895.jpg',
}, {
name: '清遊あみ',
icon: 'https://misskey-hub.net/patrons/de25195b88e940a388388bea2e7637d8.jpg',
}]; }];
const patronsWithCherryPick = [ const patronsWithCherryPick = [