Various fixes and changes

This commit is contained in:
Natsumi
2023-02-21 13:17:52 +13:00
parent e606a85cf2
commit 7b824fb3f7
5 changed files with 74 additions and 24 deletions
+10 -2
View File
@@ -696,9 +696,9 @@ namespace VRCX
if (File.Exists(path) && path.EndsWith(".png") && fileName.StartsWith(fileNamePrefix)) if (File.Exists(path) && path.EndsWith(".png") && fileName.StartsWith(fileNamePrefix))
{ {
string metadataString = null; string metadataString = null;
bool readPNGFailed = false; var readPNGFailed = false;
try try
{ {
metadataString = ScreenshotHelper.ReadPNGDescription(path); metadataString = ScreenshotHelper.ReadPNGDescription(path);
} }
@@ -767,6 +767,14 @@ namespace VRCX
MainForm.Instance.BeginInvoke(new MethodInvoker(() => { WinformThemer.Flash(MainForm.Instance); })); MainForm.Instance.BeginInvoke(new MethodInvoker(() => { WinformThemer.Flash(MainForm.Instance); }));
} }
public void SetUserAgent()
{
using (var client = MainForm.Instance.Browser.GetDevToolsClient())
{
_ = client.Network.SetUserAgentOverrideAsync(Program.Version);
}
}
private struct XSOMessage private struct XSOMessage
{ {
public int messageType { get; set; } public int messageType { get; set; }
+8 -9
View File
@@ -1,8 +1,8 @@
using System;
using System.IO;
using CefSharp; using CefSharp;
using CefSharp.SchemeHandler; using CefSharp.SchemeHandler;
using CefSharp.WinForms; using CefSharp.WinForms;
using System;
using System.IO;
namespace VRCX namespace VRCX
{ {
@@ -24,16 +24,17 @@ namespace VRCX
LogSeverity = LogSeverity.Disable, LogSeverity = LogSeverity.Disable,
WindowlessRenderingEnabled = true, WindowlessRenderingEnabled = true,
PersistSessionCookies = true, PersistSessionCookies = true,
PersistUserPreferences = true PersistUserPreferences = true,
UserAgent = Program.Version
}; };
cefSettings.RegisterScheme(new CefCustomScheme cefSettings.RegisterScheme(new CefCustomScheme
{ {
SchemeName = "file", SchemeName = "file",
DomainName = "vrcx", DomainName = "vrcx",
SchemeHandlerFactory = new FolderSchemeHandlerFactory( SchemeHandlerFactory = new FolderSchemeHandlerFactory(
rootFolder: Path.Combine(Program.BaseDirectory, "html"), Path.Combine(Program.BaseDirectory, "html"),
schemeName: "file", "file",
defaultPage: "index.html" defaultPage: "index.html"
), ),
IsLocal = true IsLocal = true
@@ -46,7 +47,7 @@ namespace VRCX
cefSettings.CefCommandLineArgs.Add("disable-pdf-extension"); cefSettings.CefCommandLineArgs.Add("disable-pdf-extension");
cefSettings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required"; cefSettings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required";
cefSettings.CefCommandLineArgs.Add("disable-web-security"); cefSettings.CefCommandLineArgs.Add("disable-web-security");
cefSettings.SetOffScreenRenderingBestPerformanceArgs(); cefSettings.SetOffScreenRenderingBestPerformanceArgs(); // causes white screen sometimes?
if (Program.LaunchDebug) if (Program.LaunchDebug)
cefSettings.RemoteDebuggingPort = 8088; cefSettings.RemoteDebuggingPort = 8088;
@@ -57,8 +58,6 @@ namespace VRCX
// Enable High-DPI support on Windows 7 or newer // Enable High-DPI support on Windows 7 or newer
Cef.EnableHighDPISupport(); Cef.EnableHighDPISupport();
cefSettings.UserAgent = Program.Version;
if (Cef.Initialize(cefSettings) == false) if (Cef.Initialize(cefSettings) == false)
{ {
throw new Exception("Cef.Initialize()"); throw new Exception("Cef.Initialize()");
+42 -8
View File
@@ -412,11 +412,7 @@ speechSynthesis.getVoices();
if (response.status === 200) { if (response.status === 200) {
this.$throw(0, 'Invalid JSON response'); this.$throw(0, 'Invalid JSON response');
} }
if ( if (response.status === 504 || response.status === 502) {
response.status === 504 ||
response.status === 502 ||
response.status === 429
) {
// ignore expected API errors // ignore expected API errors
throw new Error( throw new Error(
`${response.status}: ${response.data} ${endpoint}` `${response.status}: ${response.data} ${endpoint}`
@@ -492,6 +488,9 @@ speechSynthesis.getVoices();
) { ) {
throw new Error(`403: ${data.error.message} ${endpoint}`); throw new Error(`403: ${data.error.message} ${endpoint}`);
} }
if (status === 429) {
throw new Error(`429: ${data.error.message} ${endpoint}`);
}
if (data && data.error === Object(data.error)) { if (data && data.error === Object(data.error)) {
this.$throw( this.$throw(
data.error.status_code || status, data.error.status_code || status,
@@ -4798,6 +4797,7 @@ speechSynthesis.getVoices();
watch: {}, watch: {},
el: '#x-app', el: '#x-app',
mounted() { mounted() {
AppApi.SetUserAgent();
AppApi.GetVersion().then((version) => { AppApi.GetVersion().then((version) => {
this.appVersion = version; this.appVersion = version;
this.comapreAppVersion(); this.comapreAppVersion();
@@ -13326,7 +13326,7 @@ speechSynthesis.getVoices();
configRepository.setInt('VRCX_asidewidth', $app.data.asideWidth); configRepository.setInt('VRCX_asidewidth', $app.data.asideWidth);
} }
if (!configRepository.getString('VRCX_autoUpdateVRCX')) { if (!configRepository.getString('VRCX_autoUpdateVRCX')) {
$app.data.autoUpdateVRCX = 'Notify'; $app.data.autoUpdateVRCX = 'Auto Download';
configRepository.setString( configRepository.setString(
'VRCX_autoUpdateVRCX', 'VRCX_autoUpdateVRCX',
$app.data.autoUpdateVRCX $app.data.autoUpdateVRCX
@@ -20123,13 +20123,21 @@ speechSynthesis.getVoices();
this.WriteVRChatConfigFile(); this.WriteVRChatConfigFile();
}; };
$app.data.VRChatResolutions = [ $app.data.VRChatScreenshotResolutions = [
{name: '1280x720 (720p)', width: 1280, height: 720}, {name: '1280x720 (720p)', width: 1280, height: 720},
{name: '1920x1080 (1080p Default)', width: '', height: ''}, {name: '1920x1080 (1080p Default)', width: '', height: ''},
{name: '2560x1440 (1440p)', width: 2560, height: 1440}, {name: '2560x1440 (1440p)', width: 2560, height: 1440},
{name: '3840x2160 (4K)', width: 3840, height: 2160} {name: '3840x2160 (4K)', width: 3840, height: 2160}
]; ];
$app.data.VRChatCameraResolutions = [
{name: '1280x720 (720p)', width: 1280, height: 720},
{name: '1920x1080 (1080p Default)', width: '', height: ''},
{name: '2560x1440 (1440p)', width: 2560, height: 1440},
{name: '3840x2160 (4K)', width: 3840, height: 2160},
{name: '7680x4320 (8K)', width: 7680, height: 4320}
];
$app.methods.getVRChatResolution = function (res) { $app.methods.getVRChatResolution = function (res) {
switch (res) { switch (res) {
case '1280x720': case '1280x720':
@@ -20140,6 +20148,8 @@ speechSynthesis.getVoices();
return '2560x1440 (2K)'; return '2560x1440 (2K)';
case '3840x2160': case '3840x2160':
return '3840x2160 (4K)'; return '3840x2160 (4K)';
case '7680x4320':
return '7680x4320 (8K)';
} }
return `${res} (Custom)`; return `${res} (Custom)`;
}; };
@@ -20200,8 +20210,29 @@ speechSynthesis.getVoices();
$app.methods.displayScreenshotMetadata = function (metadata) { $app.methods.displayScreenshotMetadata = function (metadata) {
var D = this.screenshotMetadataDialog; var D = this.screenshotMetadataDialog;
var json = JSON.parse(metadata); var json = JSON.parse(metadata);
console.log(json);
D.metadata = json; D.metadata = json;
// VRChat_3840x2160_2022-02-02_03-21-39.771
// VRChat_2023-02-16_10-39-25.274_3840x2160
var regex = json.fileName.match(
/VRChat_((\d{3,})x(\d{3,})_(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})\.(\d{1,})|(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})-(\d{2})\.(\d{3})_(\d{3,})x(\d{3,}))/
);
if (regex) {
if (typeof regex[2] !== 'undefined') {
// old format
var date = `${regex[4]}-${regex[5]}-${regex[6]}`;
var time = `${regex[7]}:${regex[8]}:${regex[9]}`;
D.metadata.dateTime = Date.parse(`${date} ${time}`);
D.metadata.resolution = `${regex[2]}x${regex[3]}`;
} else if (typeof regex[11] !== 'undefined') {
// new format
var date = `${regex[11]}-${regex[12]}-${regex[13]}`;
var time = `${regex[14]}:${regex[15]}:${regex[16]}`;
D.metadata.dateTime = Date.parse(`${date} ${time}`);
D.metadata.resolution = `${regex[18]}x${regex[19]}`;
}
}
this.showScreenshotMetadataDialog(); this.showScreenshotMetadataDialog();
}; };
@@ -21277,7 +21308,10 @@ speechSynthesis.getVoices();
/\D/g, /\D/g,
'' ''
); );
// limit to 8 characters because 2019.4.31f1c1 is a thing
currentUnityVersion = currentUnityVersion.slice(0, 8);
var assetVersion = version.replace(/\D/g, ''); var assetVersion = version.replace(/\D/g, '');
assetVersion = assetVersion.slice(0, 8);
if (parseInt(assetVersion, 10) <= parseInt(currentUnityVersion, 10)) { if (parseInt(assetVersion, 10) <= parseInt(currentUnityVersion, 10)) {
return true; return true;
} }
+5 -4
View File
@@ -2687,7 +2687,7 @@ html
el-button(size="small") el-button(size="small")
span #[span(v-text="getVRChatCameraResolution()")] #[i.el-icon-arrow-down.el-icon--right] span #[span(v-text="getVRChatCameraResolution()")] #[i.el-icon-arrow-down.el-icon--right]
el-dropdown-menu(#default="dropdown") el-dropdown-menu(#default="dropdown")
el-dropdown-item(v-for="row in VRChatResolutions" :key="row.index" v-text="row.name" :command="row") el-dropdown-item(v-for="row in VRChatCameraResolutions" :key="row.index" v-text="row.name" :command="row")
div(style="display:inline-block;margin-top:10px;margin-left:10px") div(style="display:inline-block;margin-top:10px;margin-left:10px")
span {{ $t('dialog.config_json.screenshot_resolution') }} span {{ $t('dialog.config_json.screenshot_resolution') }}
br br
@@ -2695,7 +2695,7 @@ html
el-button(size="small") el-button(size="small")
span #[span(v-text="getVRChatScreenshotResolution()")] #[i.el-icon-arrow-down.el-icon--right] span #[span(v-text="getVRChatScreenshotResolution()")] #[i.el-icon-arrow-down.el-icon--right]
el-dropdown-menu(#default="dropdown") el-dropdown-menu(#default="dropdown")
el-dropdown-item(v-for="row in VRChatResolutions" :key="row.index" v-text="row.name" :command="row") el-dropdown-item(v-for="row in VRChatScreenshotResolutions" :key="row.index" v-text="row.name" :command="row")
el-checkbox(v-model="VRChatConfigFile.disableRichPresence" style="margin-top:5px;display:block") {{ $t('dialog.config_json.disable_discord_presence') }} el-checkbox(v-model="VRChatConfigFile.disableRichPresence" style="margin-top:5px;display:block") {{ $t('dialog.config_json.disable_discord_presence') }}
template(#footer) template(#footer)
el-button(size="small" @click="openExternalLink('https://docs.vrchat.com/docs/configuration-file')") {{ $t('dialog.config_json.vrchat_docs') }} el-button(size="small" @click="openExternalLink('https://docs.vrchat.com/docs/configuration-file')") {{ $t('dialog.config_json.vrchat_docs') }}
@@ -3800,8 +3800,9 @@ html
el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="screenshotMetadataDialog" :visible.sync="screenshotMetadataDialog.visible" :title="$t('dialog.screenshot_metadata.header')" width="1050px") el-dialog.x-dialog(:before-close="beforeDialogClose" @mousedown.native="dialogMouseDown" @mouseup.native="dialogMouseUp" ref="screenshotMetadataDialog" :visible.sync="screenshotMetadataDialog.visible" :title="$t('dialog.screenshot_metadata.header')" width="1050px")
div(v-if="screenshotMetadataDialog.visible") div(v-if="screenshotMetadataDialog.visible")
el-button(size="small" icon="el-icon-folder-opened" @click="AppApi.OpenScreenshotFileDialog()") {{ $t('dialog.screenshot_metadata.browse') }} el-button(size="small" icon="el-icon-folder-opened" @click="AppApi.OpenScreenshotFileDialog()") {{ $t('dialog.screenshot_metadata.browse') }}
br span(v-if="!screenshotMetadataDialog.metadata.resolution" v-text="screenshotMetadataDialog.metadata.fileName" style="margin-left:5px")
span(v-text="screenshotMetadataDialog.metadata.fileName") span(v-if="screenshotMetadataDialog.metadata.dateTime" style="margin-left:5px") {{ screenshotMetadataDialog.metadata.dateTime | formatDate('long') }}
span(v-if="screenshotMetadataDialog.metadata.resolution" v-text="screenshotMetadataDialog.metadata.resolution" style="margin-left:5px")
el-tag(v-if="screenshotMetadataDialog.metadata.fileSize" type="info" effect="plain" size="mini" style="margin-left:5px" v-text="screenshotMetadataDialog.metadata.fileSize") el-tag(v-if="screenshotMetadataDialog.metadata.fileSize" type="info" effect="plain" size="mini" style="margin-left:5px" v-text="screenshotMetadataDialog.metadata.fileSize")
br br
location(v-if="screenshotMetadataDialog.metadata.world" :location="screenshotMetadataDialog.metadata.world.instanceId" :hint="screenshotMetadataDialog.metadata.world.name") location(v-if="screenshotMetadataDialog.metadata.world" :location="screenshotMetadataDialog.metadata.world.instanceId" :hint="screenshotMetadataDialog.metadata.world.name")
+9 -1
View File
@@ -1024,6 +1024,8 @@ class Database {
var avatar = true; var avatar = true;
var online = true; var online = true;
var offline = true; var offline = true;
var aviPublic = search.includes('public');
var aviPrivate = search.includes('private');
if (filters.length > 0) { if (filters.length > 0) {
gps = false; gps = false;
status = false; status = false;
@@ -1103,6 +1105,12 @@ class Database {
}, `SELECT * FROM ${Database.userPrefix}_feed_bio WHERE (display_name LIKE '%${search}%' OR bio LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${Database.maxTableSize}`); }, `SELECT * FROM ${Database.userPrefix}_feed_bio WHERE (display_name LIKE '%${search}%' OR bio LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
} }
if (avatar) { if (avatar) {
var query = '';
if (aviPrivate) {
query = 'OR user_id = owner_id';
} else if (aviPublic) {
query = 'OR user_id != owner_id';
}
await sqliteService.execute((dbRow) => { await sqliteService.execute((dbRow) => {
var row = { var row = {
rowId: dbRow[0], rowId: dbRow[0],
@@ -1118,7 +1126,7 @@ class Database {
previousCurrentAvatarThumbnailImageUrl: dbRow[9] previousCurrentAvatarThumbnailImageUrl: dbRow[9]
}; };
feedDatabase.unshift(row); feedDatabase.unshift(row);
}, `SELECT * FROM ${Database.userPrefix}_feed_avatar WHERE (display_name LIKE '%${search}%' OR avatar_name LIKE '%${search}%') ${vipQuery} ORDER BY id DESC LIMIT ${Database.maxTableSize}`); }, `SELECT * FROM ${Database.userPrefix}_feed_avatar WHERE ((display_name LIKE '%${search}%' OR avatar_name LIKE '%${search}%') ${query}) ${vipQuery} ORDER BY id DESC LIMIT ${Database.maxTableSize}`);
} }
if (online || offline) { if (online || offline) {
var query = ''; var query = '';