forked from FoundKeyGang/FoundKey
activitypub: remove integration fields from person and nodeinfo
This commit is contained in:
parent
5d32872999
commit
4cc5b734e7
2 changed files with 4 additions and 42 deletions
|
@ -401,37 +401,6 @@ export async function resolvePerson(uri: string, resolver: Resolver): Promise<Ca
|
|||
return await createPerson(uri, resolver);
|
||||
}
|
||||
|
||||
const services: {
|
||||
[x: string]: (id: string, username: string) => any
|
||||
} = {
|
||||
'misskey:authentication:twitter': (userId, screenName) => ({ userId, screenName }),
|
||||
'misskey:authentication:github': (id, login) => ({ id, login }),
|
||||
'misskey:authentication:discord': (id, name) => $discord(id, name),
|
||||
};
|
||||
|
||||
const $discord = (id: string, name: string) => {
|
||||
if (typeof name !== 'string') {
|
||||
return { id, username: 'unknown', discriminator: '0000' };
|
||||
} else {
|
||||
const [username, discriminator] = name.split('#');
|
||||
return { id, username, discriminator };
|
||||
}
|
||||
};
|
||||
|
||||
function addService(target: { [x: string]: any }, source: IApPropertyValue) {
|
||||
const service = services[source.name];
|
||||
|
||||
if (typeof source.value !== 'string') {
|
||||
source.value = 'unknown';
|
||||
}
|
||||
|
||||
const [id, username] = source.value.split('@');
|
||||
|
||||
if (service) {
|
||||
target[source.name.split(':')[2]] = service(id, username);
|
||||
}
|
||||
}
|
||||
|
||||
export function analyzeAttachments(attachments: IObject | IObject[] | undefined) {
|
||||
const fields: {
|
||||
name: string,
|
||||
|
@ -441,16 +410,12 @@ export function analyzeAttachments(attachments: IObject | IObject[] | undefined)
|
|||
|
||||
if (Array.isArray(attachments)) {
|
||||
for (const attachment of attachments.filter(isPropertyValue)) {
|
||||
if (isPropertyValue(attachment.identifier)) {
|
||||
addService(services, attachment.identifier);
|
||||
} else {
|
||||
fields.push({
|
||||
name: attachment.name,
|
||||
value: fromHtml(attachment.value),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { fields, services };
|
||||
}
|
||||
|
|
|
@ -97,9 +97,6 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
|
|||
enableHcaptcha: meta.enableHcaptcha,
|
||||
enableRecaptcha: meta.enableRecaptcha,
|
||||
maxNoteTextLength: config.maxNoteTextLength,
|
||||
enableTwitterIntegration: meta.enableTwitterIntegration,
|
||||
enableGithubIntegration: meta.enableGithubIntegration,
|
||||
enableDiscordIntegration: meta.enableDiscordIntegration,
|
||||
enableEmail: meta.enableEmail,
|
||||
proxyAccountName: proxyAccount?.username ?? null,
|
||||
themeColor: meta.themeColor || '#86b300',
|
||||
|
|
Loading…
Reference in a new issue