Merge remote-tracking branch 'refs/remotes/misskey-original/develop' into develop
# Conflicts: # packages/frontend/src/components/MkAbuseReport.vue # packages/frontend/src/components/MkMention.vue # packages/frontend/src/components/global/MkMisskeyFlavoredMarkdown.ts
This commit is contained in:
commit
1a8d91355d
|
@ -35,6 +35,9 @@
|
|||
- Enhance: リプライにて引用がある場合テキストが空でもノートできるように
|
||||
- 引用したいノートのURLをコピーしリプライ投稿画面にペーストして添付することで達成できます
|
||||
- Enhance: フォローするかどうかの確認ダイアログを出せるように
|
||||
- Enhance: Playを手動でリロードできるように
|
||||
- Enhance: 通報のコメント内のリンクをクリックした際、ウィンドウで開くように
|
||||
- Chore: AiScriptを0.18.0にバージョンアップ
|
||||
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
|
||||
- Fix: 周年の実績が閏年を考慮しない問題を修正
|
||||
- Fix: ローカルURLのプレビューポップアップが左上に表示される
|
||||
|
@ -49,6 +52,10 @@
|
|||
- Fix: ノート詳細ページにおいてCW付き引用リノートのCWボタンのラベルに「引用」が含まれていない問題を修正
|
||||
- Fix: ダイアログの入力で字数制限に違反していてもEnterキーが押せてしまう問題を修正
|
||||
- Fix: ダイレクト投稿の宛先が保存されない問題を修正
|
||||
- Fix: Playのページを離れたときに、Playが正常に初期化されない問題を修正
|
||||
- Fix: ページのOGP URLが間違っているのを修正
|
||||
- Fix: リバーシの対局を正しく共有できないことがある問題を修正
|
||||
- Fix: 通知をグループ化している際に、人数が正常に表示されないことがある問題を修正
|
||||
|
||||
### Server
|
||||
- Enhance: エンドポイント`antennas/update`の必須項目を`antennaId`のみに
|
||||
|
@ -61,10 +68,12 @@
|
|||
- Fix: リプライのみの引用リノートと、CWのみの引用リノートが純粋なリノートとして誤って扱われてしまう問題を修正
|
||||
- Fix: 登録にメール認証が必須になっている場合、登録されているメールアドレスを削除できないように
|
||||
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/606)
|
||||
- Fix: Add Cache-Control to Bull Board
|
||||
- Fix: nginx経由で/files/にRangeリクエストされた場合に正しく応答できないのを修正
|
||||
- Fix: 一部のタイムラインのストリーミングでインスタンスミュートが効かない問題を修正
|
||||
- Fix: グローバルタイムラインで返信が表示されないことがある問題を修正
|
||||
- Fix: リノートをミュートしたユーザの投稿のリノートがミュートされる問題を修正
|
||||
- Fix: AP Link等は添付ファイル扱いしないようになど (#13754)
|
||||
|
||||
## 2024.3.1
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import type { Serialized } from '@/types.js';
|
|||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import { MiEmojiRequest } from '@/models/EmojiRequest.js';
|
||||
|
||||
const parseEmojiStrRegexp = /^(\w+)(?:@([\w.-]+))?$/;
|
||||
const parseEmojiStrRegexp = /^([-\w]+)(?:@([\w.-]+))?$/;
|
||||
|
||||
@Injectable()
|
||||
export class CustomEmojiService implements OnApplicationShutdown {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { URL } from 'node:url';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import * as parse5 from 'parse5';
|
||||
import { Window } from 'happy-dom';
|
||||
import { Window, XMLSerializer } from 'happy-dom';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { Config } from '@/config.js';
|
||||
import { intersperse } from '@/misc/prelude/array.js';
|
||||
|
@ -247,6 +247,8 @@ export class MfmService {
|
|||
|
||||
const doc = window.document;
|
||||
|
||||
const body = doc.createElement('p');
|
||||
|
||||
function appendChildren(children: mfm.MfmNode[], targetElement: any): void {
|
||||
if (children) {
|
||||
for (const child of children.map(x => (handlers as any)[x.type](x))) targetElement.appendChild(child);
|
||||
|
@ -457,8 +459,8 @@ export class MfmService {
|
|||
},
|
||||
};
|
||||
|
||||
appendChildren(nodes, doc.body);
|
||||
appendChildren(nodes, body);
|
||||
|
||||
return `<p>${doc.body.innerHTML}</p>`;
|
||||
return new XMLSerializer().serializeToString(body);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import { bindThis } from '@/decorators.js';
|
|||
import { checkHttps } from '@/misc/check-https.js';
|
||||
import { ApResolverService } from '../ApResolverService.js';
|
||||
import { ApLoggerService } from '../ApLoggerService.js';
|
||||
import type { IObject } from '../type.js';
|
||||
import { isDocument, type IObject } from '../type.js';
|
||||
|
||||
@Injectable()
|
||||
export class ApImageService {
|
||||
|
@ -39,7 +39,7 @@ export class ApImageService {
|
|||
* Imageを作成します。
|
||||
*/
|
||||
@bindThis
|
||||
public async createImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile> {
|
||||
public async createImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile | null> {
|
||||
// 投稿者が凍結されていたらスキップ
|
||||
if (actor.isSuspended) {
|
||||
throw new Error('actor has been suspended');
|
||||
|
@ -47,16 +47,18 @@ export class ApImageService {
|
|||
|
||||
const image = await this.apResolverService.createResolver().resolve(value);
|
||||
|
||||
if (!isDocument(image)) return null;
|
||||
|
||||
if (image.url == null) {
|
||||
throw new Error('invalid image: url not provided');
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof image.url !== 'string') {
|
||||
throw new Error('invalid image: unexpected type of url: ' + JSON.stringify(image.url, null, 2));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!checkHttps(image.url)) {
|
||||
throw new Error('invalid image: unexpected schema of url: ' + image.url);
|
||||
return null;
|
||||
}
|
||||
|
||||
this.logger.info(`Creating the Image: ${image.url}`);
|
||||
|
@ -86,12 +88,11 @@ export class ApImageService {
|
|||
/**
|
||||
* Imageを解決します。
|
||||
*
|
||||
* Misskeyに対象のImageが登録されていればそれを返し、そうでなければ
|
||||
* リモートサーバーからフェッチしてMisskeyに登録しそれを返します。
|
||||
* ImageをリモートサーバーからフェッチしてMisskeyに登録しそれを返します。
|
||||
*/
|
||||
@bindThis
|
||||
public async resolveImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile> {
|
||||
// TODO
|
||||
public async resolveImage(actor: MiRemoteUser, value: string | IObject): Promise<MiDriveFile | null> {
|
||||
// TODO: Misskeyに対象のImageが登録されていればそれを返す
|
||||
|
||||
// リモートサーバーからフェッチしてきて登録
|
||||
return await this.createImage(actor, value);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
||||
import promiseLimit from 'promise-limit';
|
||||
import { In } from 'typeorm';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { PollsRepository, EmojisRepository, NotesRepository } from '@/models/_.js';
|
||||
|
@ -214,15 +213,13 @@ export class ApNoteService {
|
|||
}
|
||||
|
||||
// 添付ファイル
|
||||
// TODO: attachmentは必ずしもImageではない
|
||||
// TODO: attachmentは必ずしも配列ではない
|
||||
const limit = promiseLimit<MiDriveFile>(2);
|
||||
const files = (await Promise.all(toArray(note.attachment).map(attach => (
|
||||
limit(() => this.apImageService.resolveImage(actor, {
|
||||
...attach,
|
||||
sensitive: note.sensitive, // Noteがsensitiveなら添付もsensitiveにする
|
||||
}))
|
||||
))));
|
||||
const files: MiDriveFile[] = [];
|
||||
|
||||
for (const attach of toArray(note.attachment)) {
|
||||
attach.sensitive ||= note.sensitive; // Noteがsensitiveなら添付もsensitiveにする
|
||||
const file = await this.apImageService.resolveImage(actor, attach);
|
||||
if (file) files.push(file);
|
||||
}
|
||||
|
||||
// リプライ
|
||||
const reply: MiNote | null = note.inReplyTo
|
||||
|
|
|
@ -26,6 +26,7 @@ export interface IObject {
|
|||
endTime?: Date;
|
||||
icon?: any;
|
||||
image?: any;
|
||||
mediaType?: string;
|
||||
url?: ApObject | string;
|
||||
href?: string;
|
||||
tag?: IObject | IObject[];
|
||||
|
@ -241,14 +242,14 @@ export interface IKey extends IObject {
|
|||
}
|
||||
|
||||
export interface IApDocument extends IObject {
|
||||
type: 'Document';
|
||||
name: string | null;
|
||||
mediaType: string;
|
||||
type: 'Audio' | 'Document' | 'Image' | 'Page' | 'Video';
|
||||
}
|
||||
|
||||
export interface IApImage extends IObject {
|
||||
export const isDocument = (object: IObject): object is IApDocument =>
|
||||
['Audio', 'Document', 'Image', 'Page', 'Video'].includes(getApType(object));
|
||||
|
||||
export interface IApImage extends IApDocument {
|
||||
type: 'Image';
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export interface ICreate extends IActivity {
|
||||
|
|
|
@ -120,12 +120,20 @@ export class ServerService implements OnApplicationShutdown {
|
|||
return;
|
||||
}
|
||||
|
||||
const name = path.split('@')[0].replace(/\.webp$/i, '');
|
||||
const host = path.split('@')[1]?.replace(/\.webp$/i, '');
|
||||
const emojiPath = path.replace(/\.webp$/i, '');
|
||||
const pathChunks = emojiPath.split('@');
|
||||
|
||||
if (pathChunks.length > 2) {
|
||||
reply.code(400);
|
||||
return;
|
||||
}
|
||||
|
||||
const name = pathChunks.shift();
|
||||
const host = pathChunks.pop();
|
||||
|
||||
const emoji = await this.emojisRepository.findOneBy({
|
||||
// `@.` is the spec of ReactionService.decodeReaction
|
||||
host: (host == null || host === '.') ? IsNull() : host,
|
||||
host: (host === undefined || host === '.') ? IsNull() : host,
|
||||
name: name,
|
||||
});
|
||||
|
||||
|
|
|
@ -20,13 +20,188 @@ export const meta = {
|
|||
res: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
image: {
|
||||
type: 'object',
|
||||
optional: true,
|
||||
properties: {
|
||||
link: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
url: {
|
||||
type: 'string',
|
||||
optional: false,
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
paginationLinks: {
|
||||
type: 'object',
|
||||
optional: true,
|
||||
properties: {
|
||||
self: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
first: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
next: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
last: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
prev: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
link: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
items: {
|
||||
type: 'array',
|
||||
optional: false,
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
link: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
guid: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
pubDate: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
creator: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
summary: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
content: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
isoDate: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
categories: {
|
||||
type: 'array',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
contentSnippet: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
enclosure: {
|
||||
type: 'object',
|
||||
optional: true,
|
||||
properties: {
|
||||
url: {
|
||||
type: 'string',
|
||||
optional: false,
|
||||
},
|
||||
length: {
|
||||
type: 'number',
|
||||
optional: true,
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
feedUrl: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
itunes: {
|
||||
type: 'object',
|
||||
optional: true,
|
||||
additionalProperties: true,
|
||||
properties: {
|
||||
image: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
owner: {
|
||||
type: 'object',
|
||||
optional: true,
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
email: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
author: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
summary: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
explicit: {
|
||||
type: 'string',
|
||||
optional: true,
|
||||
},
|
||||
categories: {
|
||||
type: 'array',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
keywords: {
|
||||
type: 'array',
|
||||
optional: true,
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
|
|
@ -211,6 +211,10 @@ export class ClientServerService {
|
|||
// %71ueueとかでリクエストされたら困るため
|
||||
const url = decodeURI(request.routeOptions.url);
|
||||
if (url === bullBoardPath || url.startsWith(bullBoardPath + '/')) {
|
||||
if (!url.startsWith(bullBoardPath + '/static/')) {
|
||||
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
|
||||
}
|
||||
|
||||
const token = request.cookies.token;
|
||||
if (token == null) {
|
||||
reply.code(401).send('Login required');
|
||||
|
|
|
@ -3,7 +3,7 @@ extends ./base
|
|||
block vars
|
||||
- const user = page.user;
|
||||
- const title = page.title;
|
||||
- const url = `${config.url}/@${user.username}/${page.name}`;
|
||||
- const url = `${config.url}/@${user.username}/pages/${page.name}`;
|
||||
|
||||
block title
|
||||
= `${title} | ${instanceName}`
|
||||
|
|
|
@ -39,6 +39,12 @@ describe('MfmService', () => {
|
|||
const output = '<p>foo <i>bar</i></p>';
|
||||
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
|
||||
});
|
||||
|
||||
test('escape', () => {
|
||||
const input = '```\n<p>Hello, world!</p>\n```';
|
||||
const output = '<p><pre><code><p>Hello, world!</p></code></pre></p>';
|
||||
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fromHtml', () => {
|
||||
|
|
|
@ -17,7 +17,7 @@ import { GlobalModule } from '@/GlobalModule.js';
|
|||
import { CoreModule } from '@/core/CoreModule.js';
|
||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||
import { LoggerService } from '@/core/LoggerService.js';
|
||||
import type { IActor, IApDocument, ICollection, IPost } from '@/core/activitypub/type.js';
|
||||
import type { IActor, IApDocument, ICollection, IObject, IPost } from '@/core/activitypub/type.js';
|
||||
import { MiMeta, MiNote } from '@/models/_.js';
|
||||
import { secureRndstr } from '@/misc/secure-rndstr.js';
|
||||
import { DownloadService } from '@/core/DownloadService.js';
|
||||
|
@ -295,7 +295,7 @@ describe('ActivityPub', () => {
|
|||
await createRandomRemoteUser(resolver, personService),
|
||||
imageObject,
|
||||
);
|
||||
assert.ok(!driveFile.isLink);
|
||||
assert.ok(driveFile && !driveFile.isLink);
|
||||
|
||||
const sensitiveImageObject: IApDocument = {
|
||||
type: 'Document',
|
||||
|
@ -308,7 +308,7 @@ describe('ActivityPub', () => {
|
|||
await createRandomRemoteUser(resolver, personService),
|
||||
sensitiveImageObject,
|
||||
);
|
||||
assert.ok(!sensitiveDriveFile.isLink);
|
||||
assert.ok(sensitiveDriveFile && !sensitiveDriveFile.isLink);
|
||||
});
|
||||
|
||||
test('cacheRemoteFiles=false disables caching', async () => {
|
||||
|
@ -324,7 +324,7 @@ describe('ActivityPub', () => {
|
|||
await createRandomRemoteUser(resolver, personService),
|
||||
imageObject,
|
||||
);
|
||||
assert.ok(driveFile.isLink);
|
||||
assert.ok(driveFile && driveFile.isLink);
|
||||
|
||||
const sensitiveImageObject: IApDocument = {
|
||||
type: 'Document',
|
||||
|
@ -337,7 +337,7 @@ describe('ActivityPub', () => {
|
|||
await createRandomRemoteUser(resolver, personService),
|
||||
sensitiveImageObject,
|
||||
);
|
||||
assert.ok(sensitiveDriveFile.isLink);
|
||||
assert.ok(sensitiveDriveFile && sensitiveDriveFile.isLink);
|
||||
});
|
||||
|
||||
test('cacheRemoteSensitiveFiles=false only affects sensitive files', async () => {
|
||||
|
@ -353,7 +353,7 @@ describe('ActivityPub', () => {
|
|||
await createRandomRemoteUser(resolver, personService),
|
||||
imageObject,
|
||||
);
|
||||
assert.ok(!driveFile.isLink);
|
||||
assert.ok(driveFile && !driveFile.isLink);
|
||||
|
||||
const sensitiveImageObject: IApDocument = {
|
||||
type: 'Document',
|
||||
|
@ -366,7 +366,19 @@ describe('ActivityPub', () => {
|
|||
await createRandomRemoteUser(resolver, personService),
|
||||
sensitiveImageObject,
|
||||
);
|
||||
assert.ok(sensitiveDriveFile.isLink);
|
||||
assert.ok(sensitiveDriveFile && sensitiveDriveFile.isLink);
|
||||
});
|
||||
|
||||
test('Link is not an attachment files', async () => {
|
||||
const linkObject: IObject = {
|
||||
type: 'Link',
|
||||
href: 'https://example.com/',
|
||||
};
|
||||
const driveFile = await imageService.createImage(
|
||||
await createRandomRemoteUser(resolver, personService),
|
||||
linkObject,
|
||||
);
|
||||
assert.strictEqual(driveFile, null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
"@rollup/plugin-json": "6.1.0",
|
||||
"@rollup/plugin-replace": "5.0.5",
|
||||
"@rollup/pluginutils": "5.1.0",
|
||||
"@syuilo/aiscript": "0.17.0",
|
||||
"@syuilo/aiscript": "0.18.0",
|
||||
"@tabler/icons-webfont": "2.44.0",
|
||||
"@twemoji/parser": "15.0.0",
|
||||
"@vitejs/plugin-vue": "5.0.4",
|
||||
|
|
|
@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
<div :class="$style.detail">
|
||||
<div>
|
||||
<Mfm :text="report.comment"/>
|
||||
<Mfm :text="report.comment" :linkBehavior="'window'"/>
|
||||
<MkFolder v-if="report.notes.length !== 0" :class="$style.notes">
|
||||
<template #label>{{ i18n.ts.reportedNote }}</template>
|
||||
<div v-for="note in report.notes" :class="$style.notes">
|
||||
|
|
|
@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template>
|
||||
<component
|
||||
:is="self ? 'MkA' : 'a'" ref="el" style="word-break: break-all;" class="_link" :[attr]="self ? url.substring(local.length) : url" :rel="rel ?? 'nofollow noopener'" :target="target"
|
||||
:behavior="props.behavior"
|
||||
:title="url"
|
||||
>
|
||||
<slot></slot>
|
||||
|
@ -19,10 +20,12 @@ import { url as local } from '@/config.js';
|
|||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||
import * as os from '@/os.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
import { MkABehavior } from '@/components/global/MkA.vue';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
rel?: null | string;
|
||||
behavior?: MkABehavior;
|
||||
}>(), {
|
||||
});
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe && gamingType === '' , [$style.gamingDark]: gamingType === 'dark',[$style.gamingLight]: gamingType === 'light' }]" :to="url" :style="{ background: bgCss }">
|
||||
<MkA v-user-preview="canonical" :class="[$style.root, { [$style.isMe]: isMe && gamingType === '' , [$style.gamingDark]: gamingType === 'dark',[$style.gamingLight]: gamingType === 'light' }]" :to="url" :style="{ background: bgCss }" :behavior="behavior">
|
||||
<img :class="$style.icon" :src="avatarUrl" alt="">
|
||||
<span>
|
||||
<span>@{{ username }}</span>
|
||||
|
@ -21,12 +21,14 @@ import { host as localHost } from '@/config.js';
|
|||
import { $i } from '@/account.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||
import { MkABehavior } from '@/components/global/MkA.vue';
|
||||
|
||||
const gamingType = computed(defaultStore.makeGetterSetter('gamingType'));
|
||||
|
||||
const props = defineProps<{
|
||||
username: string;
|
||||
host: string;
|
||||
behavior?: MkABehavior;
|
||||
}>();
|
||||
|
||||
const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`;
|
||||
|
|
|
@ -58,8 +58,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<span v-else-if="notification.type === 'achievementEarned'">{{ i18n.ts._notification.achievementEarned }}</span>
|
||||
<span v-else-if="notification.type === 'test'">{{ i18n.ts._notification.testNotification }}</span>
|
||||
<MkA v-else-if="notification.type === 'follow' || notification.type === 'mention' || notification.type === 'reply' || notification.type === 'renote' || notification.type === 'quote' || notification.type === 'reaction' || notification.type === 'receiveFollowRequest' || notification.type === 'followRequestAccepted'" v-user-preview="notification.user.id" :class="$style.headerName" :to="userPage(notification.user)"><MkUserName :user="notification.user"/></MkA>
|
||||
<span v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'">{{ i18n.tsx._notification.likedBySomeUsers({ n: notification.reactions.length }) }}</span>
|
||||
<span v-else-if="notification.type === 'reaction:grouped'">{{ i18n.tsx._notification.reactedBySomeUsers({ n: notification.reactions.length }) }}</span>
|
||||
<span v-else-if="notification.type === 'reaction:grouped' && notification.note.reactionAcceptance === 'likeOnly'">{{ i18n.tsx._notification.likedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
|
||||
<span v-else-if="notification.type === 'reaction:grouped'">{{ i18n.tsx._notification.reactedBySomeUsers({ n: getActualReactedUsersCount(notification) }) }}</span>
|
||||
<span v-else-if="notification.type === 'renote:grouped'">{{ i18n.tsx._notification.renotedBySomeUsers({ n: notification.users.length }) }}</span>
|
||||
<span v-else-if="notification.type === 'app'">{{ notification.header }}</span>
|
||||
<MkTime v-if="withTime" :time="notification.createdAt" :class="$style.headerTime"/>
|
||||
|
@ -72,7 +72,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</MkA>
|
||||
<MkA v-else-if="notification.type === 'renote' || notification.type === 'renote:grouped'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note.renote)">
|
||||
<i class="ti ti-quote" :class="$style.quote"></i>
|
||||
<Mfm :text="getNoteSummary(notification.note.renote)" :plain="true" :nowrap="true" :author="notification.note.renote.user"/>
|
||||
<Mfm :text="getNoteSummary(notification.note.renote)" :plain="true" :nowrap="true" :author="notification.note.renote?.user"/>
|
||||
<i class="ti ti-quote" :class="$style.quote"></i>
|
||||
</MkA>
|
||||
<MkA v-else-if="notification.type === 'reply'" :class="$style.text" :to="notePage(notification.note)" :title="getNoteSummary(notification.note)">
|
||||
|
@ -174,6 +174,11 @@ const rejectFollowRequest = () => {
|
|||
followRequestDone.value = true;
|
||||
misskeyApi('following/requests/reject', { userId: props.notification.user.id });
|
||||
};
|
||||
|
||||
function getActualReactedUsersCount(notification: Misskey.entities.Notification) {
|
||||
if (notification.type !== 'reaction:grouped') return 0;
|
||||
return new Set(notification.reactions.map((reaction) => reaction.user.id)).size;
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
@ -9,6 +9,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</a>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export type MkABehavior = 'window' | 'browser' | null;
|
||||
</script>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, shallowRef } from 'vue';
|
||||
import * as os from '@/os.js';
|
||||
|
@ -20,12 +24,14 @@ import { useRouter } from '@/router/supplier.js';
|
|||
const props = withDefaults(defineProps<{
|
||||
to: string;
|
||||
activeClass?: null | string;
|
||||
behavior?: null | 'window' | 'browser';
|
||||
behavior?: MkABehavior;
|
||||
}>(), {
|
||||
activeClass: null,
|
||||
behavior: null,
|
||||
});
|
||||
|
||||
const linkBehaviour = props.behavior;
|
||||
|
||||
const el = shallowRef<HTMLElement>();
|
||||
|
||||
defineExpose({ $el: el });
|
||||
|
|
|
@ -17,7 +17,7 @@ import MkCode from '@/components/MkCode.vue';
|
|||
import MkCodeInline from '@/components/MkCodeInline.vue';
|
||||
import MkGoogle from '@/components/MkGoogle.vue';
|
||||
import MkSparkle from '@/components/MkSparkle.vue';
|
||||
import MkA from '@/components/global/MkA.vue';
|
||||
import MkA, { MkABehavior } from '@/components/global/MkA.vue';
|
||||
import { host } from '@/config';
|
||||
import { defaultStore } from '@/store';
|
||||
import { mixEmoji } from '@/scripts/emojiKitchen/emojiMixer';
|
||||
|
@ -77,6 +77,7 @@ type MfmProps = {
|
|||
parsedNodes?: mfm.MfmNode[] | null;
|
||||
enableEmojiMenu?: boolean;
|
||||
enableEmojiMenuReaction?: boolean;
|
||||
linkBehavior?: MkABehavior;
|
||||
};
|
||||
|
||||
type MfmEvents = {
|
||||
|
@ -415,6 +416,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
key: Math.random(),
|
||||
url: token.props.url,
|
||||
rel: 'nofollow noopener',
|
||||
behavior: props.linkBehavior,
|
||||
})];
|
||||
}
|
||||
|
||||
|
@ -423,6 +425,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
key: Math.random(),
|
||||
url: token.props.url,
|
||||
rel: 'nofollow noopener',
|
||||
behavior: props.linkBehavior,
|
||||
}, genEl(token.children, scale, true))];
|
||||
}
|
||||
|
||||
|
@ -431,6 +434,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
key: Math.random(),
|
||||
host: (token.props.host == null && props.author && props.author.host != null ? props.author.host : token.props.host) ?? host,
|
||||
username: token.props.username,
|
||||
behavior: props.linkBehavior,
|
||||
})];
|
||||
}
|
||||
|
||||
|
@ -439,6 +443,7 @@ export default function (props: MfmProps, { emit }: { emit: SetupContext<MfmEven
|
|||
key: Math.random(),
|
||||
to: isNote ? `/tags/${encodeURIComponent(token.props.hashtag)}` : `/user-tags/${encodeURIComponent(token.props.hashtag)}`,
|
||||
style: 'color:var(--hashtag);',
|
||||
behavior: props.linkBehavior,
|
||||
}, `#${token.props.hashtag}`)];
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template>
|
||||
<component
|
||||
:is="self ? 'MkA' : 'a'" ref="el" :class="$style.root" class="_link" :[attr]="self ? props.url.substring(local.length) : props.url" :rel="rel ?? 'nofollow noopener'" :target="target"
|
||||
:behavior = "props.behavior"
|
||||
@contextmenu.stop="() => {}"
|
||||
>
|
||||
<template v-if="!self">
|
||||
|
@ -31,11 +32,13 @@ import * as os from '@/os.js';
|
|||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
import { MkABehavior } from '@/components/global/MkA.vue';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
rel?: string;
|
||||
showUrlPreview?: boolean;
|
||||
behavior?: MkABehavior;
|
||||
}>(), {
|
||||
showUrlPreview: true,
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ import MkInput from '@/components/MkInput.vue';
|
|||
import MkSelect from '@/components/MkSelect.vue';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
|
||||
const PRESET_DEFAULT = `/// @ 0.16.0
|
||||
const PRESET_DEFAULT = `/// @ 0.18.0
|
||||
|
||||
var name = ""
|
||||
|
||||
|
@ -60,13 +60,13 @@ Ui:render([
|
|||
Ui:C:button({
|
||||
text: "Hello"
|
||||
onClick: @() {
|
||||
Mk:dialog(null \`Hello, {name}!\`)
|
||||
Mk:dialog(null, \`Hello, {name}!\`)
|
||||
}
|
||||
})
|
||||
])
|
||||
`;
|
||||
|
||||
const PRESET_OMIKUJI = `/// @ 0.16.0
|
||||
const PRESET_OMIKUJI = `/// @ 0.18.0
|
||||
// ユーザーごとに日替わりのおみくじのプリセット
|
||||
|
||||
// 選択肢
|
||||
|
@ -81,11 +81,11 @@ let choices = [
|
|||
"大凶"
|
||||
]
|
||||
|
||||
// シードが「ユーザーID+今日の日付」である乱数生成器を用意
|
||||
let random = Math:gen_rng(\`{USER_ID}{Date:year()}{Date:month()}{Date:day()}\`)
|
||||
// シードが「PlayID+ユーザーID+今日の日付」である乱数生成器を用意
|
||||
let random = Math:gen_rng(\`{THIS_ID}{USER_ID}{Date:year()}{Date:month()}{Date:day()}\`)
|
||||
|
||||
// ランダムに選択肢を選ぶ
|
||||
let chosen = choices[random(0 (choices.len - 1))]
|
||||
let chosen = choices[random(0, (choices.len - 1))]
|
||||
|
||||
// 結果のテキスト
|
||||
let result = \`今日のあなたの運勢は **{chosen}** です。\`
|
||||
|
@ -109,7 +109,7 @@ Ui:render([
|
|||
])
|
||||
`;
|
||||
|
||||
const PRESET_SHUFFLE = `/// @ 0.16.0
|
||||
const PRESET_SHUFFLE = `/// @ 0.18.0
|
||||
// 巻き戻し可能な文字シャッフルのプリセット
|
||||
|
||||
let string = "ペペロンチーノ"
|
||||
|
@ -123,13 +123,13 @@ var cursor = 0
|
|||
|
||||
@do() {
|
||||
if (cursor != 0) {
|
||||
results = results.slice(0 (cursor + 1))
|
||||
results = results.slice(0, (cursor + 1))
|
||||
cursor = 0
|
||||
}
|
||||
|
||||
let chars = []
|
||||
for (let i, length) {
|
||||
let r = Math:rnd(0 (length - 1))
|
||||
let r = Math:rnd(0, (length - 1))
|
||||
chars.push(string.pick(r))
|
||||
}
|
||||
let result = chars.join("")
|
||||
|
@ -163,11 +163,11 @@ var cursor = 0
|
|||
text: "←"
|
||||
disabled: !(results.len > 1 && (results.len - cursor) > 1)
|
||||
onClick: back
|
||||
} {
|
||||
}, {
|
||||
text: "→"
|
||||
disabled: !(results.len > 1 && cursor > 0)
|
||||
onClick: forward
|
||||
} {
|
||||
}, {
|
||||
text: "引き直す"
|
||||
onClick: do
|
||||
}]
|
||||
|
@ -188,27 +188,27 @@ var cursor = 0
|
|||
do()
|
||||
`;
|
||||
|
||||
const PRESET_QUIZ = `/// @ 0.16.0
|
||||
const PRESET_QUIZ = `/// @ 0.18.0
|
||||
let title = '地理クイズ'
|
||||
|
||||
let qas = [{
|
||||
q: 'オーストラリアの首都は?'
|
||||
choices: ['シドニー' 'キャンベラ' 'メルボルン']
|
||||
choices: ['シドニー', 'キャンベラ', 'メルボルン']
|
||||
a: 'キャンベラ'
|
||||
aDescription: '最大の都市はシドニーですが首都はキャンベラです。'
|
||||
} {
|
||||
}, {
|
||||
q: '国土面積2番目の国は?'
|
||||
choices: ['カナダ' 'アメリカ' '中国']
|
||||
choices: ['カナダ', 'アメリカ', '中国']
|
||||
a: 'カナダ'
|
||||
aDescription: '大きい順にロシア、カナダ、アメリカ、中国です。'
|
||||
} {
|
||||
}, {
|
||||
q: '二重内陸国ではないのは?'
|
||||
choices: ['リヒテンシュタイン' 'ウズベキスタン' 'レソト']
|
||||
choices: ['リヒテンシュタイン', 'ウズベキスタン', 'レソト']
|
||||
a: 'レソト'
|
||||
aDescription: 'レソトは(一重)内陸国です。'
|
||||
} {
|
||||
}, {
|
||||
q: '閘門がない運河は?'
|
||||
choices: ['キール運河' 'スエズ運河' 'パナマ運河']
|
||||
choices: ['キール運河', 'スエズ運河', 'パナマ運河']
|
||||
a: 'スエズ運河'
|
||||
aDescription: 'スエズ運河は高低差がないので閘門はありません。'
|
||||
}]
|
||||
|
@ -244,9 +244,9 @@ each (let qa, qas) {
|
|||
})
|
||||
Ui:C:container({
|
||||
children: []
|
||||
} \`{qa.id}:a\`)
|
||||
}, \`{qa.id}:a\`)
|
||||
]
|
||||
} qa.id))
|
||||
}, qa.id))
|
||||
}
|
||||
|
||||
@finish() {
|
||||
|
@ -296,12 +296,12 @@ qaEls.push(Ui:C:container({
|
|||
onClick: finish
|
||||
})
|
||||
]
|
||||
} 'footer'))
|
||||
}, 'footer'))
|
||||
|
||||
Ui:render(qaEls)
|
||||
`;
|
||||
|
||||
const PRESET_TIMELINE = `/// @ 0.16.0
|
||||
const PRESET_TIMELINE = `/// @ 0.18.0
|
||||
// APIリクエストを行いローカルタイムラインを表示するプリセット
|
||||
|
||||
@fetch() {
|
||||
|
@ -315,7 +315,7 @@ const PRESET_TIMELINE = `/// @ 0.16.0
|
|||
])
|
||||
|
||||
// タイムライン取得
|
||||
let notes = Mk:api("notes/local-timeline" {})
|
||||
let notes = Mk:api("notes/local-timeline", {})
|
||||
|
||||
// それぞれのノートごとにUI要素作成
|
||||
let noteEls = []
|
||||
|
|
|
@ -15,11 +15,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkAsUi v-if="root" :component="root" :components="components"/>
|
||||
</div>
|
||||
<div class="actions _panel">
|
||||
<MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ti ti-heart"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.shareWithNote" class="button" rounded @click="shareWithNote"><i class="ti ti-repeat ti-fw"></i></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
||||
<MkButton v-if="isSupportShare()" v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
||||
<div class="items">
|
||||
<MkButton v-tooltip="i18n.ts.reload" class="button" rounded @click="reset"><i class="ti ti-reload"></i></MkButton>
|
||||
</div>
|
||||
<div class="items">
|
||||
<MkButton v-if="flash.isLiked" v-tooltip="i18n.ts.unlike" asLike class="button" rounded primary @click="unlike()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-else v-tooltip="i18n.ts.like" asLike class="button" rounded @click="like()"><i class="ti ti-heart"></i><span v-if="flash?.likedCount && flash.likedCount > 0" style="margin-left: 6px;">{{ flash.likedCount }}</span></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.copyLink" class="button" rounded @click="copyLink"><i class="ti ti-link ti-fw"></i></MkButton>
|
||||
<MkButton v-tooltip="i18n.ts.share" class="button" rounded @click="share"><i class="ti ti-share ti-fw"></i></MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else :class="$style.ready">
|
||||
|
@ -49,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkA v-if="$i && $i.id === flash.userId" :to="`/play/${flash.id}/edit`" style="color: var(--accent);">{{ i18n.ts._play.editThisPage }}</MkA>
|
||||
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
||||
</div>
|
||||
<MkError v-else-if="error" @retry="fetchPage()"/>
|
||||
<MkError v-else-if="error" @retry="fetchFlash()"/>
|
||||
<MkLoading v-else/>
|
||||
</Transition>
|
||||
</MkSpacer>
|
||||
|
@ -94,12 +98,33 @@ function fetchFlash() {
|
|||
});
|
||||
}
|
||||
|
||||
function share(ev: MouseEvent) {
|
||||
if (!flash.value) return;
|
||||
|
||||
os.popupMenu([
|
||||
{
|
||||
text: i18n.ts.shareWithNote,
|
||||
icon: 'ti ti-pencil',
|
||||
action: shareWithNote,
|
||||
},
|
||||
...(isSupportShare() ? [{
|
||||
text: i18n.ts.share,
|
||||
icon: 'ti ti-share',
|
||||
action: shareWithNavigator,
|
||||
}] : []),
|
||||
], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function copyLink() {
|
||||
if (!flash.value) return;
|
||||
|
||||
copyToClipboard(`${url}/play/${flash.value.id}`);
|
||||
os.success();
|
||||
}
|
||||
|
||||
function share() {
|
||||
function shareWithNavigator() {
|
||||
if (!flash.value) return;
|
||||
|
||||
navigator.share({
|
||||
title: flash.value.title,
|
||||
text: flash.value.summary,
|
||||
|
@ -108,21 +133,28 @@ function share() {
|
|||
}
|
||||
|
||||
function shareWithNote() {
|
||||
if (!flash.value) return;
|
||||
|
||||
os.post({
|
||||
initialText: `${flash.value.title} ${url}/play/${flash.value.id}`,
|
||||
initialText: `${flash.value.title}\n${url}/play/${flash.value.id}`,
|
||||
instant: true,
|
||||
});
|
||||
}
|
||||
|
||||
function like() {
|
||||
if (!flash.value) return;
|
||||
|
||||
os.apiWithDialog('flash/like', {
|
||||
flashId: flash.value.id,
|
||||
}).then(() => {
|
||||
flash.value.isLiked = true;
|
||||
flash.value.likedCount++;
|
||||
flash.value!.isLiked = true;
|
||||
flash.value!.likedCount++;
|
||||
});
|
||||
}
|
||||
|
||||
async function unlike() {
|
||||
if (!flash.value) return;
|
||||
|
||||
const confirm = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.unlikeConfirm,
|
||||
|
@ -131,8 +163,8 @@ async function unlike() {
|
|||
os.apiWithDialog('flash/unlike', {
|
||||
flashId: flash.value.id,
|
||||
}).then(() => {
|
||||
flash.value.isLiked = false;
|
||||
flash.value.likedCount--;
|
||||
flash.value!.isLiked = false;
|
||||
flash.value!.likedCount--;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -152,6 +184,7 @@ function start() {
|
|||
|
||||
async function run() {
|
||||
if (aiscript.value) aiscript.value.abort();
|
||||
if (!flash.value) return;
|
||||
|
||||
aiscript.value = new Interpreter({
|
||||
...createAiScriptEnv({
|
||||
|
@ -193,12 +226,17 @@ async function run() {
|
|||
}
|
||||
}
|
||||
|
||||
onDeactivated(() => {
|
||||
function reset() {
|
||||
if (aiscript.value) aiscript.value.abort();
|
||||
started.value = false;
|
||||
}
|
||||
|
||||
onDeactivated(() => {
|
||||
reset();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (aiscript.value) aiscript.value.abort();
|
||||
reset();
|
||||
});
|
||||
|
||||
const headerActions = computed(() => []);
|
||||
|
@ -265,11 +303,19 @@ definePageMetadata(() => ({
|
|||
}
|
||||
|
||||
> .actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
padding: 16px;
|
||||
|
||||
> .items {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
border-bottom: 1px solid var(--divider);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
|
|||
import { deepClone } from '@/scripts/clone.js';
|
||||
import { useInterval } from '@/scripts/use-interval.js';
|
||||
import { signinRequired } from '@/account.js';
|
||||
import { url } from '@/config.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { userPage } from '@/filters/user.js';
|
||||
|
@ -442,7 +443,7 @@ function autoplay() {
|
|||
|
||||
function share() {
|
||||
os.post({
|
||||
initialText: `#MisskeyReversi ${location.href}`,
|
||||
initialText: `#MisskeyReversi\n${url}/reversi/g/${game.value.id}`,
|
||||
instant: true,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MarqueeText from '@/components/MkMarquee.vue';
|
||||
import { useInterval } from '@/scripts/use-interval.js';
|
||||
import { shuffle } from '@/scripts/shuffle.js';
|
||||
|
@ -42,13 +43,13 @@ const props = defineProps<{
|
|||
refreshIntervalSec?: number;
|
||||
}>();
|
||||
|
||||
const items = ref([]);
|
||||
const items = ref<Misskey.entities.FetchRssResponse['items']>([]);
|
||||
const fetching = ref(true);
|
||||
const key = ref(0);
|
||||
|
||||
const tick = () => {
|
||||
window.fetch(`/api/fetch-rss?url=${props.url}`, {}).then(res => {
|
||||
res.json().then(feed => {
|
||||
res.json().then((feed: Misskey.entities.FetchRssResponse) => {
|
||||
if (props.shuffle) {
|
||||
shuffle(feed.items);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
|
||||
import { GetFormResultType } from '@/scripts/form.js';
|
||||
import MkContainer from '@/components/MkContainer.vue';
|
||||
|
@ -64,7 +65,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
|
|||
emit,
|
||||
);
|
||||
|
||||
const rawItems = ref([]);
|
||||
const rawItems = ref<Misskey.entities.FetchRssResponse['items']>([]);
|
||||
const items = computed(() => rawItems.value.slice(0, widgetProps.maxEntries));
|
||||
const fetching = ref(true);
|
||||
const fetchEndpoint = computed(() => {
|
||||
|
@ -79,8 +80,8 @@ const tick = () => {
|
|||
|
||||
window.fetch(fetchEndpoint.value, {})
|
||||
.then(res => res.json())
|
||||
.then(feed => {
|
||||
rawItems.value = feed.items ?? [];
|
||||
.then((feed: Misskey.entities.FetchRssResponse) => {
|
||||
rawItems.value = feed.items;
|
||||
fetching.value = false;
|
||||
});
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
|
||||
import MarqueeText from '@/components/MkMarquee.vue';
|
||||
import { GetFormResultType } from '@/scripts/form.js';
|
||||
|
@ -87,7 +88,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
|
|||
emit,
|
||||
);
|
||||
|
||||
const rawItems = ref([]);
|
||||
const rawItems = ref<Misskey.entities.FetchRssResponse['items']>([]);
|
||||
const items = computed(() => {
|
||||
const newItems = rawItems.value.slice(0, widgetProps.maxEntries);
|
||||
if (widgetProps.shuffle) {
|
||||
|
@ -110,8 +111,8 @@ const tick = () => {
|
|||
|
||||
window.fetch(fetchEndpoint.value, {})
|
||||
.then(res => res.json())
|
||||
.then(feed => {
|
||||
rawItems.value = feed.items ?? [];
|
||||
.then((feed: Misskey.entities.FetchRssResponse) => {
|
||||
rawItems.value = feed.items;
|
||||
fetching.value = false;
|
||||
key.value++;
|
||||
});
|
||||
|
|
|
@ -51,6 +51,22 @@ const devConfig = {
|
|||
'/_info_card_': httpUrl,
|
||||
'/bios': httpUrl,
|
||||
'/cli': httpUrl,
|
||||
'/inbox': httpUrl,
|
||||
'/notes': {
|
||||
target: httpUrl,
|
||||
headers: {
|
||||
'Accept': 'application/activity+json',
|
||||
},
|
||||
},
|
||||
'/users': {
|
||||
target: httpUrl,
|
||||
headers: {
|
||||
'Accept': 'application/activity+json',
|
||||
},
|
||||
},
|
||||
'/.well-known': {
|
||||
target: httpUrl,
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
|
|
|
@ -26067,7 +26067,52 @@ export type operations = {
|
|||
200: {
|
||||
content: {
|
||||
'application/json': {
|
||||
items: Record<string, never>[];
|
||||
image?: {
|
||||
link?: string;
|
||||
url: string;
|
||||
title?: string;
|
||||
};
|
||||
paginationLinks?: {
|
||||
self?: string;
|
||||
first?: string;
|
||||
next?: string;
|
||||
last?: string;
|
||||
prev?: string;
|
||||
};
|
||||
link?: string;
|
||||
title?: string;
|
||||
items: {
|
||||
link?: string;
|
||||
guid?: string;
|
||||
title?: string;
|
||||
pubDate?: string;
|
||||
creator?: string;
|
||||
summary?: string;
|
||||
content?: string;
|
||||
isoDate?: string;
|
||||
categories?: string[];
|
||||
contentSnippet?: string;
|
||||
enclosure?: {
|
||||
url: string;
|
||||
length?: number;
|
||||
type?: string;
|
||||
};
|
||||
}[];
|
||||
feedUrl?: string;
|
||||
description?: string;
|
||||
itunes?: {
|
||||
image?: string;
|
||||
owner?: {
|
||||
name?: string;
|
||||
email?: string;
|
||||
};
|
||||
author?: string;
|
||||
summary?: string;
|
||||
explicit?: string;
|
||||
categories?: string[];
|
||||
keywords?: string[];
|
||||
[key: string]: unknown;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -710,8 +710,8 @@ importers:
|
|||
specifier: 5.1.0
|
||||
version: 5.1.0(rollup@4.12.0)
|
||||
'@syuilo/aiscript':
|
||||
specifier: 0.17.0
|
||||
version: 0.17.0
|
||||
specifier: 0.18.0
|
||||
version: 0.18.0
|
||||
'@tabler/icons-webfont':
|
||||
specifier: 2.44.0
|
||||
version: 2.44.0
|
||||
|
@ -6748,7 +6748,7 @@ packages:
|
|||
ts-dedent: 2.2.0
|
||||
type-fest: 2.19.0
|
||||
vue: 3.4.21(typescript@5.3.3)
|
||||
vue-component-type-helpers: 2.0.10
|
||||
vue-component-type-helpers: 2.0.14
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
|
@ -7014,8 +7014,8 @@ packages:
|
|||
dev: false
|
||||
optional: true
|
||||
|
||||
/@syuilo/aiscript@0.17.0:
|
||||
resolution: {integrity: sha512-3JtQ1rWJHMxQ3153zLCXMUOwrOgjPPYGBl0dPHhR0ohm4tn7okMQRugxMCT0t3YxByemb9FfiM6TUjd0tEGxdA==}
|
||||
/@syuilo/aiscript@0.18.0:
|
||||
resolution: {integrity: sha512-/iY9Vv4LLjtW/KUzId1QwXC4BlpIEPCMcoT7dyRhYdyxtwhS3Hx4b/4j1HYP+n3Pq9XKyW5zvkY72/+DNu4g6Q==}
|
||||
dependencies:
|
||||
seedrandom: 3.0.5
|
||||
stringz: 2.1.0
|
||||
|
@ -19455,8 +19455,8 @@ packages:
|
|||
resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==}
|
||||
dev: true
|
||||
|
||||
/vue-component-type-helpers@2.0.10:
|
||||
resolution: {integrity: sha512-FC5fKJjDks3Ue/KRSYBdsiCaZa0kUPQfs8yQpb8W9mlO6BenV8G1z58xobeRMzevnmEcDa09LLwuXDwb4f6NMQ==}
|
||||
/vue-component-type-helpers@2.0.14:
|
||||
resolution: {integrity: sha512-DInfgOyXlMyliyqAAD9frK28tTfch0+tMi4qoWJcZlRxUf+NFAtraJBnAsKLep+FOyLMiajkhfyEb3xLK08i7w==}
|
||||
dev: true
|
||||
|
||||
/vue-demi@0.14.7(vue@3.4.21):
|
||||
|
|
Loading…
Reference in a new issue