Support username.t.me links.

This commit is contained in:
John Preston 2022-08-31 19:44:57 +04:00
parent 5530df8f2d
commit 010b5e3949
1 changed files with 7 additions and 0 deletions

View File

@ -876,6 +876,13 @@ QString TryConvertUrlToLocal(QString url) {
using namespace qthelp;
auto matchOptions = RegExOption::CaseInsensitive;
auto subdomainMatch = regex_match(qsl("^(https?://)?([a-zA-Z0-9\\_]+)\\.t\\.me/?(\\?.+)?"), url, matchOptions);
if (subdomainMatch) {
const auto name = subdomainMatch->captured(2);
if (name.size() > 1 && name != "www") {
url = subdomainMatch->captured(1) + "t.me/" + name + subdomainMatch->captured(3);
}
}
auto telegramMeMatch = regex_match(qsl("^(https?://)?(www\\.)?(telegram\\.(me|dog)|t\\.me)/(.+)$"), url, matchOptions);
if (telegramMeMatch) {
auto query = telegramMeMatch->capturedView(5);