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
+5
View File
@@ -370,6 +370,11 @@ namespace VRCX
return System.Globalization.CultureInfo.CurrentCulture.ToString(); return System.Globalization.CultureInfo.CurrentCulture.ToString();
} }
public string GetVersion()
{
return Program.Version;
}
public void ChangeTheme(int value) public void ChangeTheme(int value)
{ {
WinformThemer.SetGlobalTheme(value); WinformThemer.SetGlobalTheme(value);
+1 -1
View File
@@ -50,7 +50,7 @@ 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 = "VRCX Cef Browser"; cefSettings.UserAgent = Program.Version;
if (Cef.Initialize(cefSettings) == false) if (Cef.Initialize(cefSettings) == false)
{ {
+1 -1
View File
@@ -94,7 +94,7 @@ namespace VRCX
this.MinimumSize = new System.Drawing.Size(320, 240); this.MinimumSize = new System.Drawing.Size(320, 240);
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 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.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.MainForm_FormClosed);
this.Load += new System.EventHandler(this.MainForm_Load); this.Load += new System.EventHandler(this.MainForm_Load);
+15
View File
@@ -15,6 +15,7 @@ namespace VRCX
public static string BaseDirectory { get; private set; } public static string BaseDirectory { get; private set; }
public static string AppDataDirectory { get; private set; } public static string AppDataDirectory { get; private set; }
public static string ConfigLocation; public static string ConfigLocation;
public static string Version { get; private set; }
public static bool LaunchDebug; public static bool LaunchDebug;
static Program() 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() private static void Run()
{ {
Update.Check(); Update.Check();
StartupArgs.ArgsCheck(); StartupArgs.ArgsCheck();
GetVersion();
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
+4 -1
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"> <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')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
@@ -154,6 +154,9 @@
<DependentUpon>Settings.settings</DependentUpon> <DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<None Include="Version">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
+1
View File
@@ -0,0 +1 @@
Build
+1 -4
View File
@@ -131,6 +131,7 @@ namespace VRCX
var request = WebRequest.CreateHttp((string)options["url"]); var request = WebRequest.CreateHttp((string)options["url"]);
request.CookieContainer = _cookieContainer; request.CookieContainer = _cookieContainer;
request.KeepAlive = true; request.KeepAlive = true;
request.UserAgent = Program.Version;
if (options.TryGetValue("headers", out object headers) == true) if (options.TryGetValue("headers", out object headers) == true)
{ {
@@ -143,10 +144,6 @@ namespace VRCX
{ {
request.ContentType = value; 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) else if (string.Compare(key, "Referer", StringComparison.OrdinalIgnoreCase) == 0)
{ {
request.Referer = value; request.Referer = value;
+29 -25
View File
@@ -16,7 +16,6 @@ import {v4 as uuidv4} from 'uuid';
import * as workerTimers from 'worker-timers'; import * as workerTimers from 'worker-timers';
import 'default-passive-events'; import 'default-passive-events';
import {appVersion} from './constants.js';
import configRepository from './repository/config.js'; import configRepository from './repository/config.js';
import webApiService from './service/webapi.js'; import webApiService from './service/webapi.js';
import gameLogService from './service/gamelog.js'; import gameLogService from './service/gamelog.js';
@@ -383,10 +382,6 @@ speechSynthesis.getVoices();
init.body = init.body =
params === Object(params) ? JSON.stringify(params) : '{}'; params === Object(params) ? JSON.stringify(params) : '{}';
} }
init.headers = {
'User-Agent': appVersion,
...init.headers
};
var req = webApiService var req = webApiService
.execute(init) .execute(init)
.catch((err) => { .catch((err) => {
@@ -4328,7 +4323,7 @@ speechSynthesis.getVoices();
isGameRunning: false, isGameRunning: false,
isGameNoVR: configRepository.getBool('isGameNoVR'), isGameNoVR: configRepository.getBool('isGameNoVR'),
isSteamVRRunning: false, isSteamVRRunning: false,
appVersion, appVersion: '',
latestAppVersion: '', latestAppVersion: '',
ossDialog: false, ossDialog: false,
exportFriendsListDialog: false, exportFriendsListDialog: false,
@@ -4339,6 +4334,9 @@ speechSynthesis.getVoices();
watch: {}, watch: {},
el: '#x-app', el: '#x-app',
mounted() { mounted() {
AppApi.GetVersion().then((version) => {
this.appVersion = version;
});
API.$on('SHOW_WORLD_DIALOG', (tag) => this.showWorldDialog(tag)); API.$on('SHOW_WORLD_DIALOG', (tag) => this.showWorldDialog(tag));
API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag)); API.$on('SHOW_LAUNCH_DIALOG', (tag) => this.showLaunchDialog(tag));
this.updateLoop(); this.updateLoop();
@@ -5247,8 +5245,7 @@ speechSynthesis.getVoices();
imageLocation = await AppApi.GetImage( imageLocation = await AppApi.GetImage(
imageUrl, imageUrl,
fileId, fileId,
fileVersion, fileVersion
appVersion
); );
} else if (imageUrl) { } else if (imageUrl) {
fileVersion = imageUrl.split('/').pop(); // 1416226261.thumbnail-500.png fileVersion = imageUrl.split('/').pop(); // 1416226261.thumbnail-500.png
@@ -5256,8 +5253,7 @@ speechSynthesis.getVoices();
imageLocation = await AppApi.GetImage( imageLocation = await AppApi.GetImage(
imageUrl, imageUrl,
fileId, fileId,
fileVersion, fileVersion
appVersion
); );
} }
} catch (err) { } catch (err) {
@@ -10351,7 +10347,6 @@ speechSynthesis.getVoices();
)}&part=snippet,contentDetails&key=${apiKey}`, )}&part=snippet,contentDetails&key=${apiKey}`,
method: 'GET', method: 'GET',
headers: { headers: {
'User-Agent': appVersion,
Referer: 'https://vrcx.pypy.moe' Referer: 'https://vrcx.pypy.moe'
} }
}); });
@@ -12427,11 +12422,20 @@ speechSynthesis.getVoices();
configRepository.setString('VRCX_branch', $app.data.branch); configRepository.setString('VRCX_branch', $app.data.branch);
} }
if (configRepository.getString('VRCX_lastVRCXVersion')) { if (configRepository.getString('VRCX_lastVRCXVersion')) {
if (configRepository.getString('VRCX_lastVRCXVersion') < appVersion) { if (
configRepository.setString('VRCX_lastVRCXVersion', appVersion); configRepository.getString('VRCX_lastVRCXVersion') <
$app.data.appVersion
) {
configRepository.setString(
'VRCX_lastVRCXVersion',
$app.data.appVersion
);
} }
} else { } else {
configRepository.setString('VRCX_lastVRCXVersion', appVersion); configRepository.setString(
'VRCX_lastVRCXVersion',
$app.data.appVersion
);
} }
if (!configRepository.getInt('VRCX_maxTableSize')) { if (!configRepository.getInt('VRCX_maxTableSize')) {
$app.data.maxTableSize = 1000; $app.data.maxTableSize = 1000;
@@ -14283,7 +14287,6 @@ speechSynthesis.getVoices();
}?${type}=${encodeURIComponent(search)}&n=5000`, }?${type}=${encodeURIComponent(search)}&n=5000`,
method: 'GET', method: 'GET',
headers: { headers: {
'User-Agent': appVersion,
Referer: 'https://vrcx.pypy.moe' Referer: 'https://vrcx.pypy.moe'
} }
}); });
@@ -14346,7 +14349,6 @@ speechSynthesis.getVoices();
url: `${url}?authorId=${encodeURIComponent(authorId)}`, url: `${url}?authorId=${encodeURIComponent(authorId)}`,
method: 'GET', method: 'GET',
headers: { headers: {
'User-Agent': appVersion,
Referer: 'https://vrcx.pypy.moe' Referer: 'https://vrcx.pypy.moe'
} }
}); });
@@ -18966,7 +18968,7 @@ speechSynthesis.getVoices();
var url = this.downloadCurrent.updateZipUrl; var url = this.downloadCurrent.updateZipUrl;
var size = this.downloadCurrent.size; var size = this.downloadCurrent.size;
await AssetBundleCacher.DownloadFile(url, size, appVersion); await AssetBundleCacher.DownloadFile(url, size);
this.downloadFileProgress(); this.downloadFileProgress();
}; };
@@ -19649,10 +19651,7 @@ speechSynthesis.getVoices();
this.checkingForVRCXUpdate = true; this.checkingForVRCXUpdate = true;
var response = await webApiService.execute({ var response = await webApiService.execute({
url, url,
method: 'GET', method: 'GET'
headers: {
'User-Agent': appVersion
}
}); });
this.checkingForVRCXUpdate = false; this.checkingForVRCXUpdate = false;
var json = JSON.parse(response.data); var json = JSON.parse(response.data);
@@ -19702,6 +19701,14 @@ speechSynthesis.getVoices();
}; };
$app.methods.checkForVRCXUpdate = async function () { $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') { if (this.branch === 'Beta') {
// move Beta users to stable // move Beta users to stable
this.branch = 'Stable'; this.branch = 'Stable';
@@ -19711,10 +19718,7 @@ speechSynthesis.getVoices();
this.checkingForVRCXUpdate = true; this.checkingForVRCXUpdate = true;
var response = await webApiService.execute({ var response = await webApiService.execute({
url, url,
method: 'GET', method: 'GET'
headers: {
'User-Agent': appVersion
}
}); });
this.checkingForVRCXUpdate = false; this.checkingForVRCXUpdate = false;
var json = JSON.parse(response.data); var json = JSON.parse(response.data);
-1
View File
@@ -1 +0,0 @@
export var appVersion = 'VRCX 2022.09.09';