Fixed minor issues + added language support
This commit is contained in:
@@ -82,6 +82,8 @@ public class ProjectApi : IProjectApi {
|
||||
await _docker.DeleteContainer(project.ContainerName);
|
||||
|
||||
await _proxy.RemoveLocation(project.ProxyId, project.CertificateId);
|
||||
|
||||
Directory.Delete(_options.Root + projectId, true);
|
||||
|
||||
_context.Projects.Remove(project);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
||||
using Microsoft.Extensions.Options;
|
||||
using ProjectManager.Backend.Entities;
|
||||
|
||||
@@ -88,6 +88,16 @@ public class ProjectController : ControllerBase {
|
||||
return Redirect($"http://{_options.Host}:{project.Port}/_/");
|
||||
}
|
||||
|
||||
[Authorized]
|
||||
[HttpGet("{projectId}/url/string")]
|
||||
public IActionResult GetProjectUrlHead(string projectId) {
|
||||
var project = _projects.GetProject(projectId);
|
||||
if (project == null) return NotFound();
|
||||
if (project.OwnerId != _context.UserId) return Unauthorized();
|
||||
if (_options.Enable) return Ok(new {url = $"https://{projectId}.{_options.Domain}/_/"});
|
||||
return Ok(new {url = $"http://{_options.Host}:{project.Port}/_/"});
|
||||
}
|
||||
|
||||
[Authorized]
|
||||
[HttpGet("{projectId}/start")]
|
||||
public async Task<IActionResult> StartProject(string projectId) {
|
||||
|
||||
@@ -36,7 +36,7 @@ if (app.Environment.IsDevelopment()) {
|
||||
|
||||
app.UseCors(
|
||||
options => options
|
||||
.WithOrigins(new []{app.Configuration.GetSection("Frontend").Get<string>() ?? ""})
|
||||
.WithOrigins(app.Configuration.GetSection("Frontend").Get<string>() ?? "")
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials()
|
||||
@@ -45,5 +45,10 @@ app.UseCors(
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
app.MapGet("", async context => {
|
||||
context.Response.StatusCode = StatusCodes.Status200OK;
|
||||
await context.Response.BodyWriter.WriteAsync("Ok"u8.ToArray());
|
||||
await context.Response.BodyWriter.CompleteAsync();
|
||||
});
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user