spec(pages): URLとして使用できる文字を制限 (MisskeyIO#873)

This commit is contained in:
あわわわとーにゅ 2025-01-08 03:50:25 +09:00 committed by GitHub
parent e1ae455e4a
commit 4f9aee899f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View file

@ -52,7 +52,7 @@ export const paramDef = {
type: 'object', type: 'object',
properties: { properties: {
title: { type: 'string' }, title: { type: 'string' },
name: { type: 'string', minLength: 1 }, name: { type: 'string', minLength: 1, pattern: /^[a-zA-Z0-9_-]+$/.toString().slice(1, -1) },
summary: { type: 'string', nullable: true }, summary: { type: 'string', nullable: true },
content: { type: 'array', items: { content: { type: 'array', items: {
type: 'object', additionalProperties: true, type: 'object', additionalProperties: true,

View file

@ -57,7 +57,7 @@ export const paramDef = {
properties: { properties: {
pageId: { type: 'string', format: 'misskey:id' }, pageId: { type: 'string', format: 'misskey:id' },
title: { type: 'string' }, title: { type: 'string' },
name: { type: 'string', minLength: 1 }, name: { type: 'string', minLength: 1, pattern: /^[a-zA-Z0-9_-]+$/.toString().slice(1, -1) },
summary: { type: 'string', nullable: true }, summary: { type: 'string', nullable: true },
content: { type: 'array', items: { content: { type: 'array', items: {
type: 'object', additionalProperties: true, type: 'object', additionalProperties: true,

View file

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts._pages.summary }}</template> <template #label>{{ i18n.ts._pages.summary }}</template>
</MkInput> </MkInput>
<MkInput v-model="name"> <MkInput v-model="name" type="text" pattern="^[a-zA-Z0-9_-]+$" autocapitalize="off">
<template #prefix>{{ url }}/@{{ author.username }}/pages/</template> <template #prefix>{{ url }}/@{{ author.username }}/pages/</template>
<template #label>{{ i18n.ts._pages.url }}</template> <template #label>{{ i18n.ts._pages.url }}</template>
</MkInput> </MkInput>
@ -158,7 +158,7 @@ function save() {
if (pageId.value) { if (pageId.value) {
options.pageId = pageId.value; options.pageId = pageId.value;
misskeyApi('pages/update', options) os.apiWithDialog('pages/update', options)
.then(page => { .then(page => {
currentName.value = name.value.trim(); currentName.value = name.value.trim();
os.alert({ os.alert({
@ -167,7 +167,7 @@ function save() {
}); });
}).catch(onError); }).catch(onError);
} else { } else {
misskeyApi('pages/create', options) os.apiWithDialog('pages/create', options)
.then(created => { .then(created => {
pageId.value = created.id; pageId.value = created.id;
currentName.value = name.value.trim(); currentName.value = name.value.trim();