Compare commits

...

24 commits

Author SHA1 Message Date
Marie
af5ebdfced
merge: more upstream changes 2024-02-07 21:52:27 +01:00
syuilo
52bf808d89 typo 2024-02-07 20:52:23 +09:00
かっこかり
155896a851
enhance(frontend/HorizontalSwipe): 操作性の改善 (#13038)
* Update swipe thresholds and touch-action

* スワイプ中にPullToRefreshが反応しないように

* 横スワイプに関与する可能性のある要素がある場合はスワイプを発火しないように

* update threshold

* isSwipingを外部化

* rename

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2024-02-07 20:02:29 +09:00
MeiMei
313ce82192
正しい 2024.2.0-beta.10 改版手順? (#13173)
* 正しい 2024.2.0-beta.10 改版手順?

* run build-misskey-js-with-types
2024-02-07 19:59:06 +09:00
1Step621
56d7f58626
Fix(frontend): MkCodeEditorで行がずれていくのを修正 (#13188)
* MkCodeEditorで行がずれていくのを修正

* update CHANGELOG.md
2024-02-07 19:58:21 +09:00
MeiMei
e89d760240
Enhance: 連合向けのノート配信を軽量化 (#13192)
* AP HTML表現をシンプルに

* a

* CHANGELOG

* リンク
2024-02-07 19:57:59 +09:00
おさむのひと
c81b61eb2e
fix(misskey-js): 自動生成物の冒頭からバージョンと日付を削除 (#13185) 2024-02-06 21:03:29 +09:00
かっこかり
500ea793b3
fix(bubble-game): 共有用画像のコメントにnullが入る問題を修正 (#13183) 2024-02-06 19:24:52 +09:00
Kisaragi
93e711d8a9
chore(frontend): reword possible typo (#13182) 2024-02-06 17:17:52 +09:00
1Step621
653ca7e708
CHANGELOGを修正 (#13181) 2024-02-06 16:55:21 +09:00
MeiMei
d6cb68b091
AP Key の JSON-LD 表現を修正 (#13170) 2024-02-06 16:51:14 +09:00
かっこかり
6829ecb509
enhance(frontend): リモートへの引用リノートと同一のリンクにはリンクプレビューを表示しないように (#13178)
* enhance(frontend): リモートへの引用リノートと同一のリンクにはリンクプレビューを表示しないように

* Update Changelog

---------

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
2024-02-06 16:49:57 +09:00
Soli
4bf3974abd
fix(frontend): エラー画像URLを設定した後解除すると,デフォルトの画像が表示されない問題の修正 (#13172)
Co-authored-by: かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>
2024-02-06 16:47:17 +09:00
1Step621
74245df382
Enhance(frontend): フロント側でもリアクション権限のチェックをするように (#13134)
* フロント側でもリアクション権限のチェックをするように

* update CHANGELOG.md

* lint fixes

* remove unrelated diffs

* deny -> reject
denyは「(信用しないことを理由に)拒否する」という意味らしい

* allow -> accept

* EmojiSimpleにlocalOnlyを含めるように

* リアクション権限のない絵文字は打てないように(ダイアログを出すのではなく)

* regenerate type definitions

* lint fix

* remove unused locales

* remove unnecessary async
2024-02-06 16:45:21 +09:00
かっこかり
edb39a089d
enhance(frontend): KeepAliveのページキャッシュを削除できるように (#13180)
* enhance(frontend): 内部のページキャッシュを削除できるように

* Update Changelog
2024-02-06 16:26:03 +09:00
かっこかり
16eccad492
enhance(frontend): シンタックスハイライトにテーマを適用できるように (#13175)
* enhance(frontend): シンタックスハイライトにテーマを適用できるように

* Update Changelog

* こっちも

* テーマの値がディープマージされるように

* 常にテーマ設定に準じるように

* テーマ更新時に新しいshikiテーマを読み込むように
2024-02-06 15:03:07 +09:00
syuilo
2f54a53062 2024.2.0-beta.10 2024-02-05 21:08:05 +09:00
zyoshoka
0df069494e
refactor(frontend): os.popup()eventsの型チェックを有効化 (#13165) 2024-02-05 15:02:30 +09:00
taichan
ddfc3b8a6a
Fix(frontend): クロップ後の解像度が異様に低くなる問題の修正&クロップに失敗する問題&コメントにnullという文字列が入る問題の修正 (#13162)
* Fix(frontend): Fix resolution of cropped image (misskey-dev#11489)

* CHANGELOG

* Fix(frontend): クロップの際、folderIdがnullだと文字列のnullが送られ検索できない問題

* Fix: キャプションが存在しないときにクロップすると'null'がキャプションに入ってしまう問題 (misskey-dev#11813)

* Update CHANGELOG
2024-02-05 15:01:31 +09:00
syuilo
c5ac2ae163
New Crowdin updates (#13156)
* New translations ja-jp.yml (Italian)

* New translations ja-jp.yml (Italian)

* New translations ja-jp.yml (Korean)

* New translations ja-jp.yml (Korean (Gyeongsang))

* New translations ja-jp.yml (Korean (Gyeongsang))

* New translations ja-jp.yml (Korean)

* New translations ja-jp.yml (Catalan)

* New translations ja-jp.yml (Catalan)

* New translations ja-jp.yml (Catalan)

* New translations ja-jp.yml (Catalan)

* New translations ja-jp.yml (Catalan)
2024-02-05 11:03:55 +09:00
syuilo
03351cec0c update patrons 2024-02-05 11:03:12 +09:00
Gianni Ceccarelli
dabf1867fd
keep cached avatar&banner when refresh fails to get new values (#13145)
* keep cached avatar&banner when refresh fails to get new values

when the remote explicitly tells us a user image is gone, we remove
our cached value, but if we fail to get the image, we keep whatever
value we already have

this should minimise the problem of avatars randomly disappearing

* autogen bits

* pnpm run build-misskey-js-with-types

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2024-02-04 21:03:49 +09:00
Gianni Ceccarelli
bafef1f8b4
ignore instance.actor when checking if there are local users (#13146)
* ignore `instance.actor` when checking if there are local users

We've seen this happen a few times:

* there was some AP software at $some_domain
* it gets replaced by Misskey
* before the first user can be created, an AP activity comes in
* Misskey resolves the activity
* to do this, it creates the `instance.actor` to sign its request
* now there *is* a local user, so the `meta` endpoint returns
  `requireSetup:false`
* the admin is very confused

This commit factors out the check, and doesn't count the
`instance.actor` as a real user.

* autogen bits
2024-02-04 20:46:28 +09:00
atsuchan
2c4ba4723f
fix(backend): メール配信機能が無効ならばメールを送ることのないように (#13152)
Do not send email if email delivery is disabled
2024-02-04 20:44:35 +09:00
11 changed files with 123 additions and 23 deletions

View file

@ -73,6 +73,7 @@
- Fix: キャプションが空の画像をクロップするとキャプションにnullという文字列が入ってしまう問題の修正
- Fix: プロフィールを編集してもリロードするまで反映されない問題を修正
- Fix: エラー画像URLを設定した後解除するとデフォルトの画像が表示されない問題の修正
- Fix: MkCodeEditorで行がずれていってしまう問題の修正
### Server
- Enhance: 連合先のレートリミットに引っかかった際にリトライするようになりました
@ -87,6 +88,7 @@
- Fix: properly handle cc followers
- Fix: ジョブに関する設定の名前を修正 relashionshipJobPerSec -> relationshipJobPerSec
- Fix: コントロールパネル->モデレーション->「誰でも新規登録できるようにする」の初期値をONからOFFに変更 #13122
- Enhance: 連合向けのノート配信を軽量化 #13192
### Service Worker
- Enhance: オフライン表示のデザインを改善・多言語対応

View file

@ -419,6 +419,10 @@ export class MfmService {
},
text: (node) => {
if (!node.props.text.match(/[\r\n]/)) {
return doc.createTextNode(node.props.text);
}
const el = doc.createElement('span');
const nodes = node.props.text.split(/\r\n|\r|\n/).map(x => doc.createTextNode(x));

View file

@ -25,8 +25,21 @@ export class ApMfmService {
}
@bindThis
public getNoteHtml(note: MiNote): string | null {
if (!note.text) return '';
return this.mfmService.toHtml(mfm.parse(note.text), note.mentionedRemoteUsers ? JSON.parse(note.mentionedRemoteUsers) : []);
public getNoteHtml(note: MiNote, apAppend?: string) {
let noMisskeyContent = false;
const srcMfm = (note.text ?? '') + (apAppend ?? '');
const parsed = mfm.parse(srcMfm);
if (!apAppend && parsed?.every(n => ['text', 'unicodeEmoji', 'emojiCode', 'mention', 'hashtag', 'url'].includes(n.type))) {
noMisskeyContent = true;
}
const content = this.mfmService.toHtml(parsed, JSON.parse(note.mentionedRemoteUsers));
return {
content,
noMisskeyContent,
};
}
}

View file

@ -409,17 +409,15 @@ export class ApRendererService {
poll = await this.pollsRepository.findOneBy({ noteId: note.id });
}
let apText = text;
let apAppend = '';
if (quote) {
apText += `\n\nRE: ${quote}`;
apAppend += `\n\nRE: ${quote}`;
}
const summary = note.cw === '' ? String.fromCharCode(0x200B) : note.cw;
const content = this.apMfmService.getNoteHtml(Object.assign({}, note, {
text: apText,
}));
const { content, noMisskeyContent } = this.apMfmService.getNoteHtml(note, apAppend);
const emojis = await this.getEmojis(note.emojis);
const apemojis = emojis.filter(emoji => !emoji.localOnly).map(emoji => this.renderEmoji(emoji));
@ -432,9 +430,6 @@ export class ApRendererService {
const asPoll = poll ? {
type: 'Question',
content: this.apMfmService.getNoteHtml(Object.assign({}, note, {
text: text,
})),
[poll.expiresAt && poll.expiresAt < new Date() ? 'closed' : 'endTime']: poll.expiresAt,
[poll.multiple ? 'anyOf' : 'oneOf']: poll.choices.map((text, i) => ({
type: 'Note',
@ -452,11 +447,13 @@ export class ApRendererService {
attributedTo,
summary: summary ?? undefined,
content: content ?? undefined,
_misskey_content: text,
source: {
content: text,
mediaType: 'text/x.misskeymarkdown',
},
...(noMisskeyContent ? {} : {
_misskey_content: text,
source: {
content: text,
mediaType: 'text/x.misskeymarkdown',
},
}),
_misskey_quote: quote,
quoteUrl: quote,
quoteUri: quote,

View file

@ -0,0 +1,44 @@
import * as assert from 'assert';
import { Test } from '@nestjs/testing';
import { CoreModule } from '@/core/CoreModule.js';
import { ApMfmService } from '@/core/activitypub/ApMfmService.js';
import { GlobalModule } from '@/GlobalModule.js';
import { MiNote } from '@/models/Note.js';
describe('ApMfmService', () => {
let apMfmService: ApMfmService;
beforeAll(async () => {
const app = await Test.createTestingModule({
imports: [GlobalModule, CoreModule],
}).compile();
apMfmService = app.get<ApMfmService>(ApMfmService);
});
describe('getNoteHtml', () => {
test('Do not provide _misskey_content for simple text', () => {
const note: MiNote = {
text: 'テキスト #タグ @mention 🍊 :emoji: https://example.com',
mentionedRemoteUsers: '[]',
} as any;
const { content, noMisskeyContent } = apMfmService.getNoteHtml(note);
assert.equal(noMisskeyContent, true, 'noMisskeyContent');
assert.equal(content, '<p>テキスト <a href="http://misskey.local/tags/タグ" rel="tag">#タグ</a> <a href="http://misskey.local/@mention" class="u-url mention">@mention</a> 🍊 :emoji: <a href="https://example.com">https://example.com</a></p>', 'content');
});
test('Provide _misskey_content for MFM', () => {
const note: MiNote = {
text: '$[tada foo]',
mentionedRemoteUsers: '[]',
} as any;
const { content, noMisskeyContent } = apMfmService.getNoteHtml(note);
assert.equal(noMisskeyContent, false, 'noMisskeyContent');
assert.equal(content, '<p><i>foo</i></p>', 'content');
});
});
});

View file

@ -33,6 +33,12 @@ describe('MfmService', () => {
const output = '<p><span>foo<br>bar<br>baz</span></p>';
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
});
test('Do not generate unnecessary span', () => {
const input = 'foo $[tada bar]';
const output = '<p>foo <i>bar</i></p>';
assert.equal(mfmService.toHtml(mfm.parse(input)), output);
});
});
describe('fromHtml', () => {

View file

@ -93,6 +93,7 @@ watch(() => props.lang, (to) => {
overflow: auto;
border-radius: var(--radius-sm);
border: 1px solid var(--divider);
font-family: Consolas, Monaco, Andale Mono, Ubuntu Mono, monospace;
color: var(--shiki-fallback);
background-color: var(--shiki-fallback-bg);

View file

@ -25,11 +25,11 @@ SPDX-License-Identifier: AGPL-3.0-only
</Transition>
</div>
</template>
<script lang="ts" setup>
import { ref, shallowRef, computed, nextTick, watch } from 'vue';
import type { Tab } from '@/components/global/MkPageHeader.tabs.vue';
import { defaultStore } from '@/store.js';
import { isHorizontalSwipeSwiping as isSwiping } from '@/scripts/touch.js';
const rootEl = shallowRef<HTMLDivElement>();
@ -49,16 +49,16 @@ const shouldAnimate = computed(() => defaultStore.reactiveState.enableHorizontal
// //
//
const MIN_SWIPE_DISTANCE = 50;
const MIN_SWIPE_DISTANCE = 20;
//
const SWIPE_DISTANCE_THRESHOLD = 125;
const SWIPE_DISTANCE_THRESHOLD = 70;
// Y
const SWIPE_ABORT_Y_THRESHOLD = 75;
//
const MAX_SWIPE_DISTANCE = 150;
const MAX_SWIPE_DISTANCE = 120;
// //
@ -68,7 +68,6 @@ let startScreenY: number | null = null;
const currentTabIndex = computed(() => props.tabs.findIndex(tab => tab.key === tabModel.value));
const pullDistance = ref(0);
const isSwiping = ref(false);
const isSwipingForClass = ref(false);
let swipeAborted = false;
@ -77,6 +76,8 @@ function touchStart(event: TouchEvent) {
if (event.touches.length !== 1) return;
if (hasSomethingToDoWithXSwipe(event.target as HTMLElement)) return;
startScreenX = event.touches[0].screenX;
startScreenY = event.touches[0].screenY;
}
@ -90,6 +91,8 @@ function touchMove(event: TouchEvent) {
if (swipeAborted) return;
if (hasSomethingToDoWithXSwipe(event.target as HTMLElement)) return;
let distanceX = event.touches[0].screenX - startScreenX;
let distanceY = event.touches[0].screenY - startScreenY;
@ -139,6 +142,8 @@ function touchEnd(event: TouchEvent) {
if (!isSwiping.value) return;
if (hasSomethingToDoWithXSwipe(event.target as HTMLElement)) return;
const distance = event.changedTouches[0].screenX - startScreenX;
if (Math.abs(distance) > SWIPE_DISTANCE_THRESHOLD) {
@ -162,6 +167,24 @@ function touchEnd(event: TouchEvent) {
}, 400);
}
/** 横スワイプに関与する可能性のある要素を調べる */
function hasSomethingToDoWithXSwipe(el: HTMLElement) {
if (['INPUT', 'TEXTAREA'].includes(el.tagName)) return true;
if (el.isContentEditable) return true;
if (el.scrollWidth > el.clientWidth) return true;
const style = window.getComputedStyle(el);
if (['absolute', 'fixed', 'sticky'].includes(style.position)) return true;
if (['scroll', 'auto'].includes(style.overflowX)) return true;
if (style.touchAction === 'pan-x') return true;
if (el.parentElement && el.parentElement !== rootEl.value) {
return hasSomethingToDoWithXSwipe(el.parentElement);
} else {
return false;
}
}
const transitionName = ref<'swipeAnimationLeft' | 'swipeAnimationRight' | undefined>(undefined);
watch(tabModel, (newTab, oldTab) => {
@ -182,6 +205,7 @@ watch(tabModel, (newTab, oldTab) => {
<style lang="scss" module>
.transitionRoot {
touch-action: pan-y pinch-zoom;
display: grid;
grid-template-columns: 100%;
overflow: clip;

View file

@ -26,6 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { onMounted, onUnmounted, ref, shallowRef } from 'vue';
import { i18n } from '@/i18n.js';
import { getScrollContainer } from '@/scripts/scroll.js';
import { isHorizontalSwipeSwiping } from '@/scripts/touch.js';
const SCROLL_STOP = 10;
const MAX_PULL_DISTANCE = Infinity;
@ -129,7 +130,7 @@ function moveEnd() {
function moving(event: TouchEvent | PointerEvent) {
if (!isPullStart.value || isRefreshing.value || disabled) return;
if ((scrollEl?.scrollTop ?? 0) > (supportPointerDesktop ? SCROLL_STOP : SCROLL_STOP + pullDistance.value)) {
if ((scrollEl?.scrollTop ?? 0) > (supportPointerDesktop ? SCROLL_STOP : SCROLL_STOP + pullDistance.value) || isHorizontalSwipeSwiping.value) {
pullDistance.value = 0;
isPullEnd.value = false;
moveEnd();
@ -148,6 +149,10 @@ function moving(event: TouchEvent | PointerEvent) {
if (event.cancelable) event.preventDefault();
}
if (pullDistance.value > SCROLL_STOP) {
event.stopPropagation();
}
isPullEnd.value = pullDistance.value >= FIRE_THRESHOLD;
}

View file

@ -3,6 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ref } from 'vue';
import { deviceKind } from '@/scripts/device-kind.js';
const isTouchSupported = 'maxTouchPoints' in navigator && navigator.maxTouchPoints > 0;
@ -16,3 +17,6 @@ if (isTouchSupported && !isTouchUsing) {
isTouchUsing = true;
}, { passive: true });
}
/** (MkHorizontalSwipe) 横スワイプ中か? */
export const isHorizontalSwipeSwiping = ref(false);

View file

@ -1,7 +1,7 @@
{
"type": "module",
"name": "misskey-js",
"version": "2024.2.0-beta.8",
"version": "2024.2.0-beta.10",
"description": "Misskey SDK for JavaScript",
"types": "./built/dts/index.d.ts",
"exports": {