mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
175 lines
6 KiB
C++
175 lines
6 KiB
C++
#pragma once
|
|
|
|
#include <QStringList>
|
|
|
|
namespace chatterino {
|
|
|
|
QStringList getValidLinks()
|
|
{
|
|
return {
|
|
R"(http://github.com/)",
|
|
R"(https://github.com/)",
|
|
R"(http://username@github.com/)",
|
|
R"(https://username@github.com/)",
|
|
R"(http://pajlada.github.io)",
|
|
R"(https://pajlada.github.io)",
|
|
R"(http://pajlada.github.io/)",
|
|
R"(https://pajlada.github.io/)",
|
|
R"(http://github.com/some/random/path)",
|
|
R"(https://github.com/some/random/path)",
|
|
R"(http://github.com?query=value)",
|
|
R"(https://github.com?query=value)",
|
|
R"(http://github.com?query=value&abc=123)",
|
|
R"(https://github.com?query=value&abc=123)",
|
|
R"(http://github.com/?query=value&abc=123&yhf=abc_def)",
|
|
R"(http://github.com/?query=value&abc=123&yhf)",
|
|
R"(http://github.com?query=value&abc=)",
|
|
R"(http://github.com?query=value&abc=)",
|
|
R"(http://github.com/#block)",
|
|
R"(https://github.com/#anchor)",
|
|
R"(http://github.com/path/?qs=true#block)",
|
|
R"(https://github.com/path/?qs=true#anchor)",
|
|
R"(github.com/)",
|
|
R"(username@github.com/)",
|
|
R"(pajlada.github.io)",
|
|
R"(pajlada.github.io/)",
|
|
R"(github.com/some/random/path)",
|
|
R"(github.com?query=value)",
|
|
R"(github.com?query=value&abc=123)",
|
|
R"(github.com/?query=value&abc=123&yhf=abc_def)",
|
|
R"(github.com/?query=value&abc=123&yhf)",
|
|
R"(github.com?query=value&abc=)",
|
|
R"(github.com?query=value&abc=)",
|
|
R"(github.com/#block)",
|
|
R"(github.com/path/?qs=true#block)",
|
|
R"(HTTP://GITHUB.COM/)",
|
|
R"(HTTPS://GITHUB.COM/)",
|
|
R"(HTTP://USERNAME@GITHUB.COM/)",
|
|
R"(HTTPS://USERNAME@GITHUB.COM/)",
|
|
R"(HTTP://PAJLADA.GITHUB.IO)",
|
|
R"(HTTPS://PAJLADA.GITHUB.IO)",
|
|
R"(HTTP://PAJLADA.GITHUB.IO/)",
|
|
R"(HTTPS://PAJLADA.GITHUB.IO/)",
|
|
R"(HTTP://GITHUB.COM/SOME/RANDOM/PATH)",
|
|
R"(HTTPS://GITHUB.COM/SOME/RANDOM/PATH)",
|
|
R"(HTTP://GITHUB.COM?QUERY=VALUE)",
|
|
R"(HTTPS://GITHUB.COM?QUERY=VALUE)",
|
|
R"(HTTP://GITHUB.COM?QUERY=VALUE&ABC=123)",
|
|
R"(HTTPS://GITHUB.COM?QUERY=VALUE&ABC=123)",
|
|
R"(HTTP://GITHUB.COM/?QUERY=VALUE&ABC=123&YHF=ABC_DEF)",
|
|
R"(HTTP://GITHUB.COM/?QUERY=VALUE&ABC=123&YHF)",
|
|
R"(HTTP://GITHUB.COM?QUERY=VALUE&ABC=)",
|
|
R"(HTTP://GITHUB.COM?QUERY=VALUE&ABC=)",
|
|
R"(HTTP://GITHUB.COM/#BLOCK)",
|
|
R"(HTTPS://GITHUB.COM/#ANCHOR)",
|
|
R"(HTTP://GITHUB.COM/PATH/?QS=TRUE#BLOCK)",
|
|
R"(HTTPS://GITHUB.COM/PATH/?QS=TRUE#ANCHOR)",
|
|
R"(GITHUB.COM/)",
|
|
R"(USERNAME@GITHUB.COM/)",
|
|
R"(PAJLADA.GITHUB.IO)",
|
|
R"(PAJLADA.GITHUB.IO/)",
|
|
R"(GITHUB.COM/SOME/RANDOM/PATH)",
|
|
R"(GITHUB.COM?QUERY=VALUE)",
|
|
R"(GITHUB.COM?QUERY=VALUE&ABC=123)",
|
|
R"(GITHUB.COM/?QUERY=VALUE&ABC=123&YHF=ABC_DEF)",
|
|
R"(GITHUB.COM/?QUERY=VALUE&ABC=123&YHF)",
|
|
R"(GITHUB.COM?QUERY=VALUE&ABC=)",
|
|
R"(GITHUB.COM?QUERY=VALUE&ABC=)",
|
|
R"(GITHUB.COM/#BLOCK)",
|
|
R"(GITHUB.COM/PATH/?QS=TRUE#BLOCK)",
|
|
R"(http://foo.com/blah_blah)",
|
|
R"(http://foo.com/blah_blah/)",
|
|
R"(http://foo.com/blah_blah_(wikipedia))",
|
|
R"(http://foo.com/blah_blah_(wikipedia)_(again))",
|
|
R"(http://www.example.com/wpstyle/?p=364)",
|
|
R"(https://www.example.com/foo/?bar=baz&inga=42&quux)",
|
|
R"(http://✪df.ws/123)",
|
|
R"(http://userid@example.com)",
|
|
R"(http://userid@example.com/)",
|
|
R"(http://userid@example.com:8080)",
|
|
R"(http://userid@example.com:8080/)",
|
|
R"(http://142.42.1.1/)",
|
|
R"(http://142.42.1.1:8080/)",
|
|
R"(http://➡.ws/䨹)",
|
|
R"(http://⌘.ws)",
|
|
R"(http://⌘.ws/)",
|
|
R"(http://foo.com/blah_(wikipedia)#cite-1)",
|
|
R"(http://foo.com/blah_(wikipedia)_blah#cite-1)",
|
|
R"(http://foo.com/unicode_(✪)_in_parens)",
|
|
R"(http://foo.com/(something)?after=parens)",
|
|
R"(http://☺.damowmow.com/)",
|
|
R"(http://code.google.com/events/#&product=browser)",
|
|
R"(http://j.mp)",
|
|
R"(ftp://foo.bar/baz)",
|
|
R"(http://foo.bar/?q=Test%20URL-encoded%20stuff)",
|
|
R"(http://مثال.إختبار)",
|
|
R"(http://例子.测试)",
|
|
R"(http://उदाहरण.परीक्षा)",
|
|
R"(http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com)",
|
|
R"(http://1337.net)",
|
|
R"(http://a.b-c.de)",
|
|
R"(http://223.255.255.254)",
|
|
};
|
|
}
|
|
|
|
QStringList getValidButIgnoredLinks()
|
|
{
|
|
return {
|
|
R"(http://username:password@github.com/)",
|
|
R"(https://username:password@github.com/)",
|
|
R"(http://userid:password@example.com)",
|
|
R"(http://userid:password@example.com/)",
|
|
R"(http://userid:password@example.com:8080)",
|
|
R"(http://userid:password@example.com:8080/)",
|
|
};
|
|
}
|
|
|
|
QStringList getInvalidLinks()
|
|
{
|
|
return {
|
|
R"(1.40)",
|
|
R"(test..)",
|
|
R"(test.)",
|
|
R"(http://)",
|
|
R"(http://.)",
|
|
R"(http://..)",
|
|
R"(http://../)",
|
|
R"(http://?)",
|
|
R"(http://??)",
|
|
R"(http://??/)",
|
|
R"(http://#)",
|
|
R"(http://##)",
|
|
R"(http://##/)",
|
|
R"(http://foo.bar?q=Spaces should be encoded)",
|
|
R"(//)",
|
|
R"(//a)",
|
|
R"(///a)",
|
|
R"(///)",
|
|
R"(http:///a)",
|
|
R"(foo.com)",
|
|
R"(rdar://1234)",
|
|
R"(h://test)",
|
|
R"(http:// shouldfail.com)",
|
|
R"(:// should fail)",
|
|
R"(http://foo.bar/foo(bar)baz quux)",
|
|
R"(ftps://foo.bar/)",
|
|
R"(http://-error-.invalid/)",
|
|
R"(http://a.b--c.de/)",
|
|
R"(http://-a.b.co)",
|
|
R"(http://a.b-.co)",
|
|
R"(http://0.0.0.0)",
|
|
R"(http://10.1.1.0)",
|
|
R"(http://10.1.1.255)",
|
|
R"(http://224.1.1.1)",
|
|
R"(http://1.1.1.1.1)",
|
|
R"(http://123.123.123)",
|
|
R"(http://3628126748)",
|
|
R"(http://.www.foo.bar/)",
|
|
R"(http://www.foo.bar./)",
|
|
R"(http://.www.foo.bar./)",
|
|
R"(http://10.1.1.1)",
|
|
};
|
|
}
|
|
|
|
} // namespace chatterino
|