Merge pull request #1325 from Scrumplex/validate-meta-url
Validate Meta URL
This commit is contained in:
commit
d1528c1044
@ -687,9 +687,17 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
m_settings->reset("PastebinCustomAPIBase");
|
m_settings->reset("PastebinCustomAPIBase");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// meta URL
|
{
|
||||||
|
// Meta URL
|
||||||
m_settings->registerSetting("MetaURLOverride", "");
|
m_settings->registerSetting("MetaURLOverride", "");
|
||||||
|
|
||||||
|
QUrl metaUrl(m_settings->get("MetaURLOverride").toString());
|
||||||
|
|
||||||
|
// get rid of invalid meta urls
|
||||||
|
if (!metaUrl.isValid() || metaUrl.scheme() != "http" || metaUrl.scheme() != "https")
|
||||||
|
m_settings->reset("MetaURLOverride");
|
||||||
|
}
|
||||||
|
|
||||||
m_settings->registerSetting("CloseAfterLaunch", false);
|
m_settings->registerSetting("CloseAfterLaunch", false);
|
||||||
m_settings->registerSetting("QuitAfterGameStop", false);
|
m_settings->registerSetting("QuitAfterGameStop", false);
|
||||||
|
|
||||||
|
@ -81,6 +81,8 @@ APIPage::APIPage(QWidget *parent) :
|
|||||||
connect(ui->pasteTypeComboBox, currentIndexChangedSignal, this, &APIPage::updateBaseURLPlaceholder);
|
connect(ui->pasteTypeComboBox, currentIndexChangedSignal, this, &APIPage::updateBaseURLPlaceholder);
|
||||||
// This function needs to be called even when the ComboBox's index is still in its default state.
|
// This function needs to be called even when the ComboBox's index is still in its default state.
|
||||||
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
|
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
|
||||||
|
// NOTE: this allows http://, but we replace that with https later anyway
|
||||||
|
ui->metaURL->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->metaURL));
|
||||||
ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry));
|
ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry));
|
||||||
ui->msaClientID->setValidator(new QRegularExpressionValidator(validMSAClientID, ui->msaClientID));
|
ui->msaClientID->setValidator(new QRegularExpressionValidator(validMSAClientID, ui->msaClientID));
|
||||||
ui->flameKey->setValidator(new QRegularExpressionValidator(validFlameKey, ui->flameKey));
|
ui->flameKey->setValidator(new QRegularExpressionValidator(validFlameKey, ui->flameKey));
|
||||||
@ -163,7 +165,7 @@ void APIPage::applySettings()
|
|||||||
|
|
||||||
QString msaClientID = ui->msaClientID->text();
|
QString msaClientID = ui->msaClientID->text();
|
||||||
s->set("MSAClientIDOverride", msaClientID);
|
s->set("MSAClientIDOverride", msaClientID);
|
||||||
QUrl metaURL = ui->metaURL->text();
|
QUrl metaURL(ui->metaURL->text());
|
||||||
// Add required trailing slash
|
// Add required trailing slash
|
||||||
if (!metaURL.isEmpty() && !metaURL.path().endsWith('/'))
|
if (!metaURL.isEmpty() && !metaURL.path().endsWith('/'))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user