Merge branch 'develop' into feat-1714
This commit is contained in:
		
						commit
						9a0366f4f3
					
				|  | @ -16,16 +16,16 @@ | |||
| - Fix: テーマプレビューが見れない問題を修正 | ||||
| 
 | ||||
| ### Server | ||||
| - チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正 | ||||
| - Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949) | ||||
| - Fix: ユーザーのフィードページのMFMをHTMLに展開するように (#14006) | ||||
| - Fix: アンテナ・クリップ・リスト・ウェブフックがロールポリシーの上限より一つ多く作れてしまうのを修正 (#14036) | ||||
| - Enhance: エンドポイント`clips/update`の必須項目を`clipId`のみに | ||||
| - Enhance: エンドポイント`admin/roles/update`の必須項目を`roleId`のみに | ||||
| - Enhance: エンドポイント`pages/update`の必須項目を`pageId`のみに | ||||
| - Enhance: エンドポイント`gallery/posts/update`の必須項目を`postId`のみに | ||||
| - Enhance: エンドポイント`i/webhook/update`の必須項目を`webhookId`のみに | ||||
| - Enhance: エンドポイント`admin/ad/update`の必須項目を`id`のみに | ||||
| - Fix: チャート生成時にinstance.suspentionStateに置き換えられたinstance.isSuspendedが参照されてしまう問題を修正 | ||||
| - Fix: ユーザーのフィードページのMFMをHTMLに展開するように (#14006) | ||||
| - Fix: アンテナ・クリップ・リスト・ウェブフックがロールポリシーの上限より一つ多く作れてしまうのを修正 (#14036) | ||||
| - Fix: notRespondingSinceが実装される前に不通になったインスタンスが自動的に配信停止にならない (#14059) | ||||
| - Fix: FTT有効時、タイムライン用エンドポイントで`sinceId`にキャッシュ内最古のものより古いものを指定した場合に正しく結果が返ってこない問題を修正 | ||||
| - Fix: 自分以外のクリップ内のノート個数が見えることがあるのを修正 | ||||
|  |  | |||
|  | @ -13,10 +13,12 @@ import { intersperse } from '@/misc/prelude/array.js'; | |||
| import { normalizeForSearch } from '@/misc/normalize-for-search.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 { DefaultTreeAdapterMap } from 'parse5'; | ||||
| import type * as mfm from 'mfm-js'; | ||||
| 
 | ||||
| const treeAdapter = TreeAdapter.defaultTreeAdapter; | ||||
| const treeAdapter = parse5.defaultTreeAdapter; | ||||
| type Node = DefaultTreeAdapterMap['node']; | ||||
| type ChildNode = DefaultTreeAdapterMap['childNode']; | ||||
| 
 | ||||
| const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/; | ||||
| const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/; | ||||
|  | @ -46,7 +48,7 @@ export class MfmService { | |||
| 
 | ||||
| 		return text.trim(); | ||||
| 
 | ||||
| 		function getText(node: TreeAdapter.Node): string { | ||||
| 		function getText(node: Node): string { | ||||
| 			if (treeAdapter.isTextNode(node)) return node.value; | ||||
| 			if (!treeAdapter.isElementNode(node)) return ''; | ||||
| 			if (node.nodeName === 'br') return '\n'; | ||||
|  | @ -58,7 +60,7 @@ export class MfmService { | |||
| 			return ''; | ||||
| 		} | ||||
| 
 | ||||
| 		function appendChildren(childNodes: TreeAdapter.ChildNode[]): void { | ||||
| 		function appendChildren(childNodes: ChildNode[]): void { | ||||
| 			if (childNodes) { | ||||
| 				for (const n of childNodes) { | ||||
| 					analyze(n); | ||||
|  | @ -66,14 +68,16 @@ export class MfmService { | |||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		function analyze(node: TreeAdapter.Node) { | ||||
| 		function analyze(node: Node) { | ||||
| 			if (treeAdapter.isTextNode(node)) { | ||||
| 				text += node.value; | ||||
| 				return; | ||||
| 			} | ||||
| 
 | ||||
| 			// Skip comment or document type node
 | ||||
| 			if (!treeAdapter.isElementNode(node)) return; | ||||
| 			if (!treeAdapter.isElementNode(node)) { | ||||
| 				return; | ||||
| 			} | ||||
| 
 | ||||
| 			switch (node.nodeName) { | ||||
| 				case 'br': { | ||||
|  | @ -81,8 +85,7 @@ export class MfmService { | |||
| 					break; | ||||
| 				} | ||||
| 
 | ||||
| 				case 'a': | ||||
| 				{ | ||||
| 				case 'a': { | ||||
| 					const txt = getText(node); | ||||
| 					const rel = node.attrs.find(x => x.name === 'rel'); | ||||
| 					const href = node.attrs.find(x => x.name === 'href'); | ||||
|  | @ -90,7 +93,7 @@ export class MfmService { | |||
| 					// ハッシュタグ
 | ||||
| 					if (normalizedHashtagNames && href && normalizedHashtagNames.has(normalizeForSearch(txt))) { | ||||
| 						text += txt; | ||||
| 					// メンション
 | ||||
| 						// メンション
 | ||||
| 					} else if (txt.startsWith('@') && !(rel && rel.value.startsWith('me '))) { | ||||
| 						const part = txt.split('@'); | ||||
| 
 | ||||
|  | @ -102,7 +105,7 @@ export class MfmService { | |||
| 						} else if (part.length === 3) { | ||||
| 							text += txt; | ||||
| 						} | ||||
| 					// その他
 | ||||
| 						// その他
 | ||||
| 					} else { | ||||
| 						const generateLink = () => { | ||||
| 							if (!href && !txt) { | ||||
|  | @ -130,8 +133,7 @@ export class MfmService { | |||
| 					break; | ||||
| 				} | ||||
| 
 | ||||
| 				case 'h1': | ||||
| 				{ | ||||
| 				case 'h1': { | ||||
| 					text += '【'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					text += '】\n'; | ||||
|  | @ -139,16 +141,14 @@ export class MfmService { | |||
| 				} | ||||
| 
 | ||||
| 				case 'b': | ||||
| 				case 'strong': | ||||
| 				{ | ||||
| 				case 'strong': { | ||||
| 					text += '**'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					text += '**'; | ||||
| 					break; | ||||
| 				} | ||||
| 
 | ||||
| 				case 'small': | ||||
| 				{ | ||||
| 				case 'small': { | ||||
| 					text += '<small>'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					text += '</small>'; | ||||
|  | @ -156,8 +156,7 @@ export class MfmService { | |||
| 				} | ||||
| 
 | ||||
| 				case 's': | ||||
| 				case 'del': | ||||
| 				{ | ||||
| 				case 'del': { | ||||
| 					text += '~~'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					text += '~~'; | ||||
|  | @ -165,8 +164,7 @@ export class MfmService { | |||
| 				} | ||||
| 
 | ||||
| 				case 'i': | ||||
| 				case 'em': | ||||
| 				{ | ||||
| 				case 'em': { | ||||
| 					text += '<i>'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					text += '</i>'; | ||||
|  | @ -207,8 +205,7 @@ export class MfmService { | |||
| 				case 'h3': | ||||
| 				case 'h4': | ||||
| 				case 'h5': | ||||
| 				case 'h6': | ||||
| 				{ | ||||
| 				case 'h6': { | ||||
| 					text += '\n\n'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					break; | ||||
|  | @ -221,8 +218,7 @@ export class MfmService { | |||
| 				case 'article': | ||||
| 				case 'li': | ||||
| 				case 'dt': | ||||
| 				case 'dd': | ||||
| 				{ | ||||
| 				case 'dd': { | ||||
| 					text += '\n'; | ||||
| 					appendChildren(node.childNodes); | ||||
| 					break; | ||||
|  |  | |||
|  | @ -29,7 +29,8 @@ | |||
| 
 | ||||
| 	let forceError = localStorage.getItem('forceError'); | ||||
| 	if (forceError != null) { | ||||
| 		renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.') | ||||
| 		renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.'); | ||||
| 		return; | ||||
| 	} | ||||
| 
 | ||||
| 	//#region Detect language & fetch translations
 | ||||
|  | @ -155,7 +156,12 @@ | |||
| 		document.head.appendChild(css); | ||||
| 	} | ||||
| 
 | ||||
| 	function renderError(code, details) { | ||||
| 	async function renderError(code, details) { | ||||
| 		// Cannot set property 'innerHTML' of null を回避
 | ||||
| 		if (document.readyState === 'loading') { | ||||
| 			await new Promise(resolve => window.addEventListener('DOMContentLoaded', resolve)); | ||||
| 		} | ||||
| 
 | ||||
| 		let errorsElement = document.getElementById('errors'); | ||||
| 
 | ||||
| 		if (!errorsElement) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue