fastweb.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef NGS_FASTWEB_H
  2. #define NGS_FASTWEB_H
  3. #include <string>
  4. #include <vector>
  5. namespace ngs {
  6. namespace fastweb {
  7. constexpr const char* kDefaultVersion = "1.0.0";
  8. constexpr const char* kModuleCatalogUrl =
  9. "https://download.fwlua.com/module/module.json";
  10. struct ModuleInfo {
  11. int id = 0;
  12. std::string name;
  13. std::string name_en;
  14. std::string desc;
  15. std::string doc;
  16. std::string icon;
  17. std::string type; // fastweb | lua | other
  18. std::string download_type; // github | zip | lua
  19. std::string download_url;
  20. bool installed = false;
  21. };
  22. std::string install_dir();
  23. std::string bin_path();
  24. std::string share_dir();
  25. bool is_installed();
  26. std::string installed_version();
  27. bool install(bool debug = false);
  28. bool uninstall();
  29. void show_status();
  30. void menu();
  31. // Site modules (fastweb instmod / uninstmod).
  32. std::string site_config_ini(const std::string& site_name);
  33. bool list_modules(const std::string& site_name, std::vector<ModuleInfo>& out,
  34. std::string& err);
  35. bool install_module(const std::string& site_name, const std::string& name_en,
  36. std::string& err);
  37. bool uninstall_module(const std::string& site_name, const std::string& name_en,
  38. std::string& err);
  39. } // namespace fastweb
  40. } // namespace ngs
  41. #endif