Merge tag '2023.10.2' into merge-upstream

This commit is contained in:
riku6460
2023-10-21 18:25:55 +09:00
282 changed files with 4676 additions and 4314 deletions

View File

@@ -24,8 +24,7 @@ function getNoise(): string {
return counter.toString(36).padStart(2, '0').slice(-2);
}
export function genAid(date: Date): string {
const t = date.getTime();
export function genAid(t: number): string {
if (isNaN(t)) throw new Error('Failed to create AID: Invalid Date');
counter++;
return getTime(t) + getNoise();

View File

@@ -31,8 +31,7 @@ function getNoise(): string {
return counter.toString(36).padStart(NOISE_LENGTH, '0').slice(-NOISE_LENGTH);
}
export function genAidx(date: Date): string {
const t = date.getTime();
export function genAidx(t: number): string {
if (isNaN(t)) throw new Error('Failed to create AIDX: Invalid Date');
counter++;
return getTime(t) + nodeId + getNoise();

View File

@@ -29,8 +29,8 @@ function getRandom() {
return str;
}
export function genMeid(date: Date): string {
return getTime(date.getTime()) + getRandom();
export function genMeid(t: number): string {
return getTime(t) + getRandom();
}
export function parseMeid(id: string): { date: Date; } {

View File

@@ -29,8 +29,8 @@ function getRandom() {
return str;
}
export function genMeidg(date: Date): string {
return 'g' + getTime(date.getTime()) + getRandom();
export function genMeidg(t: number): string {
return 'g' + getTime(t) + getRandom();
}
export function parseMeidg(id: string): { date: Date; } {

View File

@@ -29,8 +29,8 @@ function getRandom() {
return str;
}
export function genObjectId(date: Date): string {
return getTime(date.getTime()) + getRandom();
export function genObjectId(t: number): string {
return getTime(t) + getRandom();
}
export function parseObjectId(id: string): { date: Date; } {

View File

@@ -1,20 +0,0 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-License-Identifier: AGPL-3.0-only
*/
export function nyaize(text: string): string {
return text
// ja-JP
.replaceAll('な', 'にゃ').replaceAll('ナ', 'ニャ').replaceAll('ナ', 'ニャ')
// en-US
.replace(/(?<=n)a/gi, x => x === 'A' ? 'YA' : 'ya')
.replace(/(?<=morn)ing/gi, x => x === 'ING' ? 'YAN' : 'yan')
.replace(/(?<=every)one/gi, x => x === 'ONE' ? 'NYAN' : 'nyan')
// ko-KR
.replace(/[나-낳]/g, match => String.fromCharCode(
match.charCodeAt(0)! + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
))
.replace(/(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm, '다냥')
.replace(/(야(?=\?))|(야$)|(야(?= ))/gm, '냥');
}