auth-youtube.hpp 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include <QObject>
  3. #include <QString>
  4. #include <random>
  5. #include <string>
  6. #include "auth-oauth.hpp"
  7. #ifdef BROWSER_AVAILABLE
  8. class BrowserDock;
  9. #endif
  10. inline const std::vector<Auth::Def> youtubeServices = {
  11. {"YouTube - RTMP", Auth::Type::OAuth_LinkedAccount, true, true},
  12. {"YouTube - RTMPS", Auth::Type::OAuth_LinkedAccount, true, true},
  13. {"YouTube - HLS", Auth::Type::OAuth_LinkedAccount, true, true}};
  14. class YoutubeAuth : public OAuthStreamKey {
  15. Q_OBJECT
  16. bool uiLoaded = false;
  17. std::mt19937 randomSeed;
  18. std::string section;
  19. #ifdef BROWSER_AVAILABLE
  20. QSharedPointer<BrowserDock> chat;
  21. QSharedPointer<QAction> chatMenu;
  22. #endif
  23. virtual bool RetryLogin() override;
  24. virtual void SaveInternal() override;
  25. virtual bool LoadInternal() override;
  26. virtual void LoadUI() override;
  27. QString GenerateState();
  28. public:
  29. YoutubeAuth(const Def &d);
  30. void SetChatId(QString &chat_id);
  31. void ResetChat();
  32. static std::shared_ptr<Auth> Login(QWidget *parent,
  33. const std::string &service);
  34. };