diff --git a/CHANGELOG.md b/CHANGELOG.md index f12e24209b..5d36875eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,20 @@ (Cherry-picked from https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/883) ### Client +- Fix: パスキーでパスワードレスログインが出来ない問題を修正 - Fix: 一部環境でセンシティブなファイルを含むノートの非表示が効かない問題 - Fix: データセーバー有効時にもユーザーページの「ファイル」タブで画像が読み込まれてしまう問題を修正 +- Fix: MFMの `sparkle` エフェクトが正しく表示されない問題を修正 +- Fix: ページのURLにスラッシュが含まれている場合にページが正しく表示されない問題を修正 +- Fix: デッキのプロファイルが新規作成できない問題を修正 +- Fix: セキュリティに関する修正 +- ローカライゼーションの更新 +- Playが実装されたため、ページ機能の「ソースを見る」は削除されました ### Server +- Enhance: ページのURLに使用可能な文字を限定するように - Fix: 個別お知らせページのmetaタグ出力の条件が間違っていたのを修正 - ## 2025.1.0 ### Note diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml index 1f885c66a2..91c90ce75a 100644 --- a/locales/ar-SA.yml +++ b/locales/ar-SA.yml @@ -1460,9 +1460,6 @@ _pages: newPage: "أنشئ صفحة جديدة" editPage: "عدّل الصفحة" readPage: "نُشّط عرض المصدر" - created: "نجح إنشاء الصفحة" - updated: "نجح تعديل الصفحة" - deleted: "نجح حذف الصفحة" pageSetting: "إعدادات الصفحة" nameAlreadyExists: "رابط الصفحة موجود مسبقًا" invalidNameTitle: "رابط الصفحة ليس صالحًا" diff --git a/locales/bn-BD.yml b/locales/bn-BD.yml index 9c8566c5b7..709874ac20 100644 --- a/locales/bn-BD.yml +++ b/locales/bn-BD.yml @@ -1237,9 +1237,6 @@ _pages: newPage: "নতুন পৃষ্ঠা বানান" editPage: "পৃষ্ঠাটি সম্পাদনা করুন" readPage: "উৎস দেখছেন" - created: "পৃষ্ঠা তৈরি করা হয়েছে" - updated: "পৃষ্ঠা সম্পাদনা করা হয়েছে" - deleted: "পৃষ্ঠা মুছে ফেলা হয়েছে" pageSetting: "পৃষ্ঠার সেটিংস" nameAlreadyExists: "পৃষ্ঠার URLটি ইতিমধ্যেই ব্যাবহার করা হয়েছে" invalidNameTitle: "পৃষ্ঠার URL অবৈধ" diff --git a/locales/ca-ES.yml b/locales/ca-ES.yml index 9954b2a747..7b029c6f41 100644 --- a/locales/ca-ES.yml +++ b/locales/ca-ES.yml @@ -2365,9 +2365,6 @@ _pages: newPage: "pa" editPage: "Editar la pàgina" readPage: "Veure el codi font d'aquesta pàgina" - created: "La pàgina ha sigut creada correctament" - updated: "La pàgina s'ha editat correctament" - deleted: "La pàgina s'ha esborrat sense problemes" pageSetting: "Configuració de la pàgina" nameAlreadyExists: "L'adreça URL de la pàgina ja existeix" invalidNameTitle: "L'adreça URL de la pàgina no és vàlida" diff --git a/locales/cs-CZ.yml b/locales/cs-CZ.yml index 20bea96b7f..afa3047c1d 100644 --- a/locales/cs-CZ.yml +++ b/locales/cs-CZ.yml @@ -1883,9 +1883,6 @@ _pages: newPage: "Vytvořit novou stránku" editPage: "Upravit stránku" readPage: "Prohlížení zdroje této stránky" - created: "Stránka byla úspěšně vytvořena" - updated: "Stránka byla úspěšně aktualizována" - deleted: "Stránka byla úspěšně smazána" pageSetting: "Nastavení stránky" nameAlreadyExists: "Zadaná adresa URL stránky již existuje" invalidNameTitle: "Zadaná adresa URL stránky je neplatná" diff --git a/locales/de-DE.yml b/locales/de-DE.yml index e99a32a364..11fe6d3ff5 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -2277,9 +2277,6 @@ _pages: newPage: "Seite erstellen" editPage: "Seite bearbeiten" readPage: "Quelltextansicht" - created: "Seite erfolgreich erstellt" - updated: "Seite erfolgreich aktualisiert" - deleted: "Seite erfolgreich gelöscht" pageSetting: "Seiteneinstellungen" nameAlreadyExists: "Die angegebene Seiten-URL existiert bereits" invalidNameTitle: "Die angegebene Seiten-URL ist ungültig" diff --git a/locales/en-US.yml b/locales/en-US.yml index d4803310c6..5700f361ee 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -2365,9 +2365,6 @@ _pages: newPage: "Create a new Page" editPage: "Edit this Page" readPage: "Viewing this Page's source" - created: "Page successfully created" - updated: "Page successfully edited" - deleted: "Page successfully deleted" pageSetting: "Page settings" nameAlreadyExists: "The specified Page URL already exists" invalidNameTitle: "The specified Page URL is invalid" @@ -2775,6 +2772,7 @@ _customEmojisManager: confirmUpdateEmojisDescription: "Update {count} Emoji(s). Are you sure to continue?" confirmDeleteEmojisDescription: "Delete checked {count} Emoji(s). Are you sure to continue?" confirmResetDescription: "" + confirmMovePageDesciption: "Changes have been made to the Emojis on this page.\nIf you leave the page without saving, all changes made on this page will be discarded." dialogSelectRoleTitle: "Search by roll set in Emojis" _register: uploadSettingTitle: "Upload settings" diff --git a/locales/es-ES.yml b/locales/es-ES.yml index 28cfba1c20..0b1411d84b 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -2294,9 +2294,6 @@ _pages: newPage: "Crear página" editPage: "Editar página" readPage: "Viendo la fuente" - created: "La página fue creada" - updated: "La página fue actualizada" - deleted: "La página borrada" pageSetting: "Configurar página" nameAlreadyExists: "La URL de la página especificada ya existe" invalidNameTitle: "URL inválida" diff --git a/locales/fr-FR.yml b/locales/fr-FR.yml index 473774114e..ccfd462a76 100644 --- a/locales/fr-FR.yml +++ b/locales/fr-FR.yml @@ -2118,9 +2118,6 @@ _pages: newPage: "Créer une page" editPage: "Modifier une page" readPage: "Affichage de la source en cours" - created: "La page a été créée !" - updated: "La page a été mise à jour !" - deleted: "La page a été supprimée" pageSetting: "Paramètres de la Page" nameAlreadyExists: "L'URL de page spécifiée existe déjà" invalidNameTitle: "L'URL de page spécifiée n’est pas valide" diff --git a/locales/id-ID.yml b/locales/id-ID.yml index 9a28cee275..7be56b1494 100644 --- a/locales/id-ID.yml +++ b/locales/id-ID.yml @@ -2285,9 +2285,6 @@ _pages: newPage: "Buat halaman baru" editPage: "Sunting halaman" readPage: "Lihat sumber kode aktif" - created: "Halaman berhasil dibuat" - updated: "Halaman berhasil diperbaharui!" - deleted: "Halaman telah dihapus" pageSetting: "Pengaturan Halaman" nameAlreadyExists: "URL Halaman yang ditentukan sudah ada" invalidNameTitle: "URL Halaman yang ditentukan tidak valid" diff --git a/locales/index.d.ts b/locales/index.d.ts index 3061950bdf..36b1c1c3e5 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -4196,7 +4196,7 @@ export interface Locale extends ILocale { */ "invalidParamError": string; /** - * リクエストパラメータに問題があります。通常これはバグですが、入力した文字数が多すぎる等の可能性もあります。 + * リクエストパラメータに問題があります。通常これはバグですが、入力した文字数が多すぎる・許可されていない文字を入力している等の可能性もあります。 */ "invalidParamErrorDescription": string; /** @@ -9296,18 +9296,6 @@ export interface Locale extends ILocale { * ソースを表示中 */ "readPage": string; - /** - * ページを作成しました - */ - "created": string; - /** - * ページを更新しました - */ - "updated": string; - /** - * ページを削除しました - */ - "deleted": string; /** * ページ設定 */ diff --git a/locales/it-IT.yml b/locales/it-IT.yml index d2942c389c..c233e3ab87 100644 --- a/locales/it-IT.yml +++ b/locales/it-IT.yml @@ -2365,9 +2365,6 @@ _pages: newPage: "Crea pagina" editPage: "Modifica pagina" readPage: "Visualizzando fonte " - created: "Pagina creata!" - updated: "Pagina aggiornata con successo!" - deleted: "Pagina eliminata" pageSetting: "Impostazioni pagina" nameAlreadyExists: "Esiste già una pagina con lo stesso URL." invalidNameTitle: "L'URL di pagina definito non è valido" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index a578704434..13d8aec9b8 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1044,7 +1044,7 @@ youCannotCreateAnymore: "これ以上作成することはできません。" cannotPerformTemporary: "一時的に利用できません" cannotPerformTemporaryDescription: "操作回数が制限を超過するため一時的に利用できません。しばらく時間を置いてから再度お試しください。" invalidParamError: "パラメータエラー" -invalidParamErrorDescription: "リクエストパラメータに問題があります。通常これはバグですが、入力した文字数が多すぎる等の可能性もあります。" +invalidParamErrorDescription: "リクエストパラメータに問題があります。通常これはバグですが、入力した文字数が多すぎる・許可されていない文字を入力している等の可能性もあります。" permissionDeniedError: "操作が拒否されました" permissionDeniedErrorDescription: "このアカウントにはこの操作を行うための権限がありません。" preset: "プリセット" @@ -2422,9 +2422,6 @@ _pages: newPage: "ページの作成" editPage: "ページの編集" readPage: "ソースを表示中" - created: "ページを作成しました" - updated: "ページを更新しました" - deleted: "ページを削除しました" pageSetting: "ページ設定" nameAlreadyExists: "指定されたページURLは既に存在しています" invalidNameTitle: "不正なページURLです" diff --git a/locales/ja-KS.yml b/locales/ja-KS.yml index 2dd2220791..66560f524b 100644 --- a/locales/ja-KS.yml +++ b/locales/ja-KS.yml @@ -2357,9 +2357,6 @@ _pages: newPage: "ページを作る" editPage: "ページの編集" readPage: "ソースを表示中" - created: "ページを作成したで" - updated: "ページを更新したで" - deleted: "ページを削除したで" pageSetting: "ページ設定" nameAlreadyExists: "指定されたページURLはもうあるみたいや" invalidNameTitle: "正しくないページURLみたいやで" diff --git a/locales/ko-KR.yml b/locales/ko-KR.yml index 45d7f26075..36b818c117 100644 --- a/locales/ko-KR.yml +++ b/locales/ko-KR.yml @@ -2365,9 +2365,6 @@ _pages: newPage: "페이지 만들기" editPage: "페이지 수정" readPage: "소스 표시 중" - created: "페이지를 만들었습니다" - updated: "페이지를 수정했습니다" - deleted: "페이지가 삭제되었습니다" pageSetting: "페이지 설정" nameAlreadyExists: "지정한 페이지 URL이 이미 존재합니다" invalidNameTitle: "유효하지 않은 페이지 URL입니다" diff --git a/locales/pl-PL.yml b/locales/pl-PL.yml index 98465ea82b..9bd585de86 100644 --- a/locales/pl-PL.yml +++ b/locales/pl-PL.yml @@ -1459,9 +1459,6 @@ _pages: newPage: "Utwórz stronę" editPage: "Edytuj tę stronę" readPage: "Aktywowano widok źródła" - created: "Pomyślnie utworzono stronę!" - updated: "Pomyślnie zaktualizowano stronę!" - deleted: "Strona została usunięta" pageSetting: "Ustawienia strony" nameAlreadyExists: "Określony adres URL strony już istnieje" invalidNameTitle: "Podany adres URL strony jest nieprawidłowy" diff --git a/locales/pt-PT.yml b/locales/pt-PT.yml index aae63805c3..d691022d75 100644 --- a/locales/pt-PT.yml +++ b/locales/pt-PT.yml @@ -2357,9 +2357,6 @@ _pages: newPage: "Criar uma Página" editPage: "Editar essa Página" readPage: "Ver a fonte dessa Página" - created: "Página criada com sucesso" - updated: "Página atualizada com sucesso" - deleted: "Página excluída com sucesso" pageSetting: "Configurações da página" nameAlreadyExists: "O URL de Página especificado já existe" invalidNameTitle: "O URL de Página especificado é inválido" diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index bc1b12895c..7ed41a9c47 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -1976,9 +1976,6 @@ _pages: newPage: "Создать страницу" editPage: "Править страницу" readPage: "Читать страницу" - created: "Страница успешно создана." - updated: "Страница успешно обновлена." - deleted: "Страница успешно удалена." pageSetting: "Настройки страницы" nameAlreadyExists: "Указанный адрес страницы уже существует." invalidNameTitle: "Указанный адрес страницы недопустим." diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml index 715ff4c847..521d172671 100644 --- a/locales/sk-SK.yml +++ b/locales/sk-SK.yml @@ -1332,9 +1332,6 @@ _pages: newPage: "Vytvoriť novú stránku" editPage: "Upraviť túto stránku" readPage: "Zobrazenie zdroja aktívne" - created: "Stránka úspešne vytvorená" - updated: "Stránka úspešne upravená" - deleted: "Stránka úspešne odstránená" pageSetting: "Nastavenia stránky" nameAlreadyExists: "Zadaná URL stránku už existuje" invalidNameTitle: "Zadaná URL stránku je nesprávna" diff --git a/locales/th-TH.yml b/locales/th-TH.yml index 8e68d6cf49..ec83ba888c 100644 --- a/locales/th-TH.yml +++ b/locales/th-TH.yml @@ -2331,9 +2331,6 @@ _pages: newPage: "สร้างหน้าเพจใหม่" editPage: "แก้ไขหน้าเพจ" readPage: "กำลังดูแหล่งที่มาของเพจนี้" - created: "สร้างหน้าเพจสำเร็จเรียบร้อยแล้ว" - updated: "แก้ไขหน้าเพจสำเร็จเรียบร้อยแล้ว" - deleted: "ลบหน้าเพจสำเร็จเรียบร้อยแล้ว" pageSetting: "การตั้งค่าหน้าเพจ" nameAlreadyExists: "URL ของหน้าที่ระบุนั้นมีอยู่แล้ว" invalidNameTitle: "URL ของหน้าที่ระบุนั้นไม่ถูกต้อง" diff --git a/locales/uk-UA.yml b/locales/uk-UA.yml index 6e3e0bb9da..a83ad80683 100644 --- a/locales/uk-UA.yml +++ b/locales/uk-UA.yml @@ -1513,9 +1513,6 @@ _pages: newPage: "Створити сторінку" editPage: "Редагувати сторінку" readPage: "Перегляд вихідного коду" - created: "Сторінка успішно створена." - updated: "Сторінка успішно оновлена." - deleted: "Сторінку видалено" pageSetting: "Налаштування сторінки" nameAlreadyExists: "Вказана адреса сторінки вже існує." invalidNameTitle: "Вказана адреса сторінки неприпустима." diff --git a/locales/uz-UZ.yml b/locales/uz-UZ.yml index 2116d2b86f..6015492b92 100644 --- a/locales/uz-UZ.yml +++ b/locales/uz-UZ.yml @@ -1004,9 +1004,6 @@ _play: _pages: newPage: "Yangi Sahifa yaratish" editPage: "Ushbu Sahifani tahrirlash" - created: "Sahifa muvaffaqiyatli yaratildi" - updated: "Sahifa muvaffaqiyatli tahrirlandi" - deleted: "Sahifa muvaffaqiyatli o'chirildi" pageSetting: "Sahifa sozlamalari" nameAlreadyExists: "Ko'rsatilgan Sahifa URL'i allaqachon mavjud" invalidNameTitle: "Ko'rsatilgan Sahifa URL'i yaroqsiz" diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml index cded29fdba..e6a9418126 100644 --- a/locales/vi-VN.yml +++ b/locales/vi-VN.yml @@ -1802,9 +1802,6 @@ _pages: newPage: "Tạo Trang mới" editPage: "Sửa Trang này" readPage: "Xem mã nguồn Trang này" - created: "Trang đã được tạo thành công" - updated: "Trang đã được cập nhật thành công" - deleted: "Trang đã được xóa thành công" pageSetting: "Cài đặt trang" nameAlreadyExists: "URL Trang đã tồn tại" invalidNameTitle: "URL Trang không hợp lệ" diff --git a/locales/zh-CN.yml b/locales/zh-CN.yml index 1a14f0bf76..f4df425af4 100644 --- a/locales/zh-CN.yml +++ b/locales/zh-CN.yml @@ -2365,9 +2365,6 @@ _pages: newPage: "创建页面" editPage: "编辑页面" readPage: "查看页面" - created: "页面已创建" - updated: "页面已更新" - deleted: "该页面已被删除" pageSetting: "页面设置" nameAlreadyExists: "该页面 URL 已存在" invalidNameTitle: "无效的页面 URL" diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index 159ede1356..466e3cc1d8 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -2365,9 +2365,6 @@ _pages: newPage: "建立頁面" editPage: "編輯頁面" readPage: "正在檢視原始碼" - created: "頁面已建立" - updated: "頁面已更新" - deleted: "頁面已被刪除" pageSetting: "頁面設定" nameAlreadyExists: "該頁面 URL 已存在" invalidNameTitle: "無效的頁面 URL" diff --git a/packages/backend/src/models/Page.ts b/packages/backend/src/models/Page.ts index 1695bf570e..0b59e7a92c 100644 --- a/packages/backend/src/models/Page.ts +++ b/packages/backend/src/models/Page.ts @@ -118,3 +118,5 @@ export class MiPage { } } } + +export const pageNameSchema = { type: 'string', pattern: /^[^\s:\/?#\[\]@!$&'()*+,;=\\%\x00-\x20]{1,256}$/.source } as const; diff --git a/packages/backend/src/server/api/endpoints/pages/create.ts b/packages/backend/src/server/api/endpoints/pages/create.ts index fa03b0b457..6de5fe3d44 100644 --- a/packages/backend/src/server/api/endpoints/pages/create.ts +++ b/packages/backend/src/server/api/endpoints/pages/create.ts @@ -7,7 +7,7 @@ import ms from 'ms'; import { Inject, Injectable } from '@nestjs/common'; import type { DriveFilesRepository, PagesRepository } from '@/models/_.js'; import { IdService } from '@/core/IdService.js'; -import { MiPage } from '@/models/Page.js'; +import { MiPage, pageNameSchema } from '@/models/Page.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { PageEntityService } from '@/core/entities/PageEntityService.js'; import { DI } from '@/di-symbols.js'; @@ -51,7 +51,7 @@ export const paramDef = { type: 'object', properties: { title: { type: 'string' }, - name: { type: 'string', minLength: 1 }, + name: { ...pageNameSchema, minLength: 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 e52d9c32df..a6aeb6002e 100644 --- a/packages/backend/src/server/api/endpoints/pages/update.ts +++ b/packages/backend/src/server/api/endpoints/pages/update.ts @@ -10,6 +10,7 @@ import type { PagesRepository, DriveFilesRepository } from '@/models/_.js'; import { Endpoint } from '@/server/api/endpoint-base.js'; import { DI } from '@/di-symbols.js'; import { ApiError } from '../../error.js'; +import { pageNameSchema } from '@/models/Page.js'; export const meta = { tags: ['pages'], @@ -31,13 +32,11 @@ export const meta = { code: 'NO_SUCH_PAGE', id: '21149b9e-3616-4778-9592-c4ce89f5a864', }, - accessDenied: { message: 'Access denied.', code: 'ACCESS_DENIED', id: '3c15cd52-3b4b-4274-967d-6456fc4f792b', }, - noSuchFile: { message: 'No such file.', code: 'NO_SUCH_FILE', @@ -56,7 +55,7 @@ export const paramDef = { properties: { pageId: { type: 'string', format: 'misskey:id' }, title: { type: 'string' }, - name: { type: 'string', minLength: 1 }, + name: { ...pageNameSchema, minLength: 1 }, summary: { type: 'string', nullable: true }, content: { type: 'array', items: { type: 'object', additionalProperties: true, diff --git a/packages/frontend/src/components/MkSignin.vue b/packages/frontend/src/components/MkSignin.vue index 4a6219071b..d6177762d2 100644 --- a/packages/frontend/src/components/MkSignin.vue +++ b/packages/frontend/src/components/MkSignin.vue @@ -141,6 +141,7 @@ function onPasskeyDone(credential: AuthenticationPublicKeyCredential): void { return; } emit('login', res.signinResponse); + onLoginSucceeded(res.signinResponse); }).catch(onSigninApiError); } else if (userInfo.value != null) { tryLogin({ diff --git a/packages/frontend/src/components/MkSparkle.vue b/packages/frontend/src/components/MkSparkle.vue index 8491ce2f84..b3fc67c0df 100644 --- a/packages/frontend/src/components/MkSparkle.vue +++ b/packages/frontend/src/components/MkSparkle.vue @@ -39,32 +39,18 @@ SPDX-License-Identifier: AGPL-3.0-only --> + - - - + > @@ -130,4 +116,25 @@ onUnmounted(() => { position: relative; display: inline-block; } + +.particle { + transform-origin: center; + transform-box: fill-box; + translate: var(--translateX) var(--translateY); + animation: particleAnimation var(--duration) linear infinite; +} + +@keyframes particleAnimation { + 0% { + rotate: 0deg; + scale: 0; + } + 50% { + scale: var(--size); + } + 100% { + rotate: 360deg; + scale: 0; + } +} diff --git a/packages/frontend/src/pages/page-editor/page-editor.vue b/packages/frontend/src/pages/page-editor/page-editor.vue index ac9f3e7401..8597654375 100644 --- a/packages/frontend/src/pages/page-editor/page-editor.vue +++ b/packages/frontend/src/pages/page-editor/page-editor.vue @@ -96,7 +96,7 @@ const summary = ref(null); const name = ref(Date.now().toString()); const eyeCatchingImage = ref(null); const eyeCatchingImageId = ref(null); -const font = ref('sans-serif'); +const font = ref<'sans-serif' | 'serif'>('sans-serif'); const content = ref([]); const alignCenter = ref(false); const hideTitleWhenPinned = ref(false); @@ -113,7 +113,7 @@ watch(eyeCatchingImageId, async () => { } }); -function getSaveOptions() { +function getSaveOptions(): Misskey.entities.PagesCreateRequest { return { title: title.value.trim(), name: name.value.trim(), @@ -128,80 +128,69 @@ function getSaveOptions() { }; } -function save() { +async function save() { const options = getSaveOptions(); - const onError = err => { - if (err.id === '3d81ceae-475f-4600-b2a8-2bc116157532') { - if (err.info.param === 'name') { - os.alert({ - type: 'error', - title: i18n.ts._pages.invalidNameTitle, - text: i18n.ts._pages.invalidNameText, - }); - } - } else if (err.code === 'NAME_ALREADY_EXISTS') { - os.alert({ - type: 'error', - text: i18n.ts._pages.nameAlreadyExists, - }); - } - }; - if (pageId.value) { - options.pageId = pageId.value; - misskeyApi('pages/update', options) - .then(page => { - currentName.value = name.value.trim(); - os.alert({ - type: 'success', - text: i18n.ts._pages.updated, - }); - }).catch(onError); + const updateOptions: Misskey.entities.PagesUpdateRequest = { + pageId: pageId.value, + ...options, + }; + + await os.apiWithDialog('pages/update', updateOptions, undefined, { + '2298a392-d4a1-44c5-9ebb-ac1aeaa5a9ab': { + title: i18n.ts.somethingHappened, + text: i18n.ts._pages.nameAlreadyExists, + }, + }); + + currentName.value = name.value.trim(); } else { - misskeyApi('pages/create', options) - .then(created => { - pageId.value = created.id; - currentName.value = name.value.trim(); - os.alert({ - type: 'success', - text: i18n.ts._pages.created, - }); - mainRouter.push(`/pages/edit/${pageId.value}`); - }).catch(onError); + const created = await os.apiWithDialog('pages/create', options, undefined, { + '4650348e-301c-499a-83c9-6aa988c66bc1': { + title: i18n.ts.somethingHappened, + text: i18n.ts._pages.nameAlreadyExists, + }, + }); + + pageId.value = created.id; + currentName.value = name.value.trim(); + mainRouter.replace(`/pages/edit/${pageId.value}`); } } -function del() { - os.confirm({ +async function del() { + if (!pageId.value) return; + + const { canceled } = await os.confirm({ type: 'warning', text: i18n.tsx.removeAreYouSure({ x: title.value.trim() }), - }).then(({ canceled }) => { - if (canceled) return; - misskeyApi('pages/delete', { - pageId: pageId.value, - }).then(() => { - os.alert({ - type: 'success', - text: i18n.ts._pages.deleted, - }); - mainRouter.push('/pages'); - }); }); + + if (canceled) return; + + await os.apiWithDialog('pages/delete', { + pageId: pageId.value, + }); + + mainRouter.replace('/pages'); } -function duplicate() { +async function duplicate() { title.value = title.value + ' - copy'; name.value = name.value + '-copy'; - misskeyApi('pages/create', getSaveOptions()).then(created => { - pageId.value = created.id; - currentName.value = name.value.trim(); - os.alert({ - type: 'success', - text: i18n.ts._pages.created, - }); - mainRouter.push(`/pages/edit/${pageId.value}`); + + const created = await os.apiWithDialog('pages/create', getSaveOptions(), undefined, { + '4650348e-301c-499a-83c9-6aa988c66bc1': { + title: i18n.ts.somethingHappened, + text: i18n.ts._pages.nameAlreadyExists, + }, }); + + pageId.value = created.id; + currentName.value = name.value.trim(); + + mainRouter.push(`/pages/edit/${pageId.value}`); } async function add() { @@ -216,7 +205,7 @@ async function add() { content.value.push({ id, type }); } -function setEyeCatchingImage(img) { +function setEyeCatchingImage(img: Event) { selectFile(img.currentTarget ?? img.target, null).then(file => { eyeCatchingImageId.value = file.id; }); diff --git a/packages/frontend/src/pages/page.vue b/packages/frontend/src/pages/page.vue index 544e112111..d27a4f121d 100644 --- a/packages/frontend/src/pages/page.vue +++ b/packages/frontend/src/pages/page.vue @@ -266,7 +266,7 @@ function showMenu(ev: MouseEvent) { if ($i && $i.id === page.value.userId) { menuItems.push({ icon: 'ti ti-pencil', - text: i18n.ts._pages.editThisPage, + text: i18n.ts.edit, action: () => router.push(`/pages/edit/${page.value.id}`), }); @@ -285,10 +285,6 @@ function showMenu(ev: MouseEvent) { } } else if ($i && $i.id !== page.value.userId) { menuItems.push({ - icon: 'ti ti-code', - text: i18n.ts._pages.viewSource, - action: () => router.push(`/@${props.username}/pages/${props.pageName}/view-source`), - }, { icon: 'ti ti-exclamation-circle', text: i18n.ts.reportAbuse, action: reportAbuse, diff --git a/packages/frontend/src/router/definition.ts b/packages/frontend/src/router/definition.ts index 74e1482ce0..2d50a27dbf 100644 --- a/packages/frontend/src/router/definition.ts +++ b/packages/frontend/src/router/definition.ts @@ -17,10 +17,7 @@ export const page = (loader: AsyncComponentLoader) => defineAsyncComponent({ }); const routes: RouteDef[] = [{ - path: '/@:initUser/pages/:initPageName/view-source', - component: page(() => import('@/pages/page-editor/page-editor.vue')), -}, { - path: '/@:username/pages/:pageName', + path: '/@:username/pages/:pageName(*)', component: page(() => import('@/pages/page.vue')), }, { path: '/@:acct/following', diff --git a/packages/frontend/src/ui/deck.vue b/packages/frontend/src/ui/deck.vue index c0ea833546..36caca5fc0 100644 --- a/packages/frontend/src/ui/deck.vue +++ b/packages/frontend/src/ui/deck.vue @@ -100,7 +100,7 @@ SPDX-License-Identifier: AGPL-3.0-only import { computed, defineAsyncComponent, ref, watch, shallowRef } from 'vue'; import { v4 as uuid } from 'uuid'; import XCommon from './_common_/common.vue'; -import { deckStore, columnTypes, addColumn as addColumnToStore, loadDeck, getProfiles, deleteProfile as deleteProfile_ } from './deck/deck-store.js'; +import { deckStore, columnTypes, addColumn as addColumnToStore, forceSaveDeck, loadDeck, getProfiles, deleteProfile as deleteProfile_ } from './deck/deck-store.js'; import type { ColumnType } from './deck/deck-store.js'; import type { MenuItem } from '@/types/menu.js'; import XSidebar from '@/ui/_common_/navbar.vue'; @@ -240,10 +240,15 @@ function changeProfile(ev: MouseEvent) { title: i18n.ts._deck.profile, minLength: 1, }); + if (canceled || name == null) return; - deckStore.set('profile', name); - unisonReload(); + os.promiseDialog((async () => { + await deckStore.set('profile', name); + await forceSaveDeck(); + })(), () => { + unisonReload(); + }); }, }); }).then(() => { @@ -258,9 +263,18 @@ async function deleteProfile() { }); if (canceled) return; - deleteProfile_(deckStore.state.profile); - deckStore.set('profile', 'default'); - unisonReload(); + os.promiseDialog((async () => { + if (deckStore.state.profile === 'default') { + await deckStore.set('columns', []); + await deckStore.set('layout', []); + await forceSaveDeck(); + } else { + await deleteProfile_(deckStore.state.profile); + } + await deckStore.set('profile', 'default'); + })(), () => { + unisonReload(); + }); } diff --git a/packages/frontend/src/ui/deck/deck-store.ts b/packages/frontend/src/ui/deck/deck-store.ts index 91859b46d7..8e5b1dd1ac 100644 --- a/packages/frontend/src/ui/deck/deck-store.ts +++ b/packages/frontend/src/ui/deck/deck-store.ts @@ -113,8 +113,7 @@ export const loadDeck = async () => { deckStore.set('layout', deck.layout); }; -// TODO: deckがloadされていない状態でsaveすると意図せず上書きが発生するので対策する -export const saveDeck = throttle(1000, async () => { +export async function forceSaveDeck() { await misskeyApi('i/registry/set', { scope: ['client', 'deck', 'profiles'], key: deckStore.state.profile, @@ -123,6 +122,11 @@ export const saveDeck = throttle(1000, async () => { layout: deckStore.reactiveState.layout.value, }, }); +} + +// TODO: deckがloadされていない状態でsaveすると意図せず上書きが発生するので対策する +export const saveDeck = throttle(1000, () => { + forceSaveDeck(); }); export async function getProfiles(): Promise {