Add a way to get splash texts

This commit is contained in:
2026-01-30 21:30:09 -07:00
parent f97e58161c
commit cb8c171dcf
4 changed files with 72 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
import { getDatabaseConnection } from '../../../lib/util'
import { berryDashSplashTexts } from '../../../lib/tables'
import { eq } from 'drizzle-orm'
export async function handler () {
const dbInfo1 = getDatabaseConnection(1)
if (!dbInfo1)
return new Response('', {
status: 200,
headers: { 'Content-Type': 'text/plain' }
})
const { connection: connection1, db: db1 } = dbInfo1
const result = await db1
.select({
content: berryDashSplashTexts.content
})
.from(berryDashSplashTexts)
.where(eq(berryDashSplashTexts.state, 1))
.execute()
connection1.end()
return new Response(result.map(i => atob(i.content)).join('\n'), {
status: 200,
headers: { 'Content-Type': 'text/plain' }
})
}