mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
use stickynotes, move storages.db to inside buildTemplateOpts
This commit is contained in:
parent
85b54e81be
commit
7c56b9dad8
1 changed files with 4 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
import { AppMiddleware } from '@/app.ts';
|
import { AppMiddleware } from '@/app.ts';
|
||||||
import { Conf } from '@/config.ts';
|
import { Conf } from '@/config.ts';
|
||||||
|
import { Stickynotes } from '@soapbox/stickynotes';
|
||||||
import { Storages } from '@/storages.ts';
|
import { Storages } from '@/storages.ts';
|
||||||
import {
|
import {
|
||||||
getHandle,
|
getHandle,
|
||||||
|
|
@ -12,6 +13,8 @@ import {
|
||||||
import { getInstanceMetadata } from '@/utils/instance.ts';
|
import { getInstanceMetadata } from '@/utils/instance.ts';
|
||||||
import { metadataView } from '@/views/meta.ts';
|
import { metadataView } from '@/views/meta.ts';
|
||||||
|
|
||||||
|
const console = new Stickynotes('ditto:frontend');
|
||||||
|
|
||||||
/** Placeholder to find & replace with metadata. */
|
/** Placeholder to find & replace with metadata. */
|
||||||
const META_PLACEHOLDER = '<!--server-generated-meta-->' as const;
|
const META_PLACEHOLDER = '<!--server-generated-meta-->' as const;
|
||||||
|
|
||||||
|
|
@ -19,9 +22,8 @@ const META_PLACEHOLDER = '<!--server-generated-meta-->' as const;
|
||||||
* TODO: implement caching for posts (LRUCache)
|
* TODO: implement caching for posts (LRUCache)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const store = await Storages.db();
|
|
||||||
|
|
||||||
async function buildTemplateOpts(params: PathParams, url: string): Promise<OpenGraphTemplateOpts> {
|
async function buildTemplateOpts(params: PathParams, url: string): Promise<OpenGraphTemplateOpts> {
|
||||||
|
const store = await Storages.db();
|
||||||
const meta = await getInstanceMetadata(store);
|
const meta = await getInstanceMetadata(store);
|
||||||
const res: OpenGraphTemplateOpts = {
|
const res: OpenGraphTemplateOpts = {
|
||||||
title: `View this page on ${meta.name}`,
|
title: `View this page on ${meta.name}`,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue