mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 09:43:49 +02:00
Small changes and fixes
This commit is contained in:
158
html/src/app.js
158
html/src/app.js
@@ -2175,6 +2175,10 @@ speechSynthesis.getVoices();
|
||||
|
||||
API.actuallyGetCurrentLocation = async function () {
|
||||
let gameLogLocation = $app.lastLocation.location;
|
||||
if (gameLogLocation.startsWith('local')) {
|
||||
console.warn('PWI: local test mode', 'test_world');
|
||||
return 'test_world';
|
||||
}
|
||||
if (gameLogLocation === 'traveling') {
|
||||
gameLogLocation = $app.lastLocationDestination;
|
||||
}
|
||||
@@ -2913,7 +2917,7 @@ speechSynthesis.getVoices();
|
||||
if (
|
||||
json.unityPackages?.length > 0 &&
|
||||
unityPackages.length > 0 &&
|
||||
!json.unityPackages.assetUrl
|
||||
!json.unityPackages[0].assetUrl
|
||||
) {
|
||||
ref.unityPackages = unityPackages;
|
||||
}
|
||||
@@ -5304,12 +5308,15 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.methods.openExternalLink = function (link) {
|
||||
this.$confirm(`${link}`, 'Open External Link', {
|
||||
confirmButtonText: 'Confirm',
|
||||
cancelButtonText: 'Cancel',
|
||||
distinguishCancelAndClose: true,
|
||||
confirmButtonText: 'Open',
|
||||
cancelButtonText: 'Copy',
|
||||
type: 'info',
|
||||
callback: (action) => {
|
||||
if (action === 'confirm') {
|
||||
AppApi.OpenLink(link);
|
||||
} else if (action === 'cancel') {
|
||||
this.copyLink(link);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -5663,6 +5670,8 @@ speechSynthesis.getVoices();
|
||||
// on Location change remove OnPlayerLeft
|
||||
if (ctx.type === 'LocationDestination') {
|
||||
currentUserLeaveTime = Date.parse(ctx.created_at);
|
||||
var currentUserLeaveTimeOffset =
|
||||
currentUserLeaveTime + 5 * 1000;
|
||||
for (var k = w - 1; k > -1; k--) {
|
||||
var feedItem = wristArr[k];
|
||||
if (
|
||||
@@ -5670,7 +5679,7 @@ speechSynthesis.getVoices();
|
||||
Date.parse(feedItem.created_at) >=
|
||||
currentUserLeaveTime &&
|
||||
Date.parse(feedItem.created_at) <=
|
||||
currentUserLeaveTime + 5 * 1000
|
||||
currentUserLeaveTimeOffset
|
||||
) {
|
||||
wristArr.splice(k, 1);
|
||||
w--;
|
||||
@@ -5680,13 +5689,14 @@ speechSynthesis.getVoices();
|
||||
// on Location change remove OnPlayerJoined
|
||||
if (ctx.type === 'Location') {
|
||||
locationJoinTime = Date.parse(ctx.created_at);
|
||||
var locationJoinTimeOffset = locationJoinTime + 20 * 1000;
|
||||
for (var k = w - 1; k > -1; k--) {
|
||||
var feedItem = wristArr[k];
|
||||
if (
|
||||
feedItem.type === 'OnPlayerJoined' &&
|
||||
Date.parse(feedItem.created_at) >= locationJoinTime &&
|
||||
Date.parse(feedItem.created_at) <=
|
||||
locationJoinTime + 20 * 1000
|
||||
locationJoinTimeOffset
|
||||
) {
|
||||
wristArr.splice(k, 1);
|
||||
w--;
|
||||
@@ -5755,8 +5765,12 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
}
|
||||
}
|
||||
// when too many user joins happen at once when switching instances
|
||||
// the "w" counter maxes out and wont add any more entries
|
||||
// until the onJoins are cleared by "Location"
|
||||
// e.g. if a "VideoPlay" occurs between "OnPlayerJoined" and "Location" it wont be added
|
||||
if (
|
||||
w < 20 &&
|
||||
w < 50 &&
|
||||
wristFilter[ctx.type] &&
|
||||
(wristFilter[ctx.type] === 'On' ||
|
||||
wristFilter[ctx.type] === 'Everyone' ||
|
||||
@@ -11059,6 +11073,26 @@ speechSynthesis.getVoices();
|
||||
playerCount: 0,
|
||||
pendingLeave: 0
|
||||
});
|
||||
} else if (data.Parameters[245][0] === 21) {
|
||||
var portalId = data.Parameters[245][1];
|
||||
var userId = data.Parameters[245][2];
|
||||
var playerCount = data.Parameters[245][3];
|
||||
var shortName = data.Parameters[245][5];
|
||||
var worldName = '';
|
||||
this.addPhotonPortalSpawn(
|
||||
gameLogDate,
|
||||
userId,
|
||||
shortName,
|
||||
worldName
|
||||
);
|
||||
this.photonLobbyActivePortals.set(portalId, {
|
||||
userId,
|
||||
shortName,
|
||||
worldName,
|
||||
created_at: Date.parse(gameLogDate),
|
||||
playerCount: 0,
|
||||
pendingLeave: 0
|
||||
});
|
||||
} else if (data.Parameters[245][0] === 22) {
|
||||
var portalId = data.Parameters[245][1];
|
||||
var text = 'DeletedPortal';
|
||||
@@ -11244,6 +11278,10 @@ speechSynthesis.getVoices();
|
||||
if (L.groupId) {
|
||||
groupName = await this.getGroupName(L.groupId);
|
||||
}
|
||||
if (!worldName) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
worldName = await this.getWorldName(location);
|
||||
}
|
||||
// var newShortName = instance.json.shortName;
|
||||
// var portalType = 'Secure';
|
||||
// if (shortName === newShortName) {
|
||||
@@ -11328,8 +11366,6 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
if (data.avatarEyeHeight < 0) {
|
||||
text = 'Photon bot has joined, invalid avatarEyeHeight';
|
||||
} else if (data.user.last_platform === 'android' && !data.inVRMode) {
|
||||
var text = 'User joined as Quest in desktop mode';
|
||||
} else if (
|
||||
data.user.last_platform === 'android' &&
|
||||
platforms.length > 0 &&
|
||||
@@ -11782,6 +11818,9 @@ speechSynthesis.getVoices();
|
||||
) {
|
||||
url = new URL(url.searchParams.get('url'));
|
||||
}
|
||||
if (videoUrl.startsWith('https://u2b.cx/')) {
|
||||
url = new URL(videoUrl.substring(15));
|
||||
}
|
||||
var id1 = url.pathname;
|
||||
var id2 = url.searchParams.get('v');
|
||||
if (id1 && id1.length === 12) {
|
||||
@@ -11794,6 +11833,7 @@ speechSynthesis.getVoices();
|
||||
}
|
||||
if (id2 && id2.length === 11) {
|
||||
// https://www.youtube.com/watch?v=
|
||||
// https://music.youtube.com/watch?v=
|
||||
youtubeVideoId = id2;
|
||||
}
|
||||
if (this.youTubeApi && youtubeVideoId) {
|
||||
@@ -12994,7 +13034,7 @@ speechSynthesis.getVoices();
|
||||
$app.applyFavorite('avatar', args.ref.id);
|
||||
});
|
||||
|
||||
$app.methods.applyFavorite = function (type, objectId, sortTop) {
|
||||
$app.methods.applyFavorite = async function (type, objectId, sortTop) {
|
||||
var favorite = API.cachedFavoritesByObjectId.get(objectId);
|
||||
var ctx = this.favoriteObjects.get(objectId);
|
||||
if (typeof favorite !== 'undefined') {
|
||||
@@ -13060,6 +13100,7 @@ speechSynthesis.getVoices();
|
||||
this.sortFavoriteFriends = true;
|
||||
}
|
||||
}
|
||||
// else too bad
|
||||
} else if (type === 'world') {
|
||||
var ref = API.cachedWorlds.get(objectId);
|
||||
if (typeof ref !== 'undefined') {
|
||||
@@ -13070,6 +13111,27 @@ speechSynthesis.getVoices();
|
||||
ctx.name = ref.name;
|
||||
this.sortFavoriteWorlds = true;
|
||||
}
|
||||
} else {
|
||||
// try fetch from local world favorites
|
||||
var world = await database.getCachedWorldById(objectId);
|
||||
if (world) {
|
||||
ctx.ref = world;
|
||||
ctx.name = world.name;
|
||||
ctx.deleted = true;
|
||||
this.sortFavoriteWorlds = true;
|
||||
}
|
||||
if (!world) {
|
||||
// try fetch from local world history
|
||||
var worldName =
|
||||
await database.getGameLogWorldNameByWorldId(
|
||||
objectId
|
||||
);
|
||||
if (worldName) {
|
||||
ctx.name = worldName;
|
||||
ctx.deleted = true;
|
||||
this.sortFavoriteWorlds = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type === 'avatar') {
|
||||
var ref = API.cachedAvatars.get(objectId);
|
||||
@@ -13081,6 +13143,17 @@ speechSynthesis.getVoices();
|
||||
ctx.name = ref.name;
|
||||
this.sortFavoriteAvatars = true;
|
||||
}
|
||||
} else {
|
||||
// try fetch from local avatar history
|
||||
var avatar = await database.getCachedAvatarById(
|
||||
objectId
|
||||
);
|
||||
if (avatar) {
|
||||
ctx.ref = avatar;
|
||||
ctx.name = avatar.name;
|
||||
ctx.deleted = true;
|
||||
this.sortFavoriteAvatars = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15196,6 +15269,17 @@ speechSynthesis.getVoices();
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.showGroupDialogShortCode = function (shortCode) {
|
||||
API.groupStrictsearch({ query: shortCode }).then((args) => {
|
||||
for (var group of args.json) {
|
||||
if (`${group.shortCode}.${group.discriminator}` === shortCode) {
|
||||
this.showGroupDialog(group.id);
|
||||
}
|
||||
}
|
||||
return args;
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.directAccessParse = function (input) {
|
||||
if (!input) {
|
||||
return false;
|
||||
@@ -15219,19 +15303,12 @@ speechSynthesis.getVoices();
|
||||
this.showGroupDialog(groupId);
|
||||
return true;
|
||||
}
|
||||
} else if (input.startsWith('https://vrc.group/')) {
|
||||
} else if (
|
||||
input.startsWith('https://vrc.group/') ||
|
||||
/^[A-Za-z0-9]{3,6}\.[0-9]{4}$/g.test(input)
|
||||
) {
|
||||
var shortCode = input.substring(18);
|
||||
API.groupStrictsearch({ query: shortCode }).then((args) => {
|
||||
for (var group of args.json) {
|
||||
if (
|
||||
`${group.shortCode}.${group.discriminator}` ===
|
||||
shortCode
|
||||
) {
|
||||
this.showGroupDialog(group.id);
|
||||
}
|
||||
}
|
||||
return args;
|
||||
});
|
||||
this.showGroupDialogShortCode(shortCode);
|
||||
return true;
|
||||
} else if (
|
||||
input.substring(0, 4) === 'usr_' ||
|
||||
@@ -19034,7 +19111,8 @@ speechSynthesis.getVoices();
|
||||
|
||||
$app.data.setWorldTagsDialog = {
|
||||
visible: false,
|
||||
tags: [],
|
||||
authorTags: [],
|
||||
contentTags: [],
|
||||
debugAllowed: false,
|
||||
avatarScalingDisabled: false
|
||||
};
|
||||
@@ -19044,10 +19122,14 @@ speechSynthesis.getVoices();
|
||||
var D = this.setWorldTagsDialog;
|
||||
D.visible = true;
|
||||
var oldTags = this.worldDialog.ref.tags;
|
||||
var tags = [];
|
||||
var authorTags = [];
|
||||
var contentTags = [];
|
||||
oldTags.forEach((tag) => {
|
||||
if (tag.includes('author_tag_')) {
|
||||
tags.unshift(tag.substring(11));
|
||||
if (tag.startsWith('author_tag_')) {
|
||||
authorTags.unshift(tag.substring(11));
|
||||
}
|
||||
if (tag.startsWith('content_')) {
|
||||
contentTags.unshift(tag.substring(8));
|
||||
}
|
||||
if (tag === 'debug_allowed') {
|
||||
D.debugAllowed = true;
|
||||
@@ -19056,18 +19138,25 @@ speechSynthesis.getVoices();
|
||||
D.avatarScalingDisabled = true;
|
||||
}
|
||||
});
|
||||
D.tags = tags.toString();
|
||||
D.authorTags = authorTags.toString();
|
||||
D.contentTags = contentTags.toString();
|
||||
};
|
||||
|
||||
$app.methods.saveSetWorldTagsDialog = function () {
|
||||
var D = this.setWorldTagsDialog;
|
||||
var oldTags = D.tags.split(',');
|
||||
var authorTags = D.authorTags.trim().split(',');
|
||||
var contentTags = D.contentTags.trim().split(',');
|
||||
var tags = [];
|
||||
oldTags.forEach((tag) => {
|
||||
authorTags.forEach((tag) => {
|
||||
if (tag) {
|
||||
tags.unshift(`author_tag_${tag}`);
|
||||
}
|
||||
});
|
||||
contentTags.forEach((tag) => {
|
||||
if (tag) {
|
||||
tags.unshift(`content_${tag}`);
|
||||
}
|
||||
});
|
||||
if (D.debugAllowed) {
|
||||
tags.unshift('debug_allowed');
|
||||
}
|
||||
@@ -19434,6 +19523,14 @@ speechSynthesis.getVoices();
|
||||
this.copyToClipboard(text);
|
||||
};
|
||||
|
||||
$app.methods.copyLink = function (text) {
|
||||
this.$message({
|
||||
message: 'Link copied to clipboard',
|
||||
type: 'success'
|
||||
});
|
||||
this.copyToClipboard(text);
|
||||
};
|
||||
|
||||
// #endregion
|
||||
// #region | App: VRCPlus Icons
|
||||
|
||||
@@ -22223,6 +22320,9 @@ speechSynthesis.getVoices();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!assetUrl) {
|
||||
assetUrl = ref.assetUrl;
|
||||
}
|
||||
var id = extractFileId(assetUrl);
|
||||
var version = parseInt(extractFileVersion(assetUrl), 10);
|
||||
if (!id || !version) {
|
||||
@@ -24326,7 +24426,7 @@ speechSynthesis.getVoices();
|
||||
case 'offline':
|
||||
case 'private':
|
||||
case 'traveling':
|
||||
case 'local':
|
||||
case instanceId.startsWith('local'):
|
||||
case '':
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user