@ -1,6 +1,8 @@
|
|||||||
import * as v from 'valibot';
|
import * as v from 'valibot';
|
||||||
|
|
||||||
import { filterSchema } from './filter';
|
import { baseFilterSchema } from './filter';
|
||||||
|
|
||||||
|
const filterSchema = v.omit(baseFilterSchema, ['keywords', 'statuses']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Schemas
|
* @category Schemas
|
||||||
|
|||||||
@ -21,6 +21,16 @@ const filterStatusSchema = v.object({
|
|||||||
status_id: v.string(),
|
status_id: v.string(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const baseFilterSchema = v.object({
|
||||||
|
id: v.string(),
|
||||||
|
title: v.string(),
|
||||||
|
context: v.array(v.picklist(['home', 'notifications', 'public', 'thread', 'account'])),
|
||||||
|
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
||||||
|
filter_action: v.fallback(v.picklist(['warn', 'hide', 'blur']), 'warn'),
|
||||||
|
keywords: filteredArray(filterKeywordSchema),
|
||||||
|
statuses: filteredArray(filterStatusSchema),
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @category Schemas
|
* @category Schemas
|
||||||
* @see {@link https://docs.joinmastodon.org/entities/Filter/}
|
* @see {@link https://docs.joinmastodon.org/entities/Filter/}
|
||||||
@ -42,15 +52,7 @@ const filterSchema = v.pipe(
|
|||||||
}
|
}
|
||||||
return filter;
|
return filter;
|
||||||
}),
|
}),
|
||||||
v.object({
|
baseFilterSchema,
|
||||||
id: v.string(),
|
|
||||||
title: v.string(),
|
|
||||||
context: v.array(v.picklist(['home', 'notifications', 'public', 'thread', 'account'])),
|
|
||||||
expires_at: v.fallback(v.nullable(datetimeSchema), null),
|
|
||||||
filter_action: v.fallback(v.picklist(['warn', 'hide', 'blur']), 'warn'),
|
|
||||||
keywords: v.optional(filteredArray(filterKeywordSchema), undefined),
|
|
||||||
statuses: v.optional(filteredArray(filterStatusSchema), undefined),
|
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,4 +60,4 @@ const filterSchema = v.pipe(
|
|||||||
*/
|
*/
|
||||||
type Filter = v.InferOutput<typeof filterSchema>;
|
type Filter = v.InferOutput<typeof filterSchema>;
|
||||||
|
|
||||||
export { filterKeywordSchema, filterStatusSchema, filterSchema, type Filter };
|
export { filterKeywordSchema, filterStatusSchema, baseFilterSchema, filterSchema, type Filter };
|
||||||
|
|||||||
19
packages/pl-api/lib/entities/privacy-policy.ts
Normal file
19
packages/pl-api/lib/entities/privacy-policy.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
import { datetimeSchema } from './utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Schemas
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/PrivacyPolicy/}
|
||||||
|
*/
|
||||||
|
const privacyPolicySchema = v.object({
|
||||||
|
updated_at: datetimeSchema,
|
||||||
|
content: v.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Entity types
|
||||||
|
*/
|
||||||
|
type PrivacyPolicy = v.InferOutput<typeof privacyPolicySchema>;
|
||||||
|
|
||||||
|
export { privacyPolicySchema, type PrivacyPolicy };
|
||||||
21
packages/pl-api/lib/entities/terms-of-service.ts
Normal file
21
packages/pl-api/lib/entities/terms-of-service.ts
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import * as v from 'valibot';
|
||||||
|
|
||||||
|
import { dateSchema } from './utils';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Schemas
|
||||||
|
* @see {@link https://docs.joinmastodon.org/entities/TermfsOfService/}
|
||||||
|
*/
|
||||||
|
const termfsOfServiceSchema = v.object({
|
||||||
|
effective_date: dateSchema,
|
||||||
|
effective: v.boolean(),
|
||||||
|
content: v.string(),
|
||||||
|
succeeded_by: v.fallback(v.nullable(dateSchema), null),
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @category Entity types
|
||||||
|
*/
|
||||||
|
type TermfsOfService = v.InferOutput<typeof termfsOfServiceSchema>;
|
||||||
|
|
||||||
|
export { termfsOfServiceSchema, type TermfsOfService };
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pl-api",
|
"name": "pl-api",
|
||||||
"version": "1.0.0-rc.68",
|
"version": "1.0.0-rc.69",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@ -105,7 +105,7 @@
|
|||||||
"multiselect-react-dropdown": "^2.0.25",
|
"multiselect-react-dropdown": "^2.0.25",
|
||||||
"mutative": "^1.1.0",
|
"mutative": "^1.1.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"pl-api": "^1.0.0-rc.68",
|
"pl-api": "^1.0.0-rc.69",
|
||||||
"postcss": "^8.5.3",
|
"postcss": "^8.5.3",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"punycode": "^2.1.1",
|
"punycode": "^2.1.1",
|
||||||
|
|||||||
@ -37,6 +37,7 @@ const importConfigs = (state: State, configs: PleromaConfig['configs']) => {
|
|||||||
const approvalRequired = getConfigValue(value, ':account_approval_required') as boolean | undefined;
|
const approvalRequired = getConfigValue(value, ':account_approval_required') as boolean | undefined;
|
||||||
|
|
||||||
state.registrations = {
|
state.registrations = {
|
||||||
|
...state.registrations,
|
||||||
enabled: registrationsOpen ?? state.registrations.enabled,
|
enabled: registrationsOpen ?? state.registrations.enabled,
|
||||||
approval_required: approvalRequired ?? state.registrations.approval_required,
|
approval_required: approvalRequired ?? state.registrations.approval_required,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6875,10 +6875,10 @@ pkg-dir@^4.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
find-up "^4.0.0"
|
find-up "^4.0.0"
|
||||||
|
|
||||||
pl-api@^1.0.0-rc.68:
|
pl-api@^1.0.0-rc.69:
|
||||||
version "1.0.0-rc.68"
|
version "1.0.0-rc.69"
|
||||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.68.tgz#c334e710e349403bebcd89e42dbc87efc0b4d612"
|
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.69.tgz#a271fcd8963e1df106bee0e081b3d4f728094259"
|
||||||
integrity sha512-CMSlxTsKL965J03Y4OfwQq/uV4hSh/daBcsVw2Tzx0KTtR/nnUE+hwfw0E0PypMFxZojPuZEGbxpuoT1JXgPSQ==
|
integrity sha512-9EVEiOE5hNBLac+0C+Z/daAxhi0IRjR0arY1m9NIvnvUfUVIbJNSSWTdVtFyd2e0CqOhFG/fiCxNZRR/qqyuNg==
|
||||||
dependencies:
|
dependencies:
|
||||||
blurhash "^2.0.5"
|
blurhash "^2.0.5"
|
||||||
http-link-header "^1.1.3"
|
http-link-header "^1.1.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user