@ -1,6 +1,8 @@
|
||||
import * as v from 'valibot';
|
||||
|
||||
import { filterSchema } from './filter';
|
||||
import { baseFilterSchema } from './filter';
|
||||
|
||||
const filterSchema = v.omit(baseFilterSchema, ['keywords', 'statuses']);
|
||||
|
||||
/**
|
||||
* @category Schemas
|
||||
|
||||
@ -21,6 +21,16 @@ const filterStatusSchema = v.object({
|
||||
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
|
||||
* @see {@link https://docs.joinmastodon.org/entities/Filter/}
|
||||
@ -42,15 +52,7 @@ const filterSchema = v.pipe(
|
||||
}
|
||||
return filter;
|
||||
}),
|
||||
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: v.optional(filteredArray(filterKeywordSchema), undefined),
|
||||
statuses: v.optional(filteredArray(filterStatusSchema), undefined),
|
||||
}),
|
||||
baseFilterSchema,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -58,4 +60,4 @@ const filterSchema = v.pipe(
|
||||
*/
|
||||
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",
|
||||
"version": "1.0.0-rc.68",
|
||||
"version": "1.0.0-rc.69",
|
||||
"type": "module",
|
||||
"homepage": "https://github.com/mkljczk/pl-fe/tree/develop/packages/pl-api",
|
||||
"repository": {
|
||||
|
||||
@ -105,7 +105,7 @@
|
||||
"multiselect-react-dropdown": "^2.0.25",
|
||||
"mutative": "^1.1.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"pl-api": "^1.0.0-rc.68",
|
||||
"pl-api": "^1.0.0-rc.69",
|
||||
"postcss": "^8.5.3",
|
||||
"process": "^0.11.10",
|
||||
"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;
|
||||
|
||||
state.registrations = {
|
||||
...state.registrations,
|
||||
enabled: registrationsOpen ?? state.registrations.enabled,
|
||||
approval_required: approvalRequired ?? state.registrations.approval_required,
|
||||
};
|
||||
|
||||
@ -6875,10 +6875,10 @@ pkg-dir@^4.1.0:
|
||||
dependencies:
|
||||
find-up "^4.0.0"
|
||||
|
||||
pl-api@^1.0.0-rc.68:
|
||||
version "1.0.0-rc.68"
|
||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.68.tgz#c334e710e349403bebcd89e42dbc87efc0b4d612"
|
||||
integrity sha512-CMSlxTsKL965J03Y4OfwQq/uV4hSh/daBcsVw2Tzx0KTtR/nnUE+hwfw0E0PypMFxZojPuZEGbxpuoT1JXgPSQ==
|
||||
pl-api@^1.0.0-rc.69:
|
||||
version "1.0.0-rc.69"
|
||||
resolved "https://registry.yarnpkg.com/pl-api/-/pl-api-1.0.0-rc.69.tgz#a271fcd8963e1df106bee0e081b3d4f728094259"
|
||||
integrity sha512-9EVEiOE5hNBLac+0C+Z/daAxhi0IRjR0arY1m9NIvnvUfUVIbJNSSWTdVtFyd2e0CqOhFG/fiCxNZRR/qqyuNg==
|
||||
dependencies:
|
||||
blurhash "^2.0.5"
|
||||
http-link-header "^1.1.3"
|
||||
|
||||
Reference in New Issue
Block a user