mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
Fix short urls
This commit is contained in:
@@ -369,11 +369,8 @@ namespace VRCX
|
|||||||
|
|
||||||
public string FollowUrl(string url)
|
public string FollowUrl(string url)
|
||||||
{
|
{
|
||||||
bool redirecting = true;
|
for (int i = 0; i < 10; i++)
|
||||||
|
|
||||||
while (redirecting)
|
|
||||||
{
|
{
|
||||||
Console.WriteLine(url);
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||||
request.AllowAutoRedirect = false;
|
request.AllowAutoRedirect = false;
|
||||||
request.UserAgent = "VRCX";
|
request.UserAgent = "VRCX";
|
||||||
@@ -381,12 +378,12 @@ namespace VRCX
|
|||||||
if ((int)response.StatusCode == 301 || (int)response.StatusCode == 302)
|
if ((int)response.StatusCode == 301 || (int)response.StatusCode == 302)
|
||||||
{
|
{
|
||||||
url = response.Headers["Location"];
|
url = response.Headers["Location"];
|
||||||
if (url.Substring(0, 1) == "/" || url.Substring(0, 31) == "https://vrchat.com/home/launch?")
|
if (url.Substring(0, 1) == "/" || (url.Length > 30 && url.Substring(0, 31) == "https://vrchat.com/home/launch?"))
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
redirecting = false;
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-5
@@ -427,9 +427,6 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
if (endpoint.substring(endpoint.length - 10) === '/shortName') {
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
this.$throw(0, 'Invalid JSON response');
|
this.$throw(0, 'Invalid JSON response');
|
||||||
}
|
}
|
||||||
@@ -15233,8 +15230,8 @@ speechSynthesis.getVoices();
|
|||||||
|
|
||||||
API.$on('INSTANCE:SHORTNAME', function (args) {
|
API.$on('INSTANCE:SHORTNAME', function (args) {
|
||||||
var url = '';
|
var url = '';
|
||||||
if (args.json) {
|
if (args.json && args.json.shortName) {
|
||||||
url = `https://vrch.at/${args.json}`;
|
url = `https://vrch.at/${args.json.shortName}`;
|
||||||
}
|
}
|
||||||
$app.launchDialog.shortUrl = url;
|
$app.launchDialog.shortUrl = url;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user