mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
Handle short URLs 2
This commit is contained in:
+23
-8
@@ -1863,9 +1863,12 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
API.getInstanceShortName = function (params) {
|
API.getInstanceShortName = function (params) {
|
||||||
return this.call(`instances/${params.worldId}:${params.instanceId}/shortName`, {
|
return this.call(
|
||||||
|
`instances/${params.worldId}:${params.instanceId}/shortName`,
|
||||||
|
{
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
}).then((json) => {
|
}
|
||||||
|
).then((json) => {
|
||||||
var args = {
|
var args = {
|
||||||
json,
|
json,
|
||||||
params
|
params
|
||||||
@@ -6952,7 +6955,9 @@ speechSynthesis.getVoices();
|
|||||||
$app.data.showUserDialogHistory = new Set();
|
$app.data.showUserDialogHistory = new Set();
|
||||||
|
|
||||||
$app.methods.quickSearchUserHistory = function () {
|
$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 = [];
|
var results = [];
|
||||||
userHistory.forEach((userId) => {
|
userHistory.forEach((userId) => {
|
||||||
var ref = API.cachedUsers.get(userId);
|
var ref = API.cachedUsers.get(userId);
|
||||||
@@ -10183,16 +10188,23 @@ speechSynthesis.getVoices();
|
|||||||
var input = instance.inputValue;
|
var input = instance.inputValue;
|
||||||
var testUrl = input.substring(0, 15);
|
var testUrl = input.substring(0, 15);
|
||||||
if (testUrl === 'https://vrch.at') {
|
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
|
// /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
|
// 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);
|
url = url.substring(18);
|
||||||
}
|
}
|
||||||
if (url.substring(0, 13) === '/home/launch?') {
|
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 worldId = urlParams.get('worldId');
|
||||||
var instanceId = urlParams.get('instanceId');
|
var instanceId =
|
||||||
|
urlParams.get('instanceId');
|
||||||
if (instanceId) {
|
if (instanceId) {
|
||||||
var location = `${worldId}:${instanceId}`;
|
var location = `${worldId}:${instanceId}`;
|
||||||
this.showWorldDialog(location);
|
this.showWorldDialog(location);
|
||||||
@@ -12721,7 +12733,10 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
D.url = getLaunchURL(L.worldId, L.instanceId);
|
D.url = getLaunchURL(L.worldId, L.instanceId);
|
||||||
D.visible = true;
|
D.visible = true;
|
||||||
API.getInstanceShortName({worldId: L.worldId, instanceId: L.instanceId});
|
API.getInstanceShortName({
|
||||||
|
worldId: L.worldId,
|
||||||
|
instanceId: L.instanceId
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.locationToLaunchArg = function (location) {
|
$app.methods.locationToLaunchArg = function (location) {
|
||||||
|
|||||||
Reference in New Issue
Block a user