Skip to content

Commit

Permalink
Merge branch 'engawa' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
1673beta committed Mar 22, 2024
2 parents 928a18d + 0570f77 commit 26d18ce
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 1 deletion.
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8105,6 +8105,14 @@ export interface Locale extends ILocale {
* ๆ–‡ๅญ—ใฎไธŠใซใƒซใƒ“ใ‚’่กจ็คบใ—ใพใ™ใ€‚
*/
"rubyDescription": string;
/**
* ใƒœใƒผใƒ€ใƒผ
*/
"border": string;
/**
* ๅ†…ๅฎนใ‚’ๆž ็ทšใงๅ›ฒใฟใพใ™ใ€‚
*/
"borderDescription": string;
};
"_instanceTicker": {
/**
Expand Down
4 changes: 3 additions & 1 deletion locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,7 @@ _mfm:
inlineCode: "ใ‚ณใƒผใƒ‰(ใ‚คใƒณใƒฉใ‚คใƒณ)"
inlineCodeDescription: "ใƒ—ใƒญใ‚ฐใƒฉใƒ ใชใฉใฎใ‚ณใƒผใƒ‰ใ‚’ใ‚คใƒณใƒฉใ‚คใƒณใงใ‚ทใƒณใ‚ฟใƒƒใ‚ฏใ‚นใƒใ‚คใƒฉใ‚คใƒˆใ—ใพใ™ใ€‚"
blockCode: "ใ‚ณใƒผใƒ‰(ใƒ–ใƒญใƒƒใ‚ฏ)"
blockCodeDescription: "่ค‡ๆ•ฐ่กŒใฎใƒ—ใƒญใ‚ฐใƒฉใƒ ใชใฉใฎใ‚ณใƒผใƒ‰ใ‚’ใƒ–ใƒญใƒƒใ‚ฏใงใ‚ทใƒณใ‚ฟใƒƒใ‚ฏใ‚นใƒใ‚คใƒฉใ‚คใƒˆใ—ใพใ™ใ€‚"
blockCodeDescription: "่ค‡ๆ•ฐ่กŒใฎใƒ—ใƒญใ‚ฐใƒฉใƒ ใชใฉใฎใ‚ณใƒผใƒ‰ใ‚’ใƒ–ใƒญใƒƒใ‚ฏใงใ‚ทใƒณใ‚ฟใƒƒใ‚ฏใ‚นใƒใ‚คใƒฉใ‚คใƒˆใ—ใพใ™ใ€‚ใ„ใใคใ‹ใฎ่จ€่ชžใ‚’ๆŒ‡ๅฎšใ™ใ‚‹ใจใใฎ่จ€่ชžใซๅˆใ‚ใ›ใŸใ‚ทใƒณใ‚ฟใƒƒใ‚ฏใ‚นใƒใ‚คใƒฉใ‚คใƒˆใซใชใ‚Šใพใ™ใ€‚"
inlineMath: "ๆ•ฐๅผ(ใ‚คใƒณใƒฉใ‚คใƒณ)"
inlineMathDescription: "ๆ•ฐๅผ(KaTeX)ใ‚’ใ‚คใƒณใƒฉใ‚คใƒณใง่กจ็คบใ—ใพใ™ใ€‚"
blockMath: "ๆ•ฐๅผ(ใƒ–ใƒญใƒƒใ‚ฏ)"
Expand Down Expand Up @@ -2119,6 +2119,8 @@ _mfm:
plainDescription: "ๅ†…ๅดใฎๆง‹ๆ–‡ใ‚’ๅ…จใฆ็„กๅŠนใซใ—ใพใ™ใ€‚"
ruby: "ใƒซใƒ“"
rubyDescription: "ๆ–‡ๅญ—ใฎไธŠใซใƒซใƒ“ใ‚’่กจ็คบใ—ใพใ™ใ€‚"
border: "border"
borderDescription: "ๅ†…ๅฎนใ‚’ๆž ็ทšใงๅ›ฒใ‚€ใ“ใจใŒใงใใพใ™ใ€‚"

_instanceTicker:
none: "่กจ็คบใ—ใชใ„"
Expand Down
64 changes: 64 additions & 0 deletions packages/backend/src/core/activitypub/models/ApPersonService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.j
import type { AccountMoveService } from '@/core/AccountMoveService.js';
import { checkHttps } from '@/misc/check-https.js';
import { AvatarDecorationService } from '@/core/AvatarDecorationService.js';
import { HttpRequestService } from '@/core/HttpRequestService.js';
import { isNotNull } from '@/misc/is-not-null.js';
import { getApId, getApType, getOneApHrefNullable, isActor, isCollection, isCollectionOrOrderedCollection, isPropertyValue } from '../type.js';
import { extractApHashtags } from './tag.js';
import type { OnModuleInit } from '@nestjs/common';
Expand Down Expand Up @@ -103,6 +105,7 @@ export class ApPersonService implements OnModuleInit {
private followingsRepository: FollowingsRepository,

private avatarDecorationService: AvatarDecorationService,
private httpRequestService: HttpRequestService,
) {
}

Expand Down Expand Up @@ -371,6 +374,34 @@ export class ApPersonService implements OnModuleInit {
});
//#endregion

let isReactionPublic = false;
let followingVisibility: 'private' | 'followers' | 'public' | undefined = typeof person.following === 'string' ? 'private' : 'public';
let followersVisibility: 'private' | 'followers' | 'public' | undefined = typeof person.followers === 'string' ? 'private' : 'public';
const instance = await this.instancesRepository.findOneBy({ host: host });

if (instance?.softwareName === 'misskey' || instance?.softwareName === 'cherrypick') {
const userHostUrl = `https://${host}`;
const showUserApiUrl = `${userHostUrl}/api/users/show`;
const res = await this.httpRequestService.send(showUserApiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ 'username': person.preferredUsername }),
});

const userData: any = await res.json();
if (userData.publicReactions === undefined ) {
isReactionPublic = userData.publicReactions;
}

if (userData._ffVisibility === undefined) {
followingVisibility = userData._ffVisibility;
followersVisibility = userData._ffVisibility;
} else {
followingVisibility = userData.followingVisibility;
followersVisibility = userData.followersVisibility;
}
}

try {
// Start transaction
await this.db.transaction(async transactionalEntityManager => {
Expand Down Expand Up @@ -439,6 +470,9 @@ export class ApPersonService implements OnModuleInit {
birthday: bday?.[0] ?? null,
location: person['vcard:Address'] ?? null,
userHost: host,
followersVisibility: followersVisibility,
followingVisibility: followingVisibility,
publicReactions: isReactionPublic,
}));

if (person.publicKey) {
Expand Down Expand Up @@ -549,10 +583,37 @@ export class ApPersonService implements OnModuleInit {

const url = getOneApHrefNullable(person.url);

const host = this.punyHost(uri);

if (url && !checkHttps(url)) {
throw new Error('unexpected schema of person url: ' + url);
}

let isReactionPublic = false;
let followingVisibility: 'private' | 'followers' | 'public' | undefined = typeof person.following === 'string' ? 'private' : 'public';
let followersVisibility: 'private' | 'followers' | 'public' | undefined = typeof person.followers === 'string' ? 'private' : 'public';
const instance = await this.instancesRepository.findOneBy({ host: host });

if (instance?.softwareName === 'misskey' || instance?.softwareName === 'cherrypick') {
const userHostUrl = `https://${host}`;
const showUserApiUrl = `${userHostUrl}/api/users/show`;
const res = await this.httpRequestService.send(showUserApiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ 'username': person.preferredUsername }),
});
const userData: any = await res.json();

if (userData.publicReactions === undefined ) {
isReactionPublic = userData.publicReactions;
}

if (userData._ffVisibility === undefined) {
followingVisibility = userData._ffVisibility;
followersVisibility = userData._ffVisibility;
}
}

let followersCount: number | undefined;

if (typeof person.followers === 'string') {
Expand Down Expand Up @@ -686,6 +747,9 @@ export class ApPersonService implements OnModuleInit {
description: _description,
birthday: bday?.[0] ?? null,
location: person['vcard:Address'] ?? null,
followersVisibility: followersVisibility,
followingVisibility: followingVisibility,
publicReactions: isReactionPublic,
});

this.globalEventService.publishInternalEvent('remoteUserUpdated', { id: exist.id });
Expand Down
11 changes: 11 additions & 0 deletions packages/frontend/src/pages/mfm-cheat-sheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,16 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</div>
</div>
<div :class="$style.section">
<div :class="$style.title">{{ i18n.ts._mfm.border }}</div>
<div :class="$style.content">
<p>{{ i18n.ts._mfm.borderDescription }}</p>
<div :class="$style.preview">
<Mfm :text="preview_border"/>
<MkTextarea v-model="preview_border" :class="$style.text"><span>MFM {{ i18n.ts.sample }}</span></MkTextarea>
</div>
</div>
</div>
</MkSpacer>
</MkStickyContainer>
</template>
Expand Down Expand Up @@ -432,6 +442,7 @@ const preview_fg = ref('$[fg.color=ffbcdc Cherry]$[fg.color=b1d3ff Pick]');
const preview_bg = ref('$[bg.color=ffbcdc Cherry]$[bg.color=b1d3ff Pick]');
const preview_plain = ref('<plain>**bold** @mention #hashtag `code` $[x2 ๐Ÿฎ]</plain>');
const preview_ruby = ref('$[ruby CherryPick Misskey]');
const preview_border = ref('$[border Example]\n$[border.color=ffbcdc Cherry]$[border.color=b1d3ff Pick]\n\n$[border $[position.x=1.5 MFM]\n$[position.x=1.5 ใชใ‚“ใ‚‚ใ‚ใ‹ใ‚‰ใ‚“]]\n$[border.noclip $[position.x=1.5 MFM]\n$[position.x=1.5 ๅฎŒๅ…จใซ็†่งฃใ—ใŸ]]\n\n$[border.radius=4 ่ง’ไธธใฎๅŠๅพ„] $[border.width=4 ๆž ็ทšใฎๅคชใ•]\n$[border.style=solid ใ“ใ‚ŒใŒๆ™ฎ้€š]\n$[border.style=hidden ๆž ็ทšใ‚’้š ใ›ใ‚‹]\n$[border.style=dotted ใƒ‰ใƒƒใƒˆ]\n$[border.style=dashed ็‚น็ทš]\n$[border.style=double ไบŒ้‡ๆž ]\n$[border.style=groove ้ก็ธ1]\n$[border.style=ridge ้ก็ธ2]\n$[border.style=inset ใ‚คใƒณใ‚ปใƒƒใƒˆ]\n$[border.style=outset ใ‚ขใ‚ฆใƒˆใ‚ปใƒƒใƒˆ] ');
const headerActions = computed(() => []);
Expand Down

0 comments on commit 26d18ce

Please sign in to comment.