Add admin status deletion endpoint

This commit is contained in:
Alex Gleason 2024-01-11 18:47:26 -06:00
parent 8f66e49db8
commit 31a6d0305f
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
2 changed files with 17 additions and 2 deletions

View File

@ -44,7 +44,12 @@ import { instanceController } from './controllers/api/instance.ts';
import { mediaController } from './controllers/api/media.ts';
import { notificationsController } from './controllers/api/notifications.ts';
import { createTokenController, oauthAuthorizeController, oauthController } from './controllers/api/oauth.ts';
import { configController, frontendConfigController, updateConfigController } from './controllers/api/pleroma.ts';
import {
configController,
frontendConfigController,
pleromaAdminDeleteStatusController,
updateConfigController,
} from './controllers/api/pleroma.ts';
import { preferencesController } from './controllers/api/preferences.ts';
import { relayController } from './controllers/nostr/relay.ts';
import { searchController } from './controllers/api/search.ts';
@ -189,6 +194,7 @@ app.get('/api/v1/blocks', requirePubkey, blocksController);
app.get('/api/v1/admin/accounts', adminAccountsController);
app.get('/api/v1/pleroma/admin/config', requireRole('admin'), configController);
app.post('/api/v1/pleroma/admin/config', requireRole('admin'), updateConfigController);
app.delete('/api/v1/pleroma/admin/statuses/:id', requireRole('admin'), pleromaAdminDeleteStatusController);
// Not (yet) implemented.
app.get('/api/v1/custom_emojis', emptyArrayController);

View File

@ -85,4 +85,13 @@ const updateConfigController: AppController = async (c) => {
return c.json({ configs: newConfigs, need_reboot: false });
};
export { configController, frontendConfigController, updateConfigController };
const pleromaAdminDeleteStatusController: AppController = async (c) => {
await createAdminEvent({
kind: 5,
tags: [['e', c.req.param('id')]],
}, c);
return c.json({});
};
export { configController, frontendConfigController, pleromaAdminDeleteStatusController, updateConfigController };