mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 10:20:27 +01:00
Merge branch 'develop' into feat/frontend/copy-note-link-on-remote
This commit is contained in:
commit
4ab74d83f2
40 changed files with 1178 additions and 893 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
### Note
|
||||
- コントロールパネル内にあるサマリープロキシの設定個所がセキュリティから全般へ変更となります。
|
||||
- 悪意のある第三者がリモートユーザーになりすましたアクティビティを受け取れてしまう問題を修正しました。詳しくは[GitHub security advisory](https://github.com/misskey-dev/misskey/security/advisories/GHSA-2vxv-pv3m-3wvj)をご覧ください。
|
||||
|
||||
### General
|
||||
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
|
||||
|
@ -56,10 +57,12 @@
|
|||
- Fix: ページのOGP URLが間違っているのを修正
|
||||
- Fix: リバーシの対局を正しく共有できないことがある問題を修正
|
||||
- Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正
|
||||
- Fix: 連合なしの状態の読み書きができない問題を修正
|
||||
|
||||
### Server
|
||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
||||
- Enhance: misskey-dev/summaly@5.1.0の取り込み(プレビュー生成処理の効率化)
|
||||
- Fix: リモートから配送されたアクティビティにJSON-LD compactionをかける
|
||||
- Fix: フォローリクエストを作成する際に既存のものは削除するように
|
||||
(Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/440)
|
||||
- Fix: エンドポイント`notes/translate`のエラーを改善
|
||||
|
@ -74,6 +77,8 @@
|
|||
- Fix: グローバルタイムラインで返信が表示されないことがある問題を修正
|
||||
- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
|
||||
- Fix: AP Link等は添付ファイル扱いしないようになど (#13754)
|
||||
- Enhance: ドライブのファイルがNSFWかどうか個別に連合されるように (#13756)
|
||||
- 可能な場合、ノートの添付ファイルのセンシティブ判定がファイル単位になります
|
||||
|
||||
## 2024.3.1
|
||||
|
||||
|
|
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
@ -4952,6 +4952,10 @@ export interface Locale extends ILocale {
|
|||
* フォローの際常に確認する
|
||||
*/
|
||||
"alwaysConfirmFollow": string;
|
||||
/**
|
||||
* お問い合わせ
|
||||
*/
|
||||
"inquiry": string;
|
||||
"_bubbleGame": {
|
||||
/**
|
||||
* 遊び方
|
||||
|
|
|
@ -1234,6 +1234,7 @@ keepOriginalFilename: "オリジナルのファイル名を保持"
|
|||
keepOriginalFilenameDescription: "この設定をオフにすると、アップロード時にファイル名が自動でランダム文字列に置き換えられます。"
|
||||
noDescription: "説明文はありません"
|
||||
alwaysConfirmFollow: "フォローの際常に確認する"
|
||||
inquiry: "お問い合わせ"
|
||||
|
||||
_bubbleGame:
|
||||
howToPlay: "遊び方"
|
||||
|
|
|
@ -127,7 +127,7 @@ import { ApMfmService } from './activitypub/ApMfmService.js';
|
|||
import { ApRendererService } from './activitypub/ApRendererService.js';
|
||||
import { ApRequestService } from './activitypub/ApRequestService.js';
|
||||
import { ApResolverService } from './activitypub/ApResolverService.js';
|
||||
import { LdSignatureService } from './activitypub/LdSignatureService.js';
|
||||
import { JsonLdService } from './activitypub/JsonLdService.js';
|
||||
import { RemoteLoggerService } from './RemoteLoggerService.js';
|
||||
import { RemoteUserResolveService } from './RemoteUserResolveService.js';
|
||||
import { WebfingerService } from './WebfingerService.js';
|
||||
|
@ -266,7 +266,7 @@ const $ApMfmService: Provider = { provide: 'ApMfmService', useExisting: ApMfmSer
|
|||
const $ApRendererService: Provider = { provide: 'ApRendererService', useExisting: ApRendererService };
|
||||
const $ApRequestService: Provider = { provide: 'ApRequestService', useExisting: ApRequestService };
|
||||
const $ApResolverService: Provider = { provide: 'ApResolverService', useExisting: ApResolverService };
|
||||
const $LdSignatureService: Provider = { provide: 'LdSignatureService', useExisting: LdSignatureService };
|
||||
const $JsonLdService: Provider = { provide: 'JsonLdService', useExisting: JsonLdService };
|
||||
const $RemoteLoggerService: Provider = { provide: 'RemoteLoggerService', useExisting: RemoteLoggerService };
|
||||
const $RemoteUserResolveService: Provider = { provide: 'RemoteUserResolveService', useExisting: RemoteUserResolveService };
|
||||
const $WebfingerService: Provider = { provide: 'WebfingerService', useExisting: WebfingerService };
|
||||
|
@ -406,7 +406,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
|||
ApRendererService,
|
||||
ApRequestService,
|
||||
ApResolverService,
|
||||
LdSignatureService,
|
||||
JsonLdService,
|
||||
RemoteLoggerService,
|
||||
RemoteUserResolveService,
|
||||
WebfingerService,
|
||||
|
@ -542,7 +542,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
|||
$ApRendererService,
|
||||
$ApRequestService,
|
||||
$ApResolverService,
|
||||
$LdSignatureService,
|
||||
$JsonLdService,
|
||||
$RemoteLoggerService,
|
||||
$RemoteUserResolveService,
|
||||
$WebfingerService,
|
||||
|
@ -678,7 +678,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
|||
ApRendererService,
|
||||
ApRequestService,
|
||||
ApResolverService,
|
||||
LdSignatureService,
|
||||
JsonLdService,
|
||||
RemoteLoggerService,
|
||||
RemoteUserResolveService,
|
||||
WebfingerService,
|
||||
|
@ -813,7 +813,7 @@ const $ApQuestionService: Provider = { provide: 'ApQuestionService', useExisting
|
|||
$ApRendererService,
|
||||
$ApRequestService,
|
||||
$ApResolverService,
|
||||
$LdSignatureService,
|
||||
$JsonLdService,
|
||||
$RemoteLoggerService,
|
||||
$RemoteUserResolveService,
|
||||
$WebfingerService,
|
||||
|
|
|
@ -28,8 +28,9 @@ import { bindThis } from '@/decorators.js';
|
|||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||
import { isNotNull } from '@/misc/is-not-null.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { LdSignatureService } from './LdSignatureService.js';
|
||||
import { JsonLdService } from './JsonLdService.js';
|
||||
import { ApMfmService } from './ApMfmService.js';
|
||||
import { CONTEXT } from './misc/contexts.js';
|
||||
import type { IAccept, IActivity, IAdd, IAnnounce, IApDocument, IApEmoji, IApHashtag, IApImage, IApMention, IBlock, ICreate, IDelete, IFlag, IFollow, IKey, ILike, IMove, IObject, IPost, IQuestion, IReject, IRemove, ITombstone, IUndo, IUpdate } from './type.js';
|
||||
|
||||
@Injectable()
|
||||
|
@ -56,7 +57,7 @@ export class ApRendererService {
|
|||
private customEmojiService: CustomEmojiService,
|
||||
private userEntityService: UserEntityService,
|
||||
private driveFileEntityService: DriveFileEntityService,
|
||||
private ldSignatureService: LdSignatureService,
|
||||
private jsonLdService: JsonLdService,
|
||||
private userKeypairService: UserKeypairService,
|
||||
private apMfmService: ApMfmService,
|
||||
private mfmService: MfmService,
|
||||
|
@ -166,6 +167,7 @@ export class ApRendererService {
|
|||
mediaType: file.webpublicType ?? file.type,
|
||||
url: this.driveFileEntityService.getPublicUrl(file),
|
||||
name: file.comment,
|
||||
sensitive: file.isSensitive,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -617,48 +619,16 @@ export class ApRendererService {
|
|||
x.id = `${this.config.url}/${randomUUID()}`;
|
||||
}
|
||||
|
||||
return Object.assign({
|
||||
'@context': [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v1',
|
||||
{
|
||||
Key: 'sec:Key',
|
||||
// as non-standards
|
||||
manuallyApprovesFollowers: 'as:manuallyApprovesFollowers',
|
||||
sensitive: 'as:sensitive',
|
||||
Hashtag: 'as:Hashtag',
|
||||
quoteUrl: 'as:quoteUrl',
|
||||
// Mastodon
|
||||
toot: 'http://joinmastodon.org/ns#',
|
||||
Emoji: 'toot:Emoji',
|
||||
featured: 'toot:featured',
|
||||
discoverable: 'toot:discoverable',
|
||||
// schema
|
||||
schema: 'http://schema.org#',
|
||||
PropertyValue: 'schema:PropertyValue',
|
||||
value: 'schema:value',
|
||||
// Misskey
|
||||
misskey: 'https://misskey-hub.net/ns#',
|
||||
'_misskey_content': 'misskey:_misskey_content',
|
||||
'_misskey_quote': 'misskey:_misskey_quote',
|
||||
'_misskey_reaction': 'misskey:_misskey_reaction',
|
||||
'_misskey_votes': 'misskey:_misskey_votes',
|
||||
'_misskey_summary': 'misskey:_misskey_summary',
|
||||
'isCat': 'misskey:isCat',
|
||||
// vcard
|
||||
vcard: 'http://www.w3.org/2006/vcard/ns#',
|
||||
},
|
||||
],
|
||||
}, x as T & { id: string });
|
||||
return Object.assign({ '@context': CONTEXT }, x as T & { id: string });
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async attachLdSignature(activity: any, user: { id: MiUser['id']; host: null; }): Promise<IActivity> {
|
||||
const keypair = await this.userKeypairService.getUserKeypair(user.id);
|
||||
|
||||
const ldSignature = this.ldSignatureService.use();
|
||||
ldSignature.debug = false;
|
||||
activity = await ldSignature.signRsaSignature2017(activity, keypair.privateKey, `${this.config.url}/users/${user.id}#main-key`);
|
||||
const jsonLd = this.jsonLdService.use();
|
||||
jsonLd.debug = false;
|
||||
activity = await jsonLd.signRsaSignature2017(activity, keypair.privateKey, `${this.config.url}/users/${user.id}#main-key`);
|
||||
|
||||
return activity;
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import * as crypto from 'node:crypto';
|
|||
import { Injectable } from '@nestjs/common';
|
||||
import { HttpRequestService } from '@/core/HttpRequestService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { CONTEXTS } from './misc/contexts.js';
|
||||
import { CONTEXT, PRELOADED_CONTEXTS } from './misc/contexts.js';
|
||||
import { validateContentTypeSetAsJsonLD } from './misc/validator.js';
|
||||
import type { JsonLdDocument } from 'jsonld';
|
||||
import type { JsonLd, RemoteDocument } from 'jsonld/jsonld-spec.js';
|
||||
import type { JsonLd as JsonLdObject, RemoteDocument } from 'jsonld/jsonld-spec.js';
|
||||
|
||||
// RsaSignature2017 based from https://github.com/transmute-industries/RsaSignature2017
|
||||
// RsaSignature2017 implementation is based on https://github.com/transmute-industries/RsaSignature2017
|
||||
|
||||
class LdSignature {
|
||||
class JsonLd {
|
||||
public debug = false;
|
||||
public preLoad = true;
|
||||
public loderTimeout = 5000;
|
||||
|
@ -89,10 +89,18 @@ class LdSignature {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
public async normalize(data: JsonLdDocument): Promise<string> {
|
||||
public async compact(data: any, context: any = CONTEXT): Promise<JsonLdDocument> {
|
||||
const customLoader = this.getLoader();
|
||||
// XXX: Importing jsonld dynamically since Jest frequently fails to import it statically
|
||||
// https://github.com/misskey-dev/misskey/pull/9894#discussion_r1103753595
|
||||
return (await import('jsonld')).default.compact(data, context, {
|
||||
documentLoader: customLoader,
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async normalize(data: JsonLdDocument): Promise<string> {
|
||||
const customLoader = this.getLoader();
|
||||
return (await import('jsonld')).default.normalize(data, {
|
||||
documentLoader: customLoader,
|
||||
});
|
||||
|
@ -104,11 +112,11 @@ class LdSignature {
|
|||
if (!/^https?:\/\//.test(url)) throw new Error(`Invalid URL ${url}`);
|
||||
|
||||
if (this.preLoad) {
|
||||
if (url in CONTEXTS) {
|
||||
if (url in PRELOADED_CONTEXTS) {
|
||||
if (this.debug) console.debug(`HIT: ${url}`);
|
||||
return {
|
||||
contextUrl: undefined,
|
||||
document: CONTEXTS[url],
|
||||
document: PRELOADED_CONTEXTS[url],
|
||||
documentUrl: url,
|
||||
};
|
||||
}
|
||||
|
@ -125,7 +133,7 @@ class LdSignature {
|
|||
}
|
||||
|
||||
@bindThis
|
||||
private async fetchDocument(url: string): Promise<JsonLd> {
|
||||
private async fetchDocument(url: string): Promise<JsonLdObject> {
|
||||
const json = await this.httpRequestService.send(
|
||||
url,
|
||||
{
|
||||
|
@ -146,7 +154,7 @@ class LdSignature {
|
|||
}
|
||||
});
|
||||
|
||||
return json as JsonLd;
|
||||
return json as JsonLdObject;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
@ -158,14 +166,14 @@ class LdSignature {
|
|||
}
|
||||
|
||||
@Injectable()
|
||||
export class LdSignatureService {
|
||||
export class JsonLdService {
|
||||
constructor(
|
||||
private httpRequestService: HttpRequestService,
|
||||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public use(): LdSignature {
|
||||
return new LdSignature(this.httpRequestService);
|
||||
public use(): JsonLd {
|
||||
return new JsonLd(this.httpRequestService);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { JsonLd } from 'jsonld/jsonld-spec.js';
|
||||
import type { Context, JsonLd } from 'jsonld/jsonld-spec.js';
|
||||
|
||||
/* eslint:disable:quotemark indent */
|
||||
const id_v1 = {
|
||||
|
@ -526,7 +526,42 @@ const activitystreams = {
|
|||
},
|
||||
} satisfies JsonLd;
|
||||
|
||||
export const CONTEXTS: Record<string, JsonLd> = {
|
||||
const context_iris = [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v1',
|
||||
];
|
||||
|
||||
const extension_context_definition = {
|
||||
Key: 'sec:Key',
|
||||
// as non-standards
|
||||
manuallyApprovesFollowers: 'as:manuallyApprovesFollowers',
|
||||
sensitive: 'as:sensitive',
|
||||
Hashtag: 'as:Hashtag',
|
||||
quoteUrl: 'as:quoteUrl',
|
||||
// Mastodon
|
||||
toot: 'http://joinmastodon.org/ns#',
|
||||
Emoji: 'toot:Emoji',
|
||||
featured: 'toot:featured',
|
||||
discoverable: 'toot:discoverable',
|
||||
// schema
|
||||
schema: 'http://schema.org#',
|
||||
PropertyValue: 'schema:PropertyValue',
|
||||
value: 'schema:value',
|
||||
// Misskey
|
||||
misskey: 'https://misskey-hub.net/ns#',
|
||||
'_misskey_content': 'misskey:_misskey_content',
|
||||
'_misskey_quote': 'misskey:_misskey_quote',
|
||||
'_misskey_reaction': 'misskey:_misskey_reaction',
|
||||
'_misskey_votes': 'misskey:_misskey_votes',
|
||||
'_misskey_summary': 'misskey:_misskey_summary',
|
||||
'isCat': 'misskey:isCat',
|
||||
// vcard
|
||||
vcard: 'http://www.w3.org/2006/vcard/ns#',
|
||||
} satisfies Context;
|
||||
|
||||
export const CONTEXT: (string | Context)[] = [...context_iris, extension_context_definition];
|
||||
|
||||
export const PRELOADED_CONTEXTS: Record<string, JsonLd> = {
|
||||
'https://w3id.org/identity/v1': id_v1,
|
||||
'https://w3id.org/security/v1': security_v1,
|
||||
'https://www.w3.org/ns/activitystreams': activitystreams,
|
||||
|
|
|
@ -211,7 +211,7 @@ export class ApNoteService {
|
|||
const files: MiDriveFile[] = [];
|
||||
|
||||
for (const attach of toArray(note.attachment)) {
|
||||
attach.sensitive ||= note.sensitive; // Noteがsensitiveなら添付もsensitiveにする
|
||||
attach.sensitive ??= note.sensitive;
|
||||
const file = await this.apImageService.resolveImage(actor, attach);
|
||||
if (file) files.push(file);
|
||||
}
|
||||
|
|
|
@ -15,13 +15,14 @@ import InstanceChart from '@/core/chart/charts/instance.js';
|
|||
import ApRequestChart from '@/core/chart/charts/ap-request.js';
|
||||
import FederationChart from '@/core/chart/charts/federation.js';
|
||||
import { getApId } from '@/core/activitypub/type.js';
|
||||
import type { IActivity } from '@/core/activitypub/type.js';
|
||||
import type { MiRemoteUser } from '@/models/User.js';
|
||||
import type { MiUserPublickey } from '@/models/UserPublickey.js';
|
||||
import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
|
||||
import { StatusError } from '@/misc/status-error.js';
|
||||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
||||
import { LdSignatureService } from '@/core/activitypub/LdSignatureService.js';
|
||||
import { JsonLdService } from '@/core/activitypub/JsonLdService.js';
|
||||
import { ApInboxService } from '@/core/activitypub/ApInboxService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
|
@ -38,7 +39,7 @@ export class InboxProcessorService {
|
|||
private apInboxService: ApInboxService,
|
||||
private federatedInstanceService: FederatedInstanceService,
|
||||
private fetchInstanceMetadataService: FetchInstanceMetadataService,
|
||||
private ldSignatureService: LdSignatureService,
|
||||
private jsonLdService: JsonLdService,
|
||||
private apPersonService: ApPersonService,
|
||||
private apDbResolverService: ApDbResolverService,
|
||||
private instanceChart: InstanceChart,
|
||||
|
@ -52,7 +53,7 @@ export class InboxProcessorService {
|
|||
@bindThis
|
||||
public async process(job: Bull.Job<InboxJobData>): Promise<string> {
|
||||
const signature = job.data.signature; // HTTP-signature
|
||||
const activity = job.data.activity;
|
||||
let activity = job.data.activity;
|
||||
|
||||
//#region Log
|
||||
const info = Object.assign({}, activity);
|
||||
|
@ -110,20 +111,21 @@ export class InboxProcessorService {
|
|||
// また、signatureのsignerは、activity.actorと一致する必要がある
|
||||
if (!httpSignatureValidated || authUser.user.uri !== activity.actor) {
|
||||
// 一致しなくても、でもLD-Signatureがありそうならそっちも見る
|
||||
if (activity.signature) {
|
||||
if (activity.signature.type !== 'RsaSignature2017') {
|
||||
throw new Bull.UnrecoverableError(`skip: unsupported LD-signature type ${activity.signature.type}`);
|
||||
const ldSignature = activity.signature;
|
||||
if (ldSignature) {
|
||||
if (ldSignature.type !== 'RsaSignature2017') {
|
||||
throw new Bull.UnrecoverableError(`skip: unsupported LD-signature type ${ldSignature.type}`);
|
||||
}
|
||||
|
||||
// activity.signature.creator: https://example.oom/users/user#main-key
|
||||
// ldSignature.creator: https://example.oom/users/user#main-key
|
||||
// みたいになっててUserを引っ張れば公開キーも入ることを期待する
|
||||
if (activity.signature.creator) {
|
||||
const candicate = activity.signature.creator.replace(/#.*/, '');
|
||||
if (ldSignature.creator) {
|
||||
const candicate = ldSignature.creator.replace(/#.*/, '');
|
||||
await this.apPersonService.resolvePerson(candicate).catch(() => null);
|
||||
}
|
||||
|
||||
// keyIdからLD-Signatureのユーザーを取得
|
||||
authUser = await this.apDbResolverService.getAuthUserFromKeyId(activity.signature.creator);
|
||||
authUser = await this.apDbResolverService.getAuthUserFromKeyId(ldSignature.creator);
|
||||
if (authUser == null) {
|
||||
throw new Bull.UnrecoverableError('skip: LD-Signatureのユーザーが取得できませんでした');
|
||||
}
|
||||
|
@ -132,13 +134,31 @@ export class InboxProcessorService {
|
|||
throw new Bull.UnrecoverableError('skip: LD-SignatureのユーザーはpublicKeyを持っていませんでした');
|
||||
}
|
||||
|
||||
const jsonLd = this.jsonLdService.use();
|
||||
|
||||
// LD-Signature検証
|
||||
const ldSignature = this.ldSignatureService.use();
|
||||
const verified = await ldSignature.verifyRsaSignature2017(activity, authUser.key.keyPem).catch(() => false);
|
||||
const verified = await jsonLd.verifyRsaSignature2017(activity, authUser.key.keyPem).catch(() => false);
|
||||
if (!verified) {
|
||||
throw new Bull.UnrecoverableError('skip: LD-Signatureの検証に失敗しました');
|
||||
}
|
||||
|
||||
// アクティビティを正規化
|
||||
delete activity.signature;
|
||||
try {
|
||||
activity = await jsonLd.compact(activity) as IActivity;
|
||||
} catch (e) {
|
||||
throw new Bull.UnrecoverableError(`skip: failed to compact activity: ${e}`);
|
||||
}
|
||||
// TODO: 元のアクティビティと非互換な形に正規化される場合は転送をスキップする
|
||||
// https://github.com/mastodon/mastodon/blob/664b0ca/app/services/activitypub/process_collection_service.rb#L24-L29
|
||||
activity.signature = ldSignature;
|
||||
|
||||
//#region Log
|
||||
const compactedInfo = Object.assign({}, activity);
|
||||
delete compactedInfo['@context'];
|
||||
this.logger.debug(`compacted: ${JSON.stringify(compactedInfo, null, 2)}`);
|
||||
//#endregion
|
||||
|
||||
// もう一度actorチェック
|
||||
if (authUser.user.uri !== activity.actor) {
|
||||
throw new Bull.UnrecoverableError(`skip: LD-Signature user(${authUser.user.uri}) !== activity.actor(${activity.actor})`);
|
||||
|
|
|
@ -13,6 +13,8 @@ import { ApImageService } from '@/core/activitypub/models/ApImageService.js';
|
|||
import { ApNoteService } from '@/core/activitypub/models/ApNoteService.js';
|
||||
import { ApPersonService } from '@/core/activitypub/models/ApPersonService.js';
|
||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||
import { JsonLdService } from '@/core/activitypub/JsonLdService.js';
|
||||
import { CONTEXT } from '@/core/activitypub/misc/contexts.js';
|
||||
import { GlobalModule } from '@/GlobalModule.js';
|
||||
import { CoreModule } from '@/core/CoreModule.js';
|
||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||
|
@ -88,6 +90,7 @@ describe('ActivityPub', () => {
|
|||
let noteService: ApNoteService;
|
||||
let personService: ApPersonService;
|
||||
let rendererService: ApRendererService;
|
||||
let jsonLdService: JsonLdService;
|
||||
let resolver: MockResolver;
|
||||
|
||||
const metaInitial = {
|
||||
|
@ -128,6 +131,7 @@ describe('ActivityPub', () => {
|
|||
personService = app.get<ApPersonService>(ApPersonService);
|
||||
rendererService = app.get<ApRendererService>(ApRendererService);
|
||||
imageService = app.get<ApImageService>(ApImageService);
|
||||
jsonLdService = app.get<JsonLdService>(JsonLdService);
|
||||
resolver = new MockResolver(await app.resolve<LoggerService>(LoggerService));
|
||||
|
||||
// Prevent ApPersonService from fetching instance, as it causes Jest import-after-test error
|
||||
|
@ -381,4 +385,42 @@ describe('ActivityPub', () => {
|
|||
assert.strictEqual(driveFile, null);
|
||||
});
|
||||
});
|
||||
|
||||
describe('JSON-LD', () =>{
|
||||
test('Compaction', async () => {
|
||||
const jsonLd = jsonLdService.use();
|
||||
|
||||
const object = {
|
||||
'@context': [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
{
|
||||
_misskey_quote: 'https://misskey-hub.net/ns#_misskey_quote',
|
||||
unknown: 'https://example.org/ns#unknown',
|
||||
undefined: null,
|
||||
},
|
||||
],
|
||||
id: 'https://example.com/notes/42',
|
||||
type: 'Note',
|
||||
attributedTo: 'https://example.com/users/1',
|
||||
to: ['https://www.w3.org/ns/activitystreams#Public'],
|
||||
content: 'test test foo',
|
||||
_misskey_quote: 'https://example.com/notes/1',
|
||||
unknown: 'test test bar',
|
||||
undefined: 'test test baz',
|
||||
};
|
||||
const compacted = await jsonLd.compact(object);
|
||||
|
||||
assert.deepStrictEqual(compacted, {
|
||||
'@context': CONTEXT,
|
||||
id: 'https://example.com/notes/42',
|
||||
type: 'Note',
|
||||
attributedTo: 'https://example.com/users/1',
|
||||
to: 'as:Public',
|
||||
content: 'test test foo',
|
||||
_misskey_quote: 'https://example.com/notes/1',
|
||||
'https://example.org/ns#unknown': 'test test bar',
|
||||
// undefined: 'test test baz',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,7 +27,7 @@ export function galleryPost(isSensitive = false) {
|
|||
id: 'somepostid',
|
||||
createdAt: '2016-12-28T22:49:51.000Z',
|
||||
updatedAt: '2016-12-28T22:49:51.000Z',
|
||||
userid: 'someuserid',
|
||||
userId: 'someuserid',
|
||||
user: userDetailed(),
|
||||
title: 'Some post title',
|
||||
description: 'Some post description',
|
||||
|
@ -75,9 +75,8 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi
|
|||
avatarUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true',
|
||||
avatarBlurhash: 'eQFRshof5NWBRi},juayfPju53WB?0ofs;s*a{ofjuay^SoMEJR%ay',
|
||||
avatarDecorations: [],
|
||||
emojis: [],
|
||||
emojis: {},
|
||||
bannerBlurhash: 'eQA^IW^-MH8w9tE8I=S^o{$*R4RikXtSxutRozjEnNR.RQadoyozog',
|
||||
bannerColor: '#000000',
|
||||
bannerUrl: 'https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true',
|
||||
birthday: '2014-06-20',
|
||||
createdAt: '2016-12-28T22:49:51.000Z',
|
||||
|
@ -118,11 +117,16 @@ export function userDetailed(id = 'someuserid', username = 'miskist', host = 'mi
|
|||
publicReactions: false,
|
||||
securityKeys: false,
|
||||
twoFactorEnabled: false,
|
||||
usePasswordLessLogin: false,
|
||||
twoFactorBackupCodesStock: 'none',
|
||||
updatedAt: null,
|
||||
lastFetchedAt: null,
|
||||
uri: null,
|
||||
url: null,
|
||||
movedTo: null,
|
||||
alsoKnownAs: null,
|
||||
notify: 'none',
|
||||
memo: null
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -82,23 +82,16 @@ function h<T extends estree.Node>(
|
|||
return Object.assign(props || {}, { type }) as T;
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace JSX {
|
||||
type Element = estree.Node;
|
||||
type ElementClass = never;
|
||||
type ElementAttributesProperty = never;
|
||||
type ElementChildrenAttribute = never;
|
||||
type IntrinsicAttributes = never;
|
||||
type IntrinsicClassAttributes<T> = never;
|
||||
type IntrinsicElements = {
|
||||
[T in keyof typeof generator as ToKebab<SplitCamel<Uncapitalize<T>>>]: {
|
||||
[K in keyof Omit<
|
||||
Parameters<(typeof generator)[T]>[0],
|
||||
'type'
|
||||
>]?: Parameters<(typeof generator)[T]>[0][K];
|
||||
};
|
||||
declare namespace h.JSX {
|
||||
type Element = estree.Node;
|
||||
type IntrinsicElements = {
|
||||
[T in keyof typeof generator as ToKebab<SplitCamel<Uncapitalize<T>>>]: {
|
||||
[K in keyof Omit<
|
||||
Parameters<(typeof generator)[T]>[0],
|
||||
'type'
|
||||
>]?: Parameters<(typeof generator)[T]>[0][K];
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function toStories(component: string): Promise<string> {
|
||||
|
@ -388,6 +381,7 @@ function toStories(component: string): Promise<string> {
|
|||
'/* eslint-disable @typescript-eslint/explicit-function-return-type */\n' +
|
||||
'/* eslint-disable import/no-default-export */\n' +
|
||||
'/* eslint-disable import/no-duplicates */\n' +
|
||||
'/* eslint-disable import/order */\n' +
|
||||
generate(program, { generator }) +
|
||||
(hasImplStories ? readFileSync(`${implStories}.ts`, 'utf-8') : ''),
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ const config = {
|
|||
disableTelemetry: true,
|
||||
},
|
||||
async viteFinal(config) {
|
||||
const replacePluginForIsChromatic = config.plugins?.findIndex((plugin) => plugin && (plugin as Partial<Plugin>)?.name === 'replace') ?? -1;
|
||||
const replacePluginForIsChromatic = config.plugins?.findIndex((plugin: Plugin) => plugin && plugin.name === 'replace') ?? -1;
|
||||
if (~replacePluginForIsChromatic) {
|
||||
config.plugins?.splice(replacePluginForIsChromatic, 1);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
import { type SharedOptions, http, HttpResponse } from 'msw';
|
||||
|
||||
export const onUnhandledRequest = ((req, print) => {
|
||||
if (req.url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|src\/|sb-|static-assets\/|vite\/)/.test(req.url.pathname)) {
|
||||
const url = new URL(req.url);
|
||||
if (url.hostname !== 'localhost' || /^\/(?:client-assets\/|fluent-emojis?\/|iframe.html$|node_modules\/|src\/|sb-|static-assets\/|vite\/)/.test(url.pathname)) {
|
||||
return
|
||||
}
|
||||
print.warning()
|
||||
|
|
|
@ -78,24 +78,24 @@
|
|||
"devDependencies": {
|
||||
"@misskey-dev/eslint-plugin": "1.0.0",
|
||||
"@misskey-dev/summaly": "5.0.3",
|
||||
"@storybook/addon-actions": "8.0.0-beta.6",
|
||||
"@storybook/addon-essentials": "8.0.0-beta.6",
|
||||
"@storybook/addon-interactions": "8.0.0-beta.6",
|
||||
"@storybook/addon-links": "8.0.0-beta.6",
|
||||
"@storybook/addon-mdx-gfm": "8.0.0-beta.6",
|
||||
"@storybook/addon-storysource": "8.0.0-beta.6",
|
||||
"@storybook/blocks": "8.0.0-beta.6",
|
||||
"@storybook/components": "8.0.0-beta.6",
|
||||
"@storybook/core-events": "8.0.0-beta.6",
|
||||
"@storybook/manager-api": "8.0.0-beta.6",
|
||||
"@storybook/preview-api": "8.0.0-beta.6",
|
||||
"@storybook/react": "8.0.0-beta.6",
|
||||
"@storybook/react-vite": "8.0.0-beta.6",
|
||||
"@storybook/test": "8.0.0-beta.6",
|
||||
"@storybook/theming": "8.0.0-beta.6",
|
||||
"@storybook/types": "8.0.0-beta.6",
|
||||
"@storybook/vue3": "8.0.0-beta.6",
|
||||
"@storybook/vue3-vite": "8.0.0-beta.6",
|
||||
"@storybook/addon-actions": "8.0.9",
|
||||
"@storybook/addon-essentials": "8.0.9",
|
||||
"@storybook/addon-interactions": "8.0.9",
|
||||
"@storybook/addon-links": "8.0.9",
|
||||
"@storybook/addon-mdx-gfm": "8.0.9",
|
||||
"@storybook/addon-storysource": "8.0.9",
|
||||
"@storybook/blocks": "8.0.9",
|
||||
"@storybook/components": "8.0.9",
|
||||
"@storybook/core-events": "8.0.9",
|
||||
"@storybook/manager-api": "8.0.9",
|
||||
"@storybook/preview-api": "8.0.9",
|
||||
"@storybook/react": "8.0.9",
|
||||
"@storybook/react-vite": "8.0.9",
|
||||
"@storybook/test": "8.0.9",
|
||||
"@storybook/theming": "8.0.9",
|
||||
"@storybook/types": "8.0.9",
|
||||
"@storybook/vue3": "8.0.9",
|
||||
"@storybook/vue3-vite": "8.0.9",
|
||||
"@testing-library/vue": "8.0.2",
|
||||
"@types/escape-regexp": "0.0.3",
|
||||
"@types/estree": "1.0.5",
|
||||
|
@ -129,7 +129,7 @@
|
|||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"start-server-and-test": "2.0.3",
|
||||
"storybook": "8.0.0-beta.6",
|
||||
"storybook": "8.0.9",
|
||||
"storybook-addon-misskey-theme": "github:misskey-dev/storybook-addon-misskey-theme",
|
||||
"vite-plugin-turbosnap": "1.0.3",
|
||||
"vitest": "0.34.6",
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { StoryObj } from '@storybook/vue3';
|
||||
import { HttpResponse, http } from 'msw';
|
||||
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||
import { userDetailed } from '../../.storybook/fakes.js';
|
||||
import MkAccountMoved from './MkAccountMoved.vue';
|
||||
export const Default = {
|
||||
|
@ -29,10 +32,18 @@ export const Default = {
|
|||
};
|
||||
},
|
||||
args: {
|
||||
username: userDetailed().username,
|
||||
host: userDetailed().host,
|
||||
movedTo: userDetailed().id,
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
msw: {
|
||||
handlers: [
|
||||
...commonHandlers,
|
||||
http.post('/api/users/show', async ({ request }) => {
|
||||
action('POST /api/users/show')(await request.json());
|
||||
return HttpResponse.json(userDetailed());
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
} satisfies StoryObj<typeof MkAccountMoved>;
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import { action } from '@storybook/addon-actions';
|
||||
import { StoryObj } from '@storybook/vue3';
|
||||
import { HttpResponse, http } from 'msw';
|
||||
import { commonHandlers } from '../../.storybook/mocks.js';
|
||||
import MkAnnouncementDialog from './MkAnnouncementDialog.vue';
|
||||
export const Default = {
|
||||
render(args) {
|
||||
|
@ -23,8 +26,13 @@ export const Default = {
|
|||
...this.args,
|
||||
};
|
||||
},
|
||||
events() {
|
||||
return {
|
||||
closed: action('closed'),
|
||||
};
|
||||
},
|
||||
},
|
||||
template: '<MkAnnouncementDialog v-bind="props" />',
|
||||
template: '<MkAnnouncementDialog v-bind="props" v-on="events" />',
|
||||
};
|
||||
},
|
||||
args: {
|
||||
|
@ -38,10 +46,20 @@ export const Default = {
|
|||
imageUrl: null,
|
||||
display: 'dialog',
|
||||
needConfirmationToRead: false,
|
||||
silence: false,
|
||||
forYou: true,
|
||||
},
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
msw: {
|
||||
handlers: [
|
||||
...commonHandlers,
|
||||
http.post('/api/i/read-announcement', async ({ request }) => {
|
||||
action('POST /api/i/read-announcement')(await request.json());
|
||||
return HttpResponse.json();
|
||||
}),
|
||||
],
|
||||
},
|
||||
},
|
||||
} satisfies StoryObj<typeof MkAnnouncementDialog>;
|
||||
|
|
|
@ -4,19 +4,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div v-if="meta" :class="$style.root" :style="{ backgroundImage: `url(${ meta.backgroundImageUrl })` }"></div>
|
||||
<div v-if="instance" :class="$style.root" :style="{ backgroundImage: `url(${ instance.backgroundImageUrl })` }"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
|
||||
const meta = ref<Misskey.entities.MetaResponse>();
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(gotMeta => {
|
||||
meta.value = gotMeta;
|
||||
});
|
||||
import { instance } from '@/instance.js';
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
@ -156,6 +156,7 @@ const props = withDefaults(defineProps<{
|
|||
initialVisibleUsers: () => [],
|
||||
autofocus: true,
|
||||
mock: false,
|
||||
initialLocalOnly: undefined,
|
||||
});
|
||||
|
||||
provide('mock', props.mock);
|
||||
|
@ -185,8 +186,8 @@ watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
|
|||
const showAddMfmFunction = ref(defaultStore.state.enableQuickAddMfmFunction);
|
||||
watch(showAddMfmFunction, () => defaultStore.set('enableQuickAddMfmFunction', showAddMfmFunction.value));
|
||||
const cw = ref<string | null>(props.initialCw ?? null);
|
||||
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
|
||||
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]);
|
||||
const localOnly = ref(props.initialLocalOnly ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly));
|
||||
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility));
|
||||
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
|
||||
if (props.initialVisibleUsers) {
|
||||
props.initialVisibleUsers.forEach(pushVisibleUser);
|
||||
|
@ -518,6 +519,9 @@ async function toggleLocalOnly() {
|
|||
}
|
||||
|
||||
localOnly.value = !localOnly.value;
|
||||
if (defaultStore.state.rememberNoteVisibility) {
|
||||
defaultStore.set('localOnly', localOnly.value);
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleReactionAcceptance() {
|
||||
|
|
|
@ -15,7 +15,7 @@ import * as Misskey from 'misskey-js';
|
|||
import MkModal from '@/components/MkModal.vue';
|
||||
import MkPostForm from '@/components/MkPostForm.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
reply?: Misskey.entities.Note;
|
||||
renote?: Misskey.entities.Note;
|
||||
channel?: any; // TODO
|
||||
|
@ -31,7 +31,9 @@ const props = defineProps<{
|
|||
instant?: boolean;
|
||||
fixed?: boolean;
|
||||
autofocus?: boolean;
|
||||
}>();
|
||||
}>(), {
|
||||
initialLocalOnly: undefined,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'closed'): void;
|
||||
|
|
|
@ -51,13 +51,16 @@ export const Empty = {
|
|||
expect(buttons.at(-1)).toBeEnabled();
|
||||
},
|
||||
args: {
|
||||
// @ts-expect-error serverRules is for test
|
||||
serverRules: [],
|
||||
tosUrl: null,
|
||||
},
|
||||
decorators: [
|
||||
(_, context) => ({
|
||||
setup() {
|
||||
// @ts-expect-error serverRules is for test
|
||||
instance.serverRules = context.args.serverRules;
|
||||
// @ts-expect-error tosUrl is for test
|
||||
instance.tosUrl = context.args.tosUrl;
|
||||
onBeforeUnmount(() => {
|
||||
// FIXME: 呼び出されない
|
||||
|
@ -76,6 +79,7 @@ export const ServerRulesOnly = {
|
|||
...Empty,
|
||||
args: {
|
||||
...Empty.args,
|
||||
// @ts-expect-error serverRules is for test
|
||||
serverRules: [
|
||||
'ルール',
|
||||
],
|
||||
|
@ -85,6 +89,7 @@ export const TOSOnly = {
|
|||
...Empty,
|
||||
args: {
|
||||
...Empty.args,
|
||||
// @ts-expect-error tosUrl is for test
|
||||
tosUrl: 'https://example.com/tos',
|
||||
},
|
||||
} satisfies StoryObj<typeof MkSignupServerRules>;
|
||||
|
@ -92,6 +97,7 @@ export const ServerRulesAndTOS = {
|
|||
...Empty,
|
||||
args: {
|
||||
...Empty.args,
|
||||
// @ts-expect-error serverRules is for test
|
||||
serverRules: ServerRulesOnly.args.serverRules,
|
||||
tosUrl: TOSOnly.args.tosUrl,
|
||||
},
|
||||
|
|
|
@ -4,19 +4,19 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div v-if="meta" :class="$style.root">
|
||||
<div v-if="instance" :class="$style.root">
|
||||
<div :class="[$style.main, $style.panel]">
|
||||
<img :src="instance.iconUrl || '/favicon.ico'" alt="" :class="$style.mainIcon"/>
|
||||
<button class="_button _acrylic" :class="$style.mainMenu" @click="showMenu"><i class="ti ti-dots"></i></button>
|
||||
<div :class="$style.mainFg">
|
||||
<h1 :class="$style.mainTitle">
|
||||
<!-- 背景色によってはロゴが見えなくなるのでとりあえず無効に -->
|
||||
<!-- <img class="logo" v-if="meta.logoImageUrl" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
|
||||
<!-- <img class="logo" v-if="instance.logoImageUrl" :src="instance.logoImageUrl"><span v-else class="text">{{ instanceName }}</span> -->
|
||||
<span>{{ instanceName }}</span>
|
||||
</h1>
|
||||
<div :class="$style.mainAbout">
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div v-html="meta.description || i18n.ts.headlineMisskey"></div>
|
||||
<div v-html="instance.description || i18n.ts.headlineMisskey"></div>
|
||||
</div>
|
||||
<div v-if="instance.disableRegistration" :class="$style.mainWarn">
|
||||
<MkInfo warn>{{ i18n.ts.invitationRequiredToRegister }}</MkInfo>
|
||||
|
@ -65,14 +65,10 @@ import { i18n } from '@/i18n.js';
|
|||
import { instance } from '@/instance.js';
|
||||
import MkNumber from '@/components/MkNumber.vue';
|
||||
import XActiveUsersChart from '@/components/MkVisitorDashboard.ActiveUsersChart.vue';
|
||||
import { openInstanceMenu } from '@/ui/_common_/common';
|
||||
|
||||
const meta = ref<Misskey.entities.MetaResponse | null>(null);
|
||||
const stats = ref<Misskey.entities.StatsResponse | null>(null);
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(_meta => {
|
||||
meta.value = _meta;
|
||||
});
|
||||
|
||||
misskeyApi('stats', {}).then((res) => {
|
||||
stats.value = res;
|
||||
});
|
||||
|
@ -90,43 +86,7 @@ function signup() {
|
|||
}
|
||||
|
||||
function showMenu(ev) {
|
||||
os.popupMenu([{
|
||||
text: i18n.ts.instanceInfo,
|
||||
icon: 'ti ti-info-circle',
|
||||
action: () => {
|
||||
os.pageWindow('/about');
|
||||
},
|
||||
}, {
|
||||
text: i18n.ts.aboutMisskey,
|
||||
icon: 'ti ti-info-circle',
|
||||
action: () => {
|
||||
os.pageWindow('/about-misskey');
|
||||
},
|
||||
}, { type: 'divider' }, (instance.impressumUrl) ? {
|
||||
text: i18n.ts.impressum,
|
||||
icon: 'ti ti-file-invoice',
|
||||
action: () => {
|
||||
window.open(instance.impressumUrl!, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (instance.tosUrl) ? {
|
||||
text: i18n.ts.termsOfService,
|
||||
icon: 'ti ti-notebook',
|
||||
action: () => {
|
||||
window.open(instance.tosUrl!, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (instance.privacyPolicyUrl) ? {
|
||||
text: i18n.ts.privacyPolicy,
|
||||
icon: 'ti ti-shield-lock',
|
||||
action: () => {
|
||||
window.open(instance.privacyPolicyUrl!, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : { type: 'divider' }, {
|
||||
text: i18n.ts.help,
|
||||
icon: 'ti ti-help-circle',
|
||||
action: () => {
|
||||
window.open('https://misskey-hub.net/docs/for-users/', '_blank', 'noopener');
|
||||
},
|
||||
}], ev.currentTarget ?? ev.target);
|
||||
openInstanceMenu(ev);
|
||||
}
|
||||
|
||||
function exploreOtherServers() {
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
import { expect, userEvent, waitFor, within } from '@storybook/test';
|
||||
import { StoryObj } from '@storybook/vue3';
|
||||
import MkAd from './MkAd.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
let lock: Promise<undefined> | undefined;
|
||||
|
||||
|
@ -30,7 +32,6 @@ const common = {
|
|||
template: '<MkAd v-bind="props" />',
|
||||
};
|
||||
},
|
||||
/* FIXME: disabled because it still didn’t pass after applying #11267
|
||||
async play({ canvasElement, args }) {
|
||||
if (lock) {
|
||||
console.warn('This test is unexpectedly running twice in parallel, fix it!');
|
||||
|
@ -44,7 +45,7 @@ const common = {
|
|||
try {
|
||||
const canvas = within(canvasElement);
|
||||
const a = canvas.getByRole<HTMLAnchorElement>('link');
|
||||
await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
||||
// await expect(a.href).toMatch(/^https?:\/\/.*#test$/);
|
||||
const img = within(a).getByRole('img');
|
||||
await expect(img).toBeInTheDocument();
|
||||
let buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||
|
@ -52,13 +53,14 @@ const common = {
|
|||
const i = buttons[0];
|
||||
await expect(i).toBeInTheDocument();
|
||||
await userEvent.click(i);
|
||||
await waitFor(() => expect(canvasElement).toHaveTextContent(i18n.ts._ad.back));
|
||||
// await expect(canvasElement).toHaveTextContent(i18n.ts._ad.back);
|
||||
await expect(a).not.toBeInTheDocument();
|
||||
await expect(i).not.toBeInTheDocument();
|
||||
buttons = canvas.getAllByRole<HTMLButtonElement>('button');
|
||||
await expect(buttons).toHaveLength(args.__hasReduce ? 2 : 1);
|
||||
const reduce = args.__hasReduce ? buttons[0] : null;
|
||||
const back = buttons[args.__hasReduce ? 1 : 0];
|
||||
const hasReduceFrequency = args.specify?.ratio !== 0;
|
||||
await expect(buttons).toHaveLength(hasReduceFrequency ? 2 : 1);
|
||||
const reduce = hasReduceFrequency ? buttons[0] : null;
|
||||
const back = buttons[hasReduceFrequency ? 1 : 0];
|
||||
if (reduce) {
|
||||
await expect(reduce).toBeInTheDocument();
|
||||
await expect(reduce).toHaveTextContent(i18n.ts._ad.reduceFrequencyOfThisAd);
|
||||
|
@ -80,15 +82,16 @@ const common = {
|
|||
lock = undefined;
|
||||
}
|
||||
},
|
||||
*/
|
||||
args: {
|
||||
prefer: [],
|
||||
specify: {
|
||||
id: 'someadid',
|
||||
radio: 1,
|
||||
ratio: 1,
|
||||
url: '#test',
|
||||
place: '',
|
||||
imageUrl: '',
|
||||
dayOfWeek: 7,
|
||||
},
|
||||
__hasReduce: true,
|
||||
},
|
||||
parameters: {
|
||||
layout: 'centered',
|
||||
|
@ -138,6 +141,5 @@ export const ZeroRatio = {
|
|||
...Square.args.specify,
|
||||
ratio: 0,
|
||||
},
|
||||
__hasReduce: false,
|
||||
},
|
||||
} satisfies StoryObj<typeof MkAd>;
|
||||
|
|
|
@ -33,7 +33,7 @@ const common = {
|
|||
},
|
||||
decorators: [
|
||||
(Story, context) => ({
|
||||
// eslint-disable-next-line quotes
|
||||
// @ts-expect-error size is for test
|
||||
template: `<div :style="{ display: 'grid', width: '${context.args.size}px', height: '${context.args.size}px' }"><story/></div>`,
|
||||
}),
|
||||
],
|
||||
|
@ -45,6 +45,7 @@ export const ProfilePage = {
|
|||
...common,
|
||||
args: {
|
||||
...common.args,
|
||||
// @ts-expect-error size is for test
|
||||
size: 120,
|
||||
indicator: true,
|
||||
},
|
||||
|
|
|
@ -28,6 +28,7 @@ export const Default = {
|
|||
};
|
||||
},
|
||||
args: {
|
||||
// @ts-expect-error text is for test
|
||||
text: 'This is a condensed line.',
|
||||
},
|
||||
parameters: {
|
||||
|
@ -41,4 +42,5 @@ export const ContainerIs100px = {
|
|||
template: '<div style="width: 100px;"><story/></div>',
|
||||
}),
|
||||
],
|
||||
// @ts-expect-error text is for test
|
||||
} satisfies StoryObj<typeof MkCondensedLine>;
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Meta } from '@storybook/vue3';
|
||||
import MkError from './MkError.vue';
|
||||
|
||||
export const argTypes = {
|
||||
retry: {
|
||||
onRetry: {
|
||||
action: 'retry',
|
||||
},
|
||||
};
|
||||
} satisfies Meta<typeof MkError>['argTypes'];
|
||||
|
|
|
@ -33,7 +33,6 @@ export const Empty = {
|
|||
await waitFor(async () => await wait);
|
||||
},
|
||||
args: {
|
||||
static: true,
|
||||
tabs: [],
|
||||
},
|
||||
parameters: {
|
||||
|
@ -71,8 +70,8 @@ export const IconOnly = {
|
|||
...Icon.args,
|
||||
tabs: [
|
||||
{
|
||||
...Icon.args.tabs[0],
|
||||
title: undefined,
|
||||
key: Icon.args.tabs[0].key,
|
||||
icon: Icon.args.tabs[0].icon,
|
||||
iconOnly: true,
|
||||
},
|
||||
],
|
||||
|
|
|
@ -38,7 +38,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts">
|
||||
export type Tab = {
|
||||
key: string;
|
||||
title: string;
|
||||
onClick?: (ev: MouseEvent) => void;
|
||||
} & (
|
||||
| {
|
||||
|
|
|
@ -60,7 +60,7 @@ export const RelativeFuture = {
|
|||
export const AbsoluteFuture = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -97,7 +97,7 @@ export const RelativeNow = {
|
|||
export const AbsoluteNow = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -136,7 +136,7 @@ export const RelativeOneHourAgo = {
|
|||
export const AbsoluteOneHourAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -175,7 +175,7 @@ export const RelativeOneDayAgo = {
|
|||
export const AbsoluteOneDayAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -214,7 +214,7 @@ export const RelativeOneWeekAgo = {
|
|||
export const AbsoluteOneWeekAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -253,7 +253,7 @@ export const RelativeOneMonthAgo = {
|
|||
export const AbsoluteOneMonthAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
@ -292,7 +292,7 @@ export const RelativeOneYearAgo = {
|
|||
export const AbsoluteOneYearAgo = {
|
||||
...Empty,
|
||||
async play({ canvasElement, args }) {
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(args.time));
|
||||
await expect(canvasElement).toHaveTextContent(dateTimeFormat.format(typeof args.time === 'string' ? new Date(args.time) : args.time ?? undefined));
|
||||
},
|
||||
args: {
|
||||
...Empty.args,
|
||||
|
|
|
@ -30,7 +30,7 @@ export const Default = {
|
|||
};
|
||||
},
|
||||
async play({ canvasElement }) {
|
||||
await expect(canvasElement).toHaveTextContent(userDetailed().name);
|
||||
await expect(canvasElement).toHaveTextContent(userDetailed().name as string);
|
||||
},
|
||||
args: {
|
||||
user: userDetailed(),
|
||||
|
|
|
@ -28,7 +28,7 @@ if (providedAt > cachedAt) {
|
|||
|
||||
// TODO: instanceをリアクティブにするかは再考の余地あり
|
||||
|
||||
export const instance: Misskey.entities.MetaResponse = reactive(cachedMeta ?? {});
|
||||
export const instance: Misskey.entities.MetaDetailed = reactive(cachedMeta ?? {});
|
||||
|
||||
export const serverErrorImageUrl = computed(() => instance.serverErrorImageUrl ?? DEFAULT_SERVER_ERROR_IMAGE_URL);
|
||||
|
||||
|
@ -38,17 +38,17 @@ export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFA
|
|||
|
||||
export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true);
|
||||
|
||||
export async function fetchInstance(force = false): Promise<void> {
|
||||
export async function fetchInstance(force = false): Promise<Misskey.entities.MetaDetailed> {
|
||||
if (!force) {
|
||||
const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0;
|
||||
|
||||
if (Date.now() - cachedAt < 1000 * 60 * 60) {
|
||||
return;
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
const meta = await misskeyApi('meta', {
|
||||
detail: false,
|
||||
detail: true,
|
||||
});
|
||||
|
||||
for (const [k, v] of Object.entries(meta)) {
|
||||
|
@ -57,4 +57,6 @@ export async function fetchInstance(force = false): Promise<void> {
|
|||
|
||||
miLocalStorage.setItem('instance', JSON.stringify(instance));
|
||||
miLocalStorage.setItem('instanceCachedAt', Date.now().toString());
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
|
24
packages/frontend/src/pages/contact.vue
Normal file
24
packages/frontend/src/pages/contact.vue
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<MkStickyContainer>
|
||||
<template #header><MkPageHeader/></template>
|
||||
<MkSpacer :contentMax="600" :marginMin="20">
|
||||
<div>{{ instance.maintainerEmail }}</div>
|
||||
</MkSpacer>
|
||||
</MkStickyContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import { instance } from '@/instance.js';
|
||||
|
||||
definePageMetadata(() => ({
|
||||
title: i18n.ts.inquiry,
|
||||
icon: 'ti ti-help-circle',
|
||||
}));
|
||||
</script>
|
|
@ -42,11 +42,11 @@ import XTimeline from './welcome.timeline.vue';
|
|||
import MarqueeText from '@/components/MkMarquee.vue';
|
||||
import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue';
|
||||
import misskeysvg from '/client-assets/misskey.svg';
|
||||
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
import { misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue';
|
||||
import { getProxiedImageUrl } from '@/scripts/media-proxy.js';
|
||||
import { instance as meta } from '@/instance.js';
|
||||
|
||||
const meta = ref<Misskey.entities.MetaResponse>();
|
||||
const instances = ref<Misskey.entities.FederationInstance[]>();
|
||||
|
||||
function getInstanceIcon(instance: Misskey.entities.FederationInstance): string {
|
||||
|
@ -56,10 +56,6 @@ function getInstanceIcon(instance: Misskey.entities.FederationInstance): string
|
|||
return getProxiedImageUrl(instance.iconUrl, 'preview');
|
||||
}
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(_meta => {
|
||||
meta.value = _meta;
|
||||
});
|
||||
|
||||
misskeyApiGet('federation/instances', {
|
||||
sort: '+pubSub',
|
||||
limit: 20,
|
||||
|
|
|
@ -4,8 +4,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div v-if="meta">
|
||||
<XSetup v-if="meta.requireSetup"/>
|
||||
<div v-if="instance">
|
||||
<XSetup v-if="instance.requireSetup"/>
|
||||
<XEntrance v-else/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -16,13 +16,13 @@ import * as Misskey from 'misskey-js';
|
|||
import XSetup from './welcome.setup.vue';
|
||||
import XEntrance from './welcome.entrance.a.vue';
|
||||
import { instanceName } from '@/config.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import { fetchInstance } from '@/instance.js';
|
||||
|
||||
const meta = ref<Misskey.entities.MetaResponse | null>(null);
|
||||
const instance = ref<Misskey.entities.MetaDetailed | null>(null);
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(res => {
|
||||
meta.value = res;
|
||||
fetchInstance(true).then((res) => {
|
||||
instance.value = res;
|
||||
});
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
|
|
@ -197,6 +197,9 @@ const routes: RouteDef[] = [{
|
|||
path: '/about',
|
||||
component: page(() => import('@/pages/about.vue')),
|
||||
hash: 'initialTab',
|
||||
}, {
|
||||
path: '/contact',
|
||||
component: page(() => import('@/pages/contact.vue')),
|
||||
}, {
|
||||
path: '/about-misskey',
|
||||
component: page(() => import('@/pages/about-misskey.vue')),
|
||||
|
|
|
@ -504,10 +504,9 @@ export function getNoteMenu(props: {
|
|||
};
|
||||
}
|
||||
|
||||
type Visibility = 'public' | 'home' | 'followers' | 'specified';
|
||||
type Visibility = (typeof Misskey.noteVisibilities)[number];
|
||||
|
||||
// defaultStore.state.visibilityがstringなためstringも受け付けている
|
||||
function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility {
|
||||
function smallerVisibility(a: Visibility, b: Visibility): Visibility {
|
||||
if (a === 'specified' || b === 'specified') return 'specified';
|
||||
if (a === 'followers' || b === 'followers') return 'followers';
|
||||
if (a === 'home' || b === 'home') return 'home';
|
||||
|
|
|
@ -94,7 +94,7 @@ export const defaultStore = markRaw(new Storage('base', {
|
|||
},
|
||||
defaultNoteVisibility: {
|
||||
where: 'account',
|
||||
default: 'public',
|
||||
default: 'public' as (typeof Misskey.noteVisibilities)[number],
|
||||
},
|
||||
defaultNoteLocalOnly: {
|
||||
where: 'account',
|
||||
|
@ -150,7 +150,7 @@ export const defaultStore = markRaw(new Storage('base', {
|
|||
},
|
||||
visibility: {
|
||||
where: 'deviceAccount',
|
||||
default: 'public' as 'public' | 'home' | 'followers' | 'specified',
|
||||
default: 'public' as (typeof Misskey.noteVisibilities)[number],
|
||||
},
|
||||
localOnly: {
|
||||
where: 'deviceAccount',
|
||||
|
|
|
@ -79,7 +79,12 @@ export function openInstanceMenu(ev: MouseEvent) {
|
|||
text: i18n.ts.tools,
|
||||
icon: 'ti ti-tool',
|
||||
children: toolsMenuItems(),
|
||||
}, { type: 'divider' }, (instance.impressumUrl) ? {
|
||||
}, { type: 'divider' }, {
|
||||
type: 'link',
|
||||
text: i18n.ts.inquiry,
|
||||
icon: 'ti ti-help-circle',
|
||||
to: '/contact',
|
||||
}, (instance.impressumUrl) ? {
|
||||
text: i18n.ts.impressum,
|
||||
icon: 'ti ti-file-invoice',
|
||||
action: () => {
|
||||
|
@ -98,8 +103,8 @@ export function openInstanceMenu(ev: MouseEvent) {
|
|||
window.open(instance.privacyPolicyUrl, '_blank', 'noopener');
|
||||
},
|
||||
} : undefined, (!instance.impressumUrl && !instance.tosUrl && !instance.privacyPolicyUrl) ? undefined : { type: 'divider' }, {
|
||||
text: i18n.ts.help,
|
||||
icon: 'ti ti-help-circle',
|
||||
text: i18n.ts.document,
|
||||
icon: 'ti ti-bulb',
|
||||
action: () => {
|
||||
window.open('https://misskey-hub.net/docs/for-users/', '_blank', 'noopener');
|
||||
},
|
||||
|
|
|
@ -70,11 +70,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, provide, ref, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import XCommon from './_common_/common.vue';
|
||||
import { instanceName } from '@/config.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import XSigninDialog from '@/components/MkSigninDialog.vue';
|
||||
import XSignupDialog from '@/components/MkSignupDialog.vue';
|
||||
|
@ -114,7 +112,6 @@ const isTimelineAvailable = ref(instance.policies?.ltlAvailable || instance.poli
|
|||
const showMenu = ref(false);
|
||||
const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
|
||||
const narrow = ref(window.innerWidth < 1280);
|
||||
const meta = ref<Misskey.entities.MetaResponse>();
|
||||
|
||||
const keymap = computed(() => {
|
||||
return {
|
||||
|
@ -128,10 +125,6 @@ const keymap = computed(() => {
|
|||
};
|
||||
});
|
||||
|
||||
misskeyApi('meta', { detail: true }).then(res => {
|
||||
meta.value = res;
|
||||
});
|
||||
|
||||
function signin() {
|
||||
os.popup(XSigninDialog, {
|
||||
autoSet: true,
|
||||
|
|
1508
pnpm-lock.yaml
1508
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue