diff --git a/app/page.tsx b/app/page.tsx index 71dd5b8..ca84372 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,14 +1,15 @@ 'use client'; +import { NextPage } from 'next'; import React from 'react'; -import { SettingContainer } from '@/components/organisms/SettingContainer'; +import { HomeContainer } from '@/components/organisms/HomeContainer'; -export default function Home() { - return ( -
-
- -
-
- ); -} +const Page: NextPage = () => ( +
+
+ +
+
+); + +export default Page; diff --git a/components/organisms/HomeContainer.tsx b/components/organisms/HomeContainer.tsx new file mode 100644 index 0000000..8d34e2c --- /dev/null +++ b/components/organisms/HomeContainer.tsx @@ -0,0 +1,23 @@ +import React, { FC } from 'react'; +import { SettingsNav } from '@/components/molecules/SettingsNav'; +import { Separator } from '@/components/ui/separator'; + +export const HomeContainer: FC = () => ( +
+
+

Settings

+

+ Automated anti-spam settings are available. +

+
+ +
+ +
+ Please select a menu +
+
+
+); diff --git a/components/organisms/SettingContainer.tsx b/components/organisms/SettingContainer.tsx index 4ecbdce..bb1b881 100644 --- a/components/organisms/SettingContainer.tsx +++ b/components/organisms/SettingContainer.tsx @@ -3,44 +3,20 @@ import { SettingsNav } from '@/components/molecules/SettingsNav'; import { useFieldArray, useForm } from 'react-hook-form'; import { Button } from '@/components/ui/button'; -import { - Form, - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form'; +import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; import { toast } from '@/components/ui/use-toast'; import { cn } from '@/lib/utils'; -import { - Card, - CardContent, - CardDescription, - CardFooter, - CardHeader, - CardTitle, -} from '@/components/ui/card'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Switch } from '@/components/ui/switch'; - -import Link from 'next/link'; -import { Textarea } from '@/components/ui/textarea'; import { Separator } from '@/components/ui/separator'; import { Cross1Icon, RocketIcon } from '@radix-ui/react-icons'; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from '@/components/ui/select'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { formSchema } from '@/app/automatic-spam-reporting/formSchema'; import { get, update } from '@/app/automatic-spam-reporting/actions'; import { Skeleton } from '@/components/ui/skeleton'; diff --git a/features/batch/misskey.ts b/features/batch/misskey.ts index 5df49b2..10f558e 100644 --- a/features/batch/misskey.ts +++ b/features/batch/misskey.ts @@ -100,6 +100,20 @@ const suspendUser = async ({ provider, userId }: { provider: TargetProvider, use return []; }); +const deleteNote = async ({ provider, noteId }: { provider: TargetProvider, noteId: string; }) => + axios.post(`${provider.apiEndpoint}/notes/delete`?.replace('//', '/'), { + i: provider.adminApiToken, + noteId, + }, { + headers: { + Authorization: `Bearer ${provider.apiToken}`, + 'Content-Type': 'application/json', + }, + }).then((res) => res.data).catch((err) => { + console.debug('err =', err.response?.data); + return []; + }); + export const execMisskey = async (provider: TargetProvider, spamTexts: string[], lastChecked: Date | null | undefined) => { // const offsetDate = dayjs((lastChecked ? dayjs(lastChecked) @@ -187,6 +201,10 @@ export const execMisskey = async (provider: TargetProvider, spamTexts: string[], throw new Error('Target User ID is not found'); } + // Delete note ( When 200OK, no value is returned ) + console.debug('[deleteNote] noteId =', notification.note?.id); + await retry(() => deleteNote({ provider, noteId: notification.note?.id })); + // Suspend User ( When 200OK, no value is returned ) console.debug('[suspendUser] targetUserId =', targetUserId); await retry(() => suspendUser({ provider, userId: targetUserId }));