index.js.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // Created by xcbosa on 2023-01-30
  3. //
  4. #include "../../processor/processor.h"
  5. #include "../../utils/utils.h"
  6. #include "../../webuiconf.h"
  7. using namespace std;
  8. using namespace xc::processor;
  9. using namespace xc::utils;
  10. using namespace xc::processor::templates;
  11. namespace xc::controller {
  12. static string ControllerPath = "/index.js";
  13. static ResponseData *controllerResponse(RequestData request) {
  14. return new TextResponseData(200,
  15. string("let app = new Framework7({\n") +
  16. string(" // App root element\n") +
  17. string(" el: \'#app\',\n") +
  18. string(" // App Name\n") +
  19. string(" name: \'FRPCWebUI\',\n") +
  20. string(" // App id\n") +
  21. string(" id: \'org.forgetive.frpcwebui\',\n") +
  22. string(" // Enable swipe panel\n") +
  23. string(" panel: {\n") +
  24. string(" swipe: true,\n") +
  25. string(" },\n") +
  26. string(" // Add default routes\n") +
  27. string(" routes: [\n") +
  28. string(" {\n") +
  29. string(" path: \'/about/\',\n") +
  30. string(" url: \'about.html\',\n") +
  31. string(" },\n") +
  32. string(" ],\n") +
  33. string(" // ... other parameters\n") +
  34. string("});\n")
  35. , mimeTypeOfFile(ControllerPath));
  36. }
  37. ContentGeneratorDefineS(request.getURL() == ControllerPath, controllerResponse(request))
  38. }