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);
|
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) {
|
export function analyzeAttachments(attachments: IObject | IObject[] | undefined) {
|
||||||
const fields: {
|
const fields: {
|
||||||
name: string,
|
name: string,
|
||||||
|
@ -441,14 +410,10 @@ export function analyzeAttachments(attachments: IObject | IObject[] | undefined)
|
||||||
|
|
||||||
if (Array.isArray(attachments)) {
|
if (Array.isArray(attachments)) {
|
||||||
for (const attachment of attachments.filter(isPropertyValue)) {
|
for (const attachment of attachments.filter(isPropertyValue)) {
|
||||||
if (isPropertyValue(attachment.identifier)) {
|
fields.push({
|
||||||
addService(services, attachment.identifier);
|
name: attachment.name,
|
||||||
} else {
|
value: fromHtml(attachment.value),
|
||||||
fields.push({
|
});
|
||||||
name: attachment.name,
|
|
||||||
value: fromHtml(attachment.value),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,9 +97,6 @@ const nodeinfo2 = async (): Promise<NodeInfo2Base> => {
|
||||||
enableHcaptcha: meta.enableHcaptcha,
|
enableHcaptcha: meta.enableHcaptcha,
|
||||||
enableRecaptcha: meta.enableRecaptcha,
|
enableRecaptcha: meta.enableRecaptcha,
|
||||||
maxNoteTextLength: config.maxNoteTextLength,
|
maxNoteTextLength: config.maxNoteTextLength,
|
||||||
enableTwitterIntegration: meta.enableTwitterIntegration,
|
|
||||||
enableGithubIntegration: meta.enableGithubIntegration,
|
|
||||||
enableDiscordIntegration: meta.enableDiscordIntegration,
|
|
||||||
enableEmail: meta.enableEmail,
|
enableEmail: meta.enableEmail,
|
||||||
proxyAccountName: proxyAccount?.username ?? null,
|
proxyAccountName: proxyAccount?.username ?? null,
|
||||||
themeColor: meta.themeColor || '#86b300',
|
themeColor: meta.themeColor || '#86b300',
|
||||||
|
|
Loading…
Reference in a new issue