diff options
author | devin ivy <devinivy@gmail.com> | 2024-06-27 13:02:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 13:02:29 -0400 |
commit | 49396451ec8c877aebd27299a98c1b9e5b1e6cd4 (patch) | |
tree | c424c554a431c9594896a09bf422c737c2341e62 /bskyogcard/src/context.ts | |
parent | f6b138f709bcf52248e3f0c5a1ef67abe96bef9c (diff) | |
download | voidsky-49396451ec8c877aebd27299a98c1b9e5b1e6cd4.tar.zst |
bskyogcard: support emoji, more languages, long starter pack names (#4668)
Diffstat (limited to 'bskyogcard/src/context.ts')
-rw-r--r-- | bskyogcard/src/context.ts | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/bskyogcard/src/context.ts b/bskyogcard/src/context.ts index f92651caf..0c972c94d 100644 --- a/bskyogcard/src/context.ts +++ b/bskyogcard/src/context.ts @@ -1,8 +1,8 @@ -import {readFileSync} from 'node:fs' +import {readdirSync, readFileSync} from 'node:fs' +import * as path from 'node:path' +import {fileURLToPath} from 'node:url' import {AtpAgent} from '@atproto/api' -import * as path from 'path' -import {fileURLToPath} from 'url' import {Config} from './config.js' @@ -28,12 +28,14 @@ export class AppContext { static async fromConfig(cfg: Config, overrides?: Partial<AppContextOptions>) { const appviewAgent = new AtpAgent({service: cfg.service.appviewUrl}) - const fonts = [ - { - name: 'Inter', - data: readFileSync(path.join(__DIRNAME, 'assets', 'Inter-Bold.ttf')), - }, - ] + const fontDirectory = path.join(__DIRNAME, 'assets', 'fonts') + const fontFiles = readdirSync(fontDirectory) + const fonts = fontFiles.map(file => { + return { + name: path.basename(file, path.extname(file)), + data: readFileSync(path.join(fontDirectory, file)), + } + }) return new AppContext({ cfg, appviewAgent, |