kopia lustrzana https://github.com/cloudflare/wildebeest
configure thumbnail
rodzic
178a6dcb9b
commit
8699e329ec
|
@ -6,15 +6,22 @@ export type InstanceConfig = {
|
|||
accessDomain?: string
|
||||
}
|
||||
|
||||
const DEFAULT_THUMBNAIL =
|
||||
'https://imagedelivery.net/NkfPDviynOyTAOI79ar_GQ/b24caf12-5230-48c4-0bf7-2f40063bd400/thumbnail'
|
||||
|
||||
export async function configure(db: D1Database, data: InstanceConfig) {
|
||||
const sql = `
|
||||
INSERT INTO instance_config
|
||||
VALUES ('title', ?),
|
||||
('email', ?),
|
||||
('thumbnail', ?),
|
||||
('description', ?);
|
||||
`
|
||||
|
||||
const { success, error } = await db.prepare(sql).bind(data.title, data.email, data.description).run()
|
||||
const { success, error } = await db
|
||||
.prepare(sql)
|
||||
.bind(data.title, data.email, DEFAULT_THUMBNAIL, data.description)
|
||||
.run()
|
||||
if (!success) {
|
||||
throw new Error('SQL error: ' + error)
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
export type InstanceConfig = {
|
||||
uri: string
|
||||
title: string
|
||||
thumbnail: string
|
||||
languages: Array<string>
|
||||
email: string
|
||||
description: string
|
||||
|
|
|
@ -19,9 +19,9 @@ export default component$(() => {
|
|||
})
|
||||
|
||||
useClientEffect$(async () => {
|
||||
if (await testInstance()) {
|
||||
instanceConfigured.value = true
|
||||
}
|
||||
if (await testInstance()) {
|
||||
instanceConfigured.value = true
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ export async function handleRequest(domain: string, db: D1Database) {
|
|||
}
|
||||
|
||||
const query = `
|
||||
SELECT * FROM instance_config WHERE key IN ('title', 'description', 'email', 'short_description')
|
||||
SELECT * FROM instance_config WHERE key IN ('title', 'description', 'email', 'short_description', 'thumbnail')
|
||||
`
|
||||
const { results, error, success } = await db.prepare(query).all()
|
||||
if (!success) {
|
||||
|
|
Ładowanie…
Reference in New Issue