Merge pull request #137 from lukeIam/develop
Check if the app fits to the server version
This commit is contained in:
commit
e8e4c3b1b8
7 files changed
+69
-14
No files matched your search
@@ -51,10 +51,12 @@ namespace ServerLib
|
|||||||
public static GetSiteFileDelegate GetSiteFile { internal get; set; }
|
public static GetSiteFileDelegate GetSiteFile { internal get; set; }
|
||||||
|
|
||||||
public static GetDelayedImageDelegate GetDelayedImage { internal get; set; }
|
public static GetDelayedImageDelegate GetDelayedImage { internal get; set; }
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region songs
|
public static GetServerVersionDelegate GetServerVersion { internal get; set; }
|
||||||
public static GetSongDelegate GetSong { internal get; set; }
|
#endregion
|
||||||
|
|
||||||
|
#region songs
|
||||||
|
public static GetSongDelegate GetSong { internal get; set; }
|
||||||
|
|
||||||
public static GetAllSongsDelegate GetAllSongs { internal get; set; }
|
public static GetAllSongsDelegate GetAllSongs { internal get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -300,6 +300,11 @@ namespace ServerLib
|
|||||||
_GetSession();
|
_GetSession();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetServerVersion()
|
||||||
|
{
|
||||||
|
return CServer.GetServerVersion();
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region songs
|
#region songs
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ namespace ServerLib
|
|||||||
public delegate byte[] GetSiteFileDelegate(string filename);
|
public delegate byte[] GetSiteFileDelegate(string filename);
|
||||||
|
|
||||||
public delegate CBase64Image GetDelayedImageDelegate(string hashedFilename);
|
public delegate CBase64Image GetDelayedImageDelegate(string hashedFilename);
|
||||||
|
|
||||||
|
public delegate String GetServerVersionDelegate();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[DataContract]
|
[DataContract]
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ namespace ServerLib
|
|||||||
ResponseFormat = WebMessageFormat.Json,
|
ResponseFormat = WebMessageFormat.Json,
|
||||||
UriTemplate = "/isServerOnline")]
|
UriTemplate = "/isServerOnline")]
|
||||||
bool IsServerOnline();
|
bool IsServerOnline();
|
||||||
|
|
||||||
|
[OperationContract, WebInvoke(Method = "GET",
|
||||||
|
ResponseFormat = WebMessageFormat.Json,
|
||||||
|
UriTemplate = "/getServerVersion")]
|
||||||
|
String GetServerVersion();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region songs
|
#region songs
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@@ -70,6 +71,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
CServer.GetProfileList = _GetProfileList;
|
CServer.GetProfileList = _GetProfileList;
|
||||||
CServer.SendPhoto = _SendPhoto;
|
CServer.SendPhoto = _SendPhoto;
|
||||||
CServer.GetSiteFile = _GetSiteFile;
|
CServer.GetSiteFile = _GetSiteFile;
|
||||||
|
CServer.GetServerVersion = _GetServerVersion;
|
||||||
CServer.GetSong = _GetSong;
|
CServer.GetSong = _GetSong;
|
||||||
CServer.GetAllSongs = _GetAllSongs;
|
CServer.GetAllSongs = _GetAllSongs;
|
||||||
CServer.GetCurrentSongId = _GetCurrentSongId;
|
CServer.GetCurrentSongId = _GetCurrentSongId;
|
||||||
@@ -94,6 +96,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
//_Discover = new CDiscover(CConfig.ServerPort, CCommands.BroadcastKeyword);
|
//_Discover = new CDiscover(CConfig.ServerPort, CCommands.BroadcastKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void Start()
|
public static void Start()
|
||||||
{
|
{
|
||||||
if (CConfig.Config.Server.ServerActive == EOffOn.TR_CONFIG_ON)
|
if (CConfig.Config.Server.ServerActive == EOffOn.TR_CONFIG_ON)
|
||||||
@@ -435,6 +438,16 @@ namespace Vocaluxe.Base.Server
|
|||||||
return hashedFilename;
|
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)
|
private static CBase64Image _GetDelayedImage(string hashedFilename)
|
||||||
{
|
{
|
||||||
if (!_DelayedImagePath.ContainsKey(hashedFilename))
|
if (!_DelayedImagePath.ContainsKey(hashedFilename))
|
||||||
|
|||||||
@@ -531,6 +531,7 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>xcopy /E /D /Y "$(ProjectDir)\Website" "$(SolutionDir)\PhoneGap"
|
<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*(?=\\\" *;)', %2524('@(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>
|
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>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@@ -543,4 +544,18 @@ powershell -command "(Get-Content -Encoding UTF8 '$(ProjectDir)Properties\Assemb
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</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>
|
</Project>
|
||||||
+24
-11
@@ -6,6 +6,7 @@
|
|||||||
var translator;
|
var translator;
|
||||||
var pageHandler;
|
var pageHandler;
|
||||||
var sessionHandler;
|
var sessionHandler;
|
||||||
|
var matchingServerVersion = "";
|
||||||
|
|
||||||
var initMain = function () {
|
var initMain = function () {
|
||||||
if (document.location.protocol == "file:") {
|
if (document.location.protocol == "file:") {
|
||||||
@@ -377,13 +378,19 @@
|
|||||||
}
|
}
|
||||||
sessionHandler.serverBaseAddress = "";
|
sessionHandler.serverBaseAddress = "";
|
||||||
request({
|
request({
|
||||||
url: address + "isServerOnline",
|
url: address + "getServerVersion",
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
}, "Checking...")
|
}, "Checking...")
|
||||||
.done(function () {
|
.done(function (serverVersion) {
|
||||||
sessionHandler.serverBaseAddress = address;
|
if(serverVersion === matchingServerVersion){
|
||||||
window.localStorage.setItem("VocaluxeServerAddress", address);
|
sessionHandler.serverBaseAddress = address;
|
||||||
$.mobile.changePage("#login", { transition: "slidefade" });
|
window.localStorage.setItem("VocaluxeServerAddress", address);
|
||||||
|
$.mobile.changePage("#login", { transition: "none" });
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.location.href = address;
|
||||||
|
return;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.fail(function () {
|
.fail(function () {
|
||||||
$('#discoverServerAddress').prop("value", "");
|
$('#discoverServerAddress').prop("value", "");
|
||||||
@@ -429,12 +436,18 @@
|
|||||||
if (address != null) {
|
if (address != null) {
|
||||||
sessionHandler.serverBaseAddress = "";
|
sessionHandler.serverBaseAddress = "";
|
||||||
var prom = request({
|
var prom = request({
|
||||||
url: address + "isServerOnline",
|
url: address + "getServerVersion",
|
||||||
timeout: 10000
|
timeout: 10000
|
||||||
}, "Checking...").done(function () {
|
}, "Checking...").done(function (serverVersion) {
|
||||||
sessionHandler.serverBaseAddress = address;
|
if (serverVersion === matchingServerVersion) {
|
||||||
window.localStorage.setItem("VocaluxeServerAddress", address);
|
sessionHandler.serverBaseAddress = address;
|
||||||
$.mobile.changePage("#login", { transition: "none" });
|
window.localStorage.setItem("VocaluxeServerAddress", address);
|
||||||
|
$.mobile.changePage("#login", { transition: "none" });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
window.location.href = address;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
if (typeof window.BarcodeScanner != "undefined") {
|
if (typeof window.BarcodeScanner != "undefined") {
|
||||||
$('#discoverReadQr').show();
|
$('#discoverReadQr').show();
|
||||||
@@ -443,7 +456,7 @@
|
|||||||
$(this).data('promise', prom);
|
$(this).data('promise', prom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof window.BarcodeScanner != "undefined") {
|
else if (typeof window.BarcodeScanner != "undefined") {
|
||||||
$('#discoverReadQr').show();
|
$('#discoverReadQr').show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user