mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-25 12:55:05 +00:00
* Dehardcode account providers * Fix crash on creation * Add dynamic 'add account dialog' provider selector * Fix typo and add newlines * Rename loginType to provider * Rename MojangAccount to Account and MojangAccountList to AccountList * Fix json save error
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include "QObjectPtr.h"
|
|
#include <QDateTime>
|
|
#include <QSet>
|
|
#include <QProcess>
|
|
#include <QUrl>
|
|
|
|
|
|
#include "multimc_logic_export.h"
|
|
#include "minecraft/auth/AccountProfile.h"
|
|
|
|
class BaseAuthProvider;
|
|
typedef std::shared_ptr<BaseAuthProvider> AuthProviderPtr;
|
|
|
|
/*!
|
|
* \brief Base class for auth provider.
|
|
* This class implements many functions that are common between providers and
|
|
* provides a standard interface for all providers.
|
|
*
|
|
* To create a new provider, create a new class inheriting from this class,
|
|
* implement the pure virtual functions, and
|
|
*/
|
|
class MULTIMC_LOGIC_EXPORT BaseAuthProvider : public QObject //, public std::enable_shared_from_this<BaseAuthProvider>
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
virtual ~BaseAuthProvider(){};
|
|
|
|
// Unique id for provider
|
|
virtual QString id() { return "base"; };
|
|
|
|
// Name of provider that displayed in account selector and list
|
|
virtual QString displayName() { return "Base"; };
|
|
|
|
// Use dummy auth on login instead of calling endpoint
|
|
virtual bool dummyAuth() { return false; };
|
|
|
|
// Endpoint for authlib injector (use empty if authlib injector isn't required)
|
|
virtual QString injectorEndpoint() { return ""; };
|
|
|
|
// Endpoint for authentication
|
|
virtual QString authEndpoint() { return ""; };
|
|
|
|
// Function to get url of skin to display in launcher
|
|
virtual QUrl resolveSkinUrl(AccountProfile profile) { return QUrl(((QString) "https://crafatar.com/skins/%1.png").arg(profile.id)); };
|
|
|
|
// Can change skin (currently only mojang support)
|
|
virtual bool canChangeSkin() { return false; }
|
|
};
|