Example #1
0
        public Task <string> Index(RouteServerBase.RouteContext ctx)
        {
            return(Task.FromResult("currently disabled"));

            return(Task.FromResult(indexHtml.Replace("{{files}}",
                                                     string.Join("<br>",
                                                                 Directory.GetFiles("bundles/")
                                                                 .Select(s => s.Substring(6))
                                                                 .Select(s => $"<a href='/custard/api/v1/bundle/{s}'>{s}</a>")))));
        }
Example #2
0
        public Task <string> SetLatestHash(RouteServerBase.RouteContext ctx)
        {
            if (!bundle.TrySetLatestHash(ctx.Query.hash))
            {
                ctx.Response.StatusCode = 400;
                return(Task.FromResult("hash not found"));
            }

            return(Task.FromResult("succeed"));
        }
Example #3
0
 public Task <string> GetBundleHash(RouteServerBase.RouteContext ctx)
 {
     return(Task.FromResult(ctx.Query.hash));
 }
Example #4
0
 public Task GetBundle(RouteServerBase.RouteContext ctx)
 {
     return(HandleBundle(ctx.Response, ctx.Query.hash));
 }
Example #5
0
 public Task GetLatestBundle(RouteServerBase.RouteContext ctx)
 {
     return(HandleBundle(ctx.Response, bundle.LatestHash));
 }
Example #6
0
 public string Count(RouteServerBase.RouteContext ctx)
 {
     countDict.TryAdd(ctx.Query.name, 0);
     return((++countDict[ctx.Query.name]).ToString());
 }