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>"))))); }
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")); }
public Task <string> GetBundleHash(RouteServerBase.RouteContext ctx) { return(Task.FromResult(ctx.Query.hash)); }
public Task GetBundle(RouteServerBase.RouteContext ctx) { return(HandleBundle(ctx.Response, ctx.Query.hash)); }
public Task GetLatestBundle(RouteServerBase.RouteContext ctx) { return(HandleBundle(ctx.Response, bundle.LatestHash)); }
public string Count(RouteServerBase.RouteContext ctx) { countDict.TryAdd(ctx.Query.name, 0); return((++countDict[ctx.Query.name]).ToString()); }