Skip to content

Commit

Permalink
fix: change shortid to nanoid
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Oct 19, 2023
1 parent d45f3fc commit abce11a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"cross-env": "7.0.3",
"crypto-browserify": "3.12.0",
"currency-symbol-map": "5.1.0",
"custompatch": "1.0.22",
"dayjs": "1.11.9",
"decode-html": "2.0.0",
"discord.js": "14.13.0",
Expand All @@ -56,20 +57,18 @@
"mkdir": "0.0.2",
"multer": "^1.4.4",
"mysql2": "3.6.1",
"nanoid": "^5.0.2",
"node-fetch": "^2.6.6",
"npm-check-updates": "^16.13.3",
"obs-websocket-js": "5.0.3",
"custompatch": "1.0.22",
"pg": "8.11.3",
"proxy-deep": "3.1.1",
"reflect-metadata": "0.1.13",
"request": "2.88.2",
"rotating-file-stream": "3.1.1",
"safe-eval": "^0.4.1",
"sanitize-filename": "1.6.3",
"shortid": "^2.2.16",
"socket.io": "4.7.2",
"typescript": "5.2.2",
"socket.io-client": "4.7.2",
"source-map-support": "0.5.21",
"spotify-web-api-node": "5.0.2",
Expand All @@ -79,6 +78,7 @@
"tlds": "1.242.0",
"trigram-similarity": "^1.0.7",
"typeorm": "0.3.17",
"typescript": "5.2.2",
"url-join": "5.0.0",
"uuid": "9.0.1",
"velocity-animate": "1.5.2",
Expand Down Expand Up @@ -177,4 +177,4 @@
"npx jsonlint"
]
}
}
}
2 changes: 1 addition & 1 deletion src/database/entity/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export interface Alerts {
/**
* Hooks determinate what events will trigger this alert
*/
hooks: ('follow' | 'raid')[];
hooks: string[];
items: ExpandRecursively<AlertImage | AlertText | AlertAudio | AlertTTS | AlertCustom>[]
/**
* additional hook filters
Expand Down
10 changes: 5 additions & 5 deletions src/systems/songs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@entity/song';
import { User } from '@entity/user';
import * as _ from 'lodash';
import shortid from 'shortid';
import { nanoid } from 'nanoid';
import io from 'socket.io';
import {
Brackets, In, Like,
Expand All @@ -29,10 +29,10 @@ import defaultPermissions from '~/helpers/permissions/defaultPermissions';
import { adminEndpoint, publicEndpoint } from '~/helpers/socket';
import { tmiEmitter } from '~/helpers/tmi';
import * as changelog from '~/helpers/user/changelog.js';
import { isModerator } from '~/helpers/user/isModerator';
import { translate } from '~/translate';
import getBotId from '~/helpers/user/getBotId';
import getBotUserName from '~/helpers/user/getBotUserName';
import { isModerator } from '~/helpers/user/isModerator';
import { translate } from '~/translate';

let importInProgress = false;
const cachedTags = new Set<string>();
Expand Down Expand Up @@ -140,12 +140,12 @@ class Songs extends System {

// filter generator for new UI
for (const filter of opts.filters || []) {
const name = shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.');
const name = nanoid();

if (filter.operation === 'includes') {
query.andWhere(new Brackets(w => {
for (let i = 0; i < filter.value.length; i++) {
const name2 = shortid.characters('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_.');
const name2 = nanoid();
const value = filter.value[i];
if (['postgres'].includes(AppDataSource.options.type.toLowerCase())) {
w[i === 0 ? 'where' : 'orWhere'](`"playlist"."${filter.columnName}" like :${name2}`, { [name2]: `%${value}%` });
Expand Down

0 comments on commit abce11a

Please sign in to comment.