mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 06:43:51 +02:00
Get instance from shortName & fixes
This commit is contained in:
23
AppApi.cs
23
AppApi.cs
@@ -356,29 +356,6 @@ namespace VRCX
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string FollowUrl(string url)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
|
||||||
request.AllowAutoRedirect = false;
|
|
||||||
request.UserAgent = "VRCX";
|
|
||||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
|
||||||
if ((int)response.StatusCode == 301 || (int)response.StatusCode == 302)
|
|
||||||
{
|
|
||||||
url = response.Headers["Location"];
|
|
||||||
if (url.Substring(0, 1) == "/" || (url.Length > 30 && url.Substring(0, 31) == "https://vrchat.com/home/launch?"))
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string CustomCssPath()
|
public string CustomCssPath()
|
||||||
{
|
{
|
||||||
var output = String.Empty;
|
var output = String.Empty;
|
||||||
|
|||||||
102
html/src/app.js
102
html/src/app.js
@@ -1995,6 +1995,24 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
params: {
|
||||||
|
shortName: string
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
API.getInstanceFromShortName = function (params) {
|
||||||
|
return this.call(`instances/s/${params.shortName}`, {
|
||||||
|
method: 'GET'
|
||||||
|
}).then((json) => {
|
||||||
|
var args = {
|
||||||
|
json,
|
||||||
|
params
|
||||||
|
};
|
||||||
|
this.$emit('INSTANCE', args);
|
||||||
|
return args;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
params: {
|
params: {
|
||||||
worldId: string,
|
worldId: string,
|
||||||
@@ -9174,15 +9192,29 @@ speechSynthesis.getVoices();
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (eventData.EventName === 'ConfigurePortal') {
|
} else if (eventData.EventName === 'ConfigurePortal') {
|
||||||
var instanceId = `${eventData.Data[0]}:${eventData.Data[1]}`;
|
var shortName = eventData.Data[0];
|
||||||
var displayName = this.getDisplayNameFromPhotonId(senderId);
|
var displayName = this.getDisplayNameFromPhotonId(senderId);
|
||||||
if (displayName) {
|
API.getInstanceFromShortName({shortName}).then((args) => {
|
||||||
var ref1 = {
|
var location = args.json.location;
|
||||||
|
var ref = {
|
||||||
id: this.getUserIdFromPhotonId(senderId),
|
id: this.getUserIdFromPhotonId(senderId),
|
||||||
displayName
|
displayName
|
||||||
};
|
};
|
||||||
this.parsePhotonPortalSpawn(datetime, instanceId, ref1);
|
this.parsePhotonPortalSpawn(datetime, location, ref);
|
||||||
}
|
var portalType = 'Secure';
|
||||||
|
if (shortName === args.json.shortName) {
|
||||||
|
portalType = 'Unlocked';
|
||||||
|
}
|
||||||
|
this.addEntryPhotonEvent({
|
||||||
|
photonId: senderId,
|
||||||
|
text: `${portalType} PortalSpawn`,
|
||||||
|
type: 'PortalSpawn',
|
||||||
|
shortName,
|
||||||
|
location,
|
||||||
|
created_at: datetime
|
||||||
|
});
|
||||||
|
return args;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
} else if (eventData.EventName === '_SendOnSpawn') {
|
} else if (eventData.EventName === '_SendOnSpawn') {
|
||||||
return;
|
return;
|
||||||
@@ -9203,11 +9235,13 @@ speechSynthesis.getVoices();
|
|||||||
}
|
}
|
||||||
} else if (eventData.EventName === 'ReloadAvatarNetworkedRPC') {
|
} else if (eventData.EventName === 'ReloadAvatarNetworkedRPC') {
|
||||||
var text = 'AvatarReset';
|
var text = 'AvatarReset';
|
||||||
|
} else if (eventData.EventName === 'ReleaseBones') {
|
||||||
|
var text = 'ResetPhysBones';
|
||||||
} else if (eventData.EventName === 'SpawnEmojiRPC') {
|
} else if (eventData.EventName === 'SpawnEmojiRPC') {
|
||||||
var text = `SpawnEmoji ${this.photonEmojis[eventData.Data]}`;
|
var text = `SpawnEmoji ${this.photonEmojis[eventData.Data]}`;
|
||||||
} else {
|
} else {
|
||||||
var eventVrc = '';
|
var eventVrc = '';
|
||||||
if (eventData.Data.length > 0) {
|
if (eventData.Data && eventData.Data.length > 0) {
|
||||||
eventVrc = ` ${JSON.stringify(eventData.Data).replace(
|
eventVrc = ` ${JSON.stringify(eventData.Data).replace(
|
||||||
/"([^(")"]+)":/g,
|
/"([^(")"]+)":/g,
|
||||||
'$1:'
|
'$1:'
|
||||||
@@ -9405,18 +9439,23 @@ speechSynthesis.getVoices();
|
|||||||
var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min
|
var bias = Date.parse(gameLogDate) + 60 * 1000; // 1min
|
||||||
if (bias > Date.now()) {
|
if (bias > Date.now()) {
|
||||||
if (typeof ref === 'undefined' || typeof ref.id === 'undefined') {
|
if (typeof ref === 'undefined' || typeof ref.id === 'undefined') {
|
||||||
var args = await API.getUser({
|
try {
|
||||||
userId: user.id
|
var args = await API.getUser({
|
||||||
});
|
userId: user.id
|
||||||
ref = args.ref;
|
|
||||||
if (photonUser.last_platform !== ref.last_platform) {
|
|
||||||
this.addEntryPhotonEvent({
|
|
||||||
photonId,
|
|
||||||
text: `API/Photon platform mismatch ${ref.last_platform}/${photonUser.last_platform}`,
|
|
||||||
type: 'PhotonBot',
|
|
||||||
color: 'yellow',
|
|
||||||
created_at: Date.parse(gameLogDate)
|
|
||||||
});
|
});
|
||||||
|
ref = args.ref;
|
||||||
|
if (photonUser.last_platform !== ref.last_platform) {
|
||||||
|
this.addEntryPhotonEvent({
|
||||||
|
photonId,
|
||||||
|
text: `API/Photon platform mismatch ${ref.last_platform}/${photonUser.last_platform}`,
|
||||||
|
type: 'PhotonBot',
|
||||||
|
color: 'yellow',
|
||||||
|
created_at: Date.parse(gameLogDate)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
ref = photonUser;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
!ref.isFriend &&
|
!ref.isFriend &&
|
||||||
@@ -11509,14 +11548,18 @@ speechSynthesis.getVoices();
|
|||||||
type: 'info',
|
type: 'info',
|
||||||
callback: (action) => {
|
callback: (action) => {
|
||||||
if (action === 'confirm') {
|
if (action === 'confirm') {
|
||||||
var L = API.parseLocation(this.lastLocation.location);
|
var currentLocation = this.lastLocation.location;
|
||||||
|
if (this.lastLocation.location === 'traveling') {
|
||||||
|
currentLocation = this.lastLocationDestination;
|
||||||
|
}
|
||||||
|
var L = API.parseLocation(currentLocation);
|
||||||
API.getCachedWorld({
|
API.getCachedWorld({
|
||||||
worldId: L.worldId
|
worldId: L.worldId
|
||||||
}).then((args) => {
|
}).then((args) => {
|
||||||
API.sendInvite(
|
API.sendInvite(
|
||||||
{
|
{
|
||||||
instanceId: this.lastLocation.location,
|
instanceId: L.tag,
|
||||||
worldId: this.lastLocation.location,
|
worldId: L.tag,
|
||||||
worldName: args.ref.name,
|
worldName: args.ref.name,
|
||||||
rsvp: true
|
rsvp: true
|
||||||
},
|
},
|
||||||
@@ -12619,9 +12662,12 @@ speechSynthesis.getVoices();
|
|||||||
if (input.startsWith('/home/')) {
|
if (input.startsWith('/home/')) {
|
||||||
input = `https://vrchat.com${input}`;
|
input = `https://vrchat.com${input}`;
|
||||||
}
|
}
|
||||||
if (input.startsWith('https://vrch.at')) {
|
if (input.startsWith('https://vrch.at/')) {
|
||||||
return AppApi.FollowUrl(input).then((output) => {
|
var shortName = input.substring(16, 24);
|
||||||
return this.directAccessWorld(output);
|
return API.getInstanceFromShortName({shortName}).then((args) => {
|
||||||
|
var location = args.json.location;
|
||||||
|
this.directAccessWorld(location);
|
||||||
|
return args;
|
||||||
});
|
});
|
||||||
} else if (
|
} else if (
|
||||||
input.startsWith('https://vrchat.') ||
|
input.startsWith('https://vrchat.') ||
|
||||||
@@ -14244,14 +14290,18 @@ speechSynthesis.getVoices();
|
|||||||
D.id
|
D.id
|
||||||
);
|
);
|
||||||
} else if (command === 'Invite') {
|
} else if (command === 'Invite') {
|
||||||
var L = API.parseLocation(this.lastLocation.location);
|
var currentLocation = this.lastLocation.location;
|
||||||
|
if (this.lastLocation.location === 'traveling') {
|
||||||
|
currentLocation = this.lastLocationDestination;
|
||||||
|
}
|
||||||
|
var L = API.parseLocation(currentLocation);
|
||||||
API.getCachedWorld({
|
API.getCachedWorld({
|
||||||
worldId: L.worldId
|
worldId: L.worldId
|
||||||
}).then((args) => {
|
}).then((args) => {
|
||||||
API.sendInvite(
|
API.sendInvite(
|
||||||
{
|
{
|
||||||
instanceId: this.lastLocation.location,
|
instanceId: L.tag,
|
||||||
worldId: this.lastLocation.location,
|
worldId: L.tag,
|
||||||
worldName: args.ref.name
|
worldName: args.ref.name
|
||||||
},
|
},
|
||||||
D.id
|
D.id
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ html
|
|||||||
i.x-user-status(:class="statusClass(scope.row.status)")
|
i.x-user-status(:class="statusClass(scope.row.status)")
|
||||||
span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription" style="margin-left:10px")
|
span(v-if="scope.row.statusDescription !== scope.row.previousStatusDescription" v-text="scope.row.statusDescription" style="margin-left:10px")
|
||||||
span(v-else-if="scope.row.color === 'yellow'" v-text="scope.row.text" style="color:yellow")
|
span(v-else-if="scope.row.color === 'yellow'" v-text="scope.row.text" style="color:yellow")
|
||||||
|
span.x-link(v-else-if="scope.row.type === 'PortalSpawn'" v-text="scope.row.text" @click="showWorldDialog(scope.row.location, scope.row.shortName)")
|
||||||
span(v-else v-text="scope.row.text")
|
span(v-else v-text="scope.row.text")
|
||||||
el-tab-pane(label="Previous")
|
el-tab-pane(label="Previous")
|
||||||
data-tables(v-bind="photonEventTablePrevious" style="margin-bottom:10px")
|
data-tables(v-bind="photonEventTablePrevious" style="margin-bottom:10px")
|
||||||
|
|||||||
Reference in New Issue
Block a user