public async Task <IActionResult> GetProperties([FromBody] dynamic body) { string itemId = body["itemId"]; string versionId = body["versionId"]; string projectId = itemId.Split("/").Reverse().ElementAt(2); string connectionId = body["connectionId"]; string fileName = versionId.Base64Encode() + ".json"; // try get the file, in case was already extracted try { ObjectsApi objects = new ObjectsApi(); objects.Configuration.AccessToken = (await Credentials.Get2LeggedTokenAsync(new Scope[] { Scope.DataWrite, Scope.DataRead })).access_token; dynamic details = await objects.GetObjectDetailsAsync(Utils.BucketName, fileName); // << this line will throw an exception if object is not found dynamic signedUrl = await objects.CreateSignedResourceAsyncWithHttpInfo(Utils.BucketName, fileName, new PostBucketsSigned(10), "read"); await _hubContext.Clients.Client(connectionId).SendAsync("propsReady", (string)(signedUrl.Data.signedUrl)); return(NoContent()); // } catch { } Credentials credentials = await Credentials.FromSessionAsync(base.Request.Cookies, Response.Cookies); if (credentials == null) { return(null); } ExtractStyles da4c3d = new ExtractStyles(); await da4c3d.StartExtractStyles(credentials, projectId, versionId, connectionId, _env.WebRootPath); return(Accepted()); }
public async Task <IActionResult> GetProperties([FromBody] dynamic body) { Credentials credentials = await Credentials.FromSessionAsync(base.Request.Cookies, Response.Cookies); if (credentials == null) { return(null); } string itemId = body["itemId"]; string versionId = body["versionId"]; string projectId = itemId.Split("/").Reverse().ElementAt(2); string connectionId = body["connectionId"]; ExtractStyles da4c3d = new ExtractStyles(); await da4c3d.StartExtractStyles(credentials, projectId, versionId, connectionId, _env.WebRootPath); return(Ok()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); // clean up on every run... :) Controllers.ExtractStyles da4c3d = new Controllers.ExtractStyles(); da4c3d.ClearAccount(); } app.UseRouting(); app.UseEndpoints(routes => { routes.MapHub <Controllers.DesignAutomationHub>("/api/signalr/designautomation"); }); app.UseDefaultFiles(); app.UseStaticFiles(); app.UseHttpsRedirection(); app.UseMvc(); }