mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-22 14:05:12 +00:00
fix esm
This commit is contained in:
parent
8dcdbddbfb
commit
4701127946
5 changed files with 13 additions and 13 deletions
|
@ -57,15 +57,15 @@ function validateActor(x: IObject, uri: string): IActor {
|
|||
if (e) throw new Error(`invalid Actor: ${name} ${e.message}`);
|
||||
};
|
||||
|
||||
validate('id', x.id, $.str.min(1));
|
||||
validate('inbox', x.inbox, $.str.min(1));
|
||||
validate('preferredUsername', x.preferredUsername, $.str.min(1).max(128).match(/^\w([\w-.]*\w)?$/));
|
||||
validate('id', x.id, $.default.str.min(1));
|
||||
validate('inbox', x.inbox, $.default.str.min(1));
|
||||
validate('preferredUsername', x.preferredUsername, $.default.str.min(1).max(128).match(/^\w([\w-.]*\w)?$/));
|
||||
|
||||
// These fields are only informational, and some AP software allows these
|
||||
// fields to be very long. If they are too long, we cut them off. This way
|
||||
// we can at least see these users and their activities.
|
||||
validate('name', truncate(x.name, nameLength), $.optional.nullable.str);
|
||||
validate('summary', truncate(x.summary, summaryLength), $.optional.nullable.str);
|
||||
validate('name', truncate(x.name, nameLength), $.default.optional.nullable.str);
|
||||
validate('summary', truncate(x.summary, summaryLength), $.default.optional.nullable.str);
|
||||
|
||||
const idHost = toPuny(new URL(x.id!).hostname);
|
||||
if (idHost !== expectHost) {
|
||||
|
|
|
@ -26,7 +26,7 @@ export async function resolveUser(username: string, host: string | null, option?
|
|||
|
||||
host = toPuny(host);
|
||||
|
||||
if (config.host == host) {
|
||||
if (config.host === host) {
|
||||
logger.info(`return local user: ${usernameLower}`);
|
||||
return await Users.findOne({ usernameLower, host: null }).then(u => {
|
||||
if (u == null) {
|
||||
|
|
|
@ -15,10 +15,10 @@ export default async (ctx: Router.RouterContext) => {
|
|||
const userId = ctx.params.user;
|
||||
|
||||
// Get 'cursor' parameter
|
||||
const [cursor, cursorErr] = $.optional.type(ID).get(ctx.request.query.cursor);
|
||||
const [cursor, cursorErr] = $.default.optional.type(ID).get(ctx.request.query.cursor);
|
||||
|
||||
// Get 'page' parameter
|
||||
const pageErr = !$.optional.str.or(['true', 'false']).ok(ctx.request.query.page);
|
||||
const pageErr = !$.default.optional.str.or(['true', 'false']).ok(ctx.request.query.page);
|
||||
const page: boolean = ctx.request.query.page === 'true';
|
||||
|
||||
// Validate parameters
|
||||
|
|
|
@ -16,10 +16,10 @@ export default async (ctx: Router.RouterContext) => {
|
|||
const userId = ctx.params.user;
|
||||
|
||||
// Get 'cursor' parameter
|
||||
const [cursor, cursorErr] = $.optional.type(ID).get(ctx.request.query.cursor);
|
||||
const [cursor, cursorErr] = $.default.optional.type(ID).get(ctx.request.query.cursor);
|
||||
|
||||
// Get 'page' parameter
|
||||
const pageErr = !$.optional.str.or(['true', 'false']).ok(ctx.request.query.page);
|
||||
const pageErr = !$.default.optional.str.or(['true', 'false']).ok(ctx.request.query.page);
|
||||
const page: boolean = ctx.request.query.page === 'true';
|
||||
|
||||
// Validate parameters
|
||||
|
|
|
@ -20,13 +20,13 @@ export default async (ctx: Router.RouterContext) => {
|
|||
const userId = ctx.params.user;
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $.optional.type(ID).get(ctx.request.query.since_id);
|
||||
const [sinceId, sinceIdErr] = $.default.optional.type(ID).get(ctx.request.query.since_id);
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $.optional.type(ID).get(ctx.request.query.until_id);
|
||||
const [untilId, untilIdErr] = $.default.optional.type(ID).get(ctx.request.query.until_id);
|
||||
|
||||
// Get 'page' parameter
|
||||
const pageErr = !$.optional.str.or(['true', 'false']).ok(ctx.request.query.page);
|
||||
const pageErr = !$.default.optional.str.or(['true', 'false']).ok(ctx.request.query.page);
|
||||
const page: boolean = ctx.request.query.page === 'true';
|
||||
|
||||
// Validate parameters
|
||||
|
|
Loading…
Reference in a new issue