Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: 1.2.2 #602

Merged
merged 7 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG_YOJO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## 1.2.2
Cherrypick 4.13.0
Misskey 2024.10.1

### Release Date
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
Misskey 2024.10.1
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
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 };
}
}
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/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
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-if="appearNote.reactionAcceptance !== 'likeOnly' && appearNote.myReaction == null && defaultStore.state.showLikeButtonInNoteFooter" ref="heartReactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="i18n.ts.like" :class="$style.noteFooterButton" class="_button" @click="heartReact()">
<i class="ti ti-heart"></i>
</button>
<button v-if="defaultStore.state.showDoReactionButtonInNoteFooter" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="appearNote.reactionAcceptance === 'likeOnly' && appearNote.myReaction != null ? i18n.ts.unlike : appearNote.myReaction != null ? i18n.ts.editReaction : appearNote.reactionAcceptance === 'likeOnly' ? i18n.ts.like : i18n.ts.doReaction" :class="$style.noteFooterButton" class="_button" @click.stop="toggleReact()">
<button v-if="defaultStore.state.showDoReactionButtonInNoteFooter" ref="reactButton" v-vibrate="defaultStore.state.vibrateSystem ? [30, 50, 50] : []" v-tooltip="appearNote.reactionAcceptance === 'likeOnly' && appearNote.myReaction != null ? i18n.ts.unlike : appearNote.myReaction != null ? i18n.ts.editReaction : appearNote.reactionAcceptance === 'likeOnly' ? i18n.ts.like : i18n.ts.doReaction" :class="$style.noteFooterButton" class="_button" @click.stop="react()">
<i v-if="appearNote.reactionAcceptance === 'likeOnly' && appearNote.myReaction != null" class="ti ti-heart-filled" style="color: var(--MI_THEME-love);"></i>
<i v-else-if="appearNote.myReaction != null" class="ti ti-mood-edit" style="color: var(--MI_THEME-accent);"></i>
<i v-else-if="appearNote.reactionAcceptance === 'likeOnly'" class="ti ti-heart"></i>
Expand Down
30 changes: 23 additions & 7 deletions packages/frontend/src/components/MkSubNoteContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ SPDX-License-Identifier: AGPL-3.0-only
:enableAnimatedMfm="enableAnimatedMfm"
/>
<MkA v-if="note.renoteId" :class="$style.rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
<div v-if="defaultStore.state.showTranslateButtonInNote && (!defaultStore.state.useAutoTranslate || (!$i.policies.canUseAutoTranslate || (defaultStore.state.useAutoTranslate && (isLong || note.cw != null || !showContent)))) && instance.translatorAvailable && $i && $i.policies.canUseTranslator && note.text && isForeignLanguage && !note.isSchedule" style="padding-top: 5px; color: var(--MI_THEME-accent);">
<div v-if="defaultStore.state.showTranslateButtonInNote && (!defaultStore.state.useAutoTranslate || (!$i.policies.canUseAutoTranslate || (defaultStore.state.useAutoTranslate && (isLong || note.cw != null || !showContent)))) && instance.translatorAvailable && $i && $i.policies.canUseTranslator && (note.text || note.poll) && isForeignLanguage" style="padding-top: 5px; color: var(--MI_THEME-accent);">
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @click.stop="translate()">{{ i18n.ts.translateNote }}</button>
<button v-else class="_button" @click.stop="translation = null">{{ i18n.ts.close }}</button>
</div>
<div v-if="translating || translation" :class="$style.translation">
<MkLoading v-if="translating" mini/>
<div v-else-if="translation">
<b>{{ i18n.tsx.translatedFrom({ x: translation.sourceLang }) }}:</b><hr style="margin: 10px 0;">
<Mfm
<Mfm v-if="note.text"
:text="translation.text"
:author="note.user"
:nyaize="defaultStore.state.disableNyaize || noNyaize ? false : 'respect'"
Expand Down Expand Up @@ -459,12 +459,19 @@ async function clip(): Promise<void> {
os.popupMenu(await getNoteClipMenu({ note: note.value, isDeleted, currentClip: currentClip?.value }), clipButton.value).then(focus);
}

const isForeignLanguage: boolean = note.value.text != null && (() => {
const isForeignLanguage: boolean = (note.value.text != null || note.value.poll != null) && (() => {
const targetLang = (miLocalStorage.getItem('lang') ?? navigator.language).slice(0, 2);
const postLang = detectLanguage(note.value.text);
const choicesLang = note.value.poll?.choices.map((choice) => choice.text).join(' ') ?? '';
const pollLang = detectLanguage(choicesLang);
return postLang !== '' && (postLang !== targetLang || pollLang !== targetLang);
if (note.value.text) {
const postLang = detectLanguage(note.value.text);
if (postLang !== '' && postLang !== targetLang) return true;
}
if (note.value.poll) {
const foreignLang = note.value.poll.choices
.map((choice) => detectLanguage(choice.text))
.filter((lang) => lang !== targetLang).length;
if (0 < foreignLang) return true;
}
return false;
})();

if (defaultStore.state.useAutoTranslate && instance.translatorAvailable && $i.policies.canUseTranslator && $i.policies.canUseAutoTranslate && !isLong && (note.value.cw == null || showContent.value) && note.value.text && isForeignLanguage) translate();
Expand All @@ -474,6 +481,15 @@ async function translate(): Promise<void> {
collapsed.value = false;
translating.value = true;

if (note.value.text == null) {
translating.value = false;
translation.value = {
sourceLang: '',
text: '',
};
return;
}

vibrate(defaultStore.state.vibrateSystem ? 5 : []);

if (props.mock) {
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/src/pages/admin/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const noInquiryUrl = computed(() => isEmpty(instance.inquiryUrl));
const thereIsUnresolvedAbuseReport = ref(false);
const currentPage = computed(() => router.currentRef.value.child);
const updateAvailable = ref(false);
const releasesCherryPick = ref(null);
const releasesYojoArt = ref(null);

misskeyApi('admin/abuse-user-reports', {
state: 'unresolved',
Expand All @@ -81,11 +81,11 @@ misskeyApi('admin/abuse-user-reports', {

misskeyApi('admin/meta')
.then(meta => {
return fetch('https://api.github.com/repos/kokonect-link/cherrypick/releases')
return fetch('https://api.github.com/repos/yojo-art/cherrypick/releases')
.then(res => res.json())
.then(cherryPickData => {
releasesCherryPick.value = meta.enableReceivePrerelease ? cherryPickData : cherryPickData.filter(x => !x.prerelease);
if ((compareVersions(version, releasesCherryPick.value[0].tag_name) < 0) && (compareVersions(meta.skipCherryPickVersion, releasesCherryPick.value[0].tag_name) < 0)) {
releasesYojoArt.value = meta.enableReceivePrerelease ? cherryPickData : cherryPickData.filter(x => !x.prerelease);
if ((compareVersions(version, releasesYojoArt.value[0].tag_name) < 0) && (compareVersions(meta.skipCherryPickVersion, releasesYojoArt.value[0].tag_name) < 0)) {
updateAvailable.value = true;
}
});
Expand Down
Loading
Loading