mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-17 05:24:22 +01:00
Merge branch 'fields' into 'main'
Instruct Soapbox to use up to 10 custom profile fields See merge request soapbox-pub/ditto!592
This commit is contained in:
@@ -350,6 +350,17 @@ class Conf {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
static profileFields = {
|
||||||
|
get maxFields(): number {
|
||||||
|
return Number(Deno.env.get('PROFILE_FIELDS_MAX_FIELDS') || 10);
|
||||||
|
},
|
||||||
|
get nameLength(): number {
|
||||||
|
return Number(Deno.env.get('PROFILE_FIELDS_NAME_LENGTH') || 255);
|
||||||
|
},
|
||||||
|
get valueLength(): number {
|
||||||
|
return Number(Deno.env.get('PROFILE_FIELDS_VALUE_LENGTH') || 2047);
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const optionalBooleanSchema = z
|
const optionalBooleanSchema = z
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ const instanceV1Controller: AppController = async (c) => {
|
|||||||
pleroma: {
|
pleroma: {
|
||||||
metadata: {
|
metadata: {
|
||||||
features,
|
features,
|
||||||
|
fields_limits: {
|
||||||
|
max_fields: Conf.profileFields.maxFields,
|
||||||
|
name_length: Conf.profileFields.nameLength,
|
||||||
|
value_length: Conf.profileFields.valueLength,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
languages: ['en'],
|
languages: ['en'],
|
||||||
@@ -141,6 +146,11 @@ const instanceV2Controller: AppController = async (c) => {
|
|||||||
pleroma: {
|
pleroma: {
|
||||||
metadata: {
|
metadata: {
|
||||||
features,
|
features,
|
||||||
|
fields_limits: {
|
||||||
|
max_fields: Conf.profileFields.maxFields,
|
||||||
|
name_length: Conf.profileFields.nameLength,
|
||||||
|
value_length: Conf.profileFields.valueLength,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
registrations: {
|
registrations: {
|
||||||
|
|||||||
@@ -60,7 +60,14 @@ async function renderAccount(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const { html } = parseNoteContent(about || '', []);
|
const { html } = parseNoteContent(about || '', []);
|
||||||
const fields = _fields?.map(([name, value]) => ({ name, value, verified_at: null })) ?? [];
|
|
||||||
|
const fields = _fields
|
||||||
|
?.slice(0, Conf.profileFields.maxFields)
|
||||||
|
.map(([name, value]) => ({
|
||||||
|
name: name.slice(0, Conf.profileFields.nameLength),
|
||||||
|
value: value.slice(0, Conf.profileFields.valueLength),
|
||||||
|
verified_at: null,
|
||||||
|
})) ?? [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: pubkey,
|
id: pubkey,
|
||||||
|
|||||||
Reference in New Issue
Block a user