Skip to content

Commit

Permalink
Merge branch 'develop' into fix-tuto-a
Browse files Browse the repository at this point in the history
  • Loading branch information
penginn-net authored Jan 5, 2025
2 parents 24980dd + c3e0bc7 commit 7a5a01c
Show file tree
Hide file tree
Showing 31 changed files with 384 additions and 157 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
## 1.3.0

### Release Date

### General
- Feat: システムユーザーのファイル一覧を追加 [#595](https://github.com/yojo-art/cherrypick/pull/595)

### Client
- Enhance: ノート詳細から前後のHTL/LTLを開く機能を追加 [#572](https://github.com/yojo-art/cherrypick/pull/572)
- Enhance: インポート時にライセンス欄にインポート元を追記する [#573](https://github.com/yojo-art/cherrypick/pull/573)
- Feat: コンパネのファイルに絵文字として利用中ラベルを表示する [#603](https://github.com/yojo-art/cherrypick/pull/603)

### Server
- Feat: フォローしているユーザーなら鍵ノートでもアンテナにひっかかるように [#568](https://github.com/yojo-art/cherrypick/pull/568)
- based-on https://github.com/team-shahu/misskey/pull/38

## 1.2.2
Cherrypick 4.13.0
Misskey 2024.10.1

### Release Date
xxxx-xx-xx
2024-12-27

### General
-

### Client
- Fix: ノート詳細画面でリアクション出来ない [#584](https://github.com/yojo-art/cherrypick/pull/584)
- Fix: タイムラインオプションで表示有無選択の選択肢を修正 [#590](https://github.com/yojo-art/cherrypick/pull/590)
- Fix: MFMチートシートが表示できない不具合を修正 [#592](https://github.com/yojo-art/cherrypick/pull/592)
- Fix: 引用や返信のノートすべてに翻訳ボタンが表示される [#598](https://github.com/yojo-art/cherrypick/pull/598)

### Server
-
- Fix:`api/ap/fetch-outbox`でリノートしか取得されないのを修正 [#588](https://github.com/yojo-art/cherrypick/pull/588)

## 1.2.1
Cherrypick 4.13.0
Expand Down
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,10 @@ export interface Locale extends ILocale {
* カスタム絵文字
*/
"customEmojis": string;
/**
* 詳細情報が利用できません
*/
"emojiRemoteDetailedUnavailable": string;
/**
* 絵文字
*/
Expand Down Expand Up @@ -4211,6 +4215,10 @@ export interface Locale extends ILocale {
* CWを維持する
*/
"keepCw": string;
/**
* %sが検索語句に置き換えられます
*/
"searchEngineDescription": string;
/**
* Pub/Subのアカウント
*/
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ selectWidget: "ウィジェットを選択"
editWidgets: "ウィジェットを編集"
editWidgetsExit: "編集を終了"
customEmojis: "カスタム絵文字"
emojiRemoteDetailedUnavailable: "詳細情報が利用できません"
emoji: "絵文字"
emojis: "絵文字"
emojiName: "絵文字名"
Expand Down Expand Up @@ -1044,6 +1045,7 @@ usernameInfo: "サーバー上であなたのアカウントを一意に識別
aiChanMode: "藍モード"
devMode: "開発者モード"
keepCw: "CWを維持する"
searchEngineDescription: "%sが検索語句に置き換えられます"
pubSub: "Pub/Subのアカウント"
lastCommunication: "直近の通信"
resolved: "解決済み"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yojo-art",
"version": "1.2.1",
"version": "1.2.2",
"basedMisskeyVersion": "2024.10.1",
"basedCherrypickVersion": "4.13.0",
"codename": "nasubi",
Expand Down
19 changes: 16 additions & 3 deletions packages/backend/src/core/AntennaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { GlobalEventService } from '@/core/GlobalEventService.js';
import * as Acct from '@/misc/acct.js';
import type { Packed } from '@/misc/json-schema.js';
import { DI } from '@/di-symbols.js';
import type { AntennasRepository, UserGroupJoiningsRepository, UserListMembershipsRepository } from '@/models/_.js';
import type { AntennasRepository, UserGroupJoiningsRepository, UserListMembershipsRepository, FollowingsRepository } from '@/models/_.js';
import { UtilityService } from '@/core/UtilityService.js';
import { bindThis } from '@/decorators.js';
import type { GlobalEvents } from '@/core/GlobalEventService.js';
import { FanoutTimelineService } from '@/core/FanoutTimelineService.js';
import { CacheService } from '@/core/CacheService.js';
import { deserializeAntenna } from './deserializeAntenna.js';
import type { OnApplicationShutdown } from '@nestjs/common';

Expand All @@ -41,6 +42,10 @@ export class AntennaService implements OnApplicationShutdown {
@Inject(DI.userListMembershipsRepository)
private userListMembershipsRepository: UserListMembershipsRepository,

@Inject(DI.followingsRepository)
private followingsRepository: FollowingsRepository,

private cacheService: CacheService,
private utilityService: UtilityService,
private globalEventService: GlobalEventService,
private fanoutTimelineService: FanoutTimelineService,
Expand Down Expand Up @@ -99,8 +104,16 @@ export class AntennaService implements OnApplicationShutdown {

@bindThis
public async checkHitAntenna(antenna: MiAntenna, note: (MiNote | Packed<'Note'>), noteUser: { id: MiUser['id']; username: string; host: string | null; isBot: boolean; }): Promise<boolean> {
if (note.visibility === 'specified') return false;
if (note.visibility === 'followers') return false;
if (note.visibility === 'specified') {
if (note.userId !== antenna.userId) {
if (note.visibleUserIds == null) return false;
if (!note.visibleUserIds.includes(antenna.userId)) return false;
}
}
if (note.visibility === 'followers') {
const isFollowing = Object.hasOwn(await this.cacheService.userFollowingsCache.fetch(antenna.userId), note.userId);
if (!isFollowing && antenna.userId !== note.userId) return false;
}

if (antenna.excludeBots && noteUser.isBot) return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export class ApOutboxFetchService implements OnModuleInit {
this.apLoggerService = this.moduleRef.get('ApLoggerService');
this.logger = this.apLoggerService.logger;
}

/**
* outboxから投稿を取得します
*/
Expand All @@ -85,14 +84,19 @@ export class ApOutboxFetchService implements OnModuleInit {
const cache = await this.redisClient.get(`${outboxUrl}--next`);
let next: string | IOrderedCollectionPage;

if (!cache) {
if (cache) {
next = cache;
} else {
// Resolve to (Ordered)Collection Object
const outbox = await Resolver.resolveOrderedCollection(outboxUrl);
if (!outbox.first) throw new IdentifiableError('a723c2df-0250-4091-b5fc-e3a7b36c7b61', 'outbox first page not exist');
next = outbox.first;
} else next = cache;
}

let created = 0;
let current = {
created: 0,
breaked: false,
};

for (let page = 0; page < pagelimit; page++) {
const collection = (typeof(next) === 'string' ? await Resolver.resolveOrderedCollectionPage(next) : next);
Expand All @@ -101,20 +105,26 @@ export class ApOutboxFetchService implements OnModuleInit {
const activityes = (collection.orderedItems ?? collection.items);
if (!activityes) throw new IdentifiableError('2a05bb06-f38c-4854-af6f-7fd5e87c98ee', 'item is unavailable');

created = await this.fetchObjects(user, activityes, includeAnnounce, created);
if (createLimit <= created) break;//次ページ見て一件だけしか取れないのは微妙
if (!collection.next) break;
do {
current = await this.fetchObjects(user, activityes, includeAnnounce, current.created);
page++;
}
while (!current.breaked && page < pagelimit);

if (!collection.next) break;
next = collection.next;
await this.redisClient.set(`${outboxUrl}--next`, `${next}`, 'EX', 60 * 15);//15min
}
this.logger.succ(`Outbox Fetced: ${outboxUrl}`);
}

@bindThis
private async fetchObjects(user: MiRemoteUser, activityes: any[], includeAnnounce:boolean, created: number): Promise<number> {
private async fetchObjects(user: MiRemoteUser, activityes: any[], includeAnnounce:boolean, created: number): Promise<{
created: number;
breaked: boolean;
}> {
for (const activity of activityes) {
if (createLimit < created) return created;
if (createLimit < created) return { created: created, breaked: true };
try {
if (activity.actor !== user.uri) throw new IdentifiableError('bde7c204-5441-4a87-9b7e-f81e8d05788a');
if (activity.type === 'Announce' && includeAnnounce) {
Expand Down Expand Up @@ -177,7 +187,7 @@ export class ApOutboxFetchService implements OnModuleInit {
}
} else if (isCreate(activity)) {
if (typeof(activity.object) !== 'string') {
if (!isNote(activity)) continue;
if (!isNote(activity.object)) continue;
}
const fetch = await this.apNoteService.fetchNote(activity.object);
if (fetch) continue;
Expand All @@ -190,11 +200,11 @@ export class ApOutboxFetchService implements OnModuleInit {
} else {
this.logger.error(`fetchError:${activity.id}`);
this.logger.error(`${err}`);
continue;
}
continue;
}
created ++;
}
return created;
return { created: created, breaked: false };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
userId: { type: 'string', format: 'misskey:id', nullable: true },
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) },
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
origin: { type: 'string', enum: ['combined', 'local', 'remote', 'system'], default: 'local' },
hostname: {
type: 'string',
nullable: true,
Expand Down Expand Up @@ -66,6 +66,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere('file.userHost IS NULL');
} else if (ps.origin === 'remote') {
query.andWhere('file.userHost IS NOT NULL');
} else if (ps.origin === 'system') {
query.andWhere('file.userId IS NULL');
}

if (ps.hostname) {
Expand Down
19 changes: 16 additions & 3 deletions packages/backend/test/e2e/antennas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,26 @@ describe('アンテナ', () => {
},
{
// https://github.com/misskey-dev/misskey/issues/9025
label: 'ただし、フォロワー限定投稿とDM投稿を含まない。フォロワーであっても。',
// https://github.com/yojo-art/cherrypick/pull/568
label: 'フォロワー限定投稿とDM投稿を含む',
parameters: () => ({}),
posts: [
{ note: (): Promise<Note> => post(userFollowedByAlice, { text: `${keyword}`, visibility: 'public' }), included: true },
{ note: (): Promise<Note> => post(userFollowedByAlice, { text: `${keyword}`, visibility: 'home' }), included: true },
{ note: (): Promise<Note> => post(userFollowedByAlice, { text: `${keyword}`, visibility: 'followers' }) },
{ note: (): Promise<Note> => post(userFollowedByAlice, { text: `${keyword}`, visibility: 'specified', visibleUserIds: [alice.id] }) },
{ note: (): Promise<Note> => post(userFollowedByAlice, { text: `${keyword}`, visibility: 'followers' }), included: true },
{ note: (): Promise<Note> => post(bob, { text: `${keyword}`, visibility: 'specified', visibleUserIds: [alice.id] }), included: true },
],
},
{
// https://github.com/misskey-dev/misskey/issues/9025
// https://github.com/yojo-art/cherrypick/pull/568
label: 'フォロワー限定投稿とDM投稿を含まない',
parameters: () => ({}),
posts: [
{ note: (): Promise<Note> => post(bob, { text: `${keyword}`, visibility: 'public' }), included: true },
{ note: (): Promise<Note> => post(bob, { text: `${keyword}`, visibility: 'home' }), included: true },
{ note: (): Promise<Note> => post(bob, { text: `${keyword}`, visibility: 'followers' }) },
{ note: (): Promise<Note> => post(bob, { text: `${keyword}`, visibility: 'specified', visibleUserIds: [carol.id] }) },
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"name": "cherrypick-js",
"version": "1.2.1",
"version": "1.2.2",
"basedMisskeyVersion": "2024.10.1",
"basedCherrypickVersion": "4.13.0",
"description": "yojo-art SDK for JavaScript",
Expand Down
2 changes: 1 addition & 1 deletion packages/cherrypick-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7550,7 +7550,7 @@ export type operations = {
* @default local
* @enum {string}
*/
origin?: 'combined' | 'local' | 'remote';
origin?: 'combined' | 'local' | 'remote' | 'system';
/**
* @description The local host is represented with `null`.
* @default null
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-embed/src/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { serverMetadata } from '@/server-metadata.js';
import { postMessageToParentWindow, setIframeId } from '@/post-message.js';
import { serverContext } from '@/server-context.js';

console.log('CherryPick Embed');
console.log('yojo-art Embed');

//#region Embedパラメータの取得・パース
const params = new URLSearchParams(location.search);
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/boot/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { createMainRouter } from '@/router/definition.js';
import { popup } from '@/os.js';

export async function common(createVue: () => App<Element>) {
console.info(`CherryPick v${version}`);
console.info(`yojo-art v${version}`);

if (_DEV_) {
console.warn('Development mode!!!');
Expand Down
60 changes: 60 additions & 0 deletions packages/frontend/src/components/MkFileListForAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ SPDX-License-Identifier: AGPL-3.0-only
class="file _button"
>
<div v-if="file.isSensitive" class="sensitive-label">{{ i18n.ts.sensitive }}</div>
<div v-if="customEmojiUrls.includes(file.url)" class="label">
<img class="labelImg" src="/client-assets/label.svg"/>
<p class="labelText">{{ i18n.ts.emoji }}</p>
</div>
<MkDriveFileThumbnail class="thumbnail" :file="file" fit="contain" :highlightWhenSensitive="true"/>
<div v-if="viewMode === 'list'" class="body">
<div>
Expand All @@ -38,12 +42,18 @@ SPDX-License-Identifier: AGPL-3.0-only

<script lang="ts" setup>
import * as Misskey from 'cherrypick-js';
import { ref, watch } from 'vue';
import MkPagination from '@/components/MkPagination.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import bytes from '@/filters/bytes.js';
import { i18n } from '@/i18n.js';
import { dateString } from '@/filters/date.js';
import { customEmojis } from '@/custom-emojis.js';

let customEmojiUrls = ref<string[]>([]);
watch(customEmojis, emojis => {
customEmojiUrls.value = emojis.map(emoji => emoji.url);
}, { immediate: true });
const props = defineProps<{
pagination: any;
viewMode: 'grid' | 'list';
Expand Down Expand Up @@ -114,5 +124,55 @@ const props = defineProps<{
}
}
}

.label {
position: absolute;
top: 0;
left: 0;
pointer-events: none;

&::before,
&::after {
content: "";
display: block;
position: absolute;
z-index: 1;
background: #0c7ac9;
}

&::before {
top: 0;
left: 57px;
width: 28px;
height: 8px;
}

&::after {
top: 57px;
left: 0;
width: 8px;
height: 28px;
}
}

.labelImg {
position: absolute;
z-index: 2;
top: 0;
left: 0;
}

.labelText {
position: absolute;
z-index: 3;
top: 19px;
left: -28px;
width: 120px;
margin: 0;
text-align: center;
line-height: 28px;
color: #fff;
transform: rotate(-45deg);
}
}
</style>
Loading

0 comments on commit 7a5a01c

Please sign in to comment.