mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
make pinned post limit configurable
This commit is contained in:
parent
6c2131fdcc
commit
a44a89276d
4 changed files with 8 additions and 1 deletions
|
@ -180,6 +180,9 @@ reservedUsernames: [
|
||||||
# notFound: '/twemoji/2049.svg'
|
# notFound: '/twemoji/2049.svg'
|
||||||
# error: '/twemoji/1f480.svg'
|
# error: '/twemoji/1f480.svg'
|
||||||
|
|
||||||
|
# Pinned Post Limit
|
||||||
|
# pinLimit: 5
|
||||||
|
|
||||||
# Search engine (MFM)
|
# Search engine (MFM)
|
||||||
#searchEngine: 'https://duckduckgo.com/?q='
|
#searchEngine: 'https://duckduckgo.com/?q='
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,8 @@ export default function load() {
|
||||||
...config.images,
|
...config.images,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config.pinLimit = config.pinLimit || parseInt(process.env.pinLimit || "", 100);
|
||||||
|
|
||||||
config.htmlCache = {
|
config.htmlCache = {
|
||||||
ttlSeconds: parseDuration(config.htmlCache?.ttl ?? '1h', 's')!,
|
ttlSeconds: parseDuration(config.htmlCache?.ttl ?? '1h', 's')!,
|
||||||
prewarm: false,
|
prewarm: false,
|
||||||
|
|
|
@ -53,6 +53,8 @@ export type Source = {
|
||||||
info?: string;
|
info?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pinLimit?: number;
|
||||||
|
|
||||||
htmlCache?: {
|
htmlCache?: {
|
||||||
ttl?: string;
|
ttl?: string;
|
||||||
ttlSeconds?: number;
|
ttlSeconds?: number;
|
||||||
|
|
|
@ -35,7 +35,7 @@ export async function addPinned(
|
||||||
|
|
||||||
const pinings = await UserNotePinings.findBy({ userId: user.id });
|
const pinings = await UserNotePinings.findBy({ userId: user.id });
|
||||||
|
|
||||||
if (pinings.length >= 5) {
|
if (pinings.length >= config.pinLimit) {
|
||||||
throw new IdentifiableError(
|
throw new IdentifiableError(
|
||||||
"15a018eb-58e5-4da1-93be-330fcc5e4e1a",
|
"15a018eb-58e5-4da1-93be-330fcc5e4e1a",
|
||||||
"You can not pin notes any more.",
|
"You can not pin notes any more.",
|
||||||
|
|
Loading…
Reference in a new issue