Skip to content

Commit 7636660

Browse files
committed
fix(air-quality): address code review findings
- Redact AQICN API token from debug logs (security) - Remove orphan i18n key panel.station - Clear stationName on refresh to avoid stale data - Disable AQI scale dropdown when AQICN is selected (US only) - Update stale comment in saveSettings()
1 parent 02346e2 commit 7636660

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

air-quality/Main.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ Item {
274274
}
275275

276276
root.loading = true
277+
root.stationName = ""
277278

278279
if (root.dataSource === "aqicn") {
279280
if (!root.aqicnToken) {
@@ -283,7 +284,7 @@ Item {
283284
return
284285
}
285286
var aqicnUrl = "https://api.waqi.info/feed/geo:" + lat + ";" + lon + "/?token=" + root.aqicnToken
286-
Logger.d("Air Quality", "Fetching AQICN: " + aqicnUrl)
287+
Logger.d("Air Quality", "Fetching AQICN data for geo:" + lat + ";" + lon)
287288
aqicnFetchProcess.command = ["curl", "-s", aqicnUrl]
288289
aqicnFetchProcess.running = true
289290
} else {

air-quality/Settings.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ ColumnLayout {
5454
currentKey: root.editDataSource
5555
onSelected: key => {
5656
root.editDataSource = key
57+
if (key === "aqicn") root.editAqiScale = "us"
5758
}
5859
}
5960
}
@@ -94,6 +95,7 @@ ColumnLayout {
9495
NComboBox {
9596
Layout.preferredWidth: 180 * Style.uiScaleRatio
9697
Layout.preferredHeight: Style.baseWidgetSize
98+
enabled: root.editDataSource !== "aqicn"
9799
model: [
98100
{ key: "us", name: pluginApi?.tr("settings.aqiScaleUs") },
99101
{ key: "eu", name: pluginApi?.tr("settings.aqiScaleEu") }
@@ -197,7 +199,7 @@ ColumnLayout {
197199

198200
pluginApi.saveSettings()
199201

200-
// Only refresh if location or scale changed
202+
// Only refresh if location, scale, or data source changed
201203
if (locationChanged || scaleChanged || dataSourceChanged) {
202204
root.pluginApi.mainInstance?.refresh()
203205
}

air-quality/i18n/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@
5454
"refresh": "Refresh",
5555
"settings": "Settings",
5656
"noData": "No data available",
57-
"loading": "Loading...",
58-
"station": "Station"
57+
"loading": "Loading..."
5958
},
6059
"settings": {
6160
"aqiScale": "AQI Scale",

0 commit comments

Comments
 (0)