[App] - The app stores the Vocaluxe version it was created with
[Server] -getServerVersion added [App] - Checks if the server has the right version, otherwise fallback to inApp WebVersion
This commit is contained in:
1 parent
a9b5334f3f
commit
0f5040d669
7 files changed
+75
-17
No files matched your search
@@ -51,10 +51,12 @@ namespace ServerLib
|
||||
public static GetSiteFileDelegate GetSiteFile { internal get; set; }
|
||||
|
||||
public static GetDelayedImageDelegate GetDelayedImage { internal get; set; }
|
||||
#endregion
|
||||
|
||||
#region songs
|
||||
public static GetSongDelegate GetSong { internal get; set; }
|
||||
public static GetServerVersionDelegate GetServerVersion { internal get; set; }
|
||||
#endregion
|
||||
|
||||
#region songs
|
||||
public static GetSongDelegate GetSong { internal get; set; }
|
||||
|
||||
public static GetAllSongsDelegate GetAllSongs { internal get; set; }
|
||||
|
||||
|
||||
@@ -300,6 +300,11 @@ namespace ServerLib
|
||||
_GetSession();
|
||||
return true;
|
||||
}
|
||||
|
||||
public string GetServerVersion()
|
||||
{
|
||||
return CServer.GetServerVersion();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region songs
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace ServerLib
|
||||
public delegate byte[] GetSiteFileDelegate(string filename);
|
||||
|
||||
public delegate CBase64Image GetDelayedImageDelegate(string hashedFilename);
|
||||
|
||||
public delegate String GetServerVersionDelegate();
|
||||
#endregion
|
||||
|
||||
[DataContract]
|
||||
|
||||
@@ -115,6 +115,11 @@ namespace ServerLib
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/isServerOnline")]
|
||||
bool IsServerOnline();
|
||||
|
||||
[OperationContract, WebInvoke(Method = "GET",
|
||||
ResponseFormat = WebMessageFormat.Json,
|
||||
UriTemplate = "/getServerVersion")]
|
||||
String GetServerVersion();
|
||||
#endregion
|
||||
|
||||
#region songs
|
||||
|
||||
@@ -20,6 +20,7 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
@@ -70,6 +71,7 @@ namespace Vocaluxe.Base.Server
|
||||
CServer.GetProfileList = _GetProfileList;
|
||||
CServer.SendPhoto = _SendPhoto;
|
||||
CServer.GetSiteFile = _GetSiteFile;
|
||||
CServer.GetServerVersion = _GetServerVersion;
|
||||
CServer.GetSong = _GetSong;
|
||||
CServer.GetAllSongs = _GetAllSongs;
|
||||
CServer.GetCurrentSongId = _GetCurrentSongId;
|
||||
@@ -93,6 +95,7 @@ namespace Vocaluxe.Base.Server
|
||||
|
||||
//_Discover = new CDiscover(CConfig.ServerPort, CCommands.BroadcastKeyword);
|
||||
}
|
||||
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
@@ -435,6 +438,16 @@ namespace Vocaluxe.Base.Server
|
||||
return hashedFilename;
|
||||
}
|
||||
|
||||
private static string _GetServerVersion()
|
||||
{
|
||||
var informationalVersion = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).FirstOrDefault();
|
||||
if (informationalVersion != null)
|
||||
{
|
||||
informationalVersion = "";
|
||||
}
|
||||
return Assembly.GetExecutingAssembly().GetName().Version.ToString() + " (" + informationalVersion + ")";
|
||||
}
|
||||
|
||||
private static CBase64Image _GetDelayedImage(string hashedFilename)
|
||||
{
|
||||
if (!_DelayedImagePath.ContainsKey(hashedFilename))
|
||||
|
||||
@@ -515,8 +515,12 @@
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap"
|
||||
powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace '(?<=AssemblyInformationalVersion\()(.*)(?=\))', '\"GITVERSION\"'} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'"</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap"
|
||||
|
||||
powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js') | Foreach-Object {$_ -replace '(?<=var *matchingServerVersion * = *\\\")\w*(?=\\\" *;)', %24('@(VersionNumber)'+' ('+$version+')')} | Set-Content -Encoding UTF8 '$(ProjectDir)..\Output\Website\js\main.js'"
|
||||
|
||||
powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace '(?<=AssemblyInformationalVersion\()(.*)(?=\))', '\"GITVERSION\"'} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>powershell -command "$version = git describe --long; (Get-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs') | Foreach-Object {$_ -replace 'GITVERSION', $version} | Set-Content -Encoding UTF8 '$(ProjectDir)Properties\AssemblyInfo.cs'"</PreBuildEvent>
|
||||
@@ -528,4 +532,18 @@ powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\Assemb
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<Target Name="PostBuildMacros">
|
||||
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
|
||||
<Output TaskParameter="Assemblies" ItemName="Targets" />
|
||||
</GetAssemblyIdentity>
|
||||
<ItemGroup>
|
||||
<VersionNumber Include="@(Targets->'%(Version)')" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PostBuildEventDependsOn>
|
||||
$(PostBuildEventDependsOn);
|
||||
PostBuildMacros;
|
||||
</PostBuildEventDependsOn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
+25
-12
@@ -6,6 +6,7 @@
|
||||
var translator;
|
||||
var pageHandler;
|
||||
var sessionHandler;
|
||||
var matchingServerVersion = "";
|
||||
|
||||
var initMain = function () {
|
||||
if (document.location.protocol == "file:") {
|
||||
@@ -47,7 +48,7 @@
|
||||
}
|
||||
|
||||
if ((typeof data.type) == "undefined") {
|
||||
data.type = "GET";
|
||||
data.type = "GET";
|
||||
}
|
||||
|
||||
if (message != "noOverlay") {
|
||||
@@ -377,13 +378,19 @@
|
||||
}
|
||||
sessionHandler.serverBaseAddress = "";
|
||||
request({
|
||||
url: address + "isServerOnline",
|
||||
url: address + "getServerVersion",
|
||||
timeout: 10000
|
||||
}, "Checking...")
|
||||
.done(function () {
|
||||
sessionHandler.serverBaseAddress = address;
|
||||
window.localStorage.setItem("VocaluxeServerAddress", address);
|
||||
$.mobile.changePage("#login", { transition: "slidefade" });
|
||||
.done(function (serverVersion) {
|
||||
if(serverVersion === matchingServerVersion){
|
||||
sessionHandler.serverBaseAddress = address;
|
||||
window.localStorage.setItem("VocaluxeServerAddress", address);
|
||||
$.mobile.changePage("#login", { transition: "none" });
|
||||
}
|
||||
else{
|
||||
window.location.href = address;
|
||||
return;
|
||||
}
|
||||
})
|
||||
.fail(function () {
|
||||
$('#discoverServerAddress').prop("value", "");
|
||||
@@ -429,12 +436,18 @@
|
||||
if (address != null) {
|
||||
sessionHandler.serverBaseAddress = "";
|
||||
var prom = request({
|
||||
url: address + "isServerOnline",
|
||||
url: address + "getServerVersion",
|
||||
timeout: 10000
|
||||
}, "Checking...").done(function () {
|
||||
sessionHandler.serverBaseAddress = address;
|
||||
window.localStorage.setItem("VocaluxeServerAddress", address);
|
||||
$.mobile.changePage("#login", { transition: "none" });
|
||||
}, "Checking...").done(function (serverVersion) {
|
||||
if (serverVersion === matchingServerVersion) {
|
||||
sessionHandler.serverBaseAddress = address;
|
||||
window.localStorage.setItem("VocaluxeServerAddress", address);
|
||||
$.mobile.changePage("#login", { transition: "none" });
|
||||
}
|
||||
else {
|
||||
window.location.href = address;
|
||||
return;
|
||||
}
|
||||
}).fail(function () {
|
||||
if (typeof window.BarcodeScanner != "undefined") {
|
||||
$('#discoverReadQr').show();
|
||||
@@ -443,7 +456,7 @@
|
||||
$(this).data('promise', prom);
|
||||
return;
|
||||
}
|
||||
if (typeof window.BarcodeScanner != "undefined") {
|
||||
else if (typeof window.BarcodeScanner != "undefined") {
|
||||
$('#discoverReadQr').show();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user