mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Handle short URLs 2
This commit is contained in:
@@ -1863,9 +1863,12 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
*/
|
||||
API.getInstanceShortName = function (params) {
|
||||
return this.call(`instances/${params.worldId}:${params.instanceId}/shortName`, {
|
||||
method: 'GET'
|
||||
}).then((json) => {
|
||||
return this.call(
|
||||
`instances/${params.worldId}:${params.instanceId}/shortName`,
|
||||
{
|
||||
method: 'GET'
|
||||
}
|
||||
).then((json) => {
|
||||
var args = {
|
||||
json,
|
||||
params
|
||||
@@ -6952,7 +6955,9 @@ speechSynthesis.getVoices();
|
||||
$app.data.showUserDialogHistory = new Set();
|
||||
|
||||
$app.methods.quickSearchUserHistory = function () {
|
||||
var userHistory = Array.from(this.showUserDialogHistory.values()).reverse().slice(0, 5);
|
||||
var userHistory = Array.from(this.showUserDialogHistory.values())
|
||||
.reverse()
|
||||
.slice(0, 5);
|
||||
var results = [];
|
||||
userHistory.forEach((userId) => {
|
||||
var ref = API.cachedUsers.get(userId);
|
||||
@@ -10183,16 +10188,23 @@ speechSynthesis.getVoices();
|
||||
var input = instance.inputValue;
|
||||
var testUrl = input.substring(0, 15);
|
||||
if (testUrl === 'https://vrch.at') {
|
||||
AppApi.FollowUrl(input).then((url) => {
|
||||
AppApi.FollowUrl(input).then((output) => {
|
||||
var url = output;
|
||||
// /home/launch?worldId=wrld_f20326da-f1ac-45fc-a062-609723b097b1&instanceId=33570~region(jp)&shortName=cough-stockinglinz-ddd26
|
||||
// https://vrch.at/wrld_f20326da-f1ac-45fc-a062-609723b097b1
|
||||
if (url.substring(0, 18) === 'https://vrchat.com') {
|
||||
if (
|
||||
url.substring(0, 18) ===
|
||||
'https://vrchat.com'
|
||||
) {
|
||||
url = url.substring(18);
|
||||
}
|
||||
if (url.substring(0, 13) === '/home/launch?') {
|
||||
var urlParams = new URLSearchParams(url.substring(13));
|
||||
var urlParams = new URLSearchParams(
|
||||
url.substring(13)
|
||||
);
|
||||
var worldId = urlParams.get('worldId');
|
||||
var instanceId = urlParams.get('instanceId');
|
||||
var instanceId =
|
||||
urlParams.get('instanceId');
|
||||
if (instanceId) {
|
||||
var location = `${worldId}:${instanceId}`;
|
||||
this.showWorldDialog(location);
|
||||
@@ -12721,7 +12733,10 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
D.url = getLaunchURL(L.worldId, L.instanceId);
|
||||
D.visible = true;
|
||||
API.getInstanceShortName({worldId: L.worldId, instanceId: L.instanceId});
|
||||
API.getInstanceShortName({
|
||||
worldId: L.worldId,
|
||||
instanceId: L.instanceId
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.locationToLaunchArg = function (location) {
|
||||
|
||||
Reference in New Issue
Block a user