Skip to content

Commit

Permalink
Merge branch 'develop' into feat-14852
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih authored Nov 2, 2024
2 parents d69e351 + 224bbd4 commit 3bac094
Show file tree
Hide file tree
Showing 88 changed files with 725 additions and 370 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Enhance: Bull DashboardでRelationship Queueの状態も確認できるように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/751)
- Enhance: ドライブでソートができるように
- Enhance: アイコンデコレーション管理画面の改善
- Enhance: 「単なるラッキー」の取得条件を変更
- Enhance: 投稿フォームでEscキーを押したときIME入力中ならフォームを閉じないように( #10866
- Enhance: MiAuth, OAuthの認可画面の改善
Expand All @@ -19,9 +20,13 @@
- Fix: Turnstileが失敗・期限切れした際にも成功扱いとなってしまう問題を修正
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/768)
- Fix: デッキのタイムラインカラムで「センシティブなファイルを含むノートを表示」設定が使用できなかった問題を修正
- Fix: Encode RSS urls with escape sequences before fetching allowing query parameters to be used
- Fix: リンク切れを修正

### Server
- Enhance: 起動前の疎通チェックで、DBとメイン以外のRedisの疎通確認も行うように
(Based on https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/588)
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/715)
- Fix: Nested proxy requestsを検出した際にブロックするように
[ghsa-gq5q-c77c-v236](https://github.com/misskey-dev/misskey/security/advisories/ghsa-gq5q-c77c-v236)
- Fix: 招待コードの発行可能な残り数算出に使用すべきロールポリシーの値が違う問題を修正
Expand Down
4 changes: 4 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5214,6 +5214,10 @@ export interface Locale extends ILocale {
* アカウントを選択してください
*/
"pleaseSelectAccount": string;
/**
* 利用可能なロール
*/
"availableRoles": string;
"_accountSettings": {
/**
* コンテンツの表示にログインを必須にする
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ yourNameContainsProhibitedWordsDescription: "名前に禁止されている文
thisContentsAreMarkedAsSigninRequiredByAuthor: "投稿者により、表示にはログインが必要と設定されています"
lockdown: "ロックダウン"
pleaseSelectAccount: "アカウントを選択してください"
availableRoles: "利用可能なロール"

_accountSettings:
requireSigninToViewContents: "コンテンツの表示にログインを必須にする"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "2024.10.2-alpha.1",
"version": "2024.10.2-alpha.2",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
51 changes: 46 additions & 5 deletions packages/backend/scripts/check_connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,52 @@

import Redis from 'ioredis';
import { loadConfig } from '../built/config.js';
import { createPostgresDataSource } from '../built/postgres.js';

const config = loadConfig();
const redis = new Redis(config.redis);

redis.on('connect', () => redis.disconnect());
redis.on('error', (e) => {
throw e;
});
async function connectToPostgres() {
const source = createPostgresDataSource(config);
await source.initialize();
await source.destroy();
}

async function connectToRedis(redisOptions) {
return await new Promise(async (resolve, reject) => {
const redis = new Redis({
...redisOptions,
lazyConnect: true,
reconnectOnError: false,
showFriendlyErrorStack: true,
});
redis.on('error', e => reject(e));

try {
await redis.connect();
resolve();

} catch (e) {
reject(e);

} finally {
redis.disconnect(false);
}
});
}

// If not all of these are defined, the default one gets reused.
// so we use a Set to only try connecting once to each **uniq** redis.
const promises = Array
.from(new Set([
config.redis,
config.redisForPubsub,
config.redisForJobQueue,
config.redisForTimelines,
config.redisForReactions,
]))
.map(connectToRedis)
.concat([
connectToPostgres()
]);

await Promise.allSettled(promises);
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ export class ApPersonService implements OnModuleInit {
if (user == null) throw new Error('failed to create user: user is null');

const [avatar, banner] = await Promise.all([icon, image].map(img => {
// icon and image may be arrays
// see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-icon
if (Array.isArray(img)) {
img = img.find(item => item && item.url) ?? null;
}

// if we have an explicitly missing image, return an
// explicitly-null set of values
if ((img == null) || (typeof img === 'object' && img.url == null)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,57 @@
import { Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
import { IdService } from '@/core/IdService.js';

export const meta = {
tags: ['admin'],

requireCredential: true,
requireRolePolicy: 'canManageAvatarDecorations',
kind: 'write:admin:avatar-decorations',

res: {
type: 'object',
optional: false, nullable: false,
properties: {
id: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
createdAt: {
type: 'string',
optional: false, nullable: false,
format: 'date-time',
},
updatedAt: {
type: 'string',
optional: false, nullable: true,
format: 'date-time',
},
name: {
type: 'string',
optional: false, nullable: false,
},
description: {
type: 'string',
optional: false, nullable: false,
},
url: {
type: 'string',
optional: false, nullable: false,
},
roleIdsThatCanBeUsedThisDecoration: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
},
},
} as const;

export const paramDef = {
Expand All @@ -32,14 +76,25 @@ export const paramDef = {
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
constructor(
private avatarDecorationService: AvatarDecorationService,
private idService: IdService,
) {
super(meta, paramDef, async (ps, me) => {
await this.avatarDecorationService.create({
const created = await this.avatarDecorationService.create({
name: ps.name,
description: ps.description,
url: ps.url,
roleIdsThatCanBeUsedThisDecoration: ps.roleIdsThatCanBeUsedThisDecoration,
}, me);

return {
id: created.id,
createdAt: this.idService.parse(created.id).date.toISOString(),
updatedAt: null,
name: created.name,
description: created.description,
url: created.url,
roleIdsThatCanBeUsedThisDecoration: created.roleIdsThatCanBeUsedThisDecoration,
};
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
*/

import { Inject, Injectable } from '@nestjs/common';
import type { AnnouncementsRepository, AnnouncementReadsRepository } from '@/models/_.js';
import type { MiAnnouncement } from '@/models/Announcement.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { QueryService } from '@/core/QueryService.js';
import { DI } from '@/di-symbols.js';
import { IdService } from '@/core/IdService.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
Expand Down
4 changes: 1 addition & 3 deletions packages/frontend/src/components/MkAbuseReport.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</template>

<div :class="$style.root" class="_gaps_s">
<div class="_gaps_s">
<MkFolder :withSpacer="false">
<template #icon><MkAvatar :user="report.targetUser" style="width: 18px; height: 18px;"/></template>
<template #label>{{ i18n.ts.target }}: <MkAcct :user="report.targetUser"/></template>
Expand Down Expand Up @@ -151,6 +151,4 @@ function showMenu(ev: MouseEvent) {
</script>

<style lang="scss" module>
.root {
}
</style>
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkAntennaEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async function deleteAntenna() {
function addUser() {
os.selectUser({ includeSelf: true }).then(user => {
users.value = users.value.trim();
users.value += '\n@' + Misskey.acct.toString(user as any);
users.value += '\n@' + Misskey.acct.toString(user);
users.value = users.value.trim();
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/MkAuthConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div :class="$style.headerText">{{ i18n.ts.pleaseSelectAccount }}</div>
</div>
<div :class="$style.accountSelectorRoot">
<div>
<div :class="$style.accountSelectorLabel">{{ i18n.ts.selectAccount }}</div>
<div :class="$style.accountSelectorList">
<template v-for="[id, user] in users">
Expand Down Expand Up @@ -63,7 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</div>
<slot name="consentAdditionalInfo"></slot>
<div :class="$style.accountSelectorRoot">
<div>
<div :class="$style.accountSelectorLabel">
{{ i18n.ts._auth.scopeUser }} <button class="_textButton" @click="clickBackToAccountSelect">{{ i18n.ts.switchAccount }}</button>
</div>
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/components/MkChannelPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import { computed, ref, watch } from 'vue';
import * as Misskey from 'misskey-js';
import { i18n } from '@/i18n.js';
import { miLocalStorage } from '@/local-storage.js';

const props = defineProps<{
channel: Record<string, any>;
channel: Misskey.entities.Channel;
}>();

const getLastReadedAt = (): number | null => {
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkCropperDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:withOkButton="true"
@close="cancel()"
@ok="ok()"
@closed="$emit('closed')"
@closed="emit('closed')"
>
<template #header>{{ i18n.ts.cropImage }}</template>
<template #default="{ width, height }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<MkModalWindow ref="dialogEl" @close="cancel()" @closed="$emit('closed')">
<MkModalWindow ref="dialogEl" @close="cancel()" @closed="emit('closed')">
<template #header>:{{ emoji.name }}:</template>
<template #default>
<MkSpacer>
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/MkDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
</MkSelect>
<div v-if="(showOkButton || showCancelButton) && !actions" :class="$style.buttons">
<MkButton v-if="showOkButton" data-cy-modal-dialog-ok inline primary rounded :autofocus="!input && !select" :disabled="okButtonDisabledReason" @click="ok">{{ okText ?? ((showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.gotIt) }}</MkButton>
<MkButton v-if="showOkButton" data-cy-modal-dialog-ok inline primary rounded :autofocus="!input && !select" :disabled="okButtonDisabledReason != null" @click="ok">{{ okText ?? ((showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.gotIt) }}</MkButton>
<MkButton v-if="showCancelButton || input || select" data-cy-modal-dialog-cancel inline rounded @click="cancel">{{ cancelText ?? i18n.ts.cancel }}</MkButton>
</div>
<div v-if="actions" :class="$style.buttons">
Expand Down Expand Up @@ -98,7 +98,7 @@ const props = withDefaults(defineProps<{
text: string;
primary?: boolean,
danger?: boolean,
callback: (...args: any[]) => void;
callback: (...args: unknown[]) => void;
}[];
showOkButton?: boolean;
showCancelButton?: boolean;
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/src/components/MkDrive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const ilFilesObserver = new IntersectionObserver(
(entries) => entries.some((entry) => entry.isIntersecting) && !fetching.value && moreFiles.value && fetchMoreFiles(),
);

const sortModeSelect = ref('+createdAt');
const sortModeSelect = ref<NonNullable<Misskey.entities.DriveFilesRequest['sort']>>('+createdAt');

watch(folder, () => emit('cd', folder.value));
watch(sortModeSelect, () => {
Expand Down Expand Up @@ -198,7 +198,7 @@ function onStreamDriveFolderDeleted(folderId: string) {
removeFolder(folderId);
}

function onDragover(ev: DragEvent): any {
function onDragover(ev: DragEvent) {
if (!ev.dataTransfer) return;

// ドラッグ元が自分自身の所有するアイテムだったら
Expand Down Expand Up @@ -243,7 +243,7 @@ function onDragleave() {
draghover.value = false;
}

function onDrop(ev: DragEvent): any {
function onDrop(ev: DragEvent) {
draghover.value = false;

if (!ev.dataTransfer) return;
Expand Down Expand Up @@ -332,7 +332,7 @@ function createFolder() {
title: i18n.ts.createFolder,
placeholder: i18n.ts.folderName,
}).then(({ canceled, result: name }) => {
if (canceled) return;
if (canceled || name == null) return;
misskeyApi('drive/folders/create', {
name: name,
parentId: folder.value ? folder.value.id : undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkEmbedCodeGenDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:scroll="false"
:withOkButton="false"
@close="cancel()"
@closed="$emit('closed')"
@closed="emit('closed')"
>
<template #header><i class="ti ti-code"></i> {{ i18n.ts._embedCodeGen.title }}</template>

Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkEmojiPicker.section.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function computeButtonTitle(ev: MouseEvent): void {
elm.title = getEmojiName(emoji);
}

function nestedChosen(emoji: any, ev: MouseEvent) {
function nestedChosen(emoji: string, ev: MouseEvent) {
emit('chosen', emoji, ev);
}
</script>
4 changes: 2 additions & 2 deletions packages/frontend/src/components/MkEmojiPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function computeButtonTitle(ev: MouseEvent): void {
elm.title = getEmojiName(emoji);
}

function chosen(emoji: any, ev?: MouseEvent) {
function chosen(emoji: string | Misskey.entities.EmojiSimple | UnicodeEmojiDef, ev?: MouseEvent) {
const el = ev && (ev.currentTarget ?? ev.target) as HTMLElement | null | undefined;
if (el) {
const rect = el.getBoundingClientRect();
Expand All @@ -426,7 +426,7 @@ function chosen(emoji: any, ev?: MouseEvent) {
// 最近使った絵文字更新
if (!pinned.value?.includes(key)) {
let recents = defaultStore.state.recentlyUsedEmojis;
recents = recents.filter((emoji: any) => emoji !== key);
recents = recents.filter((emoji) => emoji !== key);
recents.unshift(key);
defaultStore.set('recentlyUsedEmojis', recents.splice(0, 32));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkExtensionInstaller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export type Extension = {
author: string;
description?: string;
permissions?: string[];
config?: Record<string, any>;
config?: Record<string, unknown>;
};
} | {
type: 'theme';
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkFormDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@click="cancel()"
@ok="ok()"
@close="cancel()"
@closed="$emit('closed')"
@closed="emit('closed')"
>
<template #header>
{{ title }}
Expand Down
Loading

0 comments on commit 3bac094

Please sign in to comment.