feat: show whitelistable sites in the settings and set in qt settings
This commit is contained in:
parent
4f81032f5e
commit
a679758230
|
@ -1,4 +1,4 @@
|
|||
import NimQml, sequtils, strutils, sugar, os
|
||||
import NimQml, sequtils, strutils, sugar, os, json
|
||||
import views/[mailservers_list, ens_manager, contact_list, profile_info, device_list, dapp_list]
|
||||
import ../../status/profile/[mailserver, profile, devices]
|
||||
import ../../status/profile as status_profile
|
||||
|
@ -327,3 +327,6 @@ QtObject:
|
|||
self.status.contacts.removeContact(publicKey)
|
||||
self.contactChanged(publicKey, false)
|
||||
|
||||
proc getLinkPreviewWhitelist*(self: ProfileView): string {.slot.} =
|
||||
result = $(self.status.profile.getLinkPreviewWhitelist())
|
||||
|
||||
|
|
|
@ -65,4 +65,7 @@ proc getCurrentNetwork*(): Network =
|
|||
proc getCurrentNetworkDetails*(): NetworkDetails =
|
||||
let currNetwork = getSetting[string](Setting.Networks_CurrentNetwork, constants.DEFAULT_NETWORK_NAME)
|
||||
let networks = getSetting[seq[NetworkDetails]](Setting.Networks_Networks)
|
||||
networks.find((network: NetworkDetails) => network.id == currNetwork)
|
||||
networks.find((network: NetworkDetails) => network.id == currNetwork)
|
||||
|
||||
proc getLinkPreviewWhitelist*(): JsonNode =
|
||||
result = callPrivateRPC("getLinkPreviewWhitelist".prefix, %* []).parseJSON()["result"]
|
|
@ -3,6 +3,7 @@ import libstatus/types
|
|||
import profile/profile
|
||||
import libstatus/core as libstatus_core
|
||||
import libstatus/accounts as status_accounts
|
||||
import libstatus/settings as status_settings
|
||||
import ../eventemitter
|
||||
|
||||
type
|
||||
|
@ -13,3 +14,6 @@ proc newProfileModel*(): ProfileModel =
|
|||
|
||||
proc logout*(self: ProfileModel) =
|
||||
discard status_accounts.logout()
|
||||
|
||||
proc getLinkPreviewWhitelist*(self: ProfileModel): JsonNode =
|
||||
result = status_settings.getLinkPreviewWhitelist()
|
||||
|
|
|
@ -12,13 +12,32 @@ Item {
|
|||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
ListModel {
|
||||
id: previewableSites
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
const sites = profileModel.getLinkPreviewWhitelist()
|
||||
try {
|
||||
const sitesJSON = JSON.parse(sites)
|
||||
sitesJSON.forEach(function (site) {
|
||||
previewableSites.append(site)
|
||||
})
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
property Component dappListPopup: DappList {
|
||||
onClosed: destroy()
|
||||
}
|
||||
|
||||
Item {
|
||||
id: profileImgNameContainer
|
||||
|
||||
Column {
|
||||
id: containerColumn
|
||||
spacing: Style.current.padding
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: contentMargin
|
||||
anchors.left: parent.left
|
||||
|
@ -29,13 +48,10 @@ Item {
|
|||
id: labelSecurity
|
||||
//% "Security"
|
||||
text: qsTrId("security")
|
||||
anchors.top: parent.top
|
||||
}
|
||||
|
||||
Item {
|
||||
id: backupSeedPhrase
|
||||
anchors.top: labelSecurity.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
height: backupText.height
|
||||
width: parent.width
|
||||
|
||||
|
@ -77,11 +93,13 @@ Item {
|
|||
id: backupSeedModal
|
||||
}
|
||||
|
||||
Separator {
|
||||
id: separator
|
||||
Layout.topMargin: Style.current.bigPadding - containerColumn.spacing
|
||||
}
|
||||
|
||||
Item {
|
||||
id: dappPermissions
|
||||
anchors.top: backupSeedPhrase.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
height: dappPermissionsText.height
|
||||
width: parent.width
|
||||
|
||||
|
@ -117,22 +135,18 @@ Item {
|
|||
}
|
||||
|
||||
Separator {
|
||||
id: separator
|
||||
anchors.top: dappPermissions.bottom
|
||||
anchors.topMargin: Style.current.bigPadding
|
||||
id: separator2
|
||||
Layout.topMargin: Style.current.bigPadding - containerColumn.spacing
|
||||
}
|
||||
|
||||
StatusSectionHeadline {
|
||||
id: labelPrivacy
|
||||
//% "Privacy"
|
||||
text: qsTrId("privacy")
|
||||
anchors.top: separator.bottom
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: displayImageSettings
|
||||
anchors.top: labelPrivacy.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
StyledText {
|
||||
//% "Display images in chat automatically"
|
||||
text: qsTrId("display-images-in-chat-automatically")
|
||||
|
@ -148,6 +162,38 @@ Item {
|
|||
text: qsTrId("under-development")
|
||||
}
|
||||
}
|
||||
|
||||
StatusSectionHeadline {
|
||||
id: labelURLUnfurling
|
||||
text: qsTr("URL Previews")
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: sitesListView
|
||||
width: parent.width
|
||||
model: previewableSites
|
||||
interactive: false
|
||||
height: childrenRect.height
|
||||
|
||||
delegate: Component {
|
||||
RowLayout {
|
||||
id: displayYoutubeSettings
|
||||
StyledText {
|
||||
text: qsTr("Display %1 previews").arg(title)
|
||||
}
|
||||
StatusSwitch {
|
||||
checked: !!appSettings.whitelistedUnfurlingSites[address]
|
||||
onCheckedChanged: function () {
|
||||
appSettings.whitelistedUnfurlingSites[address] = this.checked
|
||||
}
|
||||
}
|
||||
StyledText {
|
||||
//% "under development"
|
||||
text: qsTrId("under-development")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ ApplicationWindow {
|
|||
property real volume: 0.2
|
||||
property int notificationSetting: 0
|
||||
property bool notificationSoundsEnabled: true
|
||||
property var whitelistedUnfurlingSites: ({})
|
||||
|
||||
// Browser settings
|
||||
property bool autoLoadImages: true
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit efbf093bc494e9c3ea00a6a3e8f286826294dff7
|
||||
Subproject commit d04e54e54e8ea85c9bd35aff5482e064f5ee76b0
|
Loading…
Reference in New Issue