Merge pull request 'main' (#9554) from main into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9554
This commit is contained in:
Kainoa Kanter 2023-02-04 20:42:37 +00:00
commit a60968f137
6 changed files with 12 additions and 16 deletions

View file

@ -11,10 +11,5 @@ pipeline:
password: password:
# Secret 'docker_password' needs to be set in the CI settings # Secret 'docker_password' needs to be set in the CI settings
from_secret: docker_password from_secret: docker_password
when:
# Push new version of tag latest if new push on main-branch
event: push
branch: main
depends_on: branch: main
- prSecurityCheck

View file

@ -2,9 +2,9 @@ export function nyaize(text: string): string {
return ( return (
text text
// ja-JP // ja-JP
.replace(/な/g, "にゃ") .replaceAll("な", "にゃ")
.replace(/ナ/g, "ニャ") .replaceAll("ナ", "ニャ")
.replace(/ナ/g, "ニャ") .replaceAll("ナ", "ニャ")
// en-US // en-US
.replace(/(?<=n)a/gi, (x) => (x === "A" ? "YA" : "ya")) .replace(/(?<=n)a/gi, (x) => (x === "A" ? "YA" : "ya"))
.replace(/(?<=morn)ing/gi, (x) => (x === "ING" ? "YAN" : "yan")) .replace(/(?<=morn)ing/gi, (x) => (x === "ING" ? "YAN" : "yan"))

View file

@ -93,7 +93,7 @@ export default define(meta, paramDef, async (ps, me) => {
try { try {
if (ps.tag) { if (ps.tag) {
if (!safeForSql(ps.tag)) throw new Error("Injection"); if (!safeForSql(normalizeForSearch(ps.tag))) throw "Injection";
query.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`); query.andWhere(`'{"${normalizeForSearch(ps.tag)}"}' <@ note.tags`);
} else { } else {
query.andWhere( query.andWhere(
@ -102,7 +102,8 @@ export default define(meta, paramDef, async (ps, me) => {
qb.orWhere( qb.orWhere(
new Brackets((qb) => { new Brackets((qb) => {
for (const tag of tags) { for (const tag of tags) {
if (!safeForSql(tag)) throw new Error("Injection"); if (!safeForSql(normalizeForSearch(ps.tag)))
throw "Injection";
qb.andWhere(`'{"${normalizeForSearch(tag)}"}' <@ note.tags`); qb.andWhere(`'{"${normalizeForSearch(tag)}"}' <@ note.tags`);
} }
}), }),

View file

@ -209,12 +209,12 @@ export default async function (
await Blockings.delete(blocking.id); await Blockings.delete(blocking.id);
} else { } else {
// それ以外は単純に例外 // それ以外は単純に例外
if (blocking != null) if (blocking)
throw new IdentifiableError( throw new IdentifiableError(
"710e8fb0-b8c3-4922-be49-d5d93d8e6a6e", "710e8fb0-b8c3-4922-be49-d5d93d8e6a6e",
"blocking", "blocking",
); );
if (blocked != null) if (blocked)
throw new IdentifiableError( throw new IdentifiableError(
"3338392a-f764-498d-8855-db939dcf8c48", "3338392a-f764-498d-8855-db939dcf8c48",
"blocked", "blocked",

View file

@ -38,8 +38,8 @@ export default async function (
}), }),
]); ]);
if (blocking != null) throw new Error("blocking"); if (blocking) throw new Error("blocking");
if (blocked != null) throw new Error("blocked"); if (blocked) throw new Error("blocked");
const followRequest = await FollowRequests.insert({ const followRequest = await FollowRequests.insert({
id: genId(), id: genId(),

View file

@ -316,7 +316,7 @@ function done(query?: any): boolean | void {
if (query == null) query = q.value; if (query == null) query = q.value;
if (query == null || typeof query !== 'string') return; if (query == null || typeof query !== 'string') return;
const q2 = query.replace(/:/g, ''); const q2 = query.replaceAll(':', '');
const exactMatchCustom = customEmojis.find(emoji => emoji.name === q2); const exactMatchCustom = customEmojis.find(emoji => emoji.name === q2);
if (exactMatchCustom) { if (exactMatchCustom) {
chosen(exactMatchCustom); chosen(exactMatchCustom);