Skip to content

Commit

Permalink
Deps bump (#167)
Browse files Browse the repository at this point in the history
Bump version to 1.5.0
Bump minimum node to latest supported LTS (12->18)
Bump all possible deps, notably Telegraf to 4.13

string-replace-async and nedb-promise still need to be dealt with later
  • Loading branch information
C0rn3j authored Sep 18, 2023
1 parent 3ac421e commit 9327111
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 103 deletions.
6 changes: 4 additions & 2 deletions handlers/middlewares/checkLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const actionPriority = (action: Action) => action.type;
const maxByActionPriority = R.maxBy(actionPriority);
const highestPriorityAction = R.reduce(maxByActionPriority, Action.Nothing);

const assumeProtocol = R.unless(R.contains("://"), R.concat("http://"));
const assumeProtocol = R.unless(R.includes("://"), R.concat("http://"));
const isHttp = R.propSatisfies(R.test(/^https?:$/i), "protocol");
const isLink = (entity: MessageEntity) =>
["url", "text_link", "mention"].includes(entity.type);
Expand Down Expand Up @@ -162,7 +162,9 @@ const checkLinkByDomain = (url: URL) => {
return handler(url);
};

const classifyAsync = R.memoize(async (url: URL) => {
const urlToKey = (url: URL) => url.toString();

const classifyAsync = R.memoizeWith(urlToKey, async (url: URL) => {
if (isWhitelisted(url)) return Action.Nothing;

if (blacklisted.protocol(url)) return Action.Warn("Link using tg protocol");
Expand Down
Loading

0 comments on commit 9327111

Please sign in to comment.