fix the thousand year old bug

This commit is contained in:
cirroskais 2024-04-30 21:30:05 -04:00
parent 9809bd3793
commit ce4e014acb
No known key found for this signature in database
GPG key ID: 5FC73EBF2678E33D
4 changed files with 52 additions and 48 deletions

View file

@ -0,0 +1,7 @@
-- DropIndex
DROP INDEX `Upload_fileName_key` ON `Upload`;
-- AlterTable
ALTER TABLE `UserSettings` MODIFY `embedColor` INTEGER NOT NULL DEFAULT 0,
MODIFY `embedDescription` VARCHAR(191) NOT NULL DEFAULT 'Uploaded by {{username}} at {{time}}',
MODIFY `embedTitle` VARCHAR(191) NOT NULL DEFAULT '{{file}}';

View file

@ -40,9 +40,9 @@ model UserSettings {
newPostsPublic Boolean @default(false)
linkToRaw Boolean @default(false)
embedTitle String
embedDescription String
embedColor Int
embedTitle String @default("{{file}}")
embedDescription String @default("Uploaded by {{username}} at {{time}}")
embedColor Int @default(0)
}
model Upload {
@ -50,7 +50,7 @@ model Upload {
uploader User @relation(fields: [uploaderId], references: [id])
uploaderId Int
fileName String @unique
fileName String
public Boolean @default(false)
uploaded DateTime @default(now())
}

View file

@ -1,10 +0,0 @@
/** @type {import("@sveltejs/kit").Load } */
export function load({ fetch }) {
const statistics = fetch('/api/statistics').then((response) => response.json());
return {
streamed: {
statistics
}
};
}

View file

@ -1,4 +1,11 @@
/** @type {import("@sveltejs/kit").Load} */
export function load({ locals }) {
return { user: locals?.user };
/** @type {import("@sveltejs/kit").ServerLoad} */
export function load({ locals, fetch }) {
const statistics = fetch('/api/statistics').then((response) => response.json());
return {
user: locals?.user,
streamed: {
statistics
}
};
}