rename server
This commit is contained in:
19
AobaServer/Controllers/Api/AuthApi.cs
Normal file
19
AobaServer/Controllers/Api/AuthApi.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AobaV2.Controllers.Api;
|
||||
|
||||
[Route("/api/auth")]
|
||||
public class AuthApi : ControllerBase
|
||||
{
|
||||
[HttpGet("login")]
|
||||
public async Task<IActionResult> LoginAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[HttpGet("register")]
|
||||
public async Task<IActionResult> RegisterAsync()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
23
AobaServer/Controllers/AuthController.cs
Normal file
23
AobaServer/Controllers/AuthController.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AobaV2.Controllers;
|
||||
|
||||
[AllowAnonymous]
|
||||
[Route("auth")]
|
||||
public class AuthController : Controller
|
||||
{
|
||||
[HttpGet("login")]
|
||||
public IActionResult Login([FromQuery] string returnUrl)
|
||||
{
|
||||
ViewData["returnUrl"] = returnUrl;
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet("register/{token}")]
|
||||
public IActionResult Register(string token)
|
||||
{
|
||||
|
||||
return View(token);
|
||||
}
|
||||
}
|
||||
27
AobaServer/Controllers/MediaController.cs
Normal file
27
AobaServer/Controllers/MediaController.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using AobaCore;
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace AobaV2.Controllers;
|
||||
|
||||
[Route("/m")]
|
||||
public class MediaController(MediaService media) : Controller
|
||||
{
|
||||
[HttpGet("{id}")]
|
||||
public IActionResult Media(ObjectId id)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpGet("/i/{id}/{*rest}")]
|
||||
public async Task<IActionResult> LegacyRedirectAsync(ObjectId id, string rest, [FromServices] AobaService aoba)
|
||||
{
|
||||
var media = await aoba.GetMediaAsync(id);
|
||||
if (media == null)
|
||||
return NotFound();
|
||||
return LocalRedirectPermanent($"/m/{media.Id}/{rest}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user