Improve MisskeyPages

This commit is contained in:
syuilo 2019-05-10 14:18:18 +09:00
parent d3c3ad839b
commit 7c714f5788
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
2 changed files with 4 additions and 2 deletions

View file

@ -31,7 +31,7 @@ export class ASEvaluator {
VERSION: opts.version, VERSION: opts.version,
URL: opts.page ? `${opts.url}/@${opts.page.user.username}/pages/${opts.page.name}` : '', URL: opts.page ? `${opts.url}/@${opts.page.user.username}/pages/${opts.page.name}` : '',
LOGIN: opts.visitor != null, LOGIN: opts.visitor != null,
NAME: opts.visitor ? opts.visitor.name : '', NAME: opts.visitor ? opts.visitor.name || opts.visitor.username : '',
USERNAME: opts.visitor ? opts.visitor.username : '', USERNAME: opts.visitor ? opts.visitor.username : '',
USERID: opts.visitor ? opts.visitor.id : '', USERID: opts.visitor ? opts.visitor.id : '',
NOTES_COUNT: opts.visitor ? opts.visitor.notesCount : 0, NOTES_COUNT: opts.visitor ? opts.visitor.notesCount : 0,
@ -42,7 +42,8 @@ export class ASEvaluator {
MY_FOLLOWERS_COUNT: opts.user ? opts.user.followersCount : 0, MY_FOLLOWERS_COUNT: opts.user ? opts.user.followersCount : 0,
MY_FOLLOWING_COUNT: opts.user ? opts.user.followingCount : 0, MY_FOLLOWING_COUNT: opts.user ? opts.user.followingCount : 0,
SEED: opts.randomSeed ? opts.randomSeed : '', SEED: opts.randomSeed ? opts.randomSeed : '',
YMD: `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}` YMD: `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`,
NULL: null
}; };
} }

View file

@ -127,6 +127,7 @@ export const envVarsDef: Record<string, Type> = {
MY_FOLLOWING_COUNT: 'number', MY_FOLLOWING_COUNT: 'number',
SEED: null, SEED: null,
YMD: 'string', YMD: 'string',
NULL: null,
}; };
export function isLiteralBlock(v: Block) { export function isLiteralBlock(v: Block) {