From 53a9f198b546925df06951f93f0dadccb8a02a9c Mon Sep 17 00:00:00 2001 From: Harald Wolff Date: Mon, 2 Sep 2019 07:22:55 +0200 Subject: [PATCH] Initial Commit --- .gitignore | 405 +++++++++++++++++++++++++++++++++++++ .gitmodules | 6 + Program.cs | 17 ++ Properties/AssemblyInfo.cs | 26 +++ ProviderApplication.cs | 178 ++++++++++++++++ ln.provider.csproj | 83 ++++++++ ln.provider.sln | 71 +++++++ www/index.html | 39 ++++ www/ln.application.js | 336 ++++++++++++++++++++++++++++++ www/style.css | 27 +++ 10 files changed, 1188 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 Program.cs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 ProviderApplication.cs create mode 100644 ln.provider.csproj create mode 100644 ln.provider.sln create mode 100644 www/index.html create mode 100644 www/ln.application.js create mode 100644 www/style.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed9dbcb --- /dev/null +++ b/.gitignore @@ -0,0 +1,405 @@ +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# content below from: https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4b30924 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "ln.types"] + path = ln.types + url = https://schwann.lnvpn.de/LupusNobilis/ln.types.git +[submodule "ln.logging"] + path = ln.logging + url = https://schwann.lnvpn.de/LupusNobilis/ln.logging.git diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..50e4dad --- /dev/null +++ b/Program.cs @@ -0,0 +1,17 @@ +using System; +using ln.types.odb.ng; +using ln.provider.data.phone; +using ln.provider.data; +using ln.logging; + +namespace ln.provider +{ + class MainClass + { + public static void Main(string[] args) + { + ProviderApplication providerApplication = new ProviderApplication(); + providerApplication.Start(args); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..cdd368a --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,26 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. + +[assembly: AssemblyTitle("ln.provider")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("${AuthorCopyright}")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. + +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] diff --git a/ProviderApplication.cs b/ProviderApplication.cs new file mode 100644 index 0000000..c9318c2 --- /dev/null +++ b/ProviderApplication.cs @@ -0,0 +1,178 @@ +using System; +using ln.application; +using ln.application.service; +using System.Threading; +using ln.http.resources; +using System.IO; +using ln.types.rpc; +using ln.types.odb.ng; +using ln.types.odb.ng.storage; +using System.Security.Cryptography; +using System.Linq; +using ln.types; +namespace ln.provider +{ + public class ProviderApplication : Application + { + public String ServerString { get; private set; } + public String WWWPath { get; private set; } = "www"; + + public ResourceApplication WWWApplication { get; private set; } + public RPCContainer RPCContainer { get; private set; } + + public ProviderApplication() + { + ServerString = "ln.provider(0.1)"; + RPCContainer = new RPCContainer(); + + if (Directory.Exists("../../www")) + WWWPath = "../../www"; + + ServiceDefinition coreRPCService = new ServiceDefinition("ln.provider.CoreService"); + coreRPCService.AutoStart = true; + + ServiceContainer.Add( + coreRPCService + ); + } + + public override void PrepareStart() + { + DirectoryResource www = new DirectoryResource(new string[] { "../../www", "www" }); + www.DefaultResource = www.GetResource("index.html"); + + ApplicationWebSocket applicationWebSocket = new ApplicationWebSocket(null, "socket", RPCContainer); + www.InjectResource(applicationWebSocket); + + WWWApplication = new ResourceApplication(); + WWWApplication.RootResource = www; + } + + public override AuthenticatedUser AuthenticateUser(string username, object prove) + { + CoreService coreService = ServiceContainer[typeof(CoreService)].ServiceBase as CoreService; + + String[] tokens = prove.ToString().Split(':'); + int token = int.Parse(tokens[0]); + + AuthenticatedUser authenticatedUser = coreService.Authenticate(username, token, tokens[1]); + + return authenticatedUser; + } + } + + public class CoreService : ApplicationServiceBase + { + public ProviderApplication Application => (ProviderApplication)base.CurrentApplicationInterface; + + public IStorageContainer CoreStorageContainer { get; private set; } + public Session CoreStorageSession { get; private set; } + public Mapper CoreStorageMapper { get; private set; } + + public CoreService() + :base(nameof(CoreService)) + { + } + + public override void ServiceMain(IApplicationInterface applicationInterface) + { + CoreStorageContainer = new FSStorageContainer("/var/cache/ln.provider"); + CoreStorageContainer.Open(); + + CoreStorageSession = new Session(CoreStorageContainer); + CoreStorageMapper = new Mapper(CoreStorageSession); + + CoreStorageMapper.EnsureIndex("ID"); + CoreStorageMapper.EnsureIndex("Name"); + + + + Application.HttpServer.DefaultApplication = Application.WWWApplication; + Application.RPCContainer.Add("core",new RPC(Application)); + + while (!StopRequested) + { + lock (this) + { + Monitor.Wait(this); + } + } + + CoreStorageMapper = null; + CoreStorageSession.Dispose(); + CoreStorageSession = null; + CoreStorageContainer.Dispose(); + CoreStorageContainer = null; + } + + public AuthenticatedUser Authenticate(string username,int token,string secretHash) + { + AuthenticatedUser authenticatedUser = CoreStorageMapper.Load(Query.Equals("Name", username)).FirstOrDefault(); + + if (authenticatedUser != null) + { + if (token <= authenticatedUser.Token) + return null; + + authenticatedUser.Token = token; + + CoreStorageMapper.Save(authenticatedUser); + + byte[] secretHashBytes = Extensions.BytesFromHexString(secretHash); + + SHA256 sha256 = SHA256.Create(); + sha256.TransformBlock(token.GetBytes(), 0, 4, null, 0); + sha256.TransformFinalBlock(authenticatedUser.SecretHash, 0, authenticatedUser.SecretHash.Length); + + if (sha256.Hash.AreEqual(secretHashBytes)) + return authenticatedUser; + + return null; + } + return null; + } + + class RPC + { + ProviderApplication providerApplication; + + public RPC(ProviderApplication providerApplication) + { + this.providerApplication = providerApplication; + } + + public String GetServerString() + { + return providerApplication.ServerString; + } + + public void Shutdown() + { + ThreadPool.QueueUserWorkItem((state) => providerApplication.Stop()); + } + + public bool Authenticate(string username,string secretHash) + { + return false; + } + + public Guid GetApplicationContext(string contextID) + { + Guid id; + if (string.Empty.Equals(contextID)) + id = Guid.Empty; + else + id = Guid.Parse(contextID); + + ApplicationContext applicationContext = providerApplication.GetApplicationContext(id); + ApplicationContext.SetCurrentContext(applicationContext); + + return applicationContext.ContextID; + } + + + } + + } + +} diff --git a/ln.provider.csproj b/ln.provider.csproj new file mode 100644 index 0000000..1f9865d --- /dev/null +++ b/ln.provider.csproj @@ -0,0 +1,83 @@ + + + + Debug + x86 + {356E62A1-5F8C-495A-B125-4E6C6F0BBB46} + Exe + ln.provider + ln.provider + v4.7 + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + x86 + + + true + bin\Release + prompt + 4 + true + x86 + + + + + + + + + + + + {8D9AB9A5-E513-4BA7-A450-534F6456BF28} + ln.types + + + {99A2827F-B0B6-4AB0-A988-E3EE4605EB43} + ln.provider.data.phone + + + {D471A566-9FB6-41B2-A777-3C32874ECD0E} + ln.logging + + + {13E13CA1-AFC2-4AAB-A378-2349C10F9F45} + ln.provider.data + + + {F9086FE4-8925-42FF-A59C-607341604293} + ln.http.resources + + + {CEEEEB41-3059-46A2-A871-2ADE22C013D9} + ln.http + + + {44AA3A50-7214-47F2-9D60-6FF34C0FE6D3} + ln.application + + + {D9342117-3249-4D8B-87C9-51A50676B158} + ln.json + + + + + + + + PreserveNewest + + + + + \ No newline at end of file diff --git a/ln.provider.sln b/ln.provider.sln new file mode 100644 index 0000000..eda3275 --- /dev/null +++ b/ln.provider.sln @@ -0,0 +1,71 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.provider", "ln.provider.csproj", "{356E62A1-5F8C-495A-B125-4E6C6F0BBB46}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.provider.data.phone", "..\ln.provider.data.phone\ln.provider.data.phone.csproj", "{99A2827F-B0B6-4AB0-A988-E3EE4605EB43}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.types", "..\ln.types\ln.types.csproj", "{8D9AB9A5-E513-4BA7-A450-534F6456BF28}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.logging", "..\ln.logging\ln.logging.csproj", "{D471A566-9FB6-41B2-A777-3C32874ECD0E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.provider.data", "..\ln.provider.data\ln.provider.data.csproj", "{13E13CA1-AFC2-4AAB-A378-2349C10F9F45}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.json", "..\ln.json\ln.json.csproj", "{D9342117-3249-4D8B-87C9-51A50676B158}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.http", "..\ln.http\ln.http.csproj", "{CEEEEB41-3059-46A2-A871-2ADE22C013D9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.http.resources", "..\ln.http.resources\ln.http.resources.csproj", "{F9086FE4-8925-42FF-A59C-607341604293}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.application", "..\ln.application\ln.application.csproj", "{44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ln.templates", "..\ln.templates\ln.templates.csproj", "{AD0267BB-F08C-4BE1-A88D-010D49041761}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {356E62A1-5F8C-495A-B125-4E6C6F0BBB46}.Debug|x86.ActiveCfg = Debug|x86 + {356E62A1-5F8C-495A-B125-4E6C6F0BBB46}.Debug|x86.Build.0 = Debug|x86 + {356E62A1-5F8C-495A-B125-4E6C6F0BBB46}.Release|x86.ActiveCfg = Release|x86 + {356E62A1-5F8C-495A-B125-4E6C6F0BBB46}.Release|x86.Build.0 = Release|x86 + {99A2827F-B0B6-4AB0-A988-E3EE4605EB43}.Debug|x86.ActiveCfg = Debug|Any CPU + {99A2827F-B0B6-4AB0-A988-E3EE4605EB43}.Debug|x86.Build.0 = Debug|Any CPU + {99A2827F-B0B6-4AB0-A988-E3EE4605EB43}.Release|x86.ActiveCfg = Release|Any CPU + {99A2827F-B0B6-4AB0-A988-E3EE4605EB43}.Release|x86.Build.0 = Release|Any CPU + {8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Debug|x86.ActiveCfg = Debug|Any CPU + {8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Debug|x86.Build.0 = Debug|Any CPU + {8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Release|x86.ActiveCfg = Release|Any CPU + {8D9AB9A5-E513-4BA7-A450-534F6456BF28}.Release|x86.Build.0 = Release|Any CPU + {D471A566-9FB6-41B2-A777-3C32874ECD0E}.Debug|x86.ActiveCfg = Debug|Any CPU + {D471A566-9FB6-41B2-A777-3C32874ECD0E}.Debug|x86.Build.0 = Debug|Any CPU + {D471A566-9FB6-41B2-A777-3C32874ECD0E}.Release|x86.ActiveCfg = Release|Any CPU + {D471A566-9FB6-41B2-A777-3C32874ECD0E}.Release|x86.Build.0 = Release|Any CPU + {13E13CA1-AFC2-4AAB-A378-2349C10F9F45}.Debug|x86.ActiveCfg = Debug|Any CPU + {13E13CA1-AFC2-4AAB-A378-2349C10F9F45}.Debug|x86.Build.0 = Debug|Any CPU + {13E13CA1-AFC2-4AAB-A378-2349C10F9F45}.Release|x86.ActiveCfg = Release|Any CPU + {13E13CA1-AFC2-4AAB-A378-2349C10F9F45}.Release|x86.Build.0 = Release|Any CPU + {D9342117-3249-4D8B-87C9-51A50676B158}.Debug|x86.ActiveCfg = Debug|Any CPU + {D9342117-3249-4D8B-87C9-51A50676B158}.Debug|x86.Build.0 = Debug|Any CPU + {D9342117-3249-4D8B-87C9-51A50676B158}.Release|x86.ActiveCfg = Release|Any CPU + {D9342117-3249-4D8B-87C9-51A50676B158}.Release|x86.Build.0 = Release|Any CPU + {CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Debug|x86.ActiveCfg = Debug|Any CPU + {CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Debug|x86.Build.0 = Debug|Any CPU + {CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Release|x86.ActiveCfg = Release|Any CPU + {CEEEEB41-3059-46A2-A871-2ADE22C013D9}.Release|x86.Build.0 = Release|Any CPU + {F9086FE4-8925-42FF-A59C-607341604293}.Debug|x86.ActiveCfg = Debug|Any CPU + {F9086FE4-8925-42FF-A59C-607341604293}.Debug|x86.Build.0 = Debug|Any CPU + {F9086FE4-8925-42FF-A59C-607341604293}.Release|x86.ActiveCfg = Release|Any CPU + {F9086FE4-8925-42FF-A59C-607341604293}.Release|x86.Build.0 = Release|Any CPU + {44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Debug|x86.ActiveCfg = Debug|Any CPU + {44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Debug|x86.Build.0 = Debug|Any CPU + {44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Release|x86.ActiveCfg = Release|Any CPU + {44AA3A50-7214-47F2-9D60-6FF34C0FE6D3}.Release|x86.Build.0 = Release|Any CPU + {AD0267BB-F08C-4BE1-A88D-010D49041761}.Debug|x86.ActiveCfg = Debug|Any CPU + {AD0267BB-F08C-4BE1-A88D-010D49041761}.Debug|x86.Build.0 = Debug|Any CPU + {AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|x86.ActiveCfg = Release|Any CPU + {AD0267BB-F08C-4BE1-A88D-010D49041761}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..9de08a0 --- /dev/null +++ b/www/index.html @@ -0,0 +1,39 @@ + + + + + ln.provider + + + + + + + +
+ +

{{ serverString }}

+ +
+ + + + diff --git a/www/ln.application.js b/www/ln.application.js new file mode 100644 index 0000000..87e725f --- /dev/null +++ b/www/ln.application.js @@ -0,0 +1,336 @@ +var LN = (function(){ + var appInterface; + + var defaultOptions = { + url: null, + + }; + + class LNInterface { + constructor(opt){ + var self = this; + + this.options = {} + Object.assign(this.options,opt); + + if (this.options.url == null) + this.options.url = this.constructURL(); + + + this.rpcCallbacks = []; + this.rpcNextID = 1; + + this.websocket = new WebSocket(this.options.url); + this.websocket.onerror = function(e){ + alert("WebSocket caught error: " + e.date); + } + this.websocket.onmessage = function(e){ + var j = JSON.parse(e.data); + if (j.state){ + updateState(j.state); + } else if (j.id) + { + for (var n=0;n 1000000000) + return ((value / 1000000000) | 0) + "G"; + if (value > 1000000) + return ((value / 1000000) | 0) + "M"; + if (value > 1000) + return ((value / 1000) | 0) + "k"; + return value; +} + + +*/ + diff --git a/www/style.css b/www/style.css new file mode 100644 index 0000000..24e4247 --- /dev/null +++ b/www/style.css @@ -0,0 +1,27 @@ +body, html { + position: absolute; + width: 100%; + height: 100%; + + padding: 0px; + margin: 0px; + + overflow: hidden; + + font-family: Arial, Helvetica, sans-serif; + font-size: 14px; +} + +h1 { + font-size: 125%; +} + +div.app { + position: absolute; + + padding: 0px; + margin: 0px; +} + + +