mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-10-26 19:14:12 +00:00
35 lines
926 B
TypeScript
35 lines
926 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: marie and sharkey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
import webpush from 'web-push';
|
|
const { generateVAPIDKeys } = webpush;
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
|
|
|
export const meta = {
|
|
tags: ['admin'],
|
|
|
|
requireCredential: true,
|
|
requireModerator: true,
|
|
kind: 'write:admin:meta',
|
|
} as const;
|
|
|
|
export const paramDef = {} as const;
|
|
|
|
@Injectable()
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
|
constructor(
|
|
private moderationLogService: ModerationLogService,
|
|
) {
|
|
super(meta, paramDef, async (ps, me) => {
|
|
const keys = await generateVAPIDKeys();
|
|
|
|
// TODO add moderation log
|
|
|
|
return { public: keys.publicKey, private: keys.privateKey };
|
|
});
|
|
}
|
|
}
|