Version file

This commit is contained in:
Natsumi
2022-10-04 01:54:38 +13:00
parent 376c7f7ae6
commit 053e85047e
9 changed files with 57 additions and 33 deletions

View File

@@ -370,6 +370,11 @@ namespace VRCX
return System.Globalization.CultureInfo.CurrentCulture.ToString();
}
public string GetVersion()
{
return Program.Version;
}
public void ChangeTheme(int value)
{
WinformThemer.SetGlobalTheme(value);

View File

@@ -50,7 +50,7 @@ namespace VRCX
// Enable High-DPI support on Windows 7 or newer
Cef.EnableHighDPISupport();
cefSettings.UserAgent = "VRCX Cef Browser";
cefSettings.UserAgent = Program.Version;
if (Cef.Initialize(cefSettings) == false)
{

2
MainForm.Designer.cs generated
View File

@@ -94,7 +94,7 @@ namespace VRCX
this.MinimumSize = new System.Drawing.Size(320, 240);
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "VRCX";
this.Text = Program.Version;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
this.Load += new System.EventHandler(this.MainForm_Load);

View File

@@ -15,6 +15,7 @@ namespace VRCX
public static string BaseDirectory { get; private set; }
public static string AppDataDirectory { get; private set; }
public static string ConfigLocation;
public static string Version { get; private set; }
public static bool LaunchDebug;
static Program()
@@ -55,10 +56,24 @@ namespace VRCX
}
}
private static void GetVersion()
{
var buildName = "VRCX";
try
{
Version = $"{buildName} {File.ReadAllText(Path.Combine(BaseDirectory, "Version"))}";
}
catch (Exception)
{
Version = $"{buildName} Build";
}
}
private static void Run()
{
Update.Check();
StartupArgs.ArgsCheck();
GetVersion();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@@ -154,6 +154,9 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<None Include="Version">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />

1
Version Normal file
View File

@@ -0,0 +1 @@
Build

View File

@@ -131,6 +131,7 @@ namespace VRCX
var request = WebRequest.CreateHttp((string)options["url"]);
request.CookieContainer = _cookieContainer;
request.KeepAlive = true;
request.UserAgent = Program.Version;
if (options.TryGetValue("headers", out object headers) == true)
{
@@ -143,10 +144,6 @@ namespace VRCX
{
request.ContentType = value;
}
else if (string.Compare(key, "User-Agent", StringComparison.OrdinalIgnoreCase) == 0)
{
request.UserAgent = value;
}
else if (string.Compare(key, "Referer", StringComparison.OrdinalIgnoreCase) == 0)
{
request.Referer = value;

View File

@@ -16,7 +16,6 @@ import {v4 as uuidv4} from 'uuid';
import * as workerTimers from 'worker-timers';
import 'default-passive-events';
import {appVersion} from './constants.js';
import configRepository from './repository/config.js';
import webApiService from './service/webapi.js';
import gameLogService from './service/gamelog.js';
@@ -383,10 +382,6 @@ speechSynthesis.getVoices();
init.body =
params === Object(params) ? JSON.stringify(params) : '{}';
}
init.headers = {
'User-Agent': appVersion,
...init.headers
};
var req = webApiService
.execute(init)
.catch((err) => {
@@ -4328,7 +4323,7 @@ speechSynthesis.getVoices();
isGameRunning: false,
isGameNoVR: configRepository.getBool('isGameNoVR'),
isSteamVRRunning: false,
appVersion,
appVersion: '',
latestAppVersion: '',
ossDialog: false,
exportFriendsListDialog: false,
@@ -4339,6 +4334,9 @@ speechSynthesis.getVoices();
watch: {},
el: '#x-app',
mounted() {
AppApi.GetVersion().then((version) => {
this.appVersion = version;
});
API.$on('SHOW_WORLD_DIALOG', (tag) => this.showWorldDialog(tag));
API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag));
this.updateLoop();
@@ -5247,8 +5245,7 @@ speechSynthesis.getVoices();
imageLocation = await AppApi.GetImage(
imageUrl,
fileId,
fileVersion,
appVersion
fileVersion
);
} else if (imageUrl) {
fileVersion = imageUrl.split('/').pop(); // 1416226261.thumbnail-500.png
@@ -5256,8 +5253,7 @@ speechSynthesis.getVoices();
imageLocation = await AppApi.GetImage(
imageUrl,
fileId,
fileVersion,
appVersion
fileVersion
);
}
} catch (err) {
@@ -10351,7 +10347,6 @@ speechSynthesis.getVoices();
)}&part=snippet,contentDetails&key=${apiKey}`,
method: 'GET',
headers: {
'User-Agent': appVersion,
Referer: 'https://vrcx.pypy.moe'
}
});
@@ -12427,11 +12422,20 @@ speechSynthesis.getVoices();
configRepository.setString('VRCX_branch', $app.data.branch);
}
if (configRepository.getString('VRCX_lastVRCXVersion')) {
if (configRepository.getString('VRCX_lastVRCXVersion') < appVersion) {
configRepository.setString('VRCX_lastVRCXVersion', appVersion);
if (
configRepository.getString('VRCX_lastVRCXVersion') <
$app.data.appVersion
) {
configRepository.setString(
'VRCX_lastVRCXVersion',
$app.data.appVersion
);
}
} else {
configRepository.setString('VRCX_lastVRCXVersion', appVersion);
configRepository.setString(
'VRCX_lastVRCXVersion',
$app.data.appVersion
);
}
if (!configRepository.getInt('VRCX_maxTableSize')) {
$app.data.maxTableSize = 1000;
@@ -14283,7 +14287,6 @@ speechSynthesis.getVoices();
}?${type}=${encodeURIComponent(search)}&n=5000`,
method: 'GET',
headers: {
'User-Agent': appVersion,
Referer: 'https://vrcx.pypy.moe'
}
});
@@ -14346,7 +14349,6 @@ speechSynthesis.getVoices();
url: `${url}?authorId=${encodeURIComponent(authorId)}`,
method: 'GET',
headers: {
'User-Agent': appVersion,
Referer: 'https://vrcx.pypy.moe'
}
});
@@ -18966,7 +18968,7 @@ speechSynthesis.getVoices();
var url = this.downloadCurrent.updateZipUrl;
var size = this.downloadCurrent.size;
await AssetBundleCacher.DownloadFile(url, size, appVersion);
await AssetBundleCacher.DownloadFile(url, size);
this.downloadFileProgress();
};
@@ -19649,10 +19651,7 @@ speechSynthesis.getVoices();
this.checkingForVRCXUpdate = true;
var response = await webApiService.execute({
url,
method: 'GET',
headers: {
'User-Agent': appVersion
}
method: 'GET'
});
this.checkingForVRCXUpdate = false;
var json = JSON.parse(response.data);
@@ -19702,6 +19701,14 @@ speechSynthesis.getVoices();
};
$app.methods.checkForVRCXUpdate = async function () {
if (
!this.appVersion ||
this.appVersion === 'VRCX Nightly Build' ||
this.appVersion === 'VRCX Stable'
) {
console.log('Skipping VRCX update check, version is null');
return;
}
if (this.branch === 'Beta') {
// move Beta users to stable
this.branch = 'Stable';
@@ -19711,10 +19718,7 @@ speechSynthesis.getVoices();
this.checkingForVRCXUpdate = true;
var response = await webApiService.execute({
url,
method: 'GET',
headers: {
'User-Agent': appVersion
}
method: 'GET'
});
this.checkingForVRCXUpdate = false;
var json = JSON.parse(response.data);

View File

@@ -1 +0,0 @@
export var appVersion = 'VRCX 2022.09.09';