2026.4.0-beta.0 #12

Merged
last2014 merged 11 commits from develop into main 2026-05-03 05:28:47 +00:00
Showing only changes of commit 2b21401587 - Show all commits
+31 -17
View File
@@ -17,22 +17,39 @@ export const createUeuse = async (data: ApiMap["ueuse/create"]["body"], title: s
const mem = Memory.memory; const mem = Memory.memory;
const maxLength = mem.max_length; const maxLength = mem.max_length;
const excessedMessage = "👉返信に続きがあります。"; const excessedMessage = "👉返信に続きがあります。";
let remainingText = data.text; // 行単位で分割
let lines = data.text.split(EOL);
let firstUniqid = ""; let firstUniqid = "";
while (remainingText.length > 0) { while (lines.length > 0) {
let currentText = ""; let currentText = "";
let bodyTextLength = 0;
const limit = maxLength - (excessedMessage.length + EOL.length * 2);
if (remainingText.length <= maxLength) { while (lines.length > 0) {
currentText = remainingText; const nextLine = lines[0];
bodyTextLength = remainingText.length; if (nextLine === undefined) break;
remainingText = "";
} else { if (nextLine.length > limit && currentText === "") {
bodyTextLength = maxLength - excessedMessage.length - 2; const targetLine = lines.shift() || "";
currentText = remainingText.slice(0, bodyTextLength) + EOL.repeat(2) + excessedMessage; currentText = targetLine.slice(0, limit);
remainingText = remainingText.slice(bodyTextLength);
lines.unshift(targetLine.slice(limit));
break;
}
const potentialText = currentText ? currentText + EOL + nextLine : nextLine;
if (potentialText.length <= limit) {
currentText = potentialText;
lines.shift();
} else {
break;
}
}
if (lines.length > 0) {
currentText += EOL.repeat(2) + excessedMessage;
} }
let postedUniqid = ""; let postedUniqid = "";
@@ -64,10 +81,7 @@ export const createUeuse = async (data: ApiMap["ueuse/create"]["body"], title: s
break; break;
} }
if (firstUniqid === "") { if (firstUniqid === "") firstUniqid = postedUniqid;
firstUniqid = postedUniqid;
}
console.log(`${title}を投稿:`, postedUniqid); console.log(`${title}を投稿:`, postedUniqid);
} }
} }