Skip to content

Commit 420e85a

Browse files
committed
feat: runtime api key support
1 parent 568900d commit 420e85a

14 files changed

Lines changed: 315 additions & 115 deletions

QuickDesk/qml/pages/SettingsPage.qml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,75 @@ Item {
339339
}
340340
}
341341

342+
// API Key Section
343+
Column {
344+
width: parent.width
345+
spacing: Theme.spacingSmall
346+
347+
Rectangle { width: parent.width; height: 1; color: Theme.border }
348+
349+
Text {
350+
text: qsTr("API Key")
351+
font.pixelSize: Theme.fontSizeLarge
352+
font.weight: Font.DemiBold
353+
color: Theme.text
354+
}
355+
356+
Text {
357+
text: qsTr("If your signaling server has API Key protection enabled, enter the key here. No recompilation needed.")
358+
font.pixelSize: Theme.fontSizeSmall
359+
color: Theme.textSecondary
360+
wrapMode: Text.WordWrap
361+
width: parent.width
362+
}
363+
364+
Row {
365+
width: parent.width
366+
spacing: Theme.spacingSmall
367+
368+
QDTextField {
369+
id: apiKeyField
370+
width: parent.width - updateApiKeyBtn.width - clearApiKeyBtn.width - parent.spacing * 2
371+
placeholderText: qsTr("Enter API Key")
372+
echoMode: TextInput.Password
373+
text: configViewModel.apiKey
374+
}
375+
376+
QDButton {
377+
id: updateApiKeyBtn
378+
text: qsTr("Update")
379+
iconText: FluentIconGlyph.saveGlyph
380+
buttonType: QDButton.Type.Primary
381+
enabled: apiKeyField.text !== configViewModel.apiKey
382+
383+
onClicked: {
384+
configViewModel.apiKey = apiKeyField.text.trim()
385+
root.showToast(qsTr("API Key updated. Restart to apply changes."), QDToast.Type.Success)
386+
}
387+
}
388+
389+
QDButton {
390+
id: clearApiKeyBtn
391+
text: qsTr("Clear")
392+
iconText: FluentIconGlyph.deleteGlyph
393+
visible: configViewModel.apiKey.length > 0
394+
395+
onClicked: {
396+
apiKeyField.text = ""
397+
configViewModel.apiKey = ""
398+
root.showToast(qsTr("API Key cleared. Restart to apply changes."), QDToast.Type.Success)
399+
}
400+
}
401+
}
402+
403+
Text {
404+
visible: configViewModel.apiKey.length > 0
405+
text: qsTr("API Key is configured (%1 characters)").arg(configViewModel.apiKey.length)
406+
font.pixelSize: Theme.fontSizeSmall
407+
color: Theme.accent
408+
}
409+
}
410+
342411
// TURN/STUN Servers Section (hidden - ICE config is always fetched from signaling server)
343412
Column {
344413
visible: true

0 commit comments

Comments
 (0)