1
0
Fork 0
mirror of https://github.com/HenkKalkwater/harbour-sailfin.git synced 2025-09-01 08:52:45 +00:00

QuickConnect: init

This adds a page in the settings page that allows the user to enter a
quick connect code to allow another device to log in.
This commit is contained in:
Chris Josten 2024-01-02 19:51:27 +01:00
parent 13786f01c9
commit a66434afa8
10 changed files with 242 additions and 3 deletions

View file

@ -256,6 +256,27 @@ public:
}
};
// Specialisation for endpoints that return "true" or "false" as response.
template<typename P>
class HttpLoaderBase<bool, P> : public Loader<bool, P> {
public:
explicit HttpLoaderBase(Jellyfin::ApiClient *apiClient)
: Loader<bool, P> (apiClient) {}
typename Loader<bool, P>::ResultType parseResponse(int statusCode, QByteArray response) {
QString text = QString::fromUtf8(response);
if (text == QStringLiteral("true")) {
return true;
} else if (text == QStringLiteral("false")) {
return false;
} else {
this->stopWithError(QStringLiteral("Could not parse boolean response: %1").arg(text));
return std::nullopt;
}
}
};
/**
* Implementation of Loader that loads Items over HTTP