Implemented reddit name recognition
This commit is contained in:
parent
d957ca52ea
commit
7211133aba
|
@ -437,6 +437,16 @@ function checkKnownProviders(target) {
|
||||||
target
|
target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const redditID = target.match(/(((((?:https?:)?\/\/)((?!about\.)[\w-]+?\.)?([rc]edd(?:it\.com|\.it)))(?!\/(?:blog|about|code|advertising|jobs|rules|wiki|contact|buttons|gold|page|help|prefs|user|message|widget)\b)((?:\/r\/[\w-]+\b(?<!\/pcmasterrace))|(?:\/tb))?(\/comments)??(\/\w{2,7}\b(?<!\/46ijrl)(?<!\/wiki))((?:(?!\))\S)*)))/);
|
||||||
|
if (redditID[9]) {
|
||||||
|
const shortcode = `r${redditID[9]}`
|
||||||
|
return {
|
||||||
|
url: `${config.getBaseUrl()}/${shortcode}`,
|
||||||
|
shortcode,
|
||||||
|
target
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue