mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-11 10:53:52 +02:00
Direct access 1 click
This commit is contained in:
11
AppApi.cs
11
AppApi.cs
@@ -21,6 +21,7 @@ using librsync.net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace VRCX
|
||||
{
|
||||
@@ -453,6 +454,16 @@ namespace VRCX
|
||||
return output;
|
||||
}
|
||||
|
||||
public string GetClipboard()
|
||||
{
|
||||
var clipboard = String.Empty;
|
||||
Thread thread = new Thread(() => clipboard = Clipboard.GetText());
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
public void SetStartup(bool enabled)
|
||||
{
|
||||
try
|
||||
|
||||
146
html/src/app.js
146
html/src/app.js
@@ -12342,77 +12342,9 @@ speechSynthesis.getVoices();
|
||||
callback: (action, instance) => {
|
||||
if (action === 'confirm' && instance.inputValue) {
|
||||
var input = instance.inputValue;
|
||||
var testUrl = input.substring(0, 15);
|
||||
if (testUrl === 'https://vrch.at') {
|
||||
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'
|
||||
) {
|
||||
url = url.substring(18);
|
||||
}
|
||||
if (url.substring(0, 13) === '/home/launch?') {
|
||||
var urlParams = new URLSearchParams(
|
||||
url.substring(13)
|
||||
);
|
||||
var worldId = urlParams.get('worldId');
|
||||
var instanceId =
|
||||
urlParams.get('instanceId');
|
||||
if (instanceId) {
|
||||
var location = `${worldId}:${instanceId}`;
|
||||
this.showWorldDialog(location);
|
||||
} else if (worldId) {
|
||||
this.showWorldDialog(worldId);
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: 'Invalid URL',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (testUrl === 'https://vrchat.') {
|
||||
var url = new URL(input);
|
||||
var urlPath = url.pathname;
|
||||
if (urlPath.substring(5, 11) === '/user/') {
|
||||
var userId = urlPath.substring(11);
|
||||
this.showUserDialog(userId);
|
||||
} else if (
|
||||
urlPath.substring(5, 13) === '/avatar/'
|
||||
) {
|
||||
var avatarId = urlPath.substring(13);
|
||||
this.showAvatarDialog(avatarId);
|
||||
} else if (urlPath.substring(5, 12) === '/world/') {
|
||||
var worldId = urlPath.substring(12);
|
||||
this.showWorldDialog(worldId);
|
||||
} else if (urlPath.substring(5, 12) === '/launch') {
|
||||
var urlParams = new URLSearchParams(url.search);
|
||||
var worldId = urlParams.get('worldId');
|
||||
var instanceId = urlParams.get('instanceId');
|
||||
if (instanceId) {
|
||||
var location = `${worldId}:${instanceId}`;
|
||||
this.showWorldDialog(location);
|
||||
} else if (worldId) {
|
||||
this.showWorldDialog(worldId);
|
||||
}
|
||||
} else {
|
||||
this.$message({
|
||||
message: 'Invalid URL',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
} else if (input.substring(0, 4) === 'usr_') {
|
||||
this.showUserDialog(input);
|
||||
} else if (input.substring(0, 5) === 'wrld_') {
|
||||
this.showWorldDialog(input);
|
||||
} else if (input.substring(0, 5) === 'avtr_') {
|
||||
this.showAvatarDialog(input);
|
||||
} else {
|
||||
if (!this.directAccessParse(input)) {
|
||||
this.$message({
|
||||
message: 'Invalid ID/URL',
|
||||
message: 'Invalid URL/ID',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
@@ -12422,6 +12354,80 @@ speechSynthesis.getVoices();
|
||||
);
|
||||
};
|
||||
|
||||
$app.methods.directAccessPaste = function () {
|
||||
AppApi.GetClipboard().then((clipboard) => {
|
||||
if (!this.directAccessParse(clipboard)) {
|
||||
this.promptOmniDirectDialog();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$app.methods.directAccessParse = function (input) {
|
||||
var testUrl = input.substring(0, 15);
|
||||
if (testUrl === 'https://vrch.at') {
|
||||
return 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') {
|
||||
url = url.substring(18);
|
||||
}
|
||||
if (url.substring(0, 13) === '/home/launch?') {
|
||||
var urlParams = new URLSearchParams(url.substring(13));
|
||||
var worldId = urlParams.get('worldId');
|
||||
var instanceId = urlParams.get('instanceId');
|
||||
if (instanceId) {
|
||||
var location = `${worldId}:${instanceId}`;
|
||||
this.showWorldDialog(location);
|
||||
return true;
|
||||
} else if (worldId) {
|
||||
this.showWorldDialog(worldId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else if (testUrl === 'https://vrchat.') {
|
||||
var url = new URL(input);
|
||||
var urlPath = url.pathname;
|
||||
if (urlPath.substring(5, 11) === '/user/') {
|
||||
var userId = urlPath.substring(11);
|
||||
this.showUserDialog(userId);
|
||||
return true;
|
||||
} else if (urlPath.substring(5, 13) === '/avatar/') {
|
||||
var avatarId = urlPath.substring(13);
|
||||
this.showAvatarDialog(avatarId);
|
||||
return true;
|
||||
} else if (urlPath.substring(5, 12) === '/world/') {
|
||||
var worldId = urlPath.substring(12);
|
||||
this.showWorldDialog(worldId);
|
||||
return true;
|
||||
} else if (urlPath.substring(5, 12) === '/launch') {
|
||||
var urlParams = new URLSearchParams(url.search);
|
||||
var worldId = urlParams.get('worldId');
|
||||
var instanceId = urlParams.get('instanceId');
|
||||
if (instanceId) {
|
||||
var location = `${worldId}:${instanceId}`;
|
||||
this.showWorldDialog(location);
|
||||
return true;
|
||||
} else if (worldId) {
|
||||
this.showWorldDialog(worldId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if (input.substring(0, 4) === 'usr_') {
|
||||
this.showUserDialog(input);
|
||||
return true;
|
||||
} else if (input.substring(0, 5) === 'wrld_') {
|
||||
this.showWorldDialog(input);
|
||||
return true;
|
||||
} else if (input.substring(0, 5) === 'avtr_') {
|
||||
this.showAvatarDialog(input);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$app.methods.promptNotificationTimeout = function () {
|
||||
this.$prompt('Enter amount of seconds', 'Notification Timeout', {
|
||||
distinguishCancelAndClose: true,
|
||||
|
||||
@@ -1312,7 +1312,7 @@ html
|
||||
img.avatar(v-lazy="userImage(item.ref)")
|
||||
span(v-else) Search More: #[span(v-text="item.label" style="font-weight:bold")]
|
||||
el-tooltip(placement="bottom" content="Direct access ID/URL" :disabled="hideTooltips")
|
||||
el-button(type="default" @click="promptOmniDirectDialog()" size="mini" icon="el-icon-discover" circle)
|
||||
el-button(type="default" @click="directAccessPaste" size="mini" icon="el-icon-discover" circle)
|
||||
el-tooltip(placement="bottom" content="Refresh friends" :disabled="hideTooltips")
|
||||
el-button(type="default" @click="API.closeWebSocket(); API.getCurrentUser(); API.refreshFriends()" :loading="API.isRefreshFriendsLoading" size="mini" icon="el-icon-refresh" circle style="margin-right:10px")
|
||||
.x-friend-list(style="padding-bottom:10px")
|
||||
|
||||
Reference in New Issue
Block a user