Re-enable tidal oauth settings

This commit is contained in:
Jonas Kvinge 2019-07-06 00:02:25 +02:00
parent aec9df1882
commit 044f347729
3 changed files with 6 additions and 11 deletions

View File

@ -70,10 +70,6 @@ TidalSettingsPage::TidalSettingsPage(SettingsDialog *parent)
ui_->streamurl->addItem("urlpostpaywall", StreamUrlMethod_UrlPostPaywall);
ui_->streamurl->addItem("playbackinfopostpaywall", StreamUrlMethod_PlaybackInfoPostPaywall);
ui_->oauth->hide();
ui_->label_client_id->hide();
ui_->client_id->hide();
}
TidalSettingsPage::~TidalSettingsPage() { delete ui_; }
@ -84,8 +80,7 @@ void TidalSettingsPage::Load() {
s.beginGroup(kSettingsGroup);
ui_->enable->setChecked(s.value("enabled", false).toBool());
//ui_->oauth->setChecked(s.value("oauth", false).toBool());
ui_->oauth->setChecked(false);
ui_->oauth->setChecked(s.value("oauth", false).toBool());
ui_->client_id->setText(s.value("client_id").toString());
ui_->api_token->setText(s.value("api_token").toString());
@ -145,6 +140,10 @@ void TidalSettingsPage::Save() {
void TidalSettingsPage::LoginClicked() {
if (ui_->oauth->isChecked()) {
if (ui_->client_id->text().isEmpty()) {
QMessageBox::critical(this, tr("Configuration incomplete"), tr("Missing Tidal client ID."));
return;
}
emit Login();
}
else {

View File

@ -62,7 +62,6 @@
using std::shared_ptr;
const Song::Source TidalService::kSource = Song::Source_Tidal;
const char *TidalService::kClientIdB64 = "dTVxUE5OWUliRDBTMG8zNk1yQWlGWjU2SzZxTUNyQ21ZUHpadVRuVg==";
const char *TidalService::kApiTokenB64 = "UDVYYmVvNUxGdkVTZUR5Ng==";
const char *TidalService::kOAuthUrl = "https://login.tidal.com/authorize";
const char *TidalService::kOAuthAccessTokenUrl = "https://login.tidal.com/oauth2/token";
@ -198,10 +197,8 @@ void TidalService::ReloadSettings() {
QSettings s;
s.beginGroup(TidalSettingsPage::kSettingsGroup);
//oauth_ = s.value("oauth", false).toBool();
oauth_ = false;
oauth_ = s.value("oauth", false).toBool();
client_id_ = s.value("client_id").toString();
if (client_id_.isEmpty()) client_id_ = QString::fromUtf8(QByteArray::fromBase64(kClientIdB64));
api_token_ = s.value("api_token").toString();
if (api_token_.isEmpty()) api_token_ = QString::fromUtf8(QByteArray::fromBase64(kApiTokenB64));

View File

@ -162,7 +162,6 @@ class TidalService : public InternetService {
void SendSearch();
QString LoginError(QString error, QVariant debug = QVariant());
static const char *kClientIdB64;
static const char *kApiTokenB64;
static const char *kOAuthUrl;
static const char *kOAuthAccessTokenUrl;