From 4f9aee899f4b3af4b415425aa9b700d51fcae234 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=81=82=E3=82=8F=E3=82=8F=E3=82=8F=E3=81=A8=E3=83=BC?=
=?UTF-8?q?=E3=81=AB=E3=82=85?=
<17376330+u1-liquid@users.noreply.github.com>
Date: Wed, 8 Jan 2025 03:50:25 +0900
Subject: [PATCH] =?UTF-8?q?spec(pages):=20URL=E3=81=A8=E3=81=97=E3=81=A6?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=A7=E3=81=8D=E3=82=8B=E6=96=87=E5=AD=97?=
=?UTF-8?q?=E3=82=92=E5=88=B6=E9=99=90=20(MisskeyIO#873)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/backend/src/server/api/endpoints/pages/create.ts | 2 +-
packages/backend/src/server/api/endpoints/pages/update.ts | 2 +-
packages/frontend/src/pages/page-editor/page-editor.vue | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts
index 305b62075835..2fb6463dfd48 100644
--- a/packages/backend/src/server/api/endpoints/pages/create.ts
+++ b/packages/backend/src/server/api/endpoints/pages/create.ts
@@ -52,7 +52,7 @@ export const paramDef = {
type: 'object',
properties: {
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 },
content: { type: 'array', items: {
type: 'object', additionalProperties: true,
diff --git a/packages/backend/src/server/api/endpoints/pages/update.ts b/packages/backend/src/server/api/endpoints/pages/update.ts
index 4d053537b5fc..3ab7fd7012b3 100644
--- a/packages/backend/src/server/api/endpoints/pages/update.ts
+++ b/packages/backend/src/server/api/endpoints/pages/update.ts
@@ -57,7 +57,7 @@ export const paramDef = {
properties: {
pageId: { type: 'string', format: 'misskey:id' },
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 },
content: { type: 'array', items: {
type: 'object', additionalProperties: true,
diff --git a/packages/frontend/src/pages/page-editor/page-editor.vue b/packages/frontend/src/pages/page-editor/page-editor.vue
index 31113e4bd2aa..d91e2e34c2a6 100644
--- a/packages/frontend/src/pages/page-editor/page-editor.vue
+++ b/packages/frontend/src/pages/page-editor/page-editor.vue
@@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._pages.summary }}
-
+
{{ url }}/@{{ author.username }}/pages/
{{ i18n.ts._pages.url }}
@@ -158,7 +158,7 @@ function save() {
if (pageId.value) {
options.pageId = pageId.value;
- misskeyApi('pages/update', options)
+ os.apiWithDialog('pages/update', options)
.then(page => {
currentName.value = name.value.trim();
os.alert({
@@ -167,7 +167,7 @@ function save() {
});
}).catch(onError);
} else {
- misskeyApi('pages/create', options)
+ os.apiWithDialog('pages/create', options)
.then(created => {
pageId.value = created.id;
currentName.value = name.value.trim();