feat: use pasted nanoid function (only 130 bytes) to resolve ESM issues

pull/243/head
Josh Moore 1 year ago
parent ed6213a76b
commit d91520cb78

@ -1,6 +1,6 @@
import fs from 'fs-extra';
import { path } from '@tycrek/joint';
import { nanoid } from 'nanoid';
import { nanoid } from './generators';
import { log } from './log';
import { AssFile, AssUser, NID, FilesSchema, UsersSchema } from 'ass';
import { UserConfig } from './UserConfig';

@ -1,5 +1,5 @@
import fs from 'fs-extra';
import { randomBytes } from 'crypto';
import { randomBytes, getRandomValues } from 'crypto';
import cryptoRandomString from 'crypto-random-string';
import { path } from '@tycrek/joint';
@ -47,3 +47,4 @@ export const gfycat = ({ gfyLength }: Length) => {
return gfycat.concat(getWord(animals));
};
export const nanoid = (size = 21) => getRandomValues(new Uint8Array(size)).reduce(((t, e) => t += (e &= 63) < 36 ? e.toString(36) : e < 62 ? (e - 26).toString(36).toUpperCase() : e > 62 ? "-" : "_"), "");

@ -4,7 +4,7 @@ import { log } from '../log';
import { UserConfig } from '../UserConfig';
import * as data from '../data';
import { AssUser, AssUserNewReq } from 'ass';
import { nanoid } from 'nanoid';
import { nanoid } from '../generators';
const router = Router({ caseSensitive: true });

Loading…
Cancel
Save