Skip to content

Commit 9c08a66

Browse files
authored
Fix wakatime api url & api key validation (#37)
* Fix wakatime API base URL (#35) * Fix API key validation to allow longer keys
1 parent b44aa50 commit 9c08a66

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

configdialog.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
</rect>
5858
</property>
5959
<property name="maxLength">
60-
<number>36</number>
60+
<number>41</number>
6161
</property>
6262
<property name="showClearButton" stdset="0">
6363
<bool>true</bool>

wakatimeplugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ K_PLUGIN_FACTORY_WITH_JSON(WakaTimePluginFactory,
5757
registerPlugin<WakaTimePlugin>();)
5858

5959
const QString kUrlHeartsBulk =
60-
QStringLiteral("%1/v1/users/current/heartbeats.bulk");
60+
QStringLiteral("%1users/current/heartbeats.bulk");
6161

6262
const QString kSettingsKeyApiKey = QStringLiteral("settings/api_key");
6363
const QString kSettingsKeyApiUrl = QStringLiteral("settings/api_url");
@@ -225,7 +225,7 @@ void WakaTimeView::slotConfigureWakaTime() {
225225
dialog.setWindowTitle(i18n("Configure WakaTime"));
226226
if (dialog.exec() == QDialog::Accepted) {
227227
QString newApiKey = ui.lineEdit_apiKey->text();
228-
if (newApiKey.size() == 36) {
228+
if (newApiKey.size() >= 36 && newApiKey.size() <= 41) {
229229
apiKey = newApiKey;
230230
}
231231
hideFilenames = ui.checkBox_hideFilenames->isChecked();
@@ -534,7 +534,7 @@ void WakaTimeView::readConfig(void) {
534534
return;
535535
}
536536

537-
QString url = QStringLiteral("https://wakatime.com/api");
537+
QString url = QStringLiteral("https://api.wakatime.com/api/v1/");
538538
if (config->contains(kSettingsKeyApiUrl) &&
539539
QString(config->value(kSettingsKeyApiUrl).toString())
540540
.trimmed()

0 commit comments

Comments
 (0)