diff --git a/CHANGELOG.md b/CHANGELOG.md index 54c0554e8a..34a69f1d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - 絵文字オートコンプリートの挙動を改修 - localStorageのaccountsはindexedDBで保持するように - ActivityPub: ジョブキューの試行タイミングを調整 (#7635) +- API: sw/unregisterを追加 - 依存関係の更新 ### Bugfixes diff --git a/src/server/api/endpoints/sw/unregister.ts b/src/server/api/endpoints/sw/unregister.ts new file mode 100644 index 0000000000..a206254950 --- /dev/null +++ b/src/server/api/endpoints/sw/unregister.ts @@ -0,0 +1,27 @@ +import $ from 'cafy'; +import define from '../../define'; +import { SwSubscriptions } from '../../../../models'; + +export const meta = { + tags: ['account'], + + requireCredential: true as const, + + desc: { + 'ja-JP': 'Push通知の登録を削除します。', + 'en-US': 'Remove push noticfication registration' + }, + + params: { + endpoint: { + validator: $.str + }, + } +}; + +export default define(meta, async (ps, user) => { + await SwSubscriptions.delete({ + userId: user.id, + endpoint: ps.endpoint, + }); +});