VersionController.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using LJProxy.Services;
  2. using Microsoft.AspNetCore.Mvc;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text.RegularExpressions;
  7. using System.Threading.Tasks;
  8. namespace LJProxy.Controllers
  9. {
  10. [Route("api/[controller]")]
  11. [ApiController]
  12. public class VersionController: Controller
  13. {
  14. private VersionService _service;
  15. public VersionController(VersionService vService)
  16. {
  17. _service = vService;
  18. }
  19. [Route("GetUpdateJson")]
  20. [HttpGet]
  21. [HttpPost]
  22. public IActionResult GetUpdateJson()
  23. {
  24. string updateJson = _service.GetUpdateJson();
  25. var result = new ContentResult();
  26. result.Content = updateJson;
  27. result.ContentType = "application/json";
  28. return result;
  29. }
  30. [Route("GetAppUpdate/{apkName}")]
  31. [HttpGet]
  32. [HttpPost]
  33. public IActionResult GetAppUpdate(string apkName)
  34. {
  35. var fs = _service.GetAPK(apkName);
  36. if (fs == null)
  37. {
  38. return NotFound();
  39. }
  40. else
  41. {
  42. return new FileContentResult(fs, "application/vnd.android.package-archive");
  43. }
  44. }
  45. }
  46. }