Merge branch 'static' into 'develop'
Use default avatar and banner from repo, instead of linking out to image See merge request soapbox-pub/ditto!42
This commit is contained in:
commit
cdfdcb19bb
|
@ -159,6 +159,7 @@ app.get('/api/v1/lists', emptyArrayController);
|
||||||
app.use('/api/*', notImplementedController);
|
app.use('/api/*', notImplementedController);
|
||||||
|
|
||||||
app.get('*', serveStatic({ root: './public/' }));
|
app.get('*', serveStatic({ root: './public/' }));
|
||||||
|
app.get('*', serveStatic({ root: './static/' }));
|
||||||
app.get('*', serveStatic({ path: './public/index.html' }));
|
app.get('*', serveStatic({ path: './public/index.html' }));
|
||||||
|
|
||||||
app.get('/', indexController);
|
app.get('/', indexController);
|
||||||
|
|
|
@ -12,8 +12,8 @@ import { verifyNip05Cached } from '@/utils/nip05.ts';
|
||||||
import { findUser } from '@/db/users.ts';
|
import { findUser } from '@/db/users.ts';
|
||||||
import { DittoAttachment, renderAttachment } from '@/views/attachment.ts';
|
import { DittoAttachment, renderAttachment } from '@/views/attachment.ts';
|
||||||
|
|
||||||
const DEFAULT_AVATAR = 'https://gleasonator.com/images/avi.png';
|
const defaultAvatar = () => Conf.local('/images/avi.png');
|
||||||
const DEFAULT_BANNER = 'https://gleasonator.com/images/banner.png';
|
const defaultBanner = () => Conf.local('/images/banner.png');
|
||||||
|
|
||||||
interface ToAccountOpts {
|
interface ToAccountOpts {
|
||||||
withSource?: boolean;
|
withSource?: boolean;
|
||||||
|
@ -21,9 +21,16 @@ interface ToAccountOpts {
|
||||||
|
|
||||||
async function toAccount(event: UnsignedEvent<0>, opts: ToAccountOpts = {}) {
|
async function toAccount(event: UnsignedEvent<0>, opts: ToAccountOpts = {}) {
|
||||||
const { withSource = false } = opts;
|
const { withSource = false } = opts;
|
||||||
|
|
||||||
const { pubkey } = event;
|
const { pubkey } = event;
|
||||||
const { name, nip05, picture, banner, about } = jsonMetaContentSchema.parse(event.content);
|
|
||||||
|
const {
|
||||||
|
name,
|
||||||
|
nip05,
|
||||||
|
picture = defaultAvatar(),
|
||||||
|
banner = defaultBanner(),
|
||||||
|
about,
|
||||||
|
} = jsonMetaContentSchema.parse(event.content);
|
||||||
|
|
||||||
const npub = nip19.npubEncode(pubkey);
|
const npub = nip19.npubEncode(pubkey);
|
||||||
|
|
||||||
const [user, parsed05, followersCount, followingCount, statusesCount] = await Promise.all([
|
const [user, parsed05, followersCount, followingCount, statusesCount] = await Promise.all([
|
||||||
|
@ -37,8 +44,8 @@ async function toAccount(event: UnsignedEvent<0>, opts: ToAccountOpts = {}) {
|
||||||
return {
|
return {
|
||||||
id: pubkey,
|
id: pubkey,
|
||||||
acct: parsed05?.handle || npub,
|
acct: parsed05?.handle || npub,
|
||||||
avatar: picture || DEFAULT_AVATAR,
|
avatar: picture,
|
||||||
avatar_static: picture || DEFAULT_AVATAR,
|
avatar_static: picture,
|
||||||
bot: false,
|
bot: false,
|
||||||
created_at: event ? nostrDate(event.created_at).toISOString() : new Date().toISOString(),
|
created_at: event ? nostrDate(event.created_at).toISOString() : new Date().toISOString(),
|
||||||
discoverable: true,
|
discoverable: true,
|
||||||
|
@ -49,8 +56,8 @@ async function toAccount(event: UnsignedEvent<0>, opts: ToAccountOpts = {}) {
|
||||||
followers_count: followersCount,
|
followers_count: followersCount,
|
||||||
following_count: followingCount,
|
following_count: followingCount,
|
||||||
fqn: parsed05?.handle || npub,
|
fqn: parsed05?.handle || npub,
|
||||||
header: banner || DEFAULT_BANNER,
|
header: banner,
|
||||||
header_static: banner || DEFAULT_BANNER,
|
header_static: banner,
|
||||||
last_status_at: null,
|
last_status_at: null,
|
||||||
locked: false,
|
locked: false,
|
||||||
note: lodash.escape(about),
|
note: lodash.escape(about),
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 81 B |
Loading…
Reference in New Issue