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:
Marie 2024-02-03 18:28:47 +00:00
commit f93a8e2d38
28 changed files with 197 additions and 197 deletions

2
.npmrc
View File

@ -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

View File

@ -83,7 +83,7 @@
"@nestjs/core": "10.2.10",
"@nestjs/testing": "10.2.10",
"@peertube/http-signature": "1.7.0",
"@sharkey/sfm-js": "0.24.4",
"@transfem-org/sfm-js": "0.24.4",
"@simplewebauthn/server": "9.0.0",
"@sinonjs/fake-timers": "11.2.2",
"@smithy/node-http-handler": "2.1.10",

View File

@ -13,7 +13,7 @@ import { intersperse } from '@/misc/prelude/array.js';
import type { IMentionedRemoteUsers } from '@/models/Note.js';
import { bindThis } from '@/decorators.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;

View File

@ -4,7 +4,7 @@
*/
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 * as Redis from 'ioredis';
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';

View File

@ -4,7 +4,7 @@
*/
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 * as Redis from 'ioredis';
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
@ -589,7 +589,7 @@ export class NoteEditService implements OnApplicationShutdown {
} else {
this.globalEventService.publishNoteStream(note.id, 'updated', {
cw: note.cw,
text: note.text!
text: note.text!,
});
}

View File

@ -4,7 +4,7 @@
*/
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 type { MiNote } from '@/models/Note.js';
import { bindThis } from '@/decorators.js';

View File

@ -6,7 +6,7 @@
import { createPublicKey, randomUUID } from 'node:crypto';
import { Inject, Injectable } from '@nestjs/common';
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 type { Config } from '@/config.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 { isNotNull } from '@/misc/is-not-null.js';
import { IdService } from '@/core/IdService.js';
import { MetaService } from '../MetaService.js';
import { LdSignatureService } from './LdSignatureService.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 { MetaService } from '../MetaService.js';
@Injectable()
export class ApRendererService {
@ -821,12 +821,12 @@ export class ApRendererService {
'_misskey_summary': 'misskey:_misskey_summary',
'isCat': 'misskey:isCat',
// Firefish
firefish: "https://joinfirefish.org/ns#",
speakAsCat: "firefish:speakAsCat",
firefish: 'https://joinfirefish.org/ns#',
speakAsCat: 'firefish:speakAsCat',
// Sharkey
sharkey: "https://joinsharkey.org/ns#",
backgroundUrl: "sharkey:backgroundUrl",
listenbrainz: "sharkey:listenbrainz",
sharkey: 'https://joinsharkey.org/ns#',
backgroundUrl: 'sharkey:backgroundUrl',
listenbrainz: 'sharkey:listenbrainz',
// vcard
vcard: 'http://www.w3.org/2006/vcard/ns#',
},

View File

@ -3,7 +3,7 @@
* 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';
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {

View File

@ -3,7 +3,7 @@
* 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';
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {

View File

@ -5,7 +5,7 @@
// 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'][] {
// TODO: 重複を削除

View File

@ -4,7 +4,7 @@
*/
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 ms from 'ms';
import { JSDOM } from 'jsdom';

View File

@ -1,6 +1,6 @@
import { Inject, Injectable } from '@nestjs/common';
import { Entity } from 'megalodon';
import mfm from '@sharkey/sfm-js';
import mfm from '@transfem-org/sfm-js';
import { DI } from '@/di-symbols.js';
import { MfmService } from '@/core/MfmService.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 { awaitAll } from '@/misc/prelude/await-all.js';
import { CustomEmojiService } from '@/core/CustomEmojiService.js';
import { GetterService } from '../GetterService.js';
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
import { IdService } from '@/core/IdService.js';
import { GetterService } from '../GetterService.js';
export enum IdConvertType {
MastodonId,
@ -94,10 +94,10 @@ export class MastoConverters {
text_url: f.url,
meta: {
width: f.properties.width,
height: f.properties.height
height: f.properties.height,
},
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),
spoiler_text: edit.cw ?? '',
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;
history.push(awaitAll(item));

View File

@ -4,7 +4,7 @@
*/
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 { CoreModule } from '@/core/CoreModule.js';

View File

@ -5,7 +5,7 @@
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';
describe('Extract mentions', () => {

View File

@ -24,7 +24,7 @@
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@sharkey/sfm-js": "0.24.4",
"@transfem-org/sfm-js": "0.24.4",
"@syuilo/aiscript": "0.17.0",
"@phosphor-icons/web": "^2.0.3",
"@twemoji/parser": "15.0.0",

View File

@ -178,7 +178,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
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 MkNoteSub from '@/components/MkNoteSub.vue';
import MkNoteHeader from '@/components/MkNoteHeader.vue';
@ -477,7 +477,7 @@ function renote(visibility: Visibility | 'local') {
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;
if (el) {
const rect = el.getBoundingClientRect();

View File

@ -221,7 +221,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
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 MkNoteSub from '@/components/MkNoteSub.vue';
import MkNoteSimple from '@/components/MkNoteSimple.vue';
@ -501,7 +501,7 @@ function renote(visibility: Visibility | 'local') {
os.toast(i18n.ts.renoted);
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;
if (el) {
const rect = el.getBoundingClientRect();

View File

@ -102,7 +102,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
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 insertTextAtCursor from 'insert-text-at-cursor';
import { toASCII } from 'punycode/';

View File

@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed } from 'vue';
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 MkPoll from '@/components/MkPoll.vue';
import MkButton from '@/components/MkButton.vue';

View File

@ -180,7 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
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 SkNoteSub from '@/components/SkNoteSub.vue';
import SkNoteHeader from '@/components/SkNoteHeader.vue';
@ -478,7 +478,7 @@ function renote(visibility: Visibility | 'local') {
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;
if (el) {
const rect = el.getBoundingClientRect();

View File

@ -229,7 +229,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
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 SkNoteSub from '@/components/SkNoteSub.vue';
import SkNoteSimple from '@/components/SkNoteSimple.vue';
@ -510,7 +510,7 @@ function renote(visibility: Visibility | 'local') {
os.toast(i18n.ts.renoted);
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;
if (el) {
const rect = el.getBoundingClientRect();

View File

@ -77,7 +77,7 @@
<script lang="ts" setup>
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 MkNoteSimple from '@/components/MkNoteSimple.vue';
import MkMediaList from '@/components/MkMediaList.vue';

View File

@ -4,7 +4,7 @@
*/
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 MkUrl from '@/components/global/MkUrl.vue';
import MkTime from '@/components/global/MkTime.vue';
@ -52,7 +52,7 @@ type MfmEvents = {
// eslint-disable-next-line import/no-default-export
export default function(props: MfmProps, context: SetupContext<MfmEvents>) {
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
if (props.text == null || props.text === '') return;

View File

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
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 { TextBlock } from './block.type.js';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';

View File

@ -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 {
const animatedNodes = mfm.extract(nodes, (node) => {

View File

@ -5,7 +5,7 @@
// 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'][] {
// TODO: 重複を削除

View File

@ -3,7 +3,7 @@
* 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';
// unique without hash

View File

@ -115,9 +115,6 @@ importers:
'@peertube/http-signature':
specifier: 1.7.0
version: 1.7.0
'@sharkey/sfm-js':
specifier: 0.24.4
version: 0.24.4
'@simplewebauthn/server':
specifier: 9.0.0
version: 9.0.0
@ -133,6 +130,9 @@ importers:
'@swc/core':
specifier: 1.3.105
version: 1.3.105
'@transfem-org/sfm-js':
specifier: 0.24.4
version: 0.24.4
'@twemoji/parser':
specifier: 15.0.0
version: 15.0.0
@ -696,12 +696,12 @@ importers:
'@rollup/pluginutils':
specifier: 5.1.0
version: 5.1.0(rollup@4.9.6)
'@sharkey/sfm-js':
specifier: 0.24.4
version: 0.24.4
'@syuilo/aiscript':
specifier: 0.17.0
version: 0.17.0
'@transfem-org/sfm-js':
specifier: 0.24.4
version: 0.24.4
'@twemoji/parser':
specifier: 15.0.0
version: 15.0.0
@ -5782,12 +5782,6 @@ packages:
string-argv: 0.3.1
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:
resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==}
dependencies:
@ -7513,6 +7507,12 @@ packages:
resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==}
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:
resolution: {integrity: sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==}
engines: {node: '>=10.13.0'}