refactor
This commit is contained in:
parent
8c9a13b2b7
commit
b7bbe090e9
@ -39,7 +39,7 @@ const sideN = Math.floor(n / 2);
|
|||||||
*/
|
*/
|
||||||
export function genIdenticon(seed: string, stream: WriteStream): Promise<void> {
|
export function genIdenticon(seed: string, stream: WriteStream): Promise<void> {
|
||||||
const rand = gen.create(seed);
|
const rand = gen.create(seed);
|
||||||
const canvas = p.make(size, size);
|
const canvas = p.make(size, size, undefined);
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
ctx.fillStyle = bg;
|
ctx.fillStyle = bg;
|
||||||
|
@ -11,7 +11,7 @@ import { In } from 'typeorm';
|
|||||||
import { Emoji } from '@/models/entities/emoji';
|
import { Emoji } from '@/models/entities/emoji';
|
||||||
import { Poll } from '@/models/entities/poll';
|
import { Poll } from '@/models/entities/poll';
|
||||||
|
|
||||||
export default async function renderNote(note: Note, dive = true, isTalk = false): Promise<any> {
|
export default async function renderNote(note: Note, dive = true, isTalk = false): Promise<Record<string, unknown>> {
|
||||||
const getPromisedFiles = async (ids: string[]) => {
|
const getPromisedFiles = async (ids: string[]) => {
|
||||||
if (!ids || ids.length === 0) return [];
|
if (!ids || ids.length === 0) return [];
|
||||||
const items = await DriveFiles.find({ id: In(ids) });
|
const items = await DriveFiles.find({ id: In(ids) });
|
||||||
|
@ -6,7 +6,14 @@
|
|||||||
* @param last URL of last page (optional)
|
* @param last URL of last page (optional)
|
||||||
* @param orderedItems attached objects (optional)
|
* @param orderedItems attached objects (optional)
|
||||||
*/
|
*/
|
||||||
export default function(id: string | null, totalItems: any, first?: string, last?: string, orderedItems?: Record<string, unknown>) {
|
export default function(id: string | null, totalItems: any, first?: string, last?: string, orderedItems?: Record<string, unknown>[]): {
|
||||||
|
id: string | null;
|
||||||
|
type: 'OrderedCollection';
|
||||||
|
totalItems: any;
|
||||||
|
first?: string;
|
||||||
|
last?: string;
|
||||||
|
orderedItems?: Record<string, unknown>[];
|
||||||
|
} {
|
||||||
const page: any = {
|
const page: any = {
|
||||||
id,
|
id,
|
||||||
type: 'OrderedCollection',
|
type: 'OrderedCollection',
|
||||||
|
@ -32,7 +32,7 @@ export default async (ctx: Router.RouterContext) => {
|
|||||||
|
|
||||||
const rendered = renderOrderedCollection(
|
const rendered = renderOrderedCollection(
|
||||||
`${config.url}/users/${userId}/collections/featured`,
|
`${config.url}/users/${userId}/collections/featured`,
|
||||||
renderedNotes.length, undefined, undefined, renderedNotes
|
renderedNotes.length, undefined, undefined, renderedNotes,
|
||||||
);
|
);
|
||||||
|
|
||||||
ctx.body = renderActivity(rendered);
|
ctx.body = renderActivity(rendered);
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"outDir": "./built",
|
"outDir": "./built",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"./node_modules/@types",
|
"./node_modules/@types",
|
||||||
"./@types"
|
"./src/@types"
|
||||||
],
|
],
|
||||||
"lib": [
|
"lib": [
|
||||||
"esnext"
|
"esnext"
|
||||||
|
Loading…
Reference in New Issue
Block a user