mirror of
https://github.com/diced/zipline.git
synced 2025-05-11 18:36:02 +02:00
fix: random type errors
This commit is contained in:
parent
bd774b8ffb
commit
96a6fe577e
4 changed files with 9 additions and 31 deletions
|
@ -153,30 +153,6 @@ export const PROP_TO_ENV = {
|
|||
|
||||
'website.tos': 'WEBSITE_TOS',
|
||||
|
||||
// 'discord.onUpload.webhookUrl': 'DISCORD_ONUPLOAD_WEBHOOK_URL',
|
||||
// 'discord.onUpload.username': 'DISCORD_ONUPLOAD_USERNAME',
|
||||
// 'discord.onUpload.avatarUrl': 'DISCORD_ONUPLOAD_AVATAR_URL',
|
||||
// 'discord.onUpload.content': 'DISCORD_ONUPLOAD_CONTENT',
|
||||
// 'discord.onUpload.embed.title': 'DISCORD_ONUPLOAD_EMBED_TITLE',
|
||||
// 'discord.onUpload.embed.description': 'DISCORD_ONUPLOAD_EMBED_DESCRIPTION',
|
||||
// 'discord.onUpload.embed.footer': 'DISCORD_ONUPLOAD_EMBED_FOOTER',
|
||||
// 'discord.onUpload.embed.color': 'DISCORD_ONUPLOAD_EMBED_COLOR',
|
||||
// 'discord.onUpload.embed.thumbnail': 'DISCORD_ONUPLOAD_EMBED_THUMBNAIL',
|
||||
// 'discord.onUpload.embed.timestamp': 'DISCORD_ONUPLOAD_EMBED_TIMESTAMP',
|
||||
// 'discord.onUpload.embed.imageOrVideo': 'DISCORD_ONUPLOAD_EMBED_IMAGE_OR_VIDEO',
|
||||
// 'discord.onUpload.embed.url': 'DISCORD_ONUPLOAD_EMBED_URL',
|
||||
|
||||
// 'discord.onShorten.webhookUrl': 'DISCORD_ONSHORTEN_WEBHOOK_URL',
|
||||
// 'discord.onShorten.username': 'DISCORD_ONSHORTEN_USERNAME',
|
||||
// 'discord.onShorten.avatarUrl': 'DISCORD_ONSHORTEN_AVATAR_URL',
|
||||
// 'discord.onShorten.content': 'DISCORD_ONSHORTEN_CONTENT',
|
||||
// 'discord.onShorten.embed.title': 'DISCORD_ONSHORTEN_EMBED_TITLE',
|
||||
// 'discord.onShorten.embed.description': 'DISCORD_ONSHORTEN_EMBED_DESCRIPTION',
|
||||
// 'discord.onShorten.embed.footer': 'DISCORD_ONSHORTEN_EMBED_FOOTER',
|
||||
// 'discord.onShorten.embed.color': 'DISCORD_ONSHORTEN_EMBED_COLOR',
|
||||
// 'discord.onShorten.embed.timestamp': 'DISCORD_ONSHORTEN_EMBED_TIMESTAMP',
|
||||
// 'discord.onShorten.embed.url': 'DISCORD_ONSHORTEN_EMBED_URL',
|
||||
|
||||
'ssl.key': 'SSL_KEY',
|
||||
'ssl.cert': 'SSL_CERT',
|
||||
};
|
||||
|
|
|
@ -4,7 +4,9 @@ export async function getZipline() {
|
|||
const zipline = await prisma.zipline.findFirst();
|
||||
if (!zipline) {
|
||||
return prisma.zipline.create({
|
||||
data: {},
|
||||
data: {
|
||||
coreTempDirectory: '/tmp/zipline',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -313,6 +313,9 @@ export const getServerSideProps: GetServerSideProps<{
|
|||
const { id, pw } = context.query;
|
||||
if (!id) return { notFound: true };
|
||||
|
||||
const { config: libConfig, reloadSettings } = await import('@/lib/config');
|
||||
if (!libConfig) await reloadSettings();
|
||||
|
||||
const file = await prisma.file.findFirst({
|
||||
where: {
|
||||
name: id as string,
|
||||
|
@ -376,7 +379,7 @@ export const getServerSideProps: GetServerSideProps<{
|
|||
const password = !!file.password;
|
||||
delete (file as any).password;
|
||||
|
||||
const config = safeConfig();
|
||||
const config = safeConfig(libConfig);
|
||||
|
||||
await prisma.file.update({
|
||||
where: {
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
import { PROP_TO_ENV } from '@/lib/config/read';
|
||||
import { Config } from '@/lib/config/validate';
|
||||
|
||||
export function checkRateLimit(config: Config) {
|
||||
if (config.ratelimit.max <= 0) throw new Error(`${PROP_TO_ENV['ratelimit.max']} must be greater than 0`);
|
||||
if (config.ratelimit.max <= 0) throw new Error('ratelimitMax must be greater than 0');
|
||||
|
||||
if (config.ratelimit.window && !config.ratelimit.max)
|
||||
throw new Error(
|
||||
`${PROP_TO_ENV['ratelimit.max']} must be set if ${PROP_TO_ENV['ratelimit.window']} is set`,
|
||||
);
|
||||
throw new Error('ratelimitMax must be set if ratelimitWindow is set');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue