Refactor /api/detect/[]

This commit is contained in:
Nikita Karamov 2023-08-26 17:09:03 +02:00
parent 256aa8fbd0
commit af241cfce9
No known key found for this signature in database
GPG Key ID: 41D6F71EE78E77CD
1 changed files with 28 additions and 39 deletions

View File

@ -21,6 +21,13 @@ const mastodonSettings = {
}, },
}; };
const misskeySettings = {
publishEndpoint: "share",
params: {
text: "text",
},
};
const pleromaSettings = { const pleromaSettings = {
publishEndpoint: "share", publishEndpoint: "share",
params: { params: {
@ -28,48 +35,30 @@ const pleromaSettings = {
}, },
}; };
const PROJECTS: Map<FediverseProject, FediverseProjectData> = new Map([ const PROJECTS: Map<FediverseProject, FediverseProjectData> = new Map()
[FediverseProject.Akkoma, pleromaSettings], .set(FediverseProject.Hometown, mastodonSettings)
[FediverseProject.Mastodon, mastodonSettings], .set(FediverseProject.Mastodon, mastodonSettings)
[FediverseProject.Hometown, mastodonSettings], .set(FediverseProject.Misskey, misskeySettings)
[ .set(FediverseProject.Akkoma, pleromaSettings)
FediverseProject.GNUSocial, .set(FediverseProject.Pleroma, pleromaSettings)
{ .set(FediverseProject.GNUSocial, {
publishEndpoint: "/notice/new", publishEndpoint: "/notice/new",
params: { params: {
text: "status_textarea", text: "status_textarea",
},
}, },
], })
[FediverseProject.Pleroma, pleromaSettings], .set(FediverseProject.Friendica, {
[ publishEndpoint: "compose",
FediverseProject.Friendica, params: {
{ text: "body",
publishEndpoint: "compose",
params: {
text: "body",
},
}, },
], })
[ .set(FediverseProject.Hubzilla, {
FediverseProject.Hubzilla, publishEndpoint: "rpost",
{ params: {
publishEndpoint: "rpost", text: "body",
params: {
text: "body",
},
}, },
], });
[
FediverseProject.Misskey,
{
publishEndpoint: "share",
params: {
text: "text",
},
},
],
]);
interface NodeInfoList { interface NodeInfoList {
links: { links: {