merge: Fix sfm-js linkage (!399)
View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/399 Approved-by: Amelia Yukii <amelia.yukii@shourai.de> Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
commit
f93a8e2d38
2
.npmrc
2
.npmrc
@ -1,2 +1,2 @@
|
|||||||
@sharkey:registry=https://git.joinsharkey.org/api/packages/Sharkey/npm/
|
@transfem-org:registry=https://activitypub.software/api/v4/packages/npm/
|
||||||
engine-strict = true
|
engine-strict = true
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
"@nestjs/core": "10.2.10",
|
"@nestjs/core": "10.2.10",
|
||||||
"@nestjs/testing": "10.2.10",
|
"@nestjs/testing": "10.2.10",
|
||||||
"@peertube/http-signature": "1.7.0",
|
"@peertube/http-signature": "1.7.0",
|
||||||
"@sharkey/sfm-js": "0.24.4",
|
"@transfem-org/sfm-js": "0.24.4",
|
||||||
"@simplewebauthn/server": "9.0.0",
|
"@simplewebauthn/server": "9.0.0",
|
||||||
"@sinonjs/fake-timers": "11.2.2",
|
"@sinonjs/fake-timers": "11.2.2",
|
||||||
"@smithy/node-http-handler": "2.1.10",
|
"@smithy/node-http-handler": "2.1.10",
|
||||||
|
@ -13,7 +13,7 @@ import { intersperse } from '@/misc/prelude/array.js';
|
|||||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js';
|
import * as TreeAdapter from '../../node_modules/parse5/dist/tree-adapters/default.js';
|
||||||
import type * as mfm from '@sharkey/sfm-js';
|
import type * as mfm from '@transfem-org/sfm-js';
|
||||||
|
|
||||||
const treeAdapter = TreeAdapter.defaultTreeAdapter;
|
const treeAdapter = TreeAdapter.defaultTreeAdapter;
|
||||||
|
|
||||||
@ -476,173 +476,173 @@ export class MfmService {
|
|||||||
const handlers: {
|
const handlers: {
|
||||||
[K in mfm.MfmNode['type']]: (node: mfm.NodeType<K>) => any;
|
[K in mfm.MfmNode['type']]: (node: mfm.NodeType<K>) => any;
|
||||||
} = {
|
} = {
|
||||||
async bold(node) {
|
async bold(node) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
el.textContent = '**';
|
el.textContent = '**';
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
el.textContent += '**';
|
el.textContent += '**';
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
async small(node) {
|
async small(node) {
|
||||||
const el = doc.createElement('small');
|
const el = doc.createElement('small');
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
async strike(node) {
|
async strike(node) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
el.textContent = '~~';
|
el.textContent = '~~';
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
el.textContent += '~~';
|
el.textContent += '~~';
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
async italic(node) {
|
async italic(node) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
el.textContent = '*';
|
el.textContent = '*';
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
el.textContent += '*';
|
el.textContent += '*';
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
async fn(node) {
|
async fn(node) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
el.textContent = '*';
|
el.textContent = '*';
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
el.textContent += '*';
|
el.textContent += '*';
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
blockCode(node) {
|
blockCode(node) {
|
||||||
const pre = doc.createElement('pre');
|
const pre = doc.createElement('pre');
|
||||||
const inner = doc.createElement('code');
|
const inner = doc.createElement('code');
|
||||||
|
|
||||||
const nodes = node.props.code
|
const nodes = node.props.code
|
||||||
.split(/\r\n|\r|\n/)
|
.split(/\r\n|\r|\n/)
|
||||||
.map((x) => doc.createTextNode(x));
|
.map((x) => doc.createTextNode(x));
|
||||||
|
|
||||||
for (const x of intersperse<FIXME | 'br'>('br', nodes)) {
|
for (const x of intersperse<FIXME | 'br'>('br', nodes)) {
|
||||||
inner.appendChild(x === 'br' ? doc.createElement('br') : x);
|
inner.appendChild(x === 'br' ? doc.createElement('br') : x);
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.appendChild(inner);
|
pre.appendChild(inner);
|
||||||
return pre;
|
return pre;
|
||||||
},
|
},
|
||||||
|
|
||||||
async center(node) {
|
async center(node) {
|
||||||
const el = doc.createElement('div');
|
const el = doc.createElement('div');
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
emojiCode(node) {
|
emojiCode(node) {
|
||||||
return doc.createTextNode(`\u200B:${node.props.name}:\u200B`);
|
return doc.createTextNode(`\u200B:${node.props.name}:\u200B`);
|
||||||
},
|
},
|
||||||
|
|
||||||
unicodeEmoji(node) {
|
unicodeEmoji(node) {
|
||||||
return doc.createTextNode(node.props.emoji);
|
return doc.createTextNode(node.props.emoji);
|
||||||
},
|
},
|
||||||
|
|
||||||
hashtag: (node) => {
|
hashtag: (node) => {
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
a.setAttribute('href', `${this.config.url}/tags/${node.props.hashtag}`);
|
a.setAttribute('href', `${this.config.url}/tags/${node.props.hashtag}`);
|
||||||
a.textContent = `#${node.props.hashtag}`;
|
a.textContent = `#${node.props.hashtag}`;
|
||||||
a.setAttribute('rel', 'tag');
|
a.setAttribute('rel', 'tag');
|
||||||
a.setAttribute('class', 'hashtag');
|
a.setAttribute('class', 'hashtag');
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
||||||
inlineCode(node) {
|
inlineCode(node) {
|
||||||
const el = doc.createElement('code');
|
const el = doc.createElement('code');
|
||||||
el.textContent = node.props.code;
|
el.textContent = node.props.code;
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
mathInline(node) {
|
mathInline(node) {
|
||||||
const el = doc.createElement('code');
|
const el = doc.createElement('code');
|
||||||
el.textContent = node.props.formula;
|
el.textContent = node.props.formula;
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
mathBlock(node) {
|
mathBlock(node) {
|
||||||
const el = doc.createElement('code');
|
const el = doc.createElement('code');
|
||||||
el.textContent = node.props.formula;
|
el.textContent = node.props.formula;
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
async link(node) {
|
async link(node) {
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
a.setAttribute('rel', 'nofollow noopener noreferrer');
|
a.setAttribute('rel', 'nofollow noopener noreferrer');
|
||||||
a.setAttribute('target', '_blank');
|
a.setAttribute('target', '_blank');
|
||||||
a.setAttribute('href', node.props.url);
|
a.setAttribute('href', node.props.url);
|
||||||
await appendChildren(node.children, a);
|
await appendChildren(node.children, a);
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
||||||
async mention(node) {
|
async mention(node) {
|
||||||
const { username, host, acct } = node.props;
|
const { username, host, acct } = node.props;
|
||||||
const resolved = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
const resolved = mentionedRemoteUsers.find(remoteUser => remoteUser.username === username && remoteUser.host === host);
|
||||||
|
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
el.textContent = acct;
|
el.textContent = acct;
|
||||||
} else {
|
} else {
|
||||||
el.setAttribute('class', 'h-card');
|
el.setAttribute('class', 'h-card');
|
||||||
el.setAttribute('translate', 'no');
|
el.setAttribute('translate', 'no');
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
a.setAttribute('href', resolved.url ? resolved.url : resolved.uri);
|
a.setAttribute('href', resolved.url ? resolved.url : resolved.uri);
|
||||||
a.className = 'u-url mention';
|
a.className = 'u-url mention';
|
||||||
const span = doc.createElement('span');
|
const span = doc.createElement('span');
|
||||||
span.textContent = resolved.username || username;
|
span.textContent = resolved.username || username;
|
||||||
a.textContent = '@';
|
a.textContent = '@';
|
||||||
a.appendChild(span);
|
a.appendChild(span);
|
||||||
el.appendChild(a);
|
el.appendChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
async quote(node) {
|
async quote(node) {
|
||||||
const el = doc.createElement('blockquote');
|
const el = doc.createElement('blockquote');
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
text(node) {
|
text(node) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
const nodes = node.props.text
|
const nodes = node.props.text
|
||||||
.split(/\r\n|\r|\n/)
|
.split(/\r\n|\r|\n/)
|
||||||
.map((x) => doc.createTextNode(x));
|
.map((x) => doc.createTextNode(x));
|
||||||
|
|
||||||
for (const x of intersperse<FIXME | 'br'>('br', nodes)) {
|
for (const x of intersperse<FIXME | 'br'>('br', nodes)) {
|
||||||
el.appendChild(x === 'br' ? doc.createElement('br') : x);
|
el.appendChild(x === 'br' ? doc.createElement('br') : x);
|
||||||
}
|
}
|
||||||
|
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
|
|
||||||
url(node) {
|
url(node) {
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
a.setAttribute('rel', 'nofollow noopener noreferrer');
|
a.setAttribute('rel', 'nofollow noopener noreferrer');
|
||||||
a.setAttribute('target', '_blank');
|
a.setAttribute('target', '_blank');
|
||||||
a.setAttribute('href', node.props.url);
|
a.setAttribute('href', node.props.url);
|
||||||
a.textContent = node.props.url.replace(/^https?:\/\//, '');
|
a.textContent = node.props.url.replace(/^https?:\/\//, '');
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
||||||
search: (node) => {
|
search: (node) => {
|
||||||
const a = doc.createElement('a');
|
const a = doc.createElement('a');
|
||||||
a.setAttribute('href', `https"google.com/${node.props.query}`);
|
a.setAttribute('href', `https"google.com/${node.props.query}`);
|
||||||
a.textContent = node.props.content;
|
a.textContent = node.props.content;
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
||||||
async plain(node) {
|
async plain(node) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
await appendChildren(node.children, el);
|
await appendChildren(node.children, el);
|
||||||
return el;
|
return el;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
await appendChildren(nodes, doc.body);
|
await appendChildren(nodes, doc.body);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { setImmediate } from 'node:timers/promises';
|
import { setImmediate } from 'node:timers/promises';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { In, DataSource, IsNull, LessThan } from 'typeorm';
|
import { In, DataSource, IsNull, LessThan } from 'typeorm';
|
||||||
import * as Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { setImmediate } from 'node:timers/promises';
|
import { setImmediate } from 'node:timers/promises';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { DataSource, In, IsNull, LessThan } from 'typeorm';
|
import { DataSource, In, IsNull, LessThan } from 'typeorm';
|
||||||
import * as Redis from 'ioredis';
|
import * as Redis from 'ioredis';
|
||||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||||
@ -589,7 +589,7 @@ export class NoteEditService implements OnApplicationShutdown {
|
|||||||
} else {
|
} else {
|
||||||
this.globalEventService.publishNoteStream(note.id, 'updated', {
|
this.globalEventService.publishNoteStream(note.id, 'updated', {
|
||||||
cw: note.cw,
|
cw: note.cw,
|
||||||
text: note.text!
|
text: note.text!,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { MfmService } from '@/core/MfmService.js';
|
import { MfmService } from '@/core/MfmService.js';
|
||||||
import type { MiNote } from '@/models/Note.js';
|
import type { MiNote } from '@/models/Note.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
import { createPublicKey, randomUUID } from 'node:crypto';
|
import { createPublicKey, randomUUID } from 'node:crypto';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type { MiPartialLocalUser, MiLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js';
|
import type { MiPartialLocalUser, MiLocalUser, MiPartialRemoteUser, MiRemoteUser, MiUser } from '@/models/User.js';
|
||||||
@ -28,10 +28,10 @@ import { bindThis } from '@/decorators.js';
|
|||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { isNotNull } from '@/misc/is-not-null.js';
|
import { isNotNull } from '@/misc/is-not-null.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
|
import { MetaService } from '../MetaService.js';
|
||||||
import { LdSignatureService } from './LdSignatureService.js';
|
import { LdSignatureService } from './LdSignatureService.js';
|
||||||
import { ApMfmService } from './ApMfmService.js';
|
import { ApMfmService } from './ApMfmService.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';
|
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';
|
||||||
import { MetaService } from '../MetaService.js';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ApRendererService {
|
export class ApRendererService {
|
||||||
@ -821,12 +821,12 @@ export class ApRendererService {
|
|||||||
'_misskey_summary': 'misskey:_misskey_summary',
|
'_misskey_summary': 'misskey:_misskey_summary',
|
||||||
'isCat': 'misskey:isCat',
|
'isCat': 'misskey:isCat',
|
||||||
// Firefish
|
// Firefish
|
||||||
firefish: "https://joinfirefish.org/ns#",
|
firefish: 'https://joinfirefish.org/ns#',
|
||||||
speakAsCat: "firefish:speakAsCat",
|
speakAsCat: 'firefish:speakAsCat',
|
||||||
// Sharkey
|
// Sharkey
|
||||||
sharkey: "https://joinsharkey.org/ns#",
|
sharkey: 'https://joinsharkey.org/ns#',
|
||||||
backgroundUrl: "sharkey:backgroundUrl",
|
backgroundUrl: 'sharkey:backgroundUrl',
|
||||||
listenbrainz: "sharkey:listenbrainz",
|
listenbrainz: 'sharkey:listenbrainz',
|
||||||
// vcard
|
// vcard
|
||||||
vcard: 'http://www.w3.org/2006/vcard/ns#',
|
vcard: 'http://www.w3.org/2006/vcard/ns#',
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { unique } from '@/misc/prelude/array.js';
|
import { unique } from '@/misc/prelude/array.js';
|
||||||
|
|
||||||
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {
|
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { unique } from '@/misc/prelude/array.js';
|
import { unique } from '@/misc/prelude/array.js';
|
||||||
|
|
||||||
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
// test is located in test/extract-mentions
|
// test is located in test/extract-mentions
|
||||||
|
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
|
|
||||||
export function extractMentions(nodes: mfm.MfmNode[]): mfm.MfmMention['props'][] {
|
export function extractMentions(nodes: mfm.MfmNode[]): mfm.MfmMention['props'][] {
|
||||||
// TODO: 重複を削除
|
// TODO: 重複を削除
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import RE2 from 're2';
|
import RE2 from 're2';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import { JSDOM } from 'jsdom';
|
import { JSDOM } from 'jsdom';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Entity } from 'megalodon';
|
import { Entity } from 'megalodon';
|
||||||
import mfm from '@sharkey/sfm-js';
|
import mfm from '@transfem-org/sfm-js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { MfmService } from '@/core/MfmService.js';
|
import { MfmService } from '@/core/MfmService.js';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
@ -9,9 +9,9 @@ import type { MiUser } from '@/models/User.js';
|
|||||||
import type { NoteEditRepository, NotesRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
import type { NoteEditRepository, NotesRepository, UserProfilesRepository, UsersRepository } from '@/models/_.js';
|
||||||
import { awaitAll } from '@/misc/prelude/await-all.js';
|
import { awaitAll } from '@/misc/prelude/await-all.js';
|
||||||
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
|
||||||
import { GetterService } from '../GetterService.js';
|
|
||||||
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
|
||||||
import { IdService } from '@/core/IdService.js';
|
import { IdService } from '@/core/IdService.js';
|
||||||
|
import { GetterService } from '../GetterService.js';
|
||||||
|
|
||||||
export enum IdConvertType {
|
export enum IdConvertType {
|
||||||
MastodonId,
|
MastodonId,
|
||||||
@ -94,10 +94,10 @@ export class MastoConverters {
|
|||||||
text_url: f.url,
|
text_url: f.url,
|
||||||
meta: {
|
meta: {
|
||||||
width: f.properties.width,
|
width: f.properties.width,
|
||||||
height: f.properties.height
|
height: f.properties.height,
|
||||||
},
|
},
|
||||||
description: f.comment ? f.comment : null,
|
description: f.comment ? f.comment : null,
|
||||||
blurhash: f.blurhash ? f.blurhash : null
|
blurhash: f.blurhash ? f.blurhash : null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ export class MastoConverters {
|
|||||||
sensitive: files.then(files => files.length > 0 ? files.some((f) => f.isSensitive) : false),
|
sensitive: files.then(files => files.length > 0 ? files.some((f) => f.isSensitive) : false),
|
||||||
spoiler_text: edit.cw ?? '',
|
spoiler_text: edit.cw ?? '',
|
||||||
poll: null,
|
poll: null,
|
||||||
media_attachments: files.then(files => files.length > 0 ? files.map((f) => this.encodeFile(f)) : [])
|
media_attachments: files.then(files => files.length > 0 ? files.map((f) => this.encodeFile(f)) : []),
|
||||||
};
|
};
|
||||||
lastDate = edit.updatedAt;
|
lastDate = edit.updatedAt;
|
||||||
history.push(awaitAll(item));
|
history.push(awaitAll(item));
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { Test } from '@nestjs/testing';
|
import { Test } from '@nestjs/testing';
|
||||||
|
|
||||||
import { CoreModule } from '@/core/CoreModule.js';
|
import { CoreModule } from '@/core/CoreModule.js';
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
|
|
||||||
import { parse } from '@sharkey/sfm-js';
|
import { parse } from '@transfem-org/sfm-js';
|
||||||
import { extractMentions } from '@/misc/extract-mentions.js';
|
import { extractMentions } from '@/misc/extract-mentions.js';
|
||||||
|
|
||||||
describe('Extract mentions', () => {
|
describe('Extract mentions', () => {
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"@rollup/plugin-json": "6.1.0",
|
"@rollup/plugin-json": "6.1.0",
|
||||||
"@rollup/plugin-replace": "5.0.5",
|
"@rollup/plugin-replace": "5.0.5",
|
||||||
"@rollup/pluginutils": "5.1.0",
|
"@rollup/pluginutils": "5.1.0",
|
||||||
"@sharkey/sfm-js": "0.24.4",
|
"@transfem-org/sfm-js": "0.24.4",
|
||||||
"@syuilo/aiscript": "0.17.0",
|
"@syuilo/aiscript": "0.17.0",
|
||||||
"@phosphor-icons/web": "^2.0.3",
|
"@phosphor-icons/web": "^2.0.3",
|
||||||
"@twemoji/parser": "15.0.0",
|
"@twemoji/parser": "15.0.0",
|
||||||
|
@ -178,7 +178,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, inject, onMounted, ref, shallowRef, Ref, watch, provide } from 'vue';
|
import { computed, inject, onMounted, ref, shallowRef, Ref, watch, provide } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkNoteSub from '@/components/MkNoteSub.vue';
|
import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||||
@ -477,7 +477,7 @@ function renote(visibility: Visibility | 'local') {
|
|||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (!appearNote.value.channel || appearNote.value.channel?.allowRenoteToExternal) {
|
} else if (!appearNote.value.channel || appearNote.value.channel.allowRenoteToExternal) {
|
||||||
const el = renoteButton.value as HTMLElement | null | undefined;
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
|
@ -170,7 +170,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<div v-if="!repliesLoaded" style="padding: 16px">
|
<div v-if="!repliesLoaded" style="padding: 16px">
|
||||||
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
|
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
|
||||||
</div>
|
</div>
|
||||||
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws" :onDeleteCallback="removeReply" />
|
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true" :expandAllCws="props.expandAllCws" :onDeleteCallback="removeReply"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
|
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
|
||||||
<MkPagination :pagination="renotesPagination" :disableAutoLoad="true">
|
<MkPagination :pagination="renotesPagination" :disableAutoLoad="true">
|
||||||
@ -221,7 +221,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, inject, onMounted, provide, ref, shallowRef, watch } from 'vue';
|
import { computed, inject, onMounted, provide, ref, shallowRef, watch } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkNoteSub from '@/components/MkNoteSub.vue';
|
import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||||
@ -501,7 +501,7 @@ function renote(visibility: Visibility | 'local') {
|
|||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
});
|
});
|
||||||
} else if (!appearNote.value.channel || appearNote.value.channel?.allowRenoteToExternal) {
|
} else if (!appearNote.value.channel || appearNote.value.channel.allowRenoteToExternal) {
|
||||||
const el = renoteButton.value as HTMLElement | null | undefined;
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
|
@ -102,7 +102,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed } from 'vue';
|
import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||||
import { toASCII } from 'punycode/';
|
import { toASCII } from 'punycode/';
|
||||||
|
@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import MkMediaList from '@/components/MkMediaList.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
import MkPoll from '@/components/MkPoll.vue';
|
import MkPoll from '@/components/MkPoll.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
|
@ -180,7 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, inject, onMounted, ref, shallowRef, Ref, watch, provide } from 'vue';
|
import { computed, inject, onMounted, ref, shallowRef, Ref, watch, provide } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import SkNoteSub from '@/components/SkNoteSub.vue';
|
import SkNoteSub from '@/components/SkNoteSub.vue';
|
||||||
import SkNoteHeader from '@/components/SkNoteHeader.vue';
|
import SkNoteHeader from '@/components/SkNoteHeader.vue';
|
||||||
@ -478,7 +478,7 @@ function renote(visibility: Visibility | 'local') {
|
|||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (!appearNote.value.channel || appearNote.value.channel?.allowRenoteToExternal) {
|
} else if (!appearNote.value.channel || appearNote.value.channel.allowRenoteToExternal) {
|
||||||
const el = renoteButton.value as HTMLElement | null | undefined;
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
|
@ -229,7 +229,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, inject, onMounted, onUnmounted, onUpdated, provide, ref, shallowRef, watch } from 'vue';
|
import { computed, inject, onMounted, onUnmounted, onUpdated, provide, ref, shallowRef, watch } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import SkNoteSub from '@/components/SkNoteSub.vue';
|
import SkNoteSub from '@/components/SkNoteSub.vue';
|
||||||
import SkNoteSimple from '@/components/SkNoteSimple.vue';
|
import SkNoteSimple from '@/components/SkNoteSimple.vue';
|
||||||
@ -510,7 +510,7 @@ function renote(visibility: Visibility | 'local') {
|
|||||||
os.toast(i18n.ts.renoted);
|
os.toast(i18n.ts.renoted);
|
||||||
renoted.value = true;
|
renoted.value = true;
|
||||||
});
|
});
|
||||||
} else if (!appearNote.value.channel || appearNote.value.channel?.allowRenoteToExternal) {
|
} else if (!appearNote.value.channel || appearNote.value.channel.allowRenoteToExternal) {
|
||||||
const el = renoteButton.value as HTMLElement | null | undefined;
|
const el = renoteButton.value as HTMLElement | null | undefined;
|
||||||
if (el) {
|
if (el) {
|
||||||
const rect = el.getBoundingClientRect();
|
const rect = el.getBoundingClientRect();
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { inject, onMounted, ref, shallowRef, computed } from 'vue';
|
import { inject, onMounted, ref, shallowRef, computed } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||||
import MkMediaList from '@/components/MkMediaList.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { VNode, h, defineAsyncComponent, SetupContext } from 'vue';
|
import { VNode, h, defineAsyncComponent, SetupContext } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import MkUrl from '@/components/global/MkUrl.vue';
|
import MkUrl from '@/components/global/MkUrl.vue';
|
||||||
import MkTime from '@/components/global/MkTime.vue';
|
import MkTime from '@/components/global/MkTime.vue';
|
||||||
@ -52,7 +52,7 @@ type MfmEvents = {
|
|||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
|
||||||
const isNote = props.isNote ?? true;
|
const isNote = props.isNote ?? true;
|
||||||
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat ? props.author?.speakAsCat : false : false : false;
|
const shouldNyaize = props.nyaize ? props.nyaize === 'respect' ? props.author?.isCat ? props.author.speakAsCat : false : false : false;
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||||
if (props.text == null || props.text === '') return;
|
if (props.text == null || props.text === '') return;
|
||||||
|
@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { TextBlock } from './block.type.js';
|
import { TextBlock } from './block.type.js';
|
||||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
|
|
||||||
export function checkAnimationFromMfm(nodes: mfm.MfmNode[]): boolean {
|
export function checkAnimationFromMfm(nodes: mfm.MfmNode[]): boolean {
|
||||||
const animatedNodes = mfm.extract(nodes, (node) => {
|
const animatedNodes = mfm.extract(nodes, (node) => {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
// test is located in test/extract-mentions
|
// test is located in test/extract-mentions
|
||||||
|
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
|
|
||||||
export function extractMentions(nodes: mfm.MfmNode[]): mfm.MfmMention['props'][] {
|
export function extractMentions(nodes: mfm.MfmNode[]): mfm.MfmMention['props'][] {
|
||||||
// TODO: 重複を削除
|
// TODO: 重複を削除
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as mfm from '@sharkey/sfm-js';
|
import * as mfm from '@transfem-org/sfm-js';
|
||||||
import { unique } from '@/scripts/array.js';
|
import { unique } from '@/scripts/array.js';
|
||||||
|
|
||||||
// unique without hash
|
// unique without hash
|
||||||
|
@ -115,9 +115,6 @@ importers:
|
|||||||
'@peertube/http-signature':
|
'@peertube/http-signature':
|
||||||
specifier: 1.7.0
|
specifier: 1.7.0
|
||||||
version: 1.7.0
|
version: 1.7.0
|
||||||
'@sharkey/sfm-js':
|
|
||||||
specifier: 0.24.4
|
|
||||||
version: 0.24.4
|
|
||||||
'@simplewebauthn/server':
|
'@simplewebauthn/server':
|
||||||
specifier: 9.0.0
|
specifier: 9.0.0
|
||||||
version: 9.0.0
|
version: 9.0.0
|
||||||
@ -133,6 +130,9 @@ importers:
|
|||||||
'@swc/core':
|
'@swc/core':
|
||||||
specifier: 1.3.105
|
specifier: 1.3.105
|
||||||
version: 1.3.105
|
version: 1.3.105
|
||||||
|
'@transfem-org/sfm-js':
|
||||||
|
specifier: 0.24.4
|
||||||
|
version: 0.24.4
|
||||||
'@twemoji/parser':
|
'@twemoji/parser':
|
||||||
specifier: 15.0.0
|
specifier: 15.0.0
|
||||||
version: 15.0.0
|
version: 15.0.0
|
||||||
@ -696,12 +696,12 @@ importers:
|
|||||||
'@rollup/pluginutils':
|
'@rollup/pluginutils':
|
||||||
specifier: 5.1.0
|
specifier: 5.1.0
|
||||||
version: 5.1.0(rollup@4.9.6)
|
version: 5.1.0(rollup@4.9.6)
|
||||||
'@sharkey/sfm-js':
|
|
||||||
specifier: 0.24.4
|
|
||||||
version: 0.24.4
|
|
||||||
'@syuilo/aiscript':
|
'@syuilo/aiscript':
|
||||||
specifier: 0.17.0
|
specifier: 0.17.0
|
||||||
version: 0.17.0
|
version: 0.17.0
|
||||||
|
'@transfem-org/sfm-js':
|
||||||
|
specifier: 0.24.4
|
||||||
|
version: 0.24.4
|
||||||
'@twemoji/parser':
|
'@twemoji/parser':
|
||||||
specifier: 15.0.0
|
specifier: 15.0.0
|
||||||
version: 15.0.0
|
version: 15.0.0
|
||||||
@ -5782,12 +5782,6 @@ packages:
|
|||||||
string-argv: 0.3.1
|
string-argv: 0.3.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@sharkey/sfm-js@0.24.4:
|
|
||||||
resolution: {integrity: sha512-m9reKRceS8kmFEPFlK2nhbN6mP9kE1I895WAc9OlFISMdT5L+IdvBW1NHv8dzjSPSTFZLeCfMHbys1oz+5uLuA==, tarball: https://git.joinsharkey.org/api/packages/Sharkey/npm/%40sharkey%2Fsfm-js/-/0.24.4/sfm-js-0.24.4.tgz}
|
|
||||||
dependencies:
|
|
||||||
'@twemoji/parser': 15.0.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@sideway/address@4.1.4:
|
/@sideway/address@4.1.4:
|
||||||
resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==}
|
resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -7513,6 +7507,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==}
|
resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@transfem-org/sfm-js@0.24.4:
|
||||||
|
resolution: {integrity: sha1-0wEXqL5UJseGFO4GGFRrES6NCDk=, tarball: https://activitypub.software/api/v4/projects/2/packages/npm/@transfem-org/sfm-js/-/@transfem-org/sfm-js-0.24.4.tgz}
|
||||||
|
dependencies:
|
||||||
|
'@twemoji/parser': 15.0.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@trysound/sax@0.2.0:
|
/@trysound/sax@0.2.0:
|
||||||
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
|
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
|
||||||
engines: {node: '>=10.13.0'}
|
engines: {node: '>=10.13.0'}
|
||||||
|
Loading…
Reference in New Issue
Block a user