You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3KB

  1. #pragma once
  2. #include <vector>
  3. #include <common.hpp>
  4. #include <plugin/Plugin.hpp>
  5. #include <plugin/Model.hpp>
  6. namespace rack {
  7. /** Plugin loader and plugin manager
  8. */
  9. namespace plugin {
  10. struct Update {
  11. std::string pluginSlug;
  12. std::string pluginName;
  13. std::string version;
  14. std::string changelogUrl;
  15. float progress = 0.f;
  16. };
  17. void init();
  18. void destroy();
  19. void logIn(const std::string& email, const std::string& password);
  20. void logOut();
  21. bool isLoggedIn();
  22. void queryUpdates();
  23. bool hasUpdates();
  24. void syncUpdate(Update* update);
  25. void syncUpdates();
  26. bool isSyncing();
  27. Plugin* getPlugin(const std::string& pluginSlug);
  28. Model* getModel(const std::string& pluginSlug, const std::string& modelSlug);
  29. /** Creates a Module from a JSON module object.
  30. Throws an Exception if the model is not found.
  31. */
  32. engine::Module* moduleFromJson(json_t* moduleJ);
  33. /** Checks that the slug contains only alphanumeric characters, "-", and "_" */
  34. bool isSlugValid(const std::string& slug);
  35. /** Returns a string containing only the valid slug characters. */
  36. std::string normalizeSlug(const std::string& slug);
  37. extern std::vector<Plugin*> plugins;
  38. extern std::string loginStatus;
  39. extern std::vector<Update> updates;
  40. extern std::string updateStatus;
  41. extern bool restartRequested;
  42. } // namespace plugin
  43. } // namespace rack