├── LunarServer
├── Properties
│ └── PublishProfiles
│ │ ├── FolderProfile.pubxml.user
│ │ └── FolderProfile.pubxml
├── Templates
│ ├── Engine
│ │ ├── SelfKey.cs
│ │ ├── LiteralKey.cs
│ │ ├── Enumerables.cs
│ │ ├── GlobalKey.cs
│ │ ├── NegationKey.cs
│ │ ├── RenderingContext.cs
│ │ ├── FormatNodes.cs
│ │ ├── CaseNodes.cs
│ │ ├── Document.cs
│ │ ├── DateNodes.cs
│ │ └── RenderingKey.cs
│ ├── AssetNodes.cs
│ └── StoreNodes.cs
├── Minifiers
│ └── CSS.cs
├── Utils
│ ├── RequestExtensions.cs
│ ├── MD5.cs
│ ├── Country.cs
│ ├── Decimals.cs
│ ├── Password.cs
│ ├── HTTP.cs
│ ├── ArrayPointer.cs
│ └── DetectionUtils.cs
├── LunarServer.csproj
├── Core
│ ├── Logger.cs
│ ├── Date.cs
│ ├── Mime.cs
│ ├── Plugin.cs
│ ├── Settings.cs
│ ├── AssetCache.cs
│ ├── MultipartParser.cs
│ ├── Session.cs
│ └── Router.cs
├── HTTP
│ ├── RequestCache.cs
│ ├── HTTPResponse.cs
│ └── HTTPRequest.cs
├── Plugins
│ ├── Oauth
│ │ ├── OauthConnection.cs
│ │ ├── Profile.cs
│ │ ├── OauthPlugin.cs
│ │ ├── LinkedIn.cs
│ │ └── Facebook.cs
│ └── RPC.cs
├── Websockets
│ ├── WebSocketFrame.cs
│ ├── WebSocketFrameWriter.cs
│ ├── Exceptions.cs
│ ├── BinaryReaderWriter.cs
│ └── WebSocketFrameReader.cs
├── Entity
│ ├── Connector.cs
│ ├── Entity.cs
│ ├── API.cs
│ └── Store.cs
└── Analytics
│ └── AnalyticsCollection.cs
├── .gitignore
├── SynkMVC
├── Modules
│ ├── Enums.cs
│ ├── Users.cs
│ ├── Search.cs
│ ├── Files.cs
│ ├── Auth.cs
│ └── API.cs
├── SynkMVC.csproj
├── Model
│ ├── Enum.cs
│ ├── File.cs
│ ├── User.cs
│ └── Config.cs
├── Core
│ ├── Menus.cs
│ ├── Condition.cs
│ └── Module.cs
└── Utils
│ ├── MailSender.cs
│ ├── ImageUtils.cs
│ └── ArrayPointer.cs
├── ServerTests
├── ServerTests.csproj
└── StorageTests.cs
├── LICENSE
├── LunarServer.sln
└── README.md
/LunarServer/Properties/PublishProfiles/FolderProfile.pubxml.user:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vs/
2 | packages/
3 | LunarServer/bin/
4 | LunarServer/obj/
5 | ServerTests/bin/
6 | ServerTests/obj/
7 | SynkMVC/bin/
8 | SynkMVC/obj/
9 |
10 | LunarServer/LunarServer.csproj.user
11 |
--------------------------------------------------------------------------------
/SynkMVC/Modules/Enums.cs:
--------------------------------------------------------------------------------
1 | using LunarLabs.WebMVC.Model;
2 | using LunarLabs.WebMVC.Utils;
3 | using System.Text;
4 |
5 | namespace LunarLabs.WebMVC.Modules
6 | {
7 | public class Enums : CRUDModule
8 | {
9 |
10 | public Enums()
11 | {
12 | this.RegisterClass();
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/SynkMVC/Modules/Users.cs:
--------------------------------------------------------------------------------
1 | using LunarLabs.WebMVC;
2 | using LunarLabs.WebMVC.Model;
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace LunarLabs.WebMVC.Modules
7 | {
8 | public class Users : CRUDModule
9 | {
10 | public Users()
11 | {
12 | this.RegisterClass();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/LunarServer/Properties/PublishProfiles/FolderProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | Any CPU
9 | publish\
10 | FileSystem
11 | <_TargetId>Folder
12 |
13 |
--------------------------------------------------------------------------------
/SynkMVC/SynkMVC.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/LunarServer/Templates/Engine/SelfKey.cs:
--------------------------------------------------------------------------------
1 | namespace LunarLabs.Templates
2 | {
3 | public class SelfKey : RenderingKey
4 | {
5 | public override RenderingType RenderingType => RenderingType.Any;
6 |
7 | public override object Evaluate(RenderingContext context)
8 | {
9 | return context.DataStack[context.DataStack.Count - 1];
10 | }
11 |
12 | public override string ToString()
13 | {
14 | return "this";
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/SynkMVC/Model/Enum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 |
5 | namespace LunarLabs.WebMVC.Model
6 | {
7 | public class Enum : Entity
8 | {
9 | public override void InitFields()
10 | {
11 | this.RegisterField("name").asString(60).showInGrid();
12 | this.RegisterField("values").asText();
13 | }
14 |
15 | public override string ToString()
16 | {
17 | return GetFieldValue("name");
18 | }
19 |
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ServerTests/ServerTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/LunarServer/Templates/Engine/LiteralKey.cs:
--------------------------------------------------------------------------------
1 | namespace LunarLabs.Templates
2 | {
3 | public class LiteralKey : RenderingKey
4 | {
5 | private object _value;
6 |
7 | private RenderingType _type;
8 | public override RenderingType RenderingType => _type;
9 |
10 | public LiteralKey(object value, RenderingType type)
11 | {
12 | this._value = value;
13 | this._type = type;
14 | }
15 |
16 | public override object Evaluate(RenderingContext context)
17 | {
18 | return _value;
19 | }
20 |
21 | public override string ToString()
22 | {
23 | return _value.ToString();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/LunarServer/Templates/Engine/Enumerables.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 |
3 | namespace LunarLabs.Templates
4 | {
5 | public static class EnumerableExtensions
6 | {
7 | public static int Count(this IEnumerable source)
8 | {
9 | int res = 0;
10 |
11 | foreach (var item in source)
12 | res++;
13 |
14 | return res;
15 | }
16 |
17 | public static bool Any(this IEnumerable source)
18 | {
19 | bool res = false;
20 |
21 | foreach (var item in source)
22 | {
23 | res = true;
24 | break;
25 | }
26 |
27 | return res;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/LunarServer/Minifiers/CSS.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | namespace LunarLabs.WebServer.Minifiers
4 | {
5 | public static class CSSMinifier
6 | {
7 | public static string Compress(string css)
8 | {
9 | css = Regex.Replace(css, @"[a-zA-Z]+#", "#");
10 | css = Regex.Replace(css, @"[\n\r]+\s*", " ");
11 | css = Regex.Replace(css, @"\s+", " ");
12 | css = Regex.Replace(css, @"\s?([:,;{}])\s?", "$1");
13 | css = css.Replace(";}", "}");
14 | css = Regex.Replace(css, @"([\s:]0)(px|pt|%|em)", "$1");
15 |
16 | // Remove comments from CSS
17 | css = Regex.Replace(css, @"/\[\d\D]?\*/", string.Empty);
18 | return css;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/SynkMVC/Core/Menus.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace LunarLabs.WebMVC
4 | {
5 | public class Menu
6 | {
7 | public class Item
8 | {
9 | public string label;
10 | public string action;
11 | public string link;
12 |
13 | public Item(string label, string action, string link)
14 | {
15 | this.label = label;
16 | this.action = action;
17 | this.link = link;
18 | }
19 | }
20 |
21 | public string title;
22 | public string link;
23 | public List- items = new List
- ();
24 |
25 | public Menu(string title, string link)
26 | {
27 | this.title = title;
28 | this.link = link;
29 | }
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/LunarServer/Utils/RequestExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using LunarLabs.WebServer.HTTP;
3 |
4 | namespace LunarLabs.WebServer.Utils
5 | {
6 | public static class RequestExtensions
7 | {
8 | public static long GetLong(this HTTPRequest request, string name)
9 | {
10 | var str = request.GetVariable(name);
11 | long result;
12 | if (long.TryParse(str, out result))
13 | {
14 | return result;
15 | }
16 |
17 | return 0;
18 | }
19 |
20 | public static T GetEnum (this HTTPRequest request, string name) where T: struct
21 | {
22 | var str = request.GetVariable(name);
23 |
24 | var type = typeof(T);
25 | T result;
26 |
27 | if (Enum.TryParse(str, out result))
28 | {
29 | return (T)result;
30 | }
31 |
32 | return default(T);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/LunarServer/Utils/MD5.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using System.Text;
3 |
4 | namespace LunarLabs.WebServer.Utils
5 | {
6 | public static class MD5Utils
7 | {
8 | public static string MD5(this string input)
9 | {
10 | byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
11 | return inputBytes.MD5();
12 | }
13 |
14 | public static string MD5(this byte[] inputBytes)
15 | {
16 | // step 1, calculate MD5 hash from input
17 | MD5 md5 = System.Security.Cryptography.MD5.Create();
18 |
19 | byte[] hash = md5.ComputeHash(inputBytes);
20 |
21 | // step 2, convert byte array to hex string
22 | StringBuilder sb = new StringBuilder();
23 | for (int i = 0; i < hash.Length; i++)
24 | {
25 | sb.Append(hash[i].ToString("X2"));
26 | }
27 |
28 | return sb.ToString();
29 | }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LunarServer/Templates/Engine/GlobalKey.cs:
--------------------------------------------------------------------------------
1 | namespace LunarLabs.Templates
2 | {
3 | public class GlobalKey : PathRenderingKey
4 | {
5 | private string _global;
6 |
7 | public override RenderingType RenderingType => RenderingType.Any;
8 |
9 | public GlobalKey(string key) : base(key)
10 | {
11 | this._global = steps[0];
12 | this.startingStep = 1;
13 | }
14 |
15 | public override object Evaluate(RenderingContext context)
16 | {
17 | var obj = context.Get(_global);
18 |
19 | if (this.steps.Length > 1)
20 | {
21 | int stackPointer = context.DataStack.Count - 1;
22 | var temp = context.DataStack[stackPointer];
23 |
24 | context.DataStack[stackPointer] = obj;
25 |
26 | var result = base.Evaluate(context);
27 |
28 | context.DataStack[stackPointer] = temp;
29 |
30 | return result;
31 | }
32 |
33 | return obj;
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/LunarServer/Templates/Engine/NegationKey.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Linq;
4 |
5 | namespace LunarLabs.Templates
6 | {
7 | public class NegationKey : RenderingKey
8 | {
9 | private RenderingKey body;
10 |
11 | public override RenderingType RenderingType => RenderingType.Bool;
12 |
13 | public NegationKey(RenderingKey body) : base()
14 | {
15 | this.body = body;
16 | }
17 |
18 | public override object Evaluate(RenderingContext context)
19 | {
20 | var obj = body.Evaluate(context);
21 |
22 | if (obj is bool)
23 | {
24 | return !((bool)obj);
25 | }
26 |
27 | if (obj is IEnumerable)
28 | {
29 | var collection = (IEnumerable)obj;
30 | return !collection.Any();
31 | }
32 |
33 | throw new Exception("Expected bool key");
34 | }
35 |
36 | public override string ToString()
37 | {
38 | return "!"+body.ToString();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Sérgio Flores
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SynkMVC/Utils/MailSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Net.Mail;
6 |
7 | namespace LunarLabs.WebMVC.Utils
8 | {
9 | public class MailSender
10 | {
11 | //http://stackoverflow.com/questions/9201239/send-e-mail-via-smtp-using-c-sharp
12 | public void Send()
13 | {
14 | SmtpClient client = new SmtpClient();
15 | client.Port = 587;
16 | client.Host = "smtp.gmail.com";
17 | client.EnableSsl = true;
18 | client.Timeout = 10000;
19 | client.DeliveryMethod = SmtpDeliveryMethod.Network;
20 | client.UseDefaultCredentials = false;
21 | client.Credentials = new System.Net.NetworkCredential("user@gmail.com", "password");
22 |
23 | MailMessage mm = new MailMessage("donotreply@domain.com", "sendtomyemail@domain.co.uk", "test", "test");
24 | mm.BodyEncoding = UTF8Encoding.UTF8;
25 | mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
26 |
27 | client.Send(mm);
28 |
29 | mm.Dispose();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/LunarServer/LunarServer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.1
5 | true
6 | 1.5.6
7 | 1.5.6
8 | 1.5.11
9 | HTTP server with minimal dependencies
10 | Sergio Flores
11 | https://github.com/Relfos/LunarServer
12 |
13 | https://github.com/Relfos/LunarServer
14 | http server cookies oauth
15 | Sergio Flores
16 | Lunar Labs
17 | LunarLabs.Server
18 | LunarLabs.Server
19 | LunarLabs.WebServer
20 | true
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ServerTests/StorageTests.cs:
--------------------------------------------------------------------------------
1 | using LunarLabs.WebServer.Core;
2 | using LunarLabs.WebServer.HTTP;
3 | using NUnit.Framework;
4 |
5 | namespace Tests
6 | {
7 | internal struct DummyStruct
8 | {
9 | public int X;
10 | public int Y;
11 | public string name;
12 | }
13 |
14 | public class Tests
15 | {
16 | [Test]
17 | public void TestWebsocketKey()
18 | {
19 | var key = HTTPServer.GenerateWebSocketKey("dGhlIHNhbXBsZSBub25jZQ==");
20 | Assert.IsTrue(key == "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=");
21 | }
22 |
23 | [Test]
24 | public void TestSessionStructs()
25 | {
26 | var storage = new MemorySessionStorage();
27 |
28 | var dummy = new DummyStruct()
29 | {
30 | name = "Hello",
31 | X = 10,
32 | Y = -20
33 | };
34 |
35 | var session = storage.CreateSession();
36 |
37 | session.SetStruct("entry", dummy);
38 |
39 | var other = session.GetStruct("entry");
40 |
41 | Assert.IsTrue(dummy.name == other.name);
42 | Assert.IsTrue(dummy.X == other.X);
43 | Assert.IsTrue(dummy.Y == other.Y);
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/SynkMVC/Model/File.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace LunarLabs.WebMVC.Model
5 | {
6 | public class File : Entity
7 | {
8 | public override void InitFields()
9 | {
10 | this.RegisterField("real_name").asString(60).showInGrid();
11 | this.RegisterField("hash").asString(40);
12 | this.RegisterField("size").asSize().showInGrid();
13 | this.RegisterField("local_name").asString(80).showInGrid();
14 | this.RegisterField("thumb").asString(80);
15 | }
16 |
17 | public override string ToString()
18 | {
19 | return GetFieldValue("real_name");
20 | }
21 |
22 | public byte[] GetBytes(SynkContext context)
23 | {
24 | var content = GetFieldValue("local_name");
25 |
26 | var filePath = System.IO.Path.Combine("public", content.TrimStart('/', '\\'));
27 | filePath = context.site.GetFullPath(filePath);
28 | if (System.IO.File.Exists(filePath))
29 | {
30 | return System.IO.File.ReadAllBytes(filePath);
31 | }
32 | else
33 | {
34 | return null;
35 | }
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/LunarServer/Core/Logger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace LunarLabs.WebServer.Core
4 | {
5 | public enum LogLevel
6 | {
7 | Default,
8 | Debug,
9 | Info,
10 | Warning,
11 | Error
12 | }
13 |
14 | public delegate void LoggerCallback(LogLevel level, string text);
15 |
16 | public static class ConsoleLogger
17 | {
18 | public static LogLevel MaxLevel = LogLevel.Default;
19 |
20 | public static bool useColors = true;
21 |
22 | public static void Write(LogLevel level, string text)
23 | {
24 | if (MaxLevel > level) return;
25 |
26 | var temp = Console.ForegroundColor;
27 |
28 | if (useColors)
29 | {
30 | ConsoleColor c;
31 | switch (level)
32 | {
33 | case LogLevel.Debug: c = ConsoleColor.Cyan; break;
34 | case LogLevel.Error: c = ConsoleColor.Red; break;
35 | case LogLevel.Warning: c = ConsoleColor.Yellow; break;
36 | default: c = ConsoleColor.Gray; break;
37 | }
38 | Console.ForegroundColor = c;
39 | }
40 |
41 | Console.WriteLine(text);
42 |
43 | if (useColors)
44 | {
45 | Console.ForegroundColor = temp;
46 | }
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/LunarServer/Utils/Country.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace LunarLabs.WebServer.Utils
4 | {
5 | public static class CountryUtils
6 | {
7 | public struct IPRange
8 | {
9 | public uint start;
10 | public uint end;
11 | public string code;
12 | }
13 |
14 | private static IPRange[] _ipRanges;
15 |
16 | private static void InitRanges()
17 | {
18 | var lines = File.ReadAllLines("ranges.txt");
19 | _ipRanges = new IPRange[lines.Length];
20 | for (int i=0; i= p.start && ip <= p.end)
42 | {
43 | return p.code;
44 | }
45 |
46 | return null;
47 | }
48 |
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/SynkMVC/Model/User.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace LunarLabs.WebMVC.Model
5 | {
6 | public class User : Entity
7 | {
8 | public override void InitFields()
9 | {
10 | this.RegisterField("username").asName(30).showInGrid();
11 | this.RegisterField("password").asPassword(40).makeOptional();
12 | this.RegisterField("hash").asHash("password");
13 | this.RegisterField("permissions").asBitfield();
14 | this.RegisterField("database").asString(64);
15 | this.RegisterField("payload").asText();
16 | }
17 |
18 | public override string ToString()
19 | {
20 | return GetFieldValue("username");
21 | }
22 |
23 | public override Condition GetSearch(string term)
24 | {
25 | return Condition.Contains("username", term);
26 | }
27 |
28 | public long GetPermissions()
29 | {
30 | long result;
31 | long.TryParse(GetFieldValue("permissions"), out result);
32 | return result;
33 | }
34 |
35 | public bool HasPermission(int permissionIndex)
36 | {
37 | var perms = GetPermissions();
38 | int flag = 1 << permissionIndex;
39 | return (perms & flag) != 0;
40 | }
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/LunarServer/HTTP/RequestCache.cs:
--------------------------------------------------------------------------------
1 | using LunarLabs.WebServer.HTTP;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace LunarLabs.WebServer.HTTP
6 | {
7 | internal struct RequestCacheEntry
8 | {
9 | public readonly HTTPResponse Response;
10 | public readonly DateTime dateTime;
11 |
12 | public RequestCacheEntry(HTTPResponse response, DateTime dateTime)
13 | {
14 | Response = response;
15 | this.dateTime = dateTime;
16 | }
17 | }
18 |
19 | internal class RequestCache
20 | {
21 | private Dictionary _cachedResponses = new Dictionary();
22 |
23 | public HTTPResponse GetCachedResponse(string path, int maxSeconds)
24 | {
25 | if (_cachedResponses.ContainsKey(path))
26 | {
27 | var entry = _cachedResponses[path];
28 | var diff = DateTime.UtcNow - entry.dateTime;
29 | if (diff.TotalSeconds <= maxSeconds)
30 | {
31 | return entry.Response;
32 | }
33 | }
34 |
35 | return null;
36 | }
37 |
38 | public void PutCachedResponse(string path, HTTPResponse response)
39 | {
40 | var entry = new RequestCacheEntry(response, DateTime.UtcNow);
41 | _cachedResponses[path] = entry;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/LunarServer/Templates/Engine/RenderingContext.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text;
3 |
4 | namespace LunarLabs.Templates
5 | {
6 | public enum RenderingOperation
7 | {
8 | None,
9 | Continue,
10 | Break,
11 | }
12 |
13 | public class RenderingContext
14 | {
15 | public Queue queue;
16 | public object DataRoot;
17 | public List