Repository: redis/RedisDesktopManager
Branch: 2022
Commit: 15f6d85528cd
Files: 337
Total size: 1.6 MB
Directory structure:
gitextract_g8d5gff1/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ └── workflows/
│ ├── run_tests.yml
│ └── sonar.yml
├── .gitignore
├── .gitmodules
├── .readthedocs.yaml
├── 3rdparty/
│ ├── 3rdparty.pri
│ └── pyotherside.pri
├── BACKERS.md
├── CONTRIBUTING.md
├── COPYRIGHT
├── LICENSE
├── README.md
├── build/
│ └── windows/
│ └── installer/
│ ├── include/
│ │ ├── install_vcredist_x64.nsh
│ │ ├── nsProcess.nsh
│ │ └── x64.nsh
│ ├── installer.nsi
│ └── resources/
│ └── qt.conf
├── docs/
│ ├── app-store.md
│ ├── bulk-operations.md
│ ├── css/
│ │ └── extra.css
│ ├── development.md
│ ├── extension-server.md
│ ├── faq.md
│ ├── index.md
│ ├── install.md
│ ├── known-issues.md
│ ├── lg-keyspaces.md
│ ├── native-formatters.md
│ ├── quick-start.md
│ ├── requirements.txt
│ └── server_spec.yaml
├── mkdocs.yml
├── sonar-project.properties
├── src/
│ ├── app/
│ │ ├── app.cpp
│ │ ├── app.h
│ │ ├── apputils.h
│ │ ├── darkmode.h
│ │ ├── events.cpp
│ │ ├── events.h
│ │ ├── jsonutils.cpp
│ │ ├── jsonutils.h
│ │ ├── models/
│ │ │ ├── configmanager.cpp
│ │ │ ├── configmanager.h
│ │ │ ├── connectionconf.cpp
│ │ │ ├── connectionconf.h
│ │ │ ├── connectiongroup.cpp
│ │ │ ├── connectiongroup.h
│ │ │ ├── connectionsmanager.cpp
│ │ │ ├── connectionsmanager.h
│ │ │ ├── key-models/
│ │ │ │ ├── abstractkey.h
│ │ │ │ ├── bfkey.cpp
│ │ │ │ ├── bfkey.h
│ │ │ │ ├── hashkey.cpp
│ │ │ │ ├── hashkey.h
│ │ │ │ ├── keyfactory.cpp
│ │ │ │ ├── keyfactory.h
│ │ │ │ ├── listkey.cpp
│ │ │ │ ├── listkey.h
│ │ │ │ ├── listlikekey.cpp
│ │ │ │ ├── listlikekey.h
│ │ │ │ ├── newkeyrequest.cpp
│ │ │ │ ├── newkeyrequest.h
│ │ │ │ ├── rejsonkey.cpp
│ │ │ │ ├── rejsonkey.h
│ │ │ │ ├── rowcache.h
│ │ │ │ ├── setkey.cpp
│ │ │ │ ├── setkey.h
│ │ │ │ ├── sortedsetkey.cpp
│ │ │ │ ├── sortedsetkey.h
│ │ │ │ ├── stream.cpp
│ │ │ │ ├── stream.h
│ │ │ │ ├── stringkey.cpp
│ │ │ │ ├── stringkey.h
│ │ │ │ ├── unknownkey.cpp
│ │ │ │ └── unknownkey.h
│ │ │ ├── treeoperations.cpp
│ │ │ └── treeoperations.h
│ │ ├── qcompress.cpp
│ │ ├── qcompress.h
│ │ ├── qmlutils.cpp
│ │ └── qmlutils.h
│ ├── main.cpp
│ ├── modules/
│ │ ├── bulk-operations/
│ │ │ ├── bulkoperationsmanager.cpp
│ │ │ ├── bulkoperationsmanager.h
│ │ │ ├── connections.h
│ │ │ └── operations/
│ │ │ ├── abstractoperation.cpp
│ │ │ ├── abstractoperation.h
│ │ │ ├── copyoperation.cpp
│ │ │ ├── copyoperation.h
│ │ │ ├── deleteoperation.cpp
│ │ │ ├── deleteoperation.h
│ │ │ ├── rdbimport.cpp
│ │ │ ├── rdbimport.h
│ │ │ ├── ttloperation.cpp
│ │ │ └── ttloperation.h
│ │ ├── common/
│ │ │ ├── baselistmodel.cpp
│ │ │ ├── baselistmodel.h
│ │ │ ├── callbackwithowner.h
│ │ │ ├── sortfilterproxymodel.cpp
│ │ │ ├── sortfilterproxymodel.h
│ │ │ ├── tabmodel.cpp
│ │ │ ├── tabmodel.h
│ │ │ ├── tabviewmodel.cpp
│ │ │ └── tabviewmodel.h
│ │ ├── connections-tree/
│ │ │ ├── items/
│ │ │ │ ├── abstractnamespaceitem.cpp
│ │ │ │ ├── abstractnamespaceitem.h
│ │ │ │ ├── databaseitem.cpp
│ │ │ │ ├── databaseitem.h
│ │ │ │ ├── keyitem.cpp
│ │ │ │ ├── keyitem.h
│ │ │ │ ├── loadmoreitem.cpp
│ │ │ │ ├── loadmoreitem.h
│ │ │ │ ├── memoryusage.h
│ │ │ │ ├── namespaceitem.cpp
│ │ │ │ ├── namespaceitem.h
│ │ │ │ ├── servergroup.cpp
│ │ │ │ ├── servergroup.h
│ │ │ │ ├── serveritem.cpp
│ │ │ │ ├── serveritem.h
│ │ │ │ ├── sortabletreeitem.h
│ │ │ │ ├── treeitem.cpp
│ │ │ │ └── treeitem.h
│ │ │ ├── keysrendering.cpp
│ │ │ ├── keysrendering.h
│ │ │ ├── model.cpp
│ │ │ ├── model.h
│ │ │ ├── operations.h
│ │ │ ├── utils.cpp
│ │ │ └── utils.h
│ │ ├── console/
│ │ │ ├── autocompletemodel.cpp
│ │ │ ├── autocompletemodel.h
│ │ │ ├── consolemodel.cpp
│ │ │ └── consolemodel.h
│ │ ├── exception.h
│ │ ├── extension-server/
│ │ │ ├── client/
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── OAIDataFormatter.cpp
│ │ │ │ ├── OAIDataFormatter.h
│ │ │ │ ├── OAIDecodePayload.cpp
│ │ │ │ ├── OAIDecodePayload.h
│ │ │ │ ├── OAIDefaultApi.cpp
│ │ │ │ ├── OAIDefaultApi.h
│ │ │ │ ├── OAIEncodePayload.cpp
│ │ │ │ ├── OAIEncodePayload.h
│ │ │ │ ├── OAIEnum.h
│ │ │ │ ├── OAIHelpers.cpp
│ │ │ │ ├── OAIHelpers.h
│ │ │ │ ├── OAIHttpFileElement.cpp
│ │ │ │ ├── OAIHttpFileElement.h
│ │ │ │ ├── OAIHttpRequest.cpp
│ │ │ │ ├── OAIHttpRequest.h
│ │ │ │ ├── OAIInline_response_400.cpp
│ │ │ │ ├── OAIInline_response_400.h
│ │ │ │ ├── OAIOauth.cpp
│ │ │ │ ├── OAIOauth.h
│ │ │ │ ├── OAIObject.h
│ │ │ │ ├── OAIServerConfiguration.h
│ │ │ │ ├── OAIServerVariable.h
│ │ │ │ └── client.pri
│ │ │ ├── dataformattermanager.cpp
│ │ │ ├── dataformattermanager.h
│ │ │ └── generate_client.sh
│ │ ├── server-actions/
│ │ │ ├── serverstatsmodel.cpp
│ │ │ └── serverstatsmodel.h
│ │ └── value-editor/
│ │ ├── abstractkeyfactory.h
│ │ ├── embeddedformattersmanager.cpp
│ │ ├── embeddedformattersmanager.h
│ │ ├── keymodel.h
│ │ ├── largetextmodel.cpp
│ │ ├── largetextmodel.h
│ │ ├── syntaxhighlighter.cpp
│ │ ├── syntaxhighlighter.h
│ │ ├── tabsmodel.cpp
│ │ ├── tabsmodel.h
│ │ ├── textcharformat.cpp
│ │ ├── textcharformat.h
│ │ ├── valueviewmodel.cpp
│ │ └── valueviewmodel.h
│ ├── py/
│ │ ├── formatters/
│ │ │ ├── __init__.py
│ │ │ ├── base.py
│ │ │ ├── binary.py
│ │ │ ├── cbor.py
│ │ │ ├── msgpack.py
│ │ │ ├── phpserialize.py
│ │ │ └── pickle.py
│ │ ├── py.qrc
│ │ ├── rdb/
│ │ │ └── __init__.py
│ │ └── requirements.txt
│ ├── qml/
│ │ ├── AppToolBar.qml
│ │ ├── LogView.qml
│ │ ├── QuickStartDialog.qml
│ │ ├── WelcomeTab.qml
│ │ ├── app.qml
│ │ ├── bulk-operations/
│ │ │ └── BulkOperationsDialog.qml
│ │ ├── common/
│ │ │ ├── AddressInput.qml
│ │ │ ├── BetterButton.qml
│ │ │ ├── BetterCheckbox.qml
│ │ │ ├── BetterComboBox.qml
│ │ │ ├── BetterDialog.qml
│ │ │ ├── BetterDialogButtonBox.qml
│ │ │ ├── BetterGroupbox.qml
│ │ │ ├── BetterLabel.qml
│ │ │ ├── BetterMenu.qml
│ │ │ ├── BetterMenuItem.qml
│ │ │ ├── BetterMessageDialog.qml
│ │ │ ├── BetterRadioButton.qml
│ │ │ ├── BetterSpinBox.qml
│ │ │ ├── BetterSplitView.qml
│ │ │ ├── BetterTab.qml
│ │ │ ├── BetterTabButton.qml
│ │ │ ├── BetterTabView.qml
│ │ │ ├── BetterTextField.qml
│ │ │ ├── BetterToolTip.qml
│ │ │ ├── ColorInput.qml
│ │ │ ├── FastTextView.qml
│ │ │ ├── FilePathInput.qml
│ │ │ ├── ImageButton.qml
│ │ │ ├── JsonHighlighter.qml
│ │ │ ├── LegacyTableView.qml
│ │ │ ├── NewTextArea.qml
│ │ │ ├── OkDialog.qml
│ │ │ ├── OkDialogOverlay.qml
│ │ │ ├── PasswordInput.qml
│ │ │ ├── RichTextWithLinks.qml
│ │ │ ├── SaveToFileButton.qml
│ │ │ ├── SettingsGroupTitle.qml
│ │ │ └── platformutils.js
│ │ ├── connections/
│ │ │ ├── AskSecretDialog.qml
│ │ │ └── ConnectionSettignsDialog.qml
│ │ ├── connections-tree/
│ │ │ ├── BetterTreeView.qml
│ │ │ ├── ConnectionGroupDialog.qml
│ │ │ ├── TreeItemDelegate.qml
│ │ │ └── menu/
│ │ │ ├── InlineMenu.qml
│ │ │ ├── database.qml
│ │ │ ├── key.qml
│ │ │ ├── namespace.qml
│ │ │ ├── server.qml
│ │ │ └── server_group.qml
│ │ ├── console/
│ │ │ ├── BaseConsole.qml
│ │ │ ├── Consoles.qml
│ │ │ └── RedisConsole.qml
│ │ ├── dummy.qml
│ │ ├── extension-server/
│ │ │ └── ExtensionServerSettings.qml
│ │ ├── qml.qrc
│ │ ├── server-actions/
│ │ │ ├── ServerAction.qml
│ │ │ ├── ServerActionTabs.qml
│ │ │ ├── ServerCharts.qml
│ │ │ ├── ServerClients.qml
│ │ │ ├── ServerConfig.qml
│ │ │ ├── ServerPubSub.qml
│ │ │ └── ServerSlowlog.qml
│ │ ├── settings/
│ │ │ ├── BoolOption.qml
│ │ │ ├── ComboboxOption.qml
│ │ │ ├── FontSizeOption.qml
│ │ │ ├── GlobalSettings.qml
│ │ │ └── IntOption.qml
│ │ └── value-editor/
│ │ ├── AddKeyDialog.qml
│ │ ├── Pagination.qml
│ │ ├── ValueTable.qml
│ │ ├── ValueTableActions.qml
│ │ ├── ValueTableCell.qml
│ │ ├── ValueTabs.qml
│ │ ├── editors/
│ │ │ ├── AbstractEditor.qml
│ │ │ ├── HashItemEditor.qml
│ │ │ ├── MultilineEditor.qml
│ │ │ ├── ReadOnlySingleItemEditor.qml
│ │ │ ├── SingleItemEditor.qml
│ │ │ ├── SortedSetItemEditor.qml
│ │ │ ├── StreamItemEditor.qml
│ │ │ ├── UnsupportedDataType.qml
│ │ │ ├── editor.js
│ │ │ └── formatters/
│ │ │ ├── ValueFormatters.qml
│ │ │ └── hexy.js
│ │ └── filters/
│ │ ├── ListFilters.qml
│ │ └── StreamFilters.qml
│ ├── resources/
│ │ ├── Info.plist.sample
│ │ ├── commands.json
│ │ ├── commands.qrc
│ │ ├── convert_commands.py
│ │ ├── flatpak/
│ │ │ ├── app.resp.RESP.desktop
│ │ │ └── app.resp.RESP.metainfo.xml
│ │ ├── fonts/
│ │ │ └── OpenSans.ttc
│ │ ├── fonts.qrc
│ │ ├── icons.qrc
│ │ ├── icons_qrc_generator.py
│ │ ├── images.qrc
│ │ ├── logo.icns
│ │ ├── resp.desktop
│ │ ├── tr.qrc
│ │ └── translations/
│ │ ├── rdm.ts
│ │ ├── rdm_es_ES.ts
│ │ ├── rdm_ja_JP.ts
│ │ ├── rdm_uk_UA.ts
│ │ ├── rdm_zh_CN.ts
│ │ └── rdm_zh_TW.ts
│ └── resp.pro
└── tests/
├── py_tests/
│ ├── requirements.txt
│ └── test_formatters/
│ ├── test_msgpack_formatter.py
│ ├── test_php_formatter.py
│ └── test_pickle_formatter.py
├── qml_tests/
│ ├── qml_tests.pro
│ ├── setup.cpp
│ ├── setup.h
│ ├── tst_MultilineEditor.qml
│ └── tst_formatters.qml
├── smoke_test.bat
├── tests.pro
└── unit_tests/
├── generate_coverage_report
├── main.cpp
├── respbasetestcase.h
├── testcases/
│ ├── app/
│ │ ├── app-tests.pri
│ │ ├── connections.json
│ │ ├── test_apputils.cpp
│ │ ├── test_apputils.h
│ │ ├── test_configmanager.cpp
│ │ ├── test_configmanager.h
│ │ ├── test_connectionsmanager.cpp
│ │ ├── test_connectionsmanager.h
│ │ ├── test_keymodels.cpp
│ │ ├── test_keymodels.h
│ │ ├── test_treeoperations.cpp
│ │ └── test_treeoperations.h
│ ├── connections-tree/
│ │ ├── connections-tree-tests.pri
│ │ ├── mocks.cpp
│ │ ├── mocks.h
│ │ ├── test_databaseitem.cpp
│ │ ├── test_databaseitem.h
│ │ ├── test_model.cpp
│ │ ├── test_model.h
│ │ ├── test_serveritem.cpp
│ │ └── test_serveritem.h
│ ├── console/
│ │ ├── console-tests.pri
│ │ ├── test_consolemodel.cpp
│ │ └── test_consolemodel.h
│ └── value-editor/
│ └── value-editor-tests.pri
└── unit_tests.pro
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Environment (please complete the following information):**
- OS & version: [e.g. Windows 10 1806]
- Redis-Server version [e.g. 5.0.1]
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
================================================
FILE: .github/workflows/run_tests.yml
================================================
name: Run Tests
on:
push:
branches:
- 2022
pull_request:
branches: [ 2022 ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2.3.4
with:
submodules: 'recursive'
- name: Install Qt
uses: jurplel/install-qt-action@v2.13.2
with:
version: 5.15.2
modules: qtcharts
- name: Install Build deps
run: |
sudo apt-get update -y
sudo apt-get install cmake liblz4-dev libzstd-dev libbrotli-dev libsnappy-dev lcov -y
cmake --version
gcc --version
- name: Setup Redis
uses: zhulik/redis-action@1.1.0
- name: Build Tests
run: qmake "SYSTEM_LZ4=1" "SYSTEM_ZSTD=1" "SYSTEM_SNAPPY=1" "SYSTEM_BROTLI=1" DEFINES+=INTEGRATION_TESTS && make -j 2
working-directory: ./tests
- name: Run Cpp Tests
run: ./../bin/tests/tests -platform minimal -txt
working-directory: ./tests
- name: Run QML Tests
run: ./../bin/tests/qml_tests -platform minimal -txt
working-directory: ./tests
================================================
FILE: .github/workflows/sonar.yml
================================================
name: Sonar Scan
on:
push:
branches:
- 2022
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
SONAR_SCANNER_VERSION: 4.6.1.2450 # Find the latest version in the "Linux" link on this page:
# https://sonarcloud.io/documentation/analysis/scan/sonarscanner/
SONAR_SERVER_URL: "https://sonarcloud.io"
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: Install Qt
uses: jurplel/install-qt-action@v2.13.2
with:
version: 5.15.2
modules: qtcharts
- name: Install system deps
run: |
sudo apt-get update -y
sudo apt-get install cmake liblz4-dev libzstd-dev libbrotli-dev libsnappy-dev -y
cmake --version
gcc --version
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
env:
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Run build-wrapper
working-directory: ./src
run: |
qmake "SYSTEM_LZ4=1" "SYSTEM_ZSTD=1" "SYSTEM_SNAPPY=1" "SYSTEM_BROTLI=1"
build-wrapper-linux-x86-64 --out-dir ../${{ env.BUILD_WRAPPER_OUT_DIR }} make -j2
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
================================================
FILE: .gitignore
================================================
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug*/
*.sbr
obj/
[Rr]elease*/
_ReSharper*/
*.sdf
*.opensdf
*/GeneratedFiles/*
build-redis*
.vagrant/*
redis-desktop-manager/Makefile*
build/redis*
build/gbreakpad*
redis-desktop-manager/connections.xml
*.deb
deps/libssh/example/.deps/*
deps/libssh/example/.*
deps/libssh/example/*
deps/libssh/config.status
deps/libssh/docs/Makefile
deps/libssh/libssh2.pc
deps/libssh/libtool
deps/libssh/Makefile
deps/libssh/src/.*
deps/libssh/*.lo
deps/libssh/src/**.o
deps/libssh/*.lo
deps/libssh/*/*.*o
deps/libssh/*/*.la
deps/libssh/tests/*
deps/libssh/src/libssh2_config.h
deps/libssh/src/Makefile
deps/libssh/src/stamp-h1
build-tests-*/*
tests/Makefile
tests/qml_tests/target_wrapper.sh
deps/jsoncpp/buildscons/*
deps/jsoncpp/dist/*
deps/jsoncpp/libs/*
redis-desktop-manager*.gz
build/cpp-coveralls/*
build/requests/*
.svn/
deps/gyp*
*.vsp
*.psess
build/windows/installer/redis-desktop-manager*.exe
vagrant-provision/automake*
RDM.sln.metaproj*
crashreports/*
redis-desktop-manager/ui_*.h
src/ui_*.h
src/Makefile*
build-rdm-*
src/rdm.pro.*
tests/tests.pro.*
.idea*
*~
*Makefile
*.DS_Store
tests/unit_tests/coverage*
*.qmlc
*.jsc
.qmake.stash
parts
prime
stage
3rdparty/python*
__pycache__/
qml_*.cpp
src/modules/extension-server/server*
.openapi-generator*
build-*
*.xcodeproj
.xcode
*qmlcache*
================================================
FILE: .gitmodules
================================================
[submodule "3rdparty/qredisclient"]
path = 3rdparty/qredisclient
url = https://github.com/uglide/qredisclient.git
[submodule "3rdparty/pyotherside"]
path = 3rdparty/pyotherside
url = https://github.com/uglide/pyotherside.git
[submodule "3rdparty/lz4"]
path = 3rdparty/lz4
url = https://github.com/lz4/lz4.git
[submodule "3rdparty/simdjson"]
path = 3rdparty/simdjson
url = https://github.com/simdjson/simdjson.git
[submodule "3rdparty/zstd"]
path = 3rdparty/zstd
url = https://github.com/facebook/zstd.git
[submodule "3rdparty/snappy"]
path = 3rdparty/snappy
url = https://github.com/google/snappy.git
[submodule "3rdparty/brotli"]
path = 3rdparty/brotli
url = https://github.com/google/brotli.git
[submodule "3rdparty/fakeit"]
path = 3rdparty/fakeit
url = https://github.com/eranpeer/FakeIt.git
================================================
FILE: .readthedocs.yaml
================================================
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.9"
mkdocs:
configuration: mkdocs.yml
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: docs/requirements.txt
================================================
FILE: 3rdparty/3rdparty.pri
================================================
#-------------------------------------------------
#
# Redis Desktop Manager Dependencies
#
#-------------------------------------------------
exists( $$_PRO_FILE_PWD_/modules/extension-server/client/client.pri) {
message("RESP.app Extension server integration was enabled")
DEFINES += ENABLE_EXTERNAL_FORMATTERS
HEADERS += $$_PRO_FILE_PWD_/modules/extension-server/dataformattermanager.h
SOURCES += $$_PRO_FILE_PWD_/modules/extension-server/dataformattermanager.cpp
include($$_PRO_FILE_PWD_/modules/extension-server/client/client.pri)
}
# qredisclient
if(win32*):exists( $$PWD/qredisclient/qredisclient.lib ) {
message("Using prebuilt qredisclient")
INCLUDEPATH += $$PWD/qredisclient/src/
OPENSSL_LIB_PATH = C:\OpenSSL-Win64\lib\VC
LIBS += -L$$OPENSSL_LIB_PATH -llibeay32MD -L$$PWD/qredisclient/ -lqredisclient -lbotan -llibssh2 -lgdi32 -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32
include($$PWD/qredisclient/3rdparty/asyncfuture/asyncfuture.pri)
} else:unix*:exists( $$PWD/qredisclient/libqredisclient.a ) {
message("Using prebuilt qredisclient")
INCLUDEPATH += $$PWD/qredisclient/src/
LIBS += -L$$PWD/qredisclient/ -lqredisclient -lbotan-2 -lssh2 -lz -lssl -lcrypto
include($$PWD/qredisclient/3rdparty/asyncfuture/asyncfuture.pri)
} else {
message("Using qredisclient source code")
include($$PWD/qredisclient/qredisclient.pri)
}
#PyOtherSide
include($$PWD/pyotherside.pri)
#LZ4
LZ4DIR = $$PWD/lz4/
INCLUDEPATH += $$LZ4DIR/lib
#ZSTD
ZSTDDIR = $$PWD/zstd/
INCLUDEPATH += $$ZSTDDIR/lib
#Snappy
SNAPPYDIR = $$PWD/snappy
INCLUDEPATH += $$SNAPPYDIR
#Brotli
BROTLIDIR = $$PWD/brotli
INCLUDEPATH += $$BROTLIDIR/c/include
#SIMDJSON
SIMDJSONDIR = $$PWD/simdjson/singleheader
INCLUDEPATH += $$SIMDJSONDIR/
HEADERS += $$SIMDJSONDIR/simdjson.h
SOURCES += $$SIMDJSONDIR/simdjson.cpp
win32* {
ZLIBDIR = $$PWD/zlib-msvc14-x64.1.2.11.7795/build/native
INCLUDEPATH += $$ZLIBDIR/include
LIBS += $$ZLIBDIR/lib_release/zlibstatic.lib $$LZ4DIR/build/cmake/Release/lz4.lib
LIBS += $$ZSTDDIR/build/cmake/lib/Release/zstd_static.lib
LIBS += $$SNAPPYDIR/Release/snappy.lib
LIBS += -L$$BROTLIDIR/Release/ -lbrotlicommon-static -lbrotlidec-static -lbrotlienc-static
}
unix:macx { # OSX
LIBS += -lz $$LZ4DIR/build/cmake/liblz4.a $$ZSTDDIR/build/cmake/lib/libzstd.a
LIBS += $$SNAPPYDIR/libsnappy.a
LIBS += -L$$BROTLIDIR/ -lbrotlicommon-static -lbrotlidec-static -lbrotlienc-static
}
unix:!macx { # ubuntu & debian
defined(CLEAN_RPATH, var) { # clean default flags
message("DEB package build")
QMAKE_LFLAGS_RPATH=
QMAKE_LFLAGS = -Wl,-rpath=\\\$$ORIGIN/../lib
QMAKE_LFLAGS += -static-libgcc -static-libstdc++
} else {
# Note: uncomment if qtcreator fails to find QtCore dependencies
#QMAKE_LFLAGS = -Wl,-rpath=/home/user/Qt5.9.3/5.9.3/gcc_64/lib
}
LIBS += -lz
defined(SYSTEM_LZ4, var) {
LIBS += -llz4
} else {
LIBS += $$LZ4DIR/build/cmake/liblz4.a
}
defined(SYSTEM_ZSTD, var) {
LIBS += -lzstd
} else {
LIBS += $$ZSTDDIR/build/cmake/lib/libzstd.a
}
defined(SYSTEM_SNAPPY, var) {
LIBS += -lsnappy
} else {
LIBS += $$SNAPPYDIR/libsnappy.a
}
defined(SYSTEM_BROTLI, var) {
LIBS += -lbrotlicommon -lbrotlidec -lbrotlienc
} else {
LIBS += -L$$BROTLIDIR/ -lbrotlienc-static -lbrotlicommon-static -lbrotlidec-static
}
# Unix signal watcher
defined(LINUX_SIGNALS, var) {
message("Build with qt-unix-signals")
DEFINES += LINUX_SIGNALS
HEADERS += $$PWD/qt-unix-signals/sigwatch.h
SOURCES += $$PWD/qt-unix-signals/sigwatch.cpp
INCLUDEPATH += $$PWD/qt-unix-signals/
}
}
================================================
FILE: 3rdparty/pyotherside.pri
================================================
# Python
PY_VERSION="39"
PY_WIN_VERSION="38"
PY_LIB_SUFFIX="3.9"
win32* {
QMAKE_LIBS += -LC:\Python$${PY_WIN_VERSION}-x64\libs -lpython$${PY_WIN_VERSION}
INCLUDEPATH += C:\Python$${PY_WIN_VERSION}-x64\include\
} else {
unix:macx {
exists($$PWD/python-3) {
message("Using Python from 3rdparty dir")
LIBS += $$PWD/python-3/lib/libpython$${PY_LIB_SUFFIX}.dylib
INCLUDEPATH += $$PWD/python-3/include/python$${PY_LIB_SUFFIX}
#deployment
PY_DATA_FILES.files = $$PWD/python-3/lib/libpython$${PY_LIB_SUFFIX}.dylib
PY_DATA_FILES.path = Contents/Frameworks
QMAKE_BUNDLE_DATA += PY_DATA_FILES
} else {
PYTHON_CONFIG = /usr/local/bin/python3-config
QMAKE_LIBS += $$system($$PYTHON_CONFIG --ldflags --libs --embed)
QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
}
} else {
PYTHON_CONFIG = python3-config
PYTHON_VERSION = $$str_member($$system(python3 --version), 7, 11)
message("Python version $$PYTHON_VERSION")
versionAtLeast(PYTHON_VERSION, "3.8.0") {
QMAKE_LIBS += $$system($$PYTHON_CONFIG --ldflags --libs --embed)
} else {
QMAKE_LIBS += $$system($$PYTHON_CONFIG --ldflags --libs)
}
QMAKE_CXXFLAGS += $$system($$PYTHON_CONFIG --includes)
DEFINES *= HAVE_DLADDR
}
}
include(pyotherside/pyotherside.pri)
DEFINES += PYOTHERSIDE_VERSION=\\\"$${VERSION}\\\"
DEPENDPATH += $$PWD/pyotherside/src
INCLUDEPATH += $$PWD/pyotherside/src
PYOTHERSIDE_DIR = $$PWD/pyotherside/src/
# Importer from Qt Resources
RESOURCES += $$PYOTHERSIDE_DIR/qrc_importer.qrc
HEADERS += $$PYOTHERSIDE_DIR/pythonlib_loader.h\
$$PWD/pyotherside/src/callback.h
SOURCES += $$PYOTHERSIDE_DIR/pythonlib_loader.cpp
# Python QML Object
SOURCES += $$PYOTHERSIDE_DIR/qpython.cpp
HEADERS += $$PYOTHERSIDE_DIR/qpython.h
SOURCES += $$PYOTHERSIDE_DIR/qpython_worker.cpp
HEADERS += $$PYOTHERSIDE_DIR/qpython_worker.h
SOURCES += $$PYOTHERSIDE_DIR/qpython_priv.cpp
HEADERS += $$PYOTHERSIDE_DIR/qpython_priv.h
HEADERS += $$PYOTHERSIDE_DIR/python_wrap.h
# Globally Load Python hack
SOURCES += $$PYOTHERSIDE_DIR/global_libpython_loader.cpp
HEADERS += $$PYOTHERSIDE_DIR/global_libpython_loader.h
# Reference-counting PyObject wrapper class
SOURCES += $$PYOTHERSIDE_DIR/pyobject_ref.cpp
HEADERS += $$PYOTHERSIDE_DIR/pyobject_ref.h
# QObject wrapper class exposed to Python
SOURCES += $$PYOTHERSIDE_DIR/qobject_ref.cpp
HEADERS += $$PYOTHERSIDE_DIR/qobject_ref.h
HEADERS += $$PYOTHERSIDE_DIR/pyqobject.h
# GIL helper
HEADERS += $$PYOTHERSIDE_DIR/ensure_gil_state.h
# Type System Conversion Logic
HEADERS += $$PYOTHERSIDE_DIR/converter.h
HEADERS += $$PYOTHERSIDE_DIR/qvariant_converter.h
HEADERS += $$PYOTHERSIDE_DIR/pyobject_converter.h
HEADERS += $$PYOTHERSIDE_DIR/qml_python_bridge.h
================================================
FILE: BACKERS.md
================================================
## RDM Backers
1. peters
2. WillPerone
3. cblage
4. richard.hoogenboom
5. rodogu
6. markoan
7. tomlobato
8. sun.ming.77
9. Wrhector
10. trelsco
11. Sai P.S.
12. mostly-harmless
13. chasm
14. Clayton Sayer
15. henkvos
16. syrusm
17. stgogm
18. pmercier
19. elliots
20. Itamar Haber
21. Kelson
22. linux_china
23. mjirby
24. cristianobaptista
25. Scott Steele
26. caywood
27. GuRui
28. ryanski44
29. alex.mirrr
30. andrewjknox
31. chrisgo
32. Rob T.
33. chrismckee
34. ritxi
35. Recumbented
36. imesner
37. ragboy
38. tinou.bao
39. dbrugne
40. brianberlin
41. noocyte
42. yu, Wu
43. Alejandra
44. ne0zen
45. Macarun
46. Mitch
47. STRML
48. somebody
49. sachinwalia
50. Wayne Robinson
51. PyYoshi
52. JHoffmanME
53. sebastian.stanisor
54. xurumelous
55. nilskp
56. science
57. cicorias
58. BrianLocke
59. anoordende
60. pablovilas
61. runes83
62. chentex
63. forcer
64. ikary
65. eduardomcrodrigues
66. Christophe Cholot
67. mickdelaney
68. SwaroopH
69. David Jonasson
70. dean.mehmet
71. lyhdj001
72. gary.weng.10
73. okachan_0417
74. xbtequila
75. ducu
76. timeblimp
77. rduplain
78. Salada
79. djolaq
80. Alric
81. patrick
82. descipar
83. marcin.glenszczyk
84. Benni
85. ksatirli
86. devcrust
87. Soheil
88. rsafier
89. leftis
90. Brayyy
91. artsard
92. irvingswiftj
93. KeyManPL
94. atierant
95. tomascayuelas
96. kiyoaki
97. Jesper Niedermann
98. Jingjie Zheng
99. humiaozuzu
100. rolfvreijdenberger
================================================
FILE: CONTRIBUTING.md
================================================
## IMPORTANT: HOW TO ADD ISSUES
* GitHub issues **SHOULD ONLY BE USED to report bugs**, and for DETAILED feature
requests. Everything else belongs to the [](https://gitter.im/uglide/RedisDesktopManager)
**PLEASE DO NOT POST GENERAL QUESTIONS** that are not about bugs or suspected
bugs in the GitHub issues system. We'll be very happy to help you and provide
all the support in the [](https://gitter.im/uglide/RedisDesktopManager)
### Bug report template:
Version:
Environment:
Redis Server Version:
Steps to reproduce:
1.
2.
3.
Expected result:
Actual Result:
### Example of bug report:
Version: 0.6.2
Environment: Windows 7 SP1 x64
Redis Server Version: 2.8.1
Steps to reproduce:
1.Click on RedisDesktopManager.ink
2.Click on Add Connection button
Expected result: Active dialog window
Actual Result: Crash
================================================
FILE: COPYRIGHT
================================================
RESP.app (formerly RedisDesktopManager), Cross-platform GUI management tool for Redis®
Copyright 2013-2022, Ihor Malinovskyi.
The RESP.app is released under the terms of the GNU General Public
License, version 3.
The RESP.app Project includes files written by third
parties and used with permission or subject to their respective
license agreements.
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
================================================
FILE: README.md
================================================
## RESP.app - GUI for Redis ® (Formerly RedisDesktopManager)
### RESP.app is joining forces with Redis to offer the Redis community the best possible developer experience and to increase productivity when developing with Redis.
Please read [this blog post](https://redis.com/blog/respapp-joining-redis/) where we share more details, and you can also visit the [FAQ](https://resp.app/faq).

================================================
FILE: build/windows/installer/include/install_vcredist_x64.nsh
================================================
!include LogicLib.nsh
!macro InstallVCredist
!define VCplus_URL "https://aka.ms/vs/16/release/VC_redist.x64.exe"
ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" Bld
${If} $0 >= 27033
goto VCInstalled
${Else}
goto VCDownload
${EndIf}
VCDownload:
DetailPrint "Beginning download of VC++ 2015-2019 Redistributable."
inetc::get /TIMEOUT=30000 ${VCplus_URL} "$TEMP\vc_redist.x64.exe" /END
Pop $0
DetailPrint "Result: $0"
StrCmp $0 "OK" InstallVCplusplus
StrCmp $0 "cancelled" VCCanceled
inetc::get /TIMEOUT=30000 /NOPROXY ${VCplus_URL} "$TEMP\vc_redist.x64.exe" /END
Pop $0
DetailPrint "Result: $0"
StrCmp $0 "OK" InstallVCplusplus
MessageBox MB_ICONEXCLAMATION "Cannot download VC++ 2015-2019 Redistributable. Please install it manually if you experience any issues: ${VCplus_URL}"
ExecShell open "${VCplus_URL}"
goto VCInstalled
InstallVCplusplus:
DetailPrint "Completed download."
Pop $0
${If} $0 == "cancel"
MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"Download cancelled. Continue Installation?" \
IDYES VCInstalled IDNO VCCanceled
${EndIf}
DetailPrint "Pausing installation while downloaded VC++ installer runs."
DetailPrint "Installation could take several minutes to complete."
ExecWait '$TEMP\vc_redist.x64.exe /passive /norestart'
DetailPrint "Removing VC++ installer."
Delete "$TEMP\vc_redist.x64.exe"
DetailPrint "VC++ installer removed."
goto VCInstalled
VCCanceled:
Abort "Installation cancelled by user."
VCInstalled:
Pop $0
!macroend
================================================
FILE: build/windows/installer/include/nsProcess.nsh
================================================
!define nsProcess::FindProcess `!insertmacro nsProcess::FindProcess`
!macro nsProcess::FindProcess _FILE _ERR
nsProcess::_FindProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
!define nsProcess::KillProcess `!insertmacro nsProcess::KillProcess`
!macro nsProcess::KillProcess _FILE _ERR
nsProcess::_KillProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
!define nsProcess::CloseProcess `!insertmacro nsProcess::CloseProcess`
!macro nsProcess::CloseProcess _FILE _ERR
nsProcess::_CloseProcess /NOUNLOAD `${_FILE}`
Pop ${_ERR}
!macroend
!define nsProcess::Unload `!insertmacro nsProcess::Unload`
!macro nsProcess::Unload
nsProcess::_Unload
!macroend
================================================
FILE: build/windows/installer/include/x64.nsh
================================================
; ---------------------
; x64.nsh
; ---------------------
;
; A few simple macros to handle installations on x64 machines.
;
; RunningX64 checks if the installer is running on x64.
;
; ${If} ${RunningX64}
; MessageBox MB_OK "running on x64"
; ${EndIf}
;
; DisableX64FSRedirection disables file system redirection.
; EnableX64FSRedirection enables file system redirection.
;
; SetOutPath $SYSDIR
; ${DisableX64FSRedirection}
; File some.dll # extracts to C:\Windows\System32
; ${EnableX64FSRedirection}
; File some.dll # extracts to C:\Windows\SysWOW64
;
!ifndef ___X64__NSH___
!define ___X64__NSH___
!include LogicLib.nsh
!macro _RunningX64 _a _b _t _f
!insertmacro _LOGICLIB_TEMP
System::Call kernel32::GetCurrentProcess()i.s
System::Call kernel32::IsWow64Process(is,*i.s)
Pop $_LOGICLIB_TEMP
!insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}`
!macroend
!define RunningX64 `"" RunningX64 ""`
!macro DisableX64FSRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i0)
!macroend
!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection"
!macro EnableX64FSRedirection
System::Call kernel32::Wow64EnableWow64FsRedirection(i1)
!macroend
!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection"
!endif # !___X64__NSH___
================================================
FILE: build/windows/installer/installer.nsi
================================================
!addincludedir .\include
!addplugindir .\plugin
Name "RESP.app (formerly RedisDesktopManager)"
BrandingText "Open source Developer GUI for Redis"
RequestExecutionLevel admin
SetCompress auto
SetCompressor /SOLID /FINAL lzma
ManifestDPIAware true
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(Name)"
!define COMPANY "Igor Malinovskiy"
!define URL resp.app
!define APP_EXE "resp.exe"
# MUI Symbol Definitions
!define MUI_ICON "..\..\..\src\resources\images\logo.ico"
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN $INSTDIR\${APP_EXE}
!define MUI_UNICON "..\..\..\src\resources\images\logo.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\images\main.bmp"
# Included files
!include "nsProcess.nsh"
!include "x64.nsh"
!include "install_vcredist_x64.nsh"
!include Sections.nsh
!include MUI2.nsh
# Variables
Var StartMenuGroup
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE ..\..\..\LICENSE
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE English
# Installer attributes
OutFile resp-${VERSION}.exe
InstallDir $PROGRAMFILES64\RESP_app
CRCCheck on
XPStyle on
ShowInstDetails show
VIProductVersion ${VERSION}.0
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductName "RESP.app (formerly RedisDesktopManager)"
VIAddVersionKey /LANG=${LANG_ENGLISH} ProductVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyName "${COMPANY}"
VIAddVersionKey /LANG=${LANG_ENGLISH} CompanyWebsite "${URL}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} FileDescription ""
VIAddVersionKey /LANG=${LANG_ENGLISH} LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails show
# Installer sections
Section -Main SEC0000
${nsProcess::KillProcess} "rdm.exe" $R4
${nsProcess::KillProcess} "${APP_EXE}" $R4
${IfNot} ${RunningX64}
MessageBox MB_OK "Starting from version 2019.0.0, RESP.app doesn't support 32-bit Windows"
Quit
${EndIf}
IfFileExists $INSTDIR\uninstall.exe already_installed not_installed
already_installed:
CopyFiles /SILENT /FILESONLY "$INSTDIR\uninstall.exe" "$INSTDIR\uninstall_.exe"
ExecWait '"$INSTDIR\uninstall_.exe" /S _?=$INSTDIR'
Sleep 100
Delete /REBOOTOK $INSTDIR\uninstall_.exe
not_installed:
SetOutPath $INSTDIR
File /r resources\*
WriteRegStr HKLM "${REGKEY}\Components" Main 1
!insertmacro InstallVCredist
BringToFront
SectionEnd
Section -post SEC0001
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
SetOutPath $SMPROGRAMS\$StartMenuGroup
CreateShortCut "$DESKTOP\RESP.lnk" "$INSTDIR\${APP_EXE}" ""
IfSilent 0 +2
Exec "$INSTDIR\${APP_EXE}"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\RESP.lnk" "$INSTDIR\${APP_EXE}"
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Macro for selecting uninstaller sections
!macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
Push $R0
ReadRegStr $R0 HKLM "${REGKEY}\Components" "${SECTION_NAME}"
StrCmp $R0 1 0 next${UNSECTION_ID}
!insertmacro SelectSection "${UNSECTION_ID}"
GoTo done${UNSECTION_ID}
next${UNSECTION_ID}:
!insertmacro UnselectSection "${UNSECTION_ID}"
done${UNSECTION_ID}:
Pop $R0
!macroend
# Uninstaller sections
Section /o -un.Main UNSEC0000
${nsProcess::KillProcess} "${APP_EXE}" $R4
Sleep 1000
Delete /REBOOTOK $INSTDIR\*
RmDir /REBOOTOK /r $INSTDIR\*
DeleteRegValue HKLM "${REGKEY}\Components" Main
SectionEnd
Section -un.post UNSEC0001
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK "$DESKTOP\RESP.lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\RESP.lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^UninstallLink).lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
DeleteRegValue HKLM "${REGKEY}" Path
DeleteRegKey /IfEmpty HKLM "${REGKEY}\Components"
DeleteRegKey /IfEmpty HKLM "${REGKEY}"
RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
RmDir /REBOOTOK $INSTDIR
SectionEnd
# Installer functions
Function .onInit
InitPluginsDir
StrCpy $StartMenuGroup RESP
FunctionEnd
# Uninstaller functions
Function un.onInit
SetAutoClose true
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
StrCpy $StartMenuGroup RESP
!insertmacro SELECT_UNSECTION Main ${UNSEC0000}
FunctionEnd
# Installer Language Strings
LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
================================================
FILE: build/windows/installer/resources/qt.conf
================================================
[Paths]
Prefix=..
================================================
FILE: docs/app-store.md
================================================
## Limitations of App Store version
* AppStore version of RESP.app doesn't support [Native Formatters](native-formatters.md)
================================================
FILE: docs/bulk-operations.md
================================================
# Bulk operations
***
RESP.app simplifies your Redis daily routines with bulk operations. To access bulk operations connect to Redis
server and click on a target database like db0:
## Supported bulk operations
### Flush database
It's a useful operation if you need to invalidate cache in a couple clicks instead of firing `FLUSHDB` command.
> !!! warning "Be careful"
Do not use it on Production servers. You can safeguard your Production Redis server by using [a restricted user with limited permissions](https://redis.io/docs/manual/security/acl/).
### Delete keys with filter
If you need to remove some specific keys or a ["namespace"](lg-keyspaces.md#use-namespaced-keys) from your Redis server this bulk operation can come in handy.
It allows you to specify a glob style pattern to define which keys should be removed.

### Set TTL for multiple keys
As you know, Redis is an in-memory database. You should be careful and set appropriate TTL for all keys otherwise Redis can
crash or stop responding after consuming all available memory. If you realized that some keys have wrong TTL values or don't have TTL at all you can fix it using RESP.app:

### Copy keys from one Redis server to another
Sometimes you need to copy some keys from a Production Redis server to local one for debugging or vice-versa.
You can achieve that by writing custom script, however it's much easier to just make a couple of clicks in RESP.app to copy keys:
> !!! warning "Limitations"
Currently RESP.app supports only copying data between redis-servers with the same RDB version.
Usually it means that major versions of both Redis servers should be the same.

### Import keys directly from RDB files
Usually, production Redis servers have [AOF or RDB back-ups or persistent files](https://redis.io/docs/manual/persistence/).
While AOF is basically a file with all commands that should be played again to reconstruct original dataset, RDB files don't have such flexibility.
Therefore, RESP.app provides a convenient way to easily import subset of data for debugging and testing directly from RDB file instead of creating additional load to your Production system.

#### Is your use case not covered in RESP.app? [Contact us](mailto:support@resp.app), and we will do our best to solve it!
================================================
FILE: docs/css/extra.css
================================================
img {
max-height: 500px;
}
code {
font-size: 11pt;
}
================================================
FILE: docs/development.md
================================================
### Build RESP.app from source
See [instruction](install.md#build-from-source)
### Generate test data
Open RESP.app console or redis-cli and execute:
```lua
eval "for index = 0,100000 do redis.call('SET', 'test_key' .. index, index) end" 0
eval "for index = 0,100000 do redis.call('SET', 'test_key:' .. math.random(1, 100) .. ':' .. math.random(1,100), index) end" 0
eval "for index = 0,100000 do redis.call('HSET', 'test_large_hash', index, index) end" 0
eval "for index = 0,100000 do redis.call('ZADD', 'test_large_zset', index, index) end" 0
eval "for index = 0,100000 do redis.call('SADD', 'test_large_set', index) end" 0
eval "for index = 0,100000 do redis.call('LPUSH', 'test_large_list', index) end" 0
```
### App profiling
```bash
sudo apt-get install valgrind
sudo add-apt-repository ppa:kubuntu-ppa/backports
sudo apt-get update
sudo apt-get install massif-visualizer
export LD_LIBRARY_PATH="/usr/share/redis-desktop-manager/lib":$LD_LIBRARY_PATH
valgrind --tool=massif --massif-out-file=rdm.massif /usr/share/redis-desktop-manager/bin/rdm
```
### Debug SSL
```bash
openssl s_client -connect HOST:PORT -cert test_user.crt -key test.key -CAfile test_ca.pem
```
### Remove app settings on OSX
```bash
rm $HOME/Library/Preferences/com.redisdesktop.RedisDesktopManager.plist
killall -u `whoami` cfprefsd
```
### Fix bugs or implement whatever you want :)
================================================
FILE: docs/extension-server.md
================================================
## RESP.app Extension Server
Developers love Redis because it gives freedom to store anything they want in it.
RESP.app shares this ideology by supporting automatic decompression (GZIP, LZ4, ZSTD, BROTLI, Snappy) and deserialization of common formats like MsgPack, PHP Sessions, CBOR and Pickle.
Is your serialization format not mentioned above? Continue reading to find out how to easily view your data in RESP.app.
### What is it?
Starting from version `2022.4` RESP.app comes with a built-in client for Extension Server. Extension Server is a simple REST API defined by
the following [OpenAPI Specification](extension-server.md#openapi-v3-specification). This server allows you to support
any custom compression or serialization format.
### Build your own Extension Server in minutes
Thanks to [OpenAPI Generator](https://openapi-generator.tech/docs/installation) you can generate boilerplate for your Extension Server in a couple of minutes.
1. [Install OpenAPI Generator](https://openapi-generator.tech/docs/installation)
2. Select [appropriate server generator](https://openapi-generator.tech/docs/generators#server-generators).
3. Download spec file from `https://raw.githubusercontent.com/uglide/RedisDesktopManager/2022/docs/server_spec.yaml`
4. Generate server:
`
openapi-generator generate -i server_spec.yaml -g YOUR_GENERATOR -o my_extension_server
`
5. Open `my_extension_server` in your favorite IDE and start adding your custom formatters to generated server.
**If you are faced with any issues you can [contact support](mailto:support@resp.app) or ask for help in [telegram chat](https://t.me/RedisDesktopManager)**
### Connect to Extension Server in RESP.app
1. Ensure that you are using RESP.app version `2022.4` or above
2. Click on the "Extension Server" button in top right corner of the main window
3. In the Extension Server dialog specify your server URL and basic auth details if any:
4. Hit Reload button
### Visualizing data with Extension Server
RESP.app supports following `Content-Type` responses from Extension Server:
- `application/json`
- `image/*` for example `image/svg+xml`
This allows you to perform any required preprocessing and visualize your data:
### OpenAPI v3 Specification
**Please submit your proposals to the following spec on [GitHub](https://github.com/uglide/RedisDesktopManager/issues)**
!!swagger server_spec.yaml!!
### Third-party extension servers
You can find some examples on [GitHub](https://github.com/search?q=resp.app+extension+server).
================================================
FILE: docs/faq.md
================================================
## Where is the connections config stored?
**Windows** `%USERPROFILE%\.rdm\connections.json`
**macOS dmg** `$HOME/Library/Preferences/rdm/connections.json`
**macOS App Store** `$HOME/Library/Containers/com.redisdesktop.rdm/Data/Library/Preferences/rdm/`
**Linux flatpak** `$HOME/.rdm/connections.json`
**Linux snap** `$HOME/snap/redis-desktop-manager/common/.rdm/connections.json`
================================================
FILE: docs/index.md
================================================
# RESP.app Documentation
RESP.app (formerly RedisDesktopManager) — is a cross-platform open source GUI for Redis ® available on Windows, Linux and macOS. This tool offers you an easy-to-use GUI to access your Redis ® DB and perform some basic operations: view keys as a tree, CRUD keys, execute commands via shell. RESP.app supports SSL/TLS encryption, SSH tunnels and cloud Redis instances, such as: Amazon ElastiCache, Microsoft Azure Redis Cache and other Redis ® clouds.
Please submit any issues and proposals on [GitHub](https://github.com/uglide/RedisDesktopManager/issues)
#### Ask for help in [telegram chat](https://t.me/RedisDesktopManager)
================================================
FILE: docs/install.md
================================================
# Quick Install
## Windows
1. Install [Microsoft Visual C++ 2015-2019 x64](https://aka.ms/vs/16/release/vc_redist.x64.exe) (If you have not already).
2. Download Windows Installer from [http://resp.app/subscriptions](http://resp.app/subscriptions). **(Requires subscription)**
3. Run the downloaded installer.
## Mac OS X
1. Download dmg image from [http://resp.app/subscriptions](http://resp.app/subscriptions). **(Requires subscription)**
2. Mount the DMG image.
3. Run rdm.app.
## Ubuntu / ArchLinux / Debian / Fedora / CentOS / OpenSUSE / etc
### Install flatpak
1. Install RESP.app using [Flathub](https://flathub.org/apps/details/app.resp.RESP).
> !!! info "How to install in command line"
Make sure to follow the [setup guide](https://flatpak.org/setup/) before installing
`flatpak install flathub app.resp.RESP`
> !!! tip "How to run"
If RESP.app icon hasn't appeared in your application launcher, you can run RESP.app from terminal with:
`flatpak run app.resp.RESP`
### Install snap
1. Install RESP.app using [Snapcraft](https://snapcraft.io/redis-desktop-manager).
> !!! warning "SSH Keys"
To be able to access your ssh keys from RESP.app please connect `ssh-key` interface:
`sudo snap connect redis-desktop-manager:ssh-keys`
> !!! tip "How to Run"
If RESP.app icon hasn't appeared in your application launcher you can run RESP.app from terminal `/snap/bin/redis-desktop-manager.rdm`
## Build from source
### Get source
1. Install git using the instructions here: https://git-scm.com/download
2. Get the source code:
```
git clone --recursive https://github.com/uglide/RedisDesktopManager.git -b 2022 rdm && cd ./rdm
```
> !!! warning "SSH Tunneling support"
Since 0.9.9 RESP.app by default does not include SSH Tunneling support. You can create a SSH tunnel to your Redis server manually and connect to `localhost`:
`ssh -L 6379:REDIS_HOST:6379 SSH_USER@SSH_HOST -P SSH_PORT -i SSH_KEY -T -N` or [use pre-built binary for your OS](#quick-install)
### Build on OS X
1. Install [Xcode](https://developer.apple.com/xcode/) with Xcode build tools.
2. Install [Homebrew](http://brew.sh/).
3. Copy `cd ./src && cp ./resources/Info.plist.sample ./resources/Info.plist`.
4. Building RESP.app dependencies require i.a. `openssl`, `cmake` and `python3`. Install them: `brew install openssl cmake python3`
5. Build lz4 lib
```
cd 3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON .
make
cd 3rdparty/brotli
cmake -DBUILD_SHARED_LIBS=OFF
make
cd 3rdparty/snappy
cmake -DHAVE_LIBLZO2=0 -DHAVE_LIBLZ4=0 && make
cd 3rdparty/zstd/build/cmake
cmake ./ && make
```
6. Install Python requirements `pip3 install -t ../bin/osx/release -r py/requirements.txt`
7. Install [Qt 5.15](http://www.qt.io/download-open-source/#section-2). Add Qt Creator and under Qt 5.15.x add Qt Charts module.
8. Open `./src/rdm.pro` in **Qt Creator**.
9. Run build.
### Build on Windows
1. Install [Visual Studio 2019 Community Edition](https://visualstudio.microsoft.com/vs/).
2. Install [Qt 5.15](https://www.qt.io/download).
3. Go to `3rdparty/qredisclient/3rdparty/hiredis` and apply the patch to fix compilation on Windows:
`git apply ../hiredis-win.patch`
4. Go to the `3rdparty/` folder and install zlib with `nuget`: `nuget install zlib-msvc14-x64 -Version 1.2.11.7795`
5. Build lz4 lib
```
cd 3rdparty/lz4/build/cmake
cmake -DLZ4_BUNDLED_MODE=ON .
make
```
6. Install Python 3.9 amd64 to `C:\Python39-x64`.
7. Install Python requirements `pip3 install -r src/py/requirements.txt`.
8. Open `./src/rdm.pro` in **Qt Creator**. Choose the `Desktop Qt 5.15.x MSVC2019 64bit > Release` build profile.
9. Run build. (Just hit `Ctrl-B`)
================================================
FILE: docs/known-issues.md
================================================
### Application looks corrupted on my 1080p screen on Linux (too small font and/or broken dialogs)
Run RESP.app from terminal without Qt Autoscaling: `Exec=env QT_AUTO_SCREEN_SCALE_FACTOR=0 redis-desktop-manager.rdm`
================================================
FILE: docs/lg-keyspaces.md
================================================
# Working with large keyspaces
By default, RESP.app uses `*` (wildcard glob-style pattern) in `SCAN` command to load all keys from the selected database. It’s simple and user-friendly for cases when you have only a couple of thousands keys. But for production redis-servers with millions of keys it leads to a huge amount of time needed to load keys in RESP.app.
On this page you will find different approaches how to work with large Redis keyspaces efficiently.
## Increase limit for `SCAN` command
RESP.app limits amount of keys that should be scanned by Redis to `10000`. If you have more than 100K keys in Redis it's recommended to increase this limit to
`50000` or `100000`.
> !!! warning "Be careful!"
High scanning limit may affect your Redis performance!
To increase this limit click on the Settings button in top right corner for the main window and change value for `Limit for SCAN command` setting.
## Use specific `SCAN` filter to reduce loaded amount of keys
Consider using more specific filters for `SCAN` in order to speed up keys loading and reduce memory footprint
1. Right click on database and click on Filter button
2. Enter glob-style pattern and press apply button
> !!! note
More details about `SCAN` filter syntax you can find in Redis documentation [https://redis.io/commands/scan#the-match-option]()
Default `SCAN` filter can be changed in connection settings on “Advanced Settings” tab:
## Use namespaced keys
Colon sign `:` is a commonly used convention when naming Redis keys. For example you can use following schema to store information about users:
`user:1000`
Following this schema allows you to simplify removal of obsolete keys and performing other operations with keys in Redis.
Using namespaced keys is also important for loading huge keyspaces in RESP.app. It renders namespaces on demand (since 2020.2+) and this approach allows to visualise millions of keys with small memory footprint.
Default namespace separator can be changed in connection settings on “Advanced Settings” tab.
More tips about Redis keys naming you can find in this tutorial [https://redis.io/topics/data-types-intro#redis-keys]()
================================================
FILE: docs/native-formatters.md
================================================
## Native value formatters
> !!! warning "End of life"
This feature was deprecated and removed from RESP.app. Please use [Extension Server](extension-server.md) instead
================================================
FILE: docs/quick-start.md
================================================
# **How to start using RESP.app**
***
After you've [installed](install.md) RESP.app, the first thing you need to do in order to get going is to create a connection to your Redis server. On the main window, press the button labelled **Connect to Redis Server**.

## Connect to a local or public redis-server
On the first tab (Connection Settings), put in general information regarding the connection that you are creating.
* **Name** - the name of new connection (example: my_local_redis)
* **Host** - redis-server host (example: localhost)
* **Port** - redis-server port (example: 6379)
* **Password** - redis-server authentication password (if any) ([http://redis.io/commands/AUTH](http://redis.io/commands/AUTH))
* **Username** - only for redis-servers >= 6.0 with configured [ACL](https://redis.io/topics/acl), for older redis-server leave empty
## Connect to a public redis-server with SSL
If you want to connect to a redis-server instance with SSL you need to enable SSL on the second tab and provide a public key in PEM format.
Instructions for certain cloud services are below:
### AWS ElastiCache
AWS ElastiCache is not accessible outside of your VPC. In order to connect to your ElastiCache remotely, you need to use one of the following options:
* Setup VPN connection **[Recommended]**
[https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/accessing-elasticache.html#access-from-outside-aws](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/accessing-elasticache.html#access-from-outside-aws)
* Setup SSH proxying host and connect through SSH tunnel. **[Slow network performance. Not recommended]**
* Setup NAT instance for exposing your AWS ElastiCache to the Internet **[Firewall rules should be configured very carefully. Not recommended.]**
#### How to connect to AWS ElastiCache with In-Transit Encryption
##### VPN / NAT
Enable SSL/TLS checkbox and connect to your AWS ElastiCache with In-Transit Encryption.
##### SSH tunnel
Click on "Enable TLS-over-SSH" checkbox in the the SSH connection settings and connect to your AWS ElastiCache with In-Transit Encryption.
### Microsoft Azure Redis Cache
1. Create a connection with all requested information.
2. Make sure that the "Use SSL Protocol" checkbox is enabled.
3. Your Azure Redis connection is ready to use.
### Redis Labs
To connect to a Redis Labs instance with SSL/TLS encryption, follow the steps below:
1. Make sure that SSL is enabled for your Redis instance in the Redis Labs dashboard.
2. Download and unzip `garantia_credentials.zip` from the Redis Labs dashboard.
3. Select `garantia_user.crt` in the "Public key" field.
4. Select `garantia_user_private.key` in the "Private key" field.
5. Select `garantia_ca.pem` in the "Authority" field.
### Digital Ocean Managed Redis
Digital Ocean connection settings is a bit confusing. To connect to a Digital Ocean Managed Redis you need to follow steps bellow:
1. Copy host, port and password information to RESP.app
2. **Leave Username field in RESP.app empty** (Important!)
3. Enable SSL/TLS checkbox
Or using Quick Connect tab for new connections:
1. Copy connection string (starts with "rediss://") from connection details to RESP.app
2. Click "Import" and "Test Connection"
### Heroku Redis
1. Get Redis connection string from terminal with command
```
heroku config -a YOUR-APP-NAME | grep REDIS
```
or get it from Heroku website.
Example output:
```
rediss://user:password@host:port
```
2. Enter connection settings in RESP.app Connection dialog:
- If URL starts with `rediss` enable SSL/TLS checkbox and **uncheck** "Enable strict mode" checkbox
- Copy `user` to "Username" field
- Copy `password` to "Password" field
- Copy `host` and `port` to "Address" field in RESP.app
## Connect to private redis-server via SSH tunnel
### Basic SSH tunneling
SSH tab is supposed to allow you to use a SSH tunnel. It's useful if your redis-server is not publicly accessible.
To use a SSH tunnel select checkbox "SSH Tunnel". There are different security options; you can use a plain password or OpenSSH private key.
>!!! note "for Windows users:"
Your private key must be in .pem format.
### SSH Agent
Starting from version 2022.3 RESP.app supports SSH Agents. This allows using password managers like [1Password](https://developer.1password.com/docs/ssh/agent)
to securely store your SSH keys with 2FA.
>!!! note "for Windows users:"
On Windows RESP.app supports only [Microsoft OpenSSH](https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview) that's why "Custom SSH Agent Path" option is not available.
##### How to connect to 1Password SSH-Agent from DMG version of RESP.app
It's possible to set default SSH Agent for all connections in RESP.app by overriding environment variable `SSH_AUTH_SOCK`.
If you need to use custom ssh agent only for specific connections follow steps above:
1. Create symlink to agent.sock
```
mkdir -p ~/.1password && ln -s ~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock ~/.1password/agent.sock
```
2. In RESP.app check "Use SSH Agent" checkbox and click on the "Select File" button next to "Custom SSH Agent Path" field
3. Press `⌘ + Shift + .` to show hidden files and folders in the dialog
4. Select file `~/.1password/agent.sock`
5. Save connection settings
##### How to connect to SSH-Agent from AppStore version of RESP.app
Due to AppStore sandboxing RESP.app cannot access default or custom SSH Agents defined by `SSH_AUTH_SOCK` variable.
To overcome this limitation you need to create proxy unix socket inside RESP.app sandbox container:
1. Install socat with homebrew
```
brew install socat
```
2. Create proxy unix-socket with socat:
```
socat UNIX-LISTEN:$HOME/Library/Containers/com.redisdesktop.rdm/Data/agent.sock UNIX-CONNECT:"$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
```
### Advanced SSH tunneling
If you need advanced SSH tunneling you should setup a SSH tunnel manually and connect via localhost:
```
ssh SSH_HOST -L 7000:localhost:6379
```
## Connect to a UNIX socket
RESP.app [doesn't support UNIX sockets](https://github.com/uglide/RedisDesktopManager/issues/1751) directly, but you can use redirecting of the local socket to the UNIX domain socket, for instance with [socat](https://sourceforge.net/projects/socat):
```
socat -v tcp-l:6379,reuseaddr,fork unix:/tmp/redis.sock
```
## Advanced connection settings
The **Advanced settings** tab allows you to customise the namespace separator and other advanced settings.
## Next steps
Now you can test a connection or create a connection right away.
Congratulations, you've successfully connected to your Redis Server. You should see something similar to what we show below.

Click on the connection and expand keys. By clicking the right button, you can see console menu and manage your connection from there.
================================================
FILE: docs/requirements.txt
================================================
mkdocs==1.3.0
mkdocs-render-swagger-plugin==0.0.3
================================================
FILE: docs/server_spec.yaml
================================================
openapi: 3.0.0
info:
version: 2022.0-preview1
title: RESP.app Extension server
description: RESP.app Extension Server API allows you to extend RESP.app with your custom data formatters
paths:
/data-formatters:
get:
description: Returns a list of data formatters
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: "#/components/schemas/DataFormatters"
/data-formatters/{id}/decode:
post:
parameters:
- name: id
in: path
required: true
description: The id of data formatter
schema:
type: string
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/DecodePayload'
responses:
'200':
description: Successful response with correct content type. RESP.app supports text/plain, application/json and application/octet-stream
content:
'*/*' :
schema:
type: string
'400':
description: Validation error response
content:
'application/json':
schema:
type: object
properties:
error:
type: string
/data-formatters/{id}/encode:
post:
parameters:
- name: id
in: path
required: true
description: The id of data formatter
schema:
type: string
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/EncodePayload'
responses:
'200':
description: Successful response with content type application/octet-stream
content:
'*/*' :
schema:
type: string
'400':
description: Validation error response
content:
'application/json':
schema:
type: object
properties:
error:
type: string
components:
securitySchemes:
basic:
type: http
scheme: basic
schemas:
DataFormatter:
type: object
required:
- id
- name
properties:
id:
type: string
description: Internal formatter ID used in requests to this API
example: "1"
name:
type: string
description: Name displayed inside RDM app
example: "My .net models decoder"
read-only:
type: boolean
description: Read-only formatters only receive decode requests
DataFormatters:
type: array
items:
$ref: "#/components/schemas/DataFormatter"
DecodePayload:
type: object
properties:
data:
type: string
description: Base64 encoded string
redis-key-name:
type: string
redis-key-type:
type: string
EncodePayload:
type: object
properties:
data:
type: string
description: Base64 encoded string
metadata:
type: object
description: Metadata from formatter custom ui forms
security:
- basic: []
================================================
FILE: mkdocs.yml
================================================
site_name: "RESP.app"
site_description: "RESP.app Documentation (formerly RedisDesktopManager)"
site_author: "Igor Malinovskiy"
site_favicon: "favicon.ico"
repo_url: https://github.com/uglide/RedisDesktopManager
edit_uri: edit/2022/docs/
theme: readthedocs
extra_css:
- css/extra.css
nav:
- Home: 'index.md'
- Install: 'install.md'
- Quick Start: 'quick-start.md'
- Bulk operations: 'bulk-operations.md'
- Working with large keyspaces: 'lg-keyspaces.md'
- Native Formatters: 'native-formatters.md'
- Extension server: 'extension-server.md'
- FAQ: 'faq.md'
- Known Issues: 'known-issues.md'
- AppStore Limitations: 'app-store.md'
- Development Guide: 'development.md'
markdown_extensions:
- markdown.extensions.admonition
plugins:
- render_swagger
================================================
FILE: sonar-project.properties
================================================
sonar.projectName=RedisDesktopManager
sonar.projectKey=uglide_RedisDesktopManager
sonar.organization=uglide
sonar.projectVersion=2021.10
# SQ standard properties
sonar.sources=src
sonar.sourceEncoding=UTF-8
================================================
FILE: src/app/app.cpp
================================================
#include "app.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#if defined(Q_OS_WINDOWS) || defined(Q_OS_LINUX)
#include "darkmode.h"
#include
#endif
#include "common/tabviewmodel.h"
#include "events.h"
#include "models/configmanager.h"
#include "models/connectionconf.h"
#include "models/connectionsmanager.h"
#include "models/key-models/keyfactory.h"
#include "modules/bulk-operations/bulkoperationsmanager.h"
#include "modules/common/sortfilterproxymodel.h"
#include "modules/console/autocompletemodel.h"
#include "modules/console/consolemodel.h"
#include "modules/server-actions/serverstatsmodel.h"
#include "modules/value-editor/embeddedformattersmanager.h"
#ifdef ENABLE_EXTERNAL_FORMATTERS
#include "modules/extension-server/dataformattermanager.h"
#endif
#include "modules/value-editor/syntaxhighlighter.h"
#include "modules/value-editor/textcharformat.h"
#include "modules/value-editor/tabsmodel.h"
#include "modules/value-editor/valueviewmodel.h"
#include "qmlutils.h"
#ifdef Q_OS_WINDOWS
#include
#endif
Application::Application(int& argc, char** argv)
: QApplication(argc, argv),
m_engine(this),
m_qmlUtils(QSharedPointer(new QmlUtils())),
m_events(QSharedPointer(new Events()))
{
// Init components required for models and qml
initAppInfo();
initProxySettings();
processCmdArgs();
initAppFonts();
#if defined(Q_OS_WINDOWS) || defined(Q_OS_LINUX)
if (isDarkThemeEnabled()) {
setStyle(QStyleFactory::create("Fusion"));
setPalette(createDarkModePalette());
}
#endif
initRedisClient();
installTranslator();
}
void Application::initModels() {
ConfigManager confManager(m_settingsDir);
QString config = confManager.getApplicationConfigPath("connections.json");
if (config.isNull()) {
QMessageBox::critical(
nullptr,
QCoreApplication::translate("RESP",
"Settings directory is not writable"),
QCoreApplication::translate(
"RESP",
"RESP.app can't save connections file to settings directory. "
"Please change file permissions or restart RESP.app as "
"administrator."));
throw std::runtime_error("invalid connections config");
}
m_keyFactory = QSharedPointer(new KeyFactory());
m_keyValues =
QSharedPointer(new ValueEditor::TabsModel(
m_keyFactory.staticCast(), m_events));
connect(m_events.data(), &Events::openValueTab, m_keyValues.data(),
&ValueEditor::TabsModel::openTab);
connect(m_events.data(), &Events::newKeyDialog, m_keyFactory.data(),
&KeyFactory::createNewKeyRequest);
connect(m_events.data(), &Events::closeDbKeys, m_keyValues.data(),
&ValueEditor::TabsModel::closeDbKeys);
m_connections = QSharedPointer(
new ConnectionsManager(config, m_events));
m_bulkOperations = QSharedPointer(
new BulkOperations::Manager(m_connections));
connect(m_events.data(), &Events::requestBulkOperation,
m_bulkOperations.data(),
&BulkOperations::Manager::requestBulkOperation);
m_consoleModel = QSharedPointer(
new TabViewModel(getTabModelFactory()));
connect(m_events.data(), &Events::openConsole, m_consoleModel.data(),
&TabViewModel::openTab);
auto srvStatsFactory = [this](QSharedPointer c,
int dbIndex, QList initCmd) {
auto model = QSharedPointer(
new ServerStats::Model(c, dbIndex, initCmd), &QObject::deleteLater);
QObject::connect(model.staticCast().data(),
&ServerStats::Model::openConsoleTerminal, m_events.data(),
&Events::openConsole);
return model;
};
m_serverStatsModel = QSharedPointer(
new TabViewModel(srvStatsFactory));
connect(m_events.data(), &Events::openServerStats, this,
[this](QSharedPointer c) {
m_serverStatsModel->openTab(c, 0, false);
});
#ifdef ENABLE_EXTERNAL_FORMATTERS
m_extServerManager =
QSharedPointer(new RespExtServer::DataFormattersManager(m_engine));
connect(m_extServerManager.data(), &RespExtServer::DataFormattersManager::error, this,
[this](const QString& msg) {
qDebug() << "External formatters:" << msg;
m_events->log(QString("External: %1").arg(msg));
});
connect(m_extServerManager.data(), &RespExtServer::DataFormattersManager::loaded, this,
[this]() {
qDebug() << "External formatters loaded";
emit m_events->externalFormattersLoaded();
});
if (!m_extServerUrl.isEmpty()) {
m_extServerManager->setUrl(m_extServerUrl);
}
connect(m_events.data(), &Events::appRendered, this, [this]() {
if (m_extServerManager) m_extServerManager->loadFormatters();
});
#endif
m_embeddedFormatters = QSharedPointer(
new ValueEditor::EmbeddedFormattersManager());
connect(m_embeddedFormatters.data(),
&ValueEditor::EmbeddedFormattersManager::error, this,
[this](const QString& msg) {
m_events->log(QString("Formatters: %1").arg(msg));
});
m_consoleAutocompleteModel = QSharedPointer(
new Console::AutocompleteModel());
connect(m_events.data(), &Events::appRendered, this, [this]() {
if (m_connections) m_connections->loadConnections();
initPython();
if (m_embeddedFormatters) m_embeddedFormatters->init(m_python);
if (m_bulkOperations) m_bulkOperations->setPython(m_python);
if (m_events) emit m_events->pythonLoaded();
});
}
void Application::initAppInfo() {
setApplicationName("RESP.app - Developer GUI for Redis");
setApplicationVersion(QString(APP_VERSION));
setOrganizationDomain("redisdesktop.com");
setOrganizationName("redisdesktop");
#ifdef Q_OS_MAC
setWindowIcon(QIcon(":/images/logo.icns"));
#else
setWindowIcon(QIcon(":/images/logo.png"));
#endif
qDebug() << "TLS support:" << QSslSocket::sslLibraryVersionString();
}
void Application::initAppFonts() {
QSettings settings;
const int minFontSize = 4;
#ifdef Q_OS_MAC
QString defaultFontName("Helvetica Neue");
QString defaultMonospacedFont("Monaco");
int defaultFontSize = 12;
#elif defined(Q_OS_WINDOWS)
QString defaultFontName("Segoe UI");
QString defaultMonospacedFont("Consolas");
int defaultFontSize = 11;
#else
QString defaultFontName("Open Sans");
QString defaultMonospacedFont("Ubuntu Mono");
int defaultFontSize = 11;
#endif
int defaultValueSizeLimit = 150000;
QString appFont = settings.value("app/appFont", defaultFontName).toString();
if (appFont.isEmpty())
appFont = defaultFontName;
int appFontSize = settings.value("app/appFontSize", defaultFontSize).toInt();
if (appFontSize < minFontSize)
appFontSize = defaultFontSize;
if (appFont == "Open Sans") {
#if defined(Q_OS_LINUX)
int result = QFontDatabase::addApplicationFont("://fonts/OpenSans.ttc");
if (result == -1) {
appFont = "Ubuntu";
}
#elif defined (Q_OS_WINDOWS)
appFont = defaultFontName;
#endif
}
QString valuesFont = settings.value("app/valueEditorFont", defaultMonospacedFont).toString();
if (valuesFont.isEmpty())
valuesFont = defaultMonospacedFont;
int valuesFontSize = settings.value("app/valueEditorFontSize", defaultFontSize).toInt();
if (valuesFontSize < minFontSize)
valuesFontSize = defaultFontSize;
int valueSizeLimit = settings.value("app/valueSizeLimit", defaultValueSizeLimit).toInt();
if (valueSizeLimit < 1000)
valueSizeLimit = defaultValueSizeLimit;
settings.setValue("app/appFont", appFont);
settings.setValue("app/appFontSize", appFontSize);
settings.setValue("app/valueEditorFont", valuesFont);
settings.setValue("app/valueEditorFontSize", valuesFontSize);
settings.setValue("app/valueSizeLimit", valueSizeLimit);
qDebug() << "App font:" << appFont << appFontSize;
qDebug() << "Values font:" << valuesFont;
QFont defaultFont(appFont, appFontSize);
QApplication::setFont(defaultFont);
}
void Application::initProxySettings() {
QSettings settings;
QNetworkProxyFactory::setUseSystemConfiguration(
settings.value("app/useSystemProxy", false).toBool());
}
void Application::registerQmlTypes() {
qmlRegisterType("rdm.models", 1, 0,
"SortFilterProxyModel");
qmlRegisterType("rdm.models", 1, 0, "SyntaxHighlighter");
qmlRegisterType("rdm.models", 1, 0, "TextCharFormat");
qRegisterMetaType();
}
void Application::registerQmlRootObjects() {
m_engine.rootContext()->setContextProperty("appEvents", m_events.data());
m_engine.rootContext()->setContextProperty("qmlUtils", m_qmlUtils.data());
m_engine.rootContext()->setContextProperty("connectionsManager",
m_connections.data());
m_engine.rootContext()->setContextProperty("keyFactory", m_keyFactory.data());
m_engine.rootContext()->setContextProperty("valuesModel", m_keyValues.data());
#ifdef ENABLE_EXTERNAL_FORMATTERS
m_engine.rootContext()->setContextProperty("formattersManager",
m_extServerManager.data());
#endif
m_engine.rootContext()->setContextProperty("embeddedFormattersManager",
m_embeddedFormatters.data());
m_engine.rootContext()->setContextProperty("consoleModel",
m_consoleModel.data());
m_engine.rootContext()->setContextProperty("serverStatsModel",
m_serverStatsModel.data());
m_engine.rootContext()->setContextProperty("bulkOperations",
m_bulkOperations.data());
m_engine.rootContext()->setContextProperty("consoleAutocompleteModel",
m_consoleAutocompleteModel.data());
}
void Application::initQml() {
if (m_renderingBackend == "auto") {
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
} else {
QQuickWindow::setSceneGraphBackend(m_renderingBackend);
}
registerQmlTypes();
registerQmlRootObjects();
try {
m_engine.load(QUrl(QStringLiteral("qrc:///app.qml")));
} catch (...) {
qDebug() << "Failed to load app window. Retrying with software renderer...";
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
m_engine.load(QUrl(QStringLiteral("qrc:///app.qml")));
}
updatePalette();
connect(this, &QGuiApplication::paletteChanged, this, &Application::updatePalette);
qDebug() << "Rendering backend:" << QQuickWindow::sceneGraphBackend();
emit m_events->appRendered();
}
void Application::initPython() {
m_python = QSharedPointer(new QPython(this, 1, 5));
m_python->addImportPath("qrc:/python/");
#ifdef Q_OS_MACOS
m_python->addImportPath(applicationDirPath() + "/../Resources/py");
#else
m_python->addImportPath(applicationDirPath());
#endif
}
void Application::installTranslator() {
QSettings settings;
QString preferredLocale = settings.value("app/locale", "system").toString();
QString locale;
if (preferredLocale == "system") {
settings.setValue("app/locale", "system");
locale = QLocale::system().uiLanguages().first().replace("-", "_");
qDebug() << QLocale::system().uiLanguages();
if (locale.isEmpty() || locale == "C") locale = "en_US";
qDebug() << "Detected locale:" << locale;
} else {
locale = preferredLocale;
}
m_translator = QSharedPointer(new QTranslator((QObject*)this));
if (m_translator->load(QString(":/translations/rdm_") + locale)) {
qDebug() << "Load translations file for locale:" << locale;
QCoreApplication::installTranslator(m_translator.data());
} else {
m_translator.clear();
}
}
void Application::processCmdArgs() {
QCommandLineParser parser;
QCommandLineOption settingsDir("settings-dir",
"(Optional) Directory where RESP.app looks/saves "
".rdm directory with connections.json file",
"settingsDir", QDir::homePath());
QCommandLineOption extensionServerUrl(
"extension-server-url",
"(Optional) Overrides extension server url",
"extensionServerUrl",
QString());
QCommandLineOption renderingBackend(
"rendering-backend",
"(Optional) QML rendering backend [software|opengl|d3d12|'']",
"renderingBackend", "auto");
parser.addHelpOption();
parser.addVersionOption();
parser.addOption(settingsDir);
parser.addOption(extensionServerUrl);
parser.addOption(renderingBackend);
parser.process(*this);
m_settingsDir = parser.value(settingsDir);
m_extServerUrl = parser.value(extensionServerUrl);
m_renderingBackend = parser.value(renderingBackend);
}
void Application::updatePalette()
{
if (m_engine.rootObjects().size() == 0) {
qWarning() << "Cannot update palette. Root object is not loaded.";
return;
}
auto rootObject = m_engine.rootObjects().at(0);
rootObject->setProperty("palette", QGuiApplication::palette());
#ifdef Q_OS_WINDOWS
if (!isDarkThemeEnabled()) return;
auto window = qobject_cast(rootObject);
if (window) {
auto winHwnd = reinterpret_cast(window->winId());
BOOL USE_DARK_MODE = true;
BOOL SET_IMMERSIVE_DARK_MODE_SUCCESS = SUCCEEDED(DwmSetWindowAttribute(
winHwnd, 20, &USE_DARK_MODE, sizeof(USE_DARK_MODE)));
if (SET_IMMERSIVE_DARK_MODE_SUCCESS) {
// Dirty hack to re-draw window and apply darkmode color
rootObject->setProperty("visible", false);
rootObject->setProperty("visible", true);
}
}
#endif
}
================================================
FILE: src/app/app.h
================================================
#pragma once
#include
#include
#include
#include
#include
#ifndef APP_VERSION
#include "../version.h"
#endif
class QmlUtils;
class Events;
class ConnectionsManager;
class Updater;
class KeyFactory;
class TabViewModel;
class QPython;
namespace ValueEditor {
class TabsModel;
}
#ifdef ENABLE_EXTERNAL_FORMATTERS
namespace RespExtServer {
class DataFormattersManager;
}
#endif
namespace ValueEditor {
class EmbeddedFormattersManager;
} // namespace ValueEditor
namespace BulkOperations {
class Manager;
}
namespace Console {
class AutocompleteModel;
}
class Application : public QApplication {
Q_OBJECT
public:
Application(int &argc, char **argv);
void initModels();
void initQml();
private:
void initAppInfo();
void initAppFonts();
void initProxySettings();
void initPython();
void registerQmlTypes();
void registerQmlRootObjects();
void installTranslator();
void processCmdArgs();
private slots:
void updatePalette();
private:
QQmlApplicationEngine m_engine;
QSharedPointer m_qmlUtils;
QSharedPointer m_events;
QSharedPointer m_connections;
QSharedPointer m_keyFactory;
QSharedPointer m_keyValues;
#ifdef ENABLE_EXTERNAL_FORMATTERS
QSharedPointer m_extServerManager;
#endif
QSharedPointer m_embeddedFormatters;
QSharedPointer m_bulkOperations;
QSharedPointer m_consoleModel;
QSharedPointer m_serverStatsModel;
QSharedPointer m_consoleAutocompleteModel;
QSharedPointer m_python;
QString m_settingsDir;
QString m_extServerUrl;
QString m_renderingBackend;
QSharedPointer m_translator = nullptr;
};
================================================
FILE: src/app/apputils.h
================================================
#pragma once
#include
#include
inline QString humanReadableSize(qint64 size) {
return QLocale().formattedDataSize(size, 2, QLocale::DataSizeSIFormat);
}
================================================
FILE: src/app/darkmode.h
================================================
#pragma once
#include
#include
bool isDarkThemeEnabled() {
#if defined(Q_OS_WINDOWS)
QSettings settings;
QSettings systemSettings(
"HKEY_CURRENT_"
"USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
QSettings::NativeFormat);
QString darkMode = settings.value("app/darkMode", "Auto").toString();
if (darkMode == "Auto") {
return systemSettings.value("AppsUseLightTheme") == 0;
} else if (darkMode == "On") {
return true;
} else {
return false;
}
#elif defined(Q_OS_LINUX)
QSettings settings;
return settings.value("app/darkModeOn", false).toBool();
#else
return false;
#endif
}
QPalette createDarkModePalette() {
QColor base = QColor(30, 30, 30);
QColor alt = QColor(50, 50, 50);
QColor text = QColor(223, 223, 223);
QColor buttonText = QColor(170, 170, 170);
QColor disabledColor = QColor(127, 127, 127);
QPalette p(alt, base);
p.setColor(QPalette::Light, QColor(76,76,76));
p.setColor(QPalette::Dark, QColor(235,235,235));
p.setColor(QPalette::Midlight, QColor(76,76,76));
p.setColor(QPalette::Mid, QColor(66,66,66));
p.setColor(QPalette::Window, base);
p.setColor(QPalette::WindowText, text);
p.setColor(QPalette::Base, base);
p.setColor(QPalette::AlternateBase, alt);
p.setColor(QPalette::ToolTipBase, alt);
p.setColor(QPalette::ToolTipText, Qt::white);
p.setColor(QPalette::Text, text);
p.setColor(QPalette::Disabled, QPalette::Text, disabledColor);
p.setColor(QPalette::Button, alt);
p.setColor(QPalette::ButtonText, buttonText);
p.setColor(QPalette::Disabled, QPalette::ButtonText, disabledColor);
p.setColor(QPalette::BrightText, text.lighter(80));
p.setColor(QPalette::Link, QColor(42, 130, 218));
p.setColor(QPalette::Highlight, QColor(42, 130, 218));
p.setColor(QPalette::HighlightedText, Qt::black);
p.setColor(QPalette::Disabled, QPalette::HighlightedText, disabledColor);
p.setBrush(QPalette::Active, QPalette::Highlight, QColor(42, 130, 218));
p.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(42, 130, 218));
return p;
}
================================================
FILE: src/app/events.cpp
================================================
#include "events.h"
void Events::registerLoggerForConnection(RedisClient::Connection& c) {
auto self = sharedFromThis().toWeakRef();
QObject::connect(
&c, &RedisClient::Connection::log, this, [self](const QString& info) {
if (!self) return;
emit self.toStrongRef()->log(QString("Connection: %1").arg(info));
}, Qt::QueuedConnection);
QObject::connect(
&c, &RedisClient::Connection::error, this, [self](const QString& error) {
if (!self) return;
emit self.toStrongRef()->log(QString("Connection: %1").arg(error));
}, Qt::QueuedConnection);
}
================================================
FILE: src/app/events.h
================================================
#pragma once
#include
#include
#include
#include
#include
#include
#include
#include "modules/bulk-operations/bulkoperationsmanager.h"
#include "common/callbackwithowner.h"
namespace ConnectionsTree {
class KeyItem;
class TreeItem;
}
class Events : public QObject, public QEnableSharedFromThis {
Q_OBJECT
public:
void registerLoggerForConnection(RedisClient::Connection& c);
signals:
// Tabs
void openValueTab(QSharedPointer connection,
QSharedPointer key,
bool inNewTab);
void openConsole(QSharedPointer connection,
int dbIndex, bool inNewTab,
QList initCmd = QList());
void openServerStats(QSharedPointer connection);
void closeDbKeys(QSharedPointer connection,
int dbIndex,
const QRegExp& filter = QRegExp("*", Qt::CaseSensitive,
QRegExp::Wildcard));
// Dialogs
void requestBulkOperation(
QSharedPointer connection, int dbIndex,
BulkOperations::Manager::Operation op, QRegExp keyPattern,
BulkOperations::AbstractOperation::OperationCallback callback);
void newKeyDialog(
QSharedPointer connection,
QSharedPointer> callback,
int dbIndex, QString keyPrefix);
// Notifications
void error(const QString& msg);
void log(const QString& msg);
void appRendered();
void pythonLoaded();
void externalFormattersLoaded();
};
================================================
FILE: src/app/jsonutils.cpp
================================================
#include "jsonutils.h"
#include
#include
// Based on https://github.com/nlohmann/json/blob/ec7a1d834773f9fee90d8ae908a0c9933c5646fc/src/json.hpp#L4604-L4697
// Copyright © 2013-2015 Niels Lohmann.
// The code is licensed under the MIT License
std::size_t extra_space(const std::string_view& s) noexcept
{
std::size_t result = 0;
for (const auto& c : s)
{
switch (c)
{
case '"':
case '\\':
case '\b':
case '\f':
case '\n':
case '\r':
case '\t':
{
// from c (1 byte) to \x (2 bytes)
result += 1;
break;
}
default:
{
if (c >= 0x00 and c <= 0x1f)
{
// from c (1 byte) to \uxxxx (6 bytes)
result += 5;
}
break;
}
}
}
return result;
}
std::string escape_string(const std::string_view& s) noexcept
{
const auto space = extra_space(s);
if (space == 0)
{
return std::string(s);
}
// create a result string of necessary size
std::string result(s.size() + space, '\\');
std::size_t pos = 0;
for (const auto& c : s)
{
switch (c)
{
// quotation mark (0x22)
case '"':
{
result[pos + 1] = '"';
pos += 2;
break;
}
// reverse solidus (0x5c)
case '\\':
{
// nothing to change
pos += 2;
break;
}
// backspace (0x08)
case '\b':
{
result[pos + 1] = 'b';
pos += 2;
break;
}
// formfeed (0x0c)
case '\f':
{
result[pos + 1] = 'f';
pos += 2;
break;
}
// newline (0x0a)
case '\n':
{
result[pos + 1] = 'n';
pos += 2;
break;
}
// carriage return (0x0d)
case '\r':
{
result[pos + 1] = 'r';
pos += 2;
break;
}
// horizontal tab (0x09)
case '\t':
{
result[pos + 1] = 't';
pos += 2;
break;
}
default:
{
if (c >= 0x00 and c <= 0x1f)
{
// print character c as \uxxxx
std::snprintf(&result[pos + 1], 7, "u%04x", int(c));
pos += 6;
// overwrite trailing null character
result[pos] = '\\';
}
else
{
// all other characters are added as-is
result[pos++] = c;
}
break;
}
}
}
return result;
}
QByteArray escapeJsonKey(std::string_view key) {
return QByteArray::fromStdString(escape_string(key));
}
void print_json(QByteArray &result,
simdjson::ondemand::value element,
long level, bool objectValue = false) {
using namespace simdjson::ondemand;
QByteArray whitespace = QByteArray().fill(' ', level * 2);
bool add_comma;
if (!objectValue) result.append(whitespace);
switch (element.type()) {
case json_type::array:
result.append("[\n");
add_comma = false;
for (auto child : element.get_array()) {
if (add_comma) {
result.append(",\n");
}
print_json(result, child.value(), level + 1);
add_comma = true;
}
result.append('\n');
result.append(whitespace);
result.append("]");
break;
case json_type::object:
result.append("{\n");
add_comma = false;
for (auto field : element.get_object()) {
if (add_comma) {
result.append(",\n");
}
result.append(whitespace);
result.append(" ");
result.append(QString("\"%1\": ")
.arg(QString::fromUtf8(escapeJsonKey(field.unescaped_key())))
.toUtf8());
print_json(result, field.value(), level + 1, true);
add_comma = true;
}
result.append('\n');
result.append(whitespace);
result.append("}");
break;
case json_type::number:
result.append(QByteArray::fromStdString(
std::string(std::string_view(element.raw_json_token())))
.trimmed());
break;
case json_type::string:
result.append(QByteArray::fromStdString(
std::string(std::string_view(element.raw_json_token())))
.trimmed());
break;
case json_type::boolean:
result.append(bool(element) ? "true" : "false");
break;
case json_type::null:
result.append("null");
break;
}
}
QByteArray JSONUtils::prettyPrintJSON(QByteArray val)
{
QByteArray result;
result.reserve(val.size() * 32);
val.resize(val.size() + simdjson::SIMDJSON_PADDING);
simdjson::ondemand::parser p;
try {
auto doc = p.iterate(val.data(), val.size());
if (doc.is_scalar()) {
return val;
}
print_json(result, simdjson::ondemand::value(doc), 0);
} catch (const std::exception& e) {
qDebug() << "Cannot parse JSON:" << e.what();
return QByteArray();
}
return result;
}
QByteArray JSONUtils::minifyJSON(const QByteArray &val)
{
QByteArray minified;
minified.resize(val.size());
size_t new_length{};
auto error = simdjson::minify(val.data(), val.size(), minified.data(), new_length);
if (error != 0) {
qDebug() << "Failed to minify JSON with simdjson:" << error;
return QByteArray();
}
minified.resize(new_length);
return minified;
}
bool JSONUtils::isJSON(QByteArray val)
{
int originalSize = val.size();
val.resize(val.size() + simdjson::SIMDJSON_PADDING);
simdjson::dom::parser parser;
simdjson::dom::element data;
auto error = parser.parse(val.data(), originalSize, false).get(data);
// NOTE(u_glide): Workaround to distinguish invalid JSON and valid JSON with Big Int
if (error == simdjson::NUMBER_ERROR) {
simdjson::ondemand::parser p;
try {
auto doc = p.iterate(val.data(), val.size());
return !doc.is_scalar();
} catch (const std::exception& e) {
qDebug() << "JSON is not valid:" << e.what();
return false;
}
} else if (error != simdjson::SUCCESS) {
qDebug() << "JSON is not valid:" << simdjson::error_message(error);
return false;
}
return true;
}
================================================
FILE: src/app/jsonutils.h
================================================
#pragma once
#include
namespace JSONUtils {
QByteArray prettyPrintJSON(QByteArray val);
bool isJSON(QByteArray val);
QByteArray minifyJSON(const QByteArray& val);
}; // namespace JSONUtils
================================================
FILE: src/app/models/configmanager.cpp
================================================
#include "configmanager.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "app/models/connectionconf.h"
ConfigManager::ConfigManager(const QString &basePath) : m_basePath(basePath) {}
QString ConfigManager::getApplicationConfigPath(const QString &configFile,
bool checkPath) {
QString configDir = getConfigPath(m_basePath);
QDir settingsPath(configDir);
if (!settingsPath.exists() && settingsPath.mkpath(configDir)) {
qDebug() << "Config Dir created";
}
QString configPath = QString("%1/%2").arg(configDir).arg(configFile);
if (checkPath && !chechPath(configPath)) return QString();
return configPath;
}
bool ConfigManager::chechPath(const QString &configPath) {
QFile testConfig(configPath);
QFileInfo checkPermissions(configPath);
if (!testConfig.exists() && testConfig.open(QIODevice::ReadWrite))
testConfig.close();
if (checkPermissions.isWritable()) {
setPermissions(testConfig);
return true;
}
return false;
}
void ConfigManager::setPermissions(QFile &file) {
#ifdef Q_OS_WIN
extern Q_CORE_EXPORT int qt_ntfs_permission_lookup;
qt_ntfs_permission_lookup++;
#endif
if (!file.setPermissions(QFile::ReadUser | QFile::WriteUser))
qWarning() << "Cannot set permissions for config folder";
#ifdef Q_OS_WIN
qt_ntfs_permission_lookup--;
#endif
}
QString ConfigManager::getConfigPath(QString basePath) {
QString configDir;
#ifdef Q_OS_MACX
if (basePath == QDir::homePath()) {
configDir = "/Library/Preferences/rdm/";
} else {
configDir = ".rdm";
}
configDir =
QDir::toNativeSeparators(QString("%1/%2").arg(basePath).arg(configDir));
#else
configDir =
QDir::toNativeSeparators(QString("%1/%2").arg(basePath).arg(".rdm"));
#endif
return configDir;
}
bool saveJsonArrayToFile(const QJsonArray &c, const QString &f) {
QJsonDocument config(c);
QFile confFile(f);
if (confFile.open(QIODevice::WriteOnly)) {
QTextStream outStream(&confFile);
outStream.setCodec("UTF-8");
outStream << config.toJson();
confFile.close();
return true;
}
return false;
}
================================================
FILE: src/app/models/configmanager.h
================================================
#pragma once
#include
#include
#include
#include
class ConfigManager
{
public:
explicit ConfigManager(const QString& basePath = QDir::homePath());
QString getApplicationConfigPath(const QString &, bool checkPath=true);
public:
static QString getConfigPath(QString basePath = QDir::homePath());
private:
static bool chechPath(const QString&);
static void setPermissions(QFile&);
private:
QString m_basePath;
};
bool saveJsonArrayToFile(const QJsonArray& c, const QString& f);
================================================
FILE: src/app/models/connectionconf.cpp
================================================
#include "connectionconf.h"
ServerConfig::ServerConfig(const QString &host, const QString &auth, const uint port, const QString &name)
: RedisClient::ConnectionConfig(host, auth, port, name),
m_owner(QSharedPointer())
{
}
ServerConfig::ServerConfig(const QVariantHash &options)
: RedisClient::ConnectionConfig(options),
m_owner(QSharedPointer())
{
}
QString ServerConfig::keysPattern() const
{
return param("keys_pattern", QString(DEFAULT_KEYS_GLOB_PATTERN));
}
void ServerConfig::setKeysPattern(QString keyGlobPattern)
{
setParam("keys_pattern", keyGlobPattern);
}
QString ServerConfig::namespaceSeparator() const
{
return param("namespace_separator", QString(DEFAULT_NAMESPACE_SEPARATOR));
}
void ServerConfig::setNamespaceSeparator(QString ns)
{
return setParam("namespace_separator", ns);
}
uint ServerConfig::databaseScanLimit() const
{
return param("db_scan_limit", DEFAULT_DB_SCAN_LIMIT);
}
void ServerConfig::setDatabaseScanLimit(uint limit)
{
setParam("db_scan_limit", limit);
}
bool ServerConfig::useSshTunnel() const
{
return RedisClient::ConnectionConfig::useSshTunnel();
}
QWeakPointer ServerConfig::owner() const
{
return m_owner;
}
void ServerConfig::setOwner(QWeakPointer o)
{
m_owner = o;
}
QVariantMap ServerConfig::filterHistory()
{
return param("filter_history");
}
void ServerConfig::setFilterHistory(QVariantMap filterHistory)
{
setParam("filter_history", filterHistory);
}
bool ServerConfig::askForSshPassword() const
{
return param("ask_ssh_password", false);
}
void ServerConfig::setAskForSshPassword(bool v)
{
setParam("ask_ssh_password", v);
}
QString ServerConfig::defaultFormatter() const
{
return param("default_formatter", QString("auto"));
}
void ServerConfig::setDefaultFormatter(const QString &v)
{
setParam("default_formatter", v);
}
QString ServerConfig::iconColor() const
{
return param("icon_color", QString(""));
}
void ServerConfig::setIconColor(const QString &v)
{
setParam("icon_color", v);
}
================================================
FILE: src/app/models/connectionconf.h
================================================
#pragma once
#include
#include
class TreeOperations;
class ServerConfig : public RedisClient::ConnectionConfig
{
Q_GADGET
/* Basic settings */
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString host READ host WRITE setHost)
Q_PROPERTY(uint port READ port WRITE setPort)
Q_PROPERTY(QString auth READ auth WRITE setAuth)
Q_PROPERTY(QString username READ username WRITE setUsername)
/* SSL settings */
Q_PROPERTY(bool sslEnabled READ useSsl WRITE setSsl)
Q_PROPERTY(QString sslLocalCertPath READ sslLocalCertPath WRITE setSslLocalCertPath)
Q_PROPERTY(QString sslPrivateKeyPath READ sslPrivateKeyPath WRITE setSslPrivateKeyPath)
Q_PROPERTY(QString sslCaCertPath READ sslCaCertPath WRITE setSslCaCertPath)
/* SSH Settings */
Q_PROPERTY(QString sshPassword READ sshPassword WRITE setSshPassword)
Q_PROPERTY(bool askForSshPassword READ askForSshPassword WRITE setAskForSshPassword)
Q_PROPERTY(QString sshUser READ sshUser WRITE setSshUser)
Q_PROPERTY(QString sshHost READ sshHost WRITE setSshHost)
Q_PROPERTY(uint sshPort READ sshPort WRITE setSshPort)
Q_PROPERTY(QString sshPrivateKey READ getSshPrivateKeyPath WRITE setSshPrivateKeyPath)
Q_PROPERTY(bool sshAgent READ sshAgent WRITE setSshAgent)
Q_PROPERTY(QString sshAgentPath READ sshAgentPath WRITE setSshAgentPath)
/* Advanced settings */
Q_PROPERTY(QString keysPattern READ keysPattern WRITE setKeysPattern)
Q_PROPERTY(QString namespaceSeparator READ namespaceSeparator WRITE setNamespaceSeparator)
Q_PROPERTY(uint executeTimeout READ executeTimeout WRITE setExecutionTimeout)
Q_PROPERTY(uint connectionTimeout READ connectionTimeout WRITE setConnectionTimeout)
Q_PROPERTY(bool overrideClusterHost READ overrideClusterHost WRITE setClusterHostOverride)
Q_PROPERTY(bool ignoreSSLErrors READ ignoreAllSslErrors WRITE setIgnoreAllSslErrors)
Q_PROPERTY(uint databaseScanLimit READ databaseScanLimit WRITE setDatabaseScanLimit)
Q_PROPERTY(QString defaultFormatter READ defaultFormatter WRITE setDefaultFormatter)
Q_PROPERTY(QString iconColor READ iconColor WRITE setIconColor)
public:
static const char DEFAULT_NAMESPACE_SEPARATOR = ':';
static const char DEFAULT_KEYS_GLOB_PATTERN = '*';
static const bool DEFAULT_LUA_KEYS_LOADING = false;
static const uint DEFAULT_DB_SCAN_LIMIT = 20;
static constexpr const char* SSH_SECRET_ID = "ssh_password";
public:
ServerConfig(const QString & host = "127.0.0.1", const QString & auth = "",
const uint port = DEFAULT_REDIS_PORT, const QString & name = "");
explicit ServerConfig(const QVariantHash& options);
QString keysPattern() const;
void setKeysPattern(QString keyGlobPattern);
QString namespaceSeparator() const;
void setNamespaceSeparator(QString);
void setLuaKeysLoading(bool);
uint databaseScanLimit() const;
void setDatabaseScanLimit(uint limit);
Q_INVOKABLE bool useSshTunnel() const;
QWeakPointer owner() const;
void setOwner(QWeakPointer o);
QVariantMap filterHistory();
void setFilterHistory(QVariantMap filterHistory);
bool askForSshPassword() const;
void setAskForSshPassword(bool v);
QString defaultFormatter() const;
void setDefaultFormatter(const QString& v);
QString iconColor() const;
void setIconColor(const QString& v);
private:
QWeakPointer m_owner;
};
Q_DECLARE_METATYPE(ServerConfig)
================================================
FILE: src/app/models/connectiongroup.cpp
================================================
#include "connectiongroup.h"
#include "connections-tree/items/servergroup.h"
ConnectionGroup::ConnectionGroup(QSharedPointer g)
: m_group(g) {}
ConnectionGroup::ConnectionGroup() : m_group(nullptr) {}
QString ConnectionGroup::name() const {
if (!m_group) return QString();
return m_group->getDisplayName();
}
void ConnectionGroup::setName(const QString &n) {
if (m_group) m_group->setName(n);
}
QSharedPointer ConnectionGroup::serverGroup() const {
return m_group;
}
================================================
FILE: src/app/models/connectiongroup.h
================================================
#pragma once
#include
#include
namespace ConnectionsTree {
class ServerGroup;
}
class ConnectionGroup {
Q_GADGET
Q_PROPERTY(QString name READ name WRITE setName)
public:
ConnectionGroup();
ConnectionGroup(QSharedPointer g);
QString name() const;
void setName(const QString& n);
QSharedPointer serverGroup() const;
private:
QSharedPointer m_group;
};
Q_DECLARE_METATYPE(ConnectionGroup)
================================================
FILE: src/app/models/connectionsmanager.cpp
================================================
#include "connectionsmanager.h"
#include
#include
#include
#include
#include
#include
#include "app/events.h"
#include "configmanager.h"
#include "modules/bulk-operations/bulkoperationsmanager.h"
#include "modules/connections-tree/items/serveritem.h"
#include "modules/connections-tree/items/servergroup.h"
#include "modules/value-editor/tabsmodel.h"
ConnectionsManager::ConnectionsManager(const QString& configPath,
QSharedPointer events)
: ConnectionsTree::Model(), m_configPath(configPath), m_events(events) {
connect(this, &ConnectionsTree::Model::error, m_events.data(),
&Events::error);
}
void ConnectionsManager::loadConnections() {
if (!m_configPath.isEmpty() && QFile::exists(m_configPath)) {
loadConnectionsConfigFromFile(m_configPath);
}
emit connectionsLoaded();
}
void ConnectionsManager::addNewConnection(
const ServerConfig& config, bool saveToConfig,
QSharedPointer group) {
createServerItemForConnection(config, group);
if (saveToConfig) saveConfig();
buildConnectionsCache();
}
void ConnectionsManager::addNewGroup(const QString& name) {
auto group = QSharedPointer(
new ConnectionsTree::ServerGroup(
name, *static_cast(this)));
addGroup(group);
saveConfig();
}
void ConnectionsManager::updateGroup(const ConnectionGroup &group)
{
auto serverGroup = group.serverGroup();
if (!serverGroup){
qWarning() << "invalid server group";
return;
}
emit itemChanged(serverGroup);
saveConfig();
buildConnectionsCache();
}
void ConnectionsManager::updateConnection(const ServerConfig& config) {
if (!config.owner()) return addNewConnection(config);
auto treeOperations = config.owner().toStrongRef();
if (!treeOperations) return;
treeOperations->setConfig(config);
saveConfig();
}
bool ConnectionsManager::importConnections(const QString& path) {
if (loadConnectionsConfigFromFile(path, true)) {
emit sizeChanged();
return true;
}
return false;
}
bool ConnectionsManager::loadConnectionsConfigFromFile(const QString& config,
bool saveChangesToFile) {
QJsonArray connections;
QFile conf(config);
if (!conf.open(QIODevice::ReadOnly)) return false;
QByteArray data = conf.readAll();
conf.close();
QJsonDocument jsonConfig = QJsonDocument::fromJson(data);
if (jsonConfig.isEmpty()) return true;
if (!jsonConfig.isArray()) {
return false;
}
connections = jsonConfig.array();
for (QJsonValue connection : connections) {
if (!connection.isObject()) continue;
auto obj = connection.toObject();
bool isValidGroup = obj.contains("type") && obj.contains("connections") &&
obj.contains("name") && obj["connections"].isArray() &&
obj["type"].toString().toLower() == "group";
if (isValidGroup) {
auto groupConnections = obj["connections"].toArray();
auto group = QSharedPointer(
new ConnectionsTree::ServerGroup(
obj["name"].toString(),
*static_cast(this)));
for (const QJsonValue &c : qAsConst(groupConnections)) {
if (!c.isObject()) continue;
ServerConfig conf(c.toObject().toVariantHash());
if (conf.isNull()) continue;
conf.setId(QUuid::createUuid().toByteArray());
addNewConnection(conf, false, group);
}
addGroup(group);
} else {
ServerConfig conf(obj.toVariantHash());
if (conf.isNull()) continue;
addNewConnection(conf, false);
}
}
if (saveChangesToFile) saveConfig();
buildConnectionsCache();
return true;
}
void ConnectionsManager::tryToConnect(const ServerConfig &config, QJSValue jsCallback)
{
RedisClient::Connection testConnection(config);
m_events->registerLoggerForConnection(testConnection);
try {
jsCallback.call(QJSValueList{testConnection.connect()});
} catch (const RedisClient::Connection::Exception&) {
jsCallback.call(QJSValueList{false});
}
}
void ConnectionsManager::saveConfig() {
saveConnectionsConfigToFile(m_configPath);
}
bool ConnectionsManager::saveConnectionsConfigToFile(
const QString& pathToFile) {
QJsonArray connections;
auto addConfig = [](QSharedPointer i,
QJsonArray& connections) {
auto srvItem = i.dynamicCast();
if (!srvItem) return;
auto op = srvItem->getOperations().dynamicCast();
if (!op) return;
auto config = op->config();
QSet ignoreFields {"id"};
if (config.askForSshPassword()) {
ignoreFields.insert(ServerConfig::SSH_SECRET_ID);
}
connections.push_back(QJsonValue(config.toJsonObject(ignoreFields)));
};
for (auto item : m_treeItems) {
if (item->type() == "server_group") {
QJsonObject group;
group["type"] = "group";
group["name"] = item->getDisplayName();
QJsonArray groupConnections;
for (auto srv : item->getAllChilds()) {
addConfig(srv, groupConnections);
}
group["connections"] = groupConnections;
connections.push_back(QJsonValue(group));
} else if (item->type() == "server") {
addConfig(item, connections);
}
}
return saveJsonArrayToFile(connections, pathToFile);
}
void ConnectionsManager::testConnectionSettings(const ServerConfig& config,
QJSValue jsCallback) {
if (!jsCallback.isCallable()) {
qDebug() << "JS callback is not callable";
return;
}
if (config.askForSshPassword()) {
m_jsCallback = jsCallback;
emit askUserForConnectionSecret(config, ServerConfig::SSH_SECRET_ID);
} else {
tryToConnect(config, jsCallback);
}
}
void ConnectionsManager::proceedWithConnectionSecret(const ServerConfig &config)
{
if (m_jsCallback.isCallable()) {
tryToConnect(config, m_jsCallback);
m_jsCallback = QJSValue();
return;
}
if (!config.owner()) {
qWarning() << "Invalid config with secret";
return;
}
auto treeOperations = config.owner().toStrongRef();
if (!treeOperations) {
qWarning() << "Config with secret doesn't have owner";
return;
}
treeOperations->proceedWithSecret(config);
}
ServerConfig ConnectionsManager::createEmptyConfig() const {
return ServerConfig();
}
ServerConfig ConnectionsManager::parseConfigFromRedisConnectionString(const QString& connectionString) const {
QUrl url = QUrl(connectionString);
QUrlQuery query = QUrlQuery(url.query());
ServerConfig config;
config.setHost(url.host().isEmpty() || url.host() == "localhost" ? "127.0.0.1" : url.host());
config.setPort(url.port() == -1 ? 6379 : url.port());
config.setUsername(url.userName());
config.setAuth(url.password().isEmpty() ? query.queryItemValue("password") : url.password());
if (url.scheme() == "rediss" || (!query.isEmpty() && query.queryItemValue("ssl") == "true")) {
config.setSsl(true);
}
return config;
}
bool ConnectionsManager::isRedisConnectionStringValid(
const QString& connectionString) {
QUrl url;
if (connectionString.startsWith("redis://") ||
connectionString.startsWith("rediss://")) {
url = QUrl(connectionString);
} else {
url = QUrl(QString("redis://%1").arg(connectionString));
}
return url.isValid() &&
(url.scheme() == "redis" || url.scheme() == "rediss") &&
!url.host().isEmpty();
}
int ConnectionsManager::size() {
int connectionsCount = 0;
for (auto item : qAsConst(m_treeItems)) {
if (item->type() == "server_group") {
connectionsCount += item->childCount();
} else if (item->type() == "server") {
connectionsCount++;
}
}
return connectionsCount;
}
QSharedPointer ConnectionsManager::getByIndex(
int index) {
auto op = m_connectionsCache.values().at(index)->getOperations();
if (!op) return QSharedPointer();
auto treeOp = op.dynamicCast();
if (!treeOp) return QSharedPointer();
return treeOp->connection();
}
QStringList ConnectionsManager::getConnections() {
return m_connectionsCache.keys();
}
void ConnectionsManager::applyGroupChanges() {
ConnectionsTree::Model::applyGroupChanges();
buildConnectionsCache();
saveConfig();
}
void ConnectionsManager::createServerItemForConnection(
const ServerConfig& config,
QSharedPointer group) {
using namespace ConnectionsTree;
auto treeModel =
QSharedPointer(new TreeOperations(config, m_events));
connect(treeModel.data(), &TreeOperations::createNewConnection, this,
[this](const ServerConfig& config) { addNewConnection(config); });
connect(treeModel.data(), &TreeOperations::secretRequired, this,
&ConnectionsManager::askUserForConnectionSecret);
QWeakPointer parent;
if (group) {
parent = group.toWeakRef();
}
auto serverItem = QSharedPointer(
new ServerItem(treeModel.dynamicCast(),
*static_cast(this), parent));
serverItem->setWeakPointer(serverItem.toWeakRef());
connect(
treeModel.data(), &TreeOperations::configUpdated, this,
[this, serverItem]() {
if (!serverItem) return;
emit itemChanged(
serverItem.dynamicCast().toWeakRef());
});
connect(treeModel.data(), &TreeOperations::filterHistoryUpdated,
this, [this]() {
saveConfig();
});
connect(serverItem.data(), &ConnectionsTree::ServerItem::editActionRequested,
this, [this, treeModel]() {
if (!treeModel) return;
auto config = treeModel->config();
emit connectionAboutToBeEdited(config.name());
// NOTE(u_glide): Do not show temproary stored password in the UI
if (config.askForSshPassword()) {
config.setSshPassword(QString());
}
emit editConnection(config);
});
connect(serverItem.data(),
&ConnectionsTree::ServerItem::deleteActionRequested, this,
[this, serverItem, treeModel, group]() {
if (!serverItem || !treeModel) return;
emit connectionAboutToBeEdited(treeModel->config().name());
if (group) {
group->removeConnection(serverItem);
} else {
removeRootItem(serverItem);
}
buildConnectionsCache();
emit sizeChanged();
saveConfig();
});
if (group) {
group->addServer(serverItem);
} else {
addRootItem(serverItem);
}
}
void ConnectionsManager::addGroup(
QSharedPointer group) {
connect(group.data(), &ConnectionsTree::ServerGroup::editActionRequested,
this, [this, group]() {
if (!group) return;
ConnectionGroup g(group);
emit editConnectionGroup(g);
});
connect(group.data(), &ConnectionsTree::ServerGroup::deleteActionRequested,
this, [this, group]() {
if (!group) return;
removeRootItem(group);
buildConnectionsCache();
emit sizeChanged();
saveConfig();
});
addRootItem(group);
buildConnectionsCache();
}
void ConnectionsManager::buildConnectionsCache() {
m_connectionsCache.clear();
for (auto item : m_treeItems) {
if (item->type() == "server_group") {
QString nameTemplate = QString("[%1] %2").arg(item->getDisplayName());
for (auto srv : item->getAllChilds()) {
QString name = nameTemplate.arg(srv->getDisplayName());
m_connectionsCache[name] =
srv.dynamicCast();
}
} else if (item->type() == "server") {
m_connectionsCache[item->getDisplayName()] =
item.dynamicCast();
}
}
}
================================================
FILE: src/app/models/connectionsmanager.h
================================================
#pragma once
#include
#include
#include
#include "app/models/connectionconf.h"
#include "bulk-operations/connections.h"
#include "connections-tree/model.h"
#include "treeoperations.h"
#include "connectiongroup.h"
namespace ValueEditor {
class TabsModel;
}
namespace ConnectionsTree {
class ServerGroup;
}
class Events;
class ConnectionsManager : public ConnectionsTree::Model,
public BulkOperations::ConnectionsModel {
Q_OBJECT
Q_PROPERTY(int connectionsCount READ size NOTIFY sizeChanged)
public:
ConnectionsManager(const QString& m_configPath,
QSharedPointer events);
void loadConnections();
Q_INVOKABLE void addNewConnection(const ServerConfig& config,
bool saveToConfig = true,
QSharedPointer group =
QSharedPointer());
Q_INVOKABLE void addNewGroup(const QString& name);
Q_INVOKABLE void updateGroup(const ConnectionGroup& group);
Q_INVOKABLE void updateConnection(const ServerConfig& config);
Q_INVOKABLE bool importConnections(const QString&);
Q_INVOKABLE bool saveConnectionsConfigToFile(const QString&);
Q_INVOKABLE void testConnectionSettings(const ServerConfig& config, QJSValue jsCallback);
Q_INVOKABLE void proceedWithConnectionSecret(const ServerConfig& config);
Q_INVOKABLE ServerConfig createEmptyConfig() const;
Q_INVOKABLE ServerConfig parseConfigFromRedisConnectionString(const QString&) const;
Q_INVOKABLE bool isRedisConnectionStringValid(const QString&);
void saveConfig();
Q_INVOKABLE int size() override;
// BulkOperations model methods
QSharedPointer getByIndex(int index) override;
QStringList getConnections() override;
void applyGroupChanges() override;
signals:
void editConnection(ServerConfig config);
void editConnectionGroup(ConnectionGroup group);
void connectionAboutToBeEdited(QString name);
void sizeChanged();
void connectionsLoaded();
void askUserForConnectionSecret(const ServerConfig& config, const QString& id);
protected:
bool loadConnectionsConfigFromFile(const QString& config,
bool saveChangesToFile = false);
void tryToConnect(const ServerConfig& config, QJSValue jsCallback);
private:
void createServerItemForConnection(const ServerConfig &config,
QSharedPointer group=QSharedPointer());
void addGroup(QSharedPointer serverGroup);
void buildConnectionsCache();
private:
QString m_configPath;
QSharedPointer m_events;
QJSValue m_jsCallback;
QMap> m_connectionsCache;
};
================================================
FILE: src/app/models/key-models/abstractkey.h
================================================
#pragma once
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "modules/value-editor/keymodel.h"
#include "rowcache.h"
#include "app/models/connectionconf.h"
template
class KeyModel : public ValueEditor::Model {
public:
KeyModel(QSharedPointer connection,
QByteArray fullPath, int dbIndex, long long ttl,
QByteArray rowsCountCmd = QByteArray(),
QByteArray rowsLoadCmd = QByteArray())
: m_connection(connection),
m_keyFullPath(fullPath),
m_dbIndex(dbIndex),
m_ttl(ttl),
m_rowCount(0),
m_isMultiRow(!rowsCountCmd.isEmpty()),
m_rowsCountCmd(rowsCountCmd),
m_rowsLoadCmd(rowsLoadCmd),
m_scanCursor(0),
m_notifier(new ValueEditor::ModelSignals(), &QObject::deleteLater) {}
virtual QString getKeyName() override {
return printableString(m_keyFullPath);
}
virtual QString getKeyTitle(int limit=-1) override {
QString fullTitle = QString("%1::db%2::%3")
.arg(m_connection->getConfig().name())
.arg(m_dbIndex)
.arg(getKeyName());
int length = fullTitle.size();
if (limit == -1 || length <= limit){
return fullTitle;
} else {
return QString("%1 ... %2").arg(fullTitle.mid(0, limit/2)).arg(fullTitle.mid(length - limit/2));
}
}
virtual long long getTTL() override { return m_ttl; }
virtual bool isMultiRow() const override { return m_isMultiRow; }
virtual bool isRowLoaded(int rowIndex) override {
return m_rowsCache.isRowLoaded(rowIndex);
}
virtual unsigned long rowsCount() override {
if (isMultiRow())
return m_rowCount;
else
return 1;
}
virtual void setKeyName(const QByteArray& newKeyName,
ValueEditor::Model::Callback c) override {
// NOTE(u_glide): DUMP + RESTORE + DEL is cluster compatible alternative to RENAME command
executeCmd(
{"DUMP", m_keyFullPath}, c,
[this, newKeyName](RedisClient::Response r, Callback c) {
executeCmd(
{"RESTORE", newKeyName,
QString::number(m_ttl > 0 ? m_ttl : 0).toLatin1(),
r.value().toByteArray()},
c,
[this, newKeyName](RedisClient::Response r, Callback c) {
if (!r.isOkMessage()) {
return c(QCoreApplication::translate(
"RESP", "Cannot rename key %1: %2")
.arg(getKeyName())
.arg(r.value().toString()));
}
executeCmd(
{"DEL", m_keyFullPath}, [](const QString&) {},
[](RedisClient::Response, Callback) {});
m_keyFullPath = newKeyName;
c(QString());
},
RedisClient::Response::Type::Status);
},
RedisClient::Response::Type::String);
}
virtual void setTTL(const long long ttl,
ValueEditor::Model::Callback c) override {
executeCmd(
{"EXPIRE", m_keyFullPath, QString::number(ttl).toLatin1()}, c,
[this, ttl](RedisClient::Response r, Callback c) {
if (r.value().toInt() == 0) {
return c(
QCoreApplication::translate("RESP", "Cannot set TTL for key %1")
.arg(getKeyName()));
}
if (ttl >= 0)
m_ttl = ttl;
else
m_ttl = -1;
c(QString());
},
RedisClient::Response::Type::Integer);
}
virtual void persistKey(Callback c) override {
executeCmd(
{"PERSIST", m_keyFullPath}, c,
[this](RedisClient::Response r, Callback c) {
if (r.value().toInt() == 0) {
return c(QCoreApplication::translate(
"RESP",
"Cannot persist key '%1'.
Key does not exist or "
"does not have an assigned TTL value")
.arg(getKeyName()));
}
m_ttl = -1;
c(QString());
},
RedisClient::Response::Type::Integer);
}
virtual void removeKey(ValueEditor::Model::Callback c) override {
executeCmd({"DEL", m_keyFullPath}, c,
[this](RedisClient::Response, Callback c) {
m_notifier->removed();
c(QString());
});
}
virtual void loadRows(QVariant rowStart, unsigned long count,
LoadRowsCallback callback) override {
if (m_rowsLoadCmd.mid(1, 4).toLower() == "scan") {
QList cmdParts = {m_rowsLoadCmd, m_keyFullPath,
QString::number(m_scanCursor).toLatin1(),
"COUNT", QString::number(count).toLatin1()};
auto self = ValueEditor::Model::sharedFromThis().toWeakRef();
m_connection->cmd(
cmdParts, m_notifier.data(), -1,
[this, callback, rowStart, self](RedisClient::Response r) {
if (!r.isValidScanResponse()) {
callback(QCoreApplication::translate(
"RESP", "Cannot parse scan response"),
0);
return;
}
if (r.getCursor() > 0) {
m_scanCursor = r.getCursor();
}
try {
unsigned long addedRows =
addLoadedRowsToCache(r.getCollection(), rowStart);
callback(QString(), addedRows);
} catch (const std::runtime_error& e) {
callback(QString(e.what()), 0);
}
},
[self, callback](QString err) {
if (!self) {
return;
}
return callback(
QCoreApplication::translate("RESP", "Connection error: ") + err,
0);
});
} else {
getRowsRange(
getRangeCmd(rowStart, count),
[this, callback, rowStart](const QString& err, QVariantList result) {
if (!err.isEmpty()) return callback(err, 0);
unsigned long addedRows = addLoadedRowsToCache(result, rowStart);
callback(QString(), addedRows);
});
}
}
virtual void clearRowCache() override { m_rowsCache.clear(); }
virtual QSharedPointer getConnector()
const override {
return m_notifier;
}
virtual QSharedPointer getConnection()
const override {
return m_connection;
}
virtual QString getDefaultFormatter() const override{
if (!m_connection)
return QString("auto");
// TODO(u_glide): Pass ServerConfig to KeyModel and remove this
return m_connection->getConfig().getInternalParameters().value("default_formatter", QString("auto")).toString();
}
virtual unsigned int dbIndex() const override { return m_dbIndex; }
virtual void loadRowsCount(ValueEditor::Model::Callback c) override {
if (!isMultiRow()) {
m_rowCount = 1;
return c(QString());
}
executeCmd(
{m_rowsCountCmd, m_keyFullPath}, c,
[this](RedisClient::Response r, Callback c) {
m_rowCount = r.value().toUInt();
c(QString());
},
RedisClient::Response::Type::Integer);
}
protected:
// multi row internal operations
virtual QList getRangeCmd(QVariant rowStartId,
unsigned long count) {
QList cmd;
unsigned long rowStart = rowStartId.toULongLong();
unsigned long rowEnd = std::min(m_rowCount, rowStart + count) - 1;
if (m_rowsLoadCmd.contains(' ')) {
QList suffixCmd(m_rowsLoadCmd.split(' '));
cmd << suffixCmd.takeFirst();
cmd << m_keyFullPath << QString::number(rowStart).toLatin1()
<< QString::number(rowEnd).toLatin1();
cmd += suffixCmd;
} else {
cmd << m_rowsLoadCmd << m_keyFullPath
<< QString::number(rowStart).toLatin1()
<< QString::number(rowEnd).toLatin1();
}
return cmd;
}
virtual void getRowsRange(
const QList& rangeCmd,
std::function callback) {
try {
m_connection->command(
rangeCmd, getConnector().data(),
[this, callback](RedisClient::Response r, QString e) {
if (!e.isEmpty()) {
return callback(e, QVariantList());
}
if (r.type() != RedisClient::Response::Array) {
return callback(QCoreApplication::translate(
"RESP", "Cannot load rows for key %1: %2")
.arg(getKeyName()),
QVariantList());
}
return callback(QString(), r.value().toList());
},
-1);
} catch (const RedisClient::Connection::Exception& e) {
callback(
QCoreApplication::translate("RESP", "Cannot load rows for key %1: %2")
.arg(getKeyName())
.arg(e.what()),
QVariantList());
}
}
// row validator
virtual bool isRowValid(const QVariantMap& row) {
if (row.isEmpty()) return false;
QSet validKeys;
foreach (QByteArray role, getRoles().values()) { validKeys.insert(role); }
QMapIterator i(row);
while (i.hasNext()) {
i.next();
if (!validKeys.contains(i.key())) return false;
}
return true;
}
virtual void setRemovedIfEmpty() {
if (m_rowCount == 0) {
m_notifier->removed();
}
}
typedef std::function CmdHandler;
virtual void executeCmd(QList cmd, Callback c,
CmdHandler handler = CmdHandler(),
RedisClient::Response::Type expectedType =
RedisClient::Response::Type::Unknown) {
m_connection->cmd(
cmd, m_notifier.data(), -1,
[c, handler, expectedType](RedisClient::Response r) {
if (expectedType != RedisClient::Response::Type::Unknown &&
r.type() != expectedType) {
return c(QCoreApplication::translate(
"RESP", "Server returned unexpected response: ") +
r.value().toString());
}
if (handler) {
return handler(r, c);
} else {
return c(QString());
}
},
[c](QString err) {
return c(QCoreApplication::translate("RESP", "Connection error: ") +
err);
});
}
virtual int addLoadedRowsToCache(const QVariantList& rows,
QVariant rowStart) = 0;
QVariant filter(const QString& key) const override {
return m_filters.value(key, QVariant());
};
void setFilter(const QString& k, QVariant v) override {
m_filters[k] = v;
qDebug() << "filter:" << k << v;
}
protected:
QSharedPointer m_connection;
QByteArray m_keyFullPath;
int m_dbIndex;
long long m_ttl;
unsigned long m_rowCount;
bool m_isMultiRow;
// CMD strings
QByteArray m_rowsCountCmd;
QByteArray m_rowsLoadCmd;
MappedCache m_rowsCache;
long long m_scanCursor;
QSharedPointer m_notifier;
QVariantMap m_filters;
};
================================================
FILE: src/app/models/key-models/bfkey.cpp
================================================
#include "bfkey.h"
#include
BloomFilterKeyModel::BloomFilterKeyModel(
QSharedPointer connection, QByteArray fullPath,
int dbIndex, long long ttl, QString filterFamily)
: KeyModel(connection, fullPath, dbIndex, ttl), m_type(filterFamily) {}
QString BloomFilterKeyModel::type() { return m_type; }
QStringList BloomFilterKeyModel::getColumnNames() {
return QStringList() << "value";
}
QHash BloomFilterKeyModel::getRoles() {
QHash roles;
roles[Roles::Value] = "value";
return roles;
}
QVariant BloomFilterKeyModel::getData(int rowIndex, int dataRole) {
if (rowIndex > 0 || !isRowLoaded(rowIndex)) return QVariant();
if (dataRole == Roles::Value)
return QJsonDocument::fromVariant(m_rowsCache[rowIndex])
.toJson(QJsonDocument::Compact);
return QVariant();
}
void BloomFilterKeyModel::addRow(const QVariantMap& row, Callback c) {
QByteArray value = row.value("value").toByteArray();
executeCmd({QString("%1.ADD").arg(m_type).toLatin1(), m_keyFullPath, value},
[this, c](const QString& err) {
m_rowCount++;
return c(err);
});
}
void BloomFilterKeyModel::loadRows(QVariant, unsigned long,
LoadRowsCallback callback) {
auto onConnectionError = [callback](const QString& err) {
return callback(err, 0);
};
auto responseHandler = [this, callback](const RedisClient::Response& r, Callback) {
m_rowsCache.clear();
auto value = r.value().toList();
QVariantMap row;
for (auto item = value.cbegin(); item != value.cend(); ++item) {
auto key = item->toByteArray();
++item;
if (item == value.cend()) {
emit m_notifier->error(QCoreApplication::translate(
"RESP", "Data was loaded from server partially."));
break;
}
auto keyVal = item->toByteArray();
row[key] = keyVal;
}
m_rowsCache.push_back(row);
callback(QString(), 1);
};
executeCmd({QString("%1.INFO").arg(m_type).toLatin1(), m_keyFullPath},
onConnectionError, responseHandler, RedisClient::Response::Array);
}
================================================
FILE: src/app/models/key-models/bfkey.h
================================================
#pragma once
#include "stringkey.h"
class BloomFilterKeyModel : public KeyModel {
public:
BloomFilterKeyModel(QSharedPointer connection,
QByteArray fullPath, int dbIndex, long long ttl, QString filterFamily="bf");
QString type() override;
QStringList getColumnNames() override;
QHash getRoles() override;
QVariant getData(int rowIndex, int dataRole) override;
void addRow(const QVariantMap&, Callback c) override;
virtual void updateRow(int, const QVariantMap&,
Callback) override {
// NOTE(u_glide): BF/CF is read-only
}
void loadRows(QVariant, unsigned long, LoadRowsCallback callback) override;
void removeRow(int, Callback) override {
// NOTE(u_glide): BF/CF is read-only
}
virtual unsigned long rowsCount() override { return m_rowCount; }
protected:
int addLoadedRowsToCache(const QVariantList&, QVariant) override { return 1; }
private:
enum Roles { Value = Qt::UserRole + 1 };
QString m_type;
};
================================================
FILE: src/app/models/key-models/hashkey.cpp
================================================
#include "hashkey.h"
#include
#include
HashKeyModel::HashKeyModel(QSharedPointer connection,
QByteArray fullPath, int dbIndex, long long ttl)
: KeyModel(connection, fullPath, dbIndex, ttl, "HLEN", "HSCAN") {}
QString HashKeyModel::type() { return "hash"; }
QStringList HashKeyModel::getColumnNames() {
return QStringList() << "rowNumber"
<< "key"
<< "value";
}
QHash HashKeyModel::getRoles() {
QHash roles;
roles[Roles::RowNumber] = "rowNumber";
roles[Roles::Key] = "key";
roles[Roles::Value] = "value";
return roles;
}
QVariant HashKeyModel::getData(int rowIndex, int dataRole) {
if (!isRowLoaded(rowIndex)) return QVariant();
QPair row = m_rowsCache[rowIndex];
if (dataRole == Roles::Key)
return row.first;
else if (dataRole == Roles::Value)
return row.second;
else if (dataRole == Roles::RowNumber)
return rowIndex;
return QVariant();
}
void HashKeyModel::updateRow(int rowIndex, const QVariantMap &row, Callback c) {
if (!isRowLoaded(rowIndex) || !isRowValid(row)) {
c(QCoreApplication::translate("RESP", "Invalid row"));
return;
}
QPair cachedRow = m_rowsCache[rowIndex];
bool keyChanged = cachedRow.first != row["key"].toByteArray();
bool valueChanged = cachedRow.second != row["value"].toByteArray();
QPair newRow(
(keyChanged) ? row["key"].toByteArray() : cachedRow.first,
(valueChanged) ? row["value"].toByteArray() : cachedRow.second);
auto afterValueUpdate = [this, c, rowIndex, newRow](const QString &err) {
if (err.isEmpty()) m_rowsCache.replace(rowIndex, newRow);
return c(err);
};
if (keyChanged) {
deleteHashRow(cachedRow.first,
[this, c, newRow, afterValueUpdate](const QString &err) {
if (err.size() > 0) return c(err);
setHashRow(newRow.first, newRow.second, afterValueUpdate);
});
} else {
setHashRow(newRow.first, newRow.second, afterValueUpdate);
}
}
void HashKeyModel::addRow(const QVariantMap &row, Callback c) {
if (!isRowValid(row)) {
c(QCoreApplication::translate("RESP", "Invalid row"));
return;
}
setHashRow(
row["key"].toByteArray(), row["value"].toByteArray(),
[this, c](const QString &err) {
if (err.isEmpty()) m_rowCount++;
return c(err);
},
false);
}
void HashKeyModel::removeRow(int i, Callback c) {
if (!isRowLoaded(i)) return;
QPair row = m_rowsCache[i];
deleteHashRow(row.first, [this, i, c](const QString &err) {
if (err.isEmpty()) {
m_rowCount--;
m_rowsCache.removeAt(i);
setRemovedIfEmpty();
}
return c(err);
});
}
void HashKeyModel::setHashRow(const QByteArray &hashKey,
const QByteArray &hashValue, Callback c,
bool updateIfNotExist) {
QList rawCmd{(updateIfNotExist) ? "HSET" : "HSETNX",
m_keyFullPath, hashKey, hashValue};
executeCmd(rawCmd, c,
[updateIfNotExist](RedisClient::Response r, Callback c) {
if (updateIfNotExist == false && r.value().toInt() == 0) {
return c(QCoreApplication::translate(
"RESP", "Value with the same key already exists"));
} else {
return c(QString());
}
});
}
void HashKeyModel::deleteHashRow(const QByteArray &hashKey, Callback c) {
executeCmd({"HDEL", m_keyFullPath, hashKey}, c);
}
int HashKeyModel::addLoadedRowsToCache(const QVariantList &rows,
QVariant rowStartId) {
QList> result;
for (QVariantList::const_iterator item = rows.begin(); item != rows.end();
++item) {
QPair value;
value.first = item->toByteArray();
++item;
if (item == rows.end()) {
emit m_notifier->error(QCoreApplication::translate(
"RESP", "Data was loaded from server partially."));
return 0;
}
value.second = item->toByteArray();
result.push_back(value);
}
auto rowStart = rowStartId.toLongLong();
m_rowsCache.addLoadedRange({rowStart, rowStart + result.size() - 1}, result);
return result.size();
}
================================================
FILE: src/app/models/key-models/hashkey.h
================================================
#pragma once
#include "abstractkey.h"
class HashKeyModel : public KeyModel> {
public:
HashKeyModel(QSharedPointer connection,
QByteArray fullPath, int dbIndex, long long ttl);
QString type() override;
QStringList getColumnNames() override;
QHash getRoles() override;
QVariant getData(int rowIndex, int dataRole) override;
void addRow(const QVariantMap &, Callback) override;
virtual void updateRow(int rowIndex, const QVariantMap &, Callback) override;
void removeRow(int, Callback) override;
protected:
int addLoadedRowsToCache(const QVariantList &list,
QVariant rowStart) override;
private:
enum Roles { RowNumber = Qt::UserRole + 1, Key, Value };
void setHashRow(const QByteArray &hashKey, const QByteArray &hashValue,
Callback c, bool updateIfNotExist = true);
void deleteHashRow(const QByteArray &hashKey, Callback c);
};
================================================
FILE: src/app/models/key-models/keyfactory.cpp
================================================
#include "keyfactory.h"
#include
#include
#include
#include
#include "bfkey.h"
#include "hashkey.h"
#include "listkey.h"
#include "rejsonkey.h"
#include "setkey.h"
#include "sortedsetkey.h"
#include "stream.h"
#include "stringkey.h"
#include "unknownkey.h"
KeyFactory::KeyFactory() {}
void KeyFactory::loadKey(
QSharedPointer connection, QByteArray keyFullPath,
int dbIndex,
std::function, const QString&)>
callback) {
auto processError = [callback, keyFullPath](const QString& err) {
QString msg(QCoreApplication::translate(
"RESP", "Cannot load key %1, connection error occurred: %2"));
callback(QSharedPointer(),
msg.arg(printableString(keyFullPath)).arg(err));
};
auto loadModel = [this, connection, keyFullPath, dbIndex, callback,
processError](RedisClient::Response resp) {
QSharedPointer result;
if (resp.isErrorMessage() ||
resp.type() != RedisClient::Response::Type::Status) {
QString msg(QCoreApplication::translate(
"RESP", "Cannot load key %1, connection error occurred: %2"));
callback(
result,
msg.arg(printableString(keyFullPath)).arg(resp.value().toString()));
return;
}
QString type = resp.value().toString();
if (type == "none") {
QString msg(QCoreApplication::translate(
"RESP",
"Cannot load key %1 because it doesn't exist in database."
" Please reload connection tree and try again."));
callback(result, msg.arg(printableString(keyFullPath)));
return;
}
auto parseTtl = [this, type, connection, keyFullPath, dbIndex, callback,
processError](const RedisClient::Response& ttlResult) {
long long ttl = -1;
if (ttlResult.type() == RedisClient::Response::Integer) {
ttl = ttlResult.value().toLongLong();
}
auto result = createModel(type, connection, keyFullPath, dbIndex, ttl);
callback(result, QString());
};
connection->cmd({"ttl", keyFullPath}, this, -1, parseTtl, processError);
};
try {
connection->cmd({"type", keyFullPath}, this, dbIndex, loadModel,
processError);
} catch (const RedisClient::Connection::Exception& e) {
callback(QSharedPointer(),
QCoreApplication::translate("RESP",
"Cannot retrieve type of the key: ") +
QString(e.what()));
}
}
void KeyFactory::createNewKeyRequest(
QSharedPointer connection,
QSharedPointer callback,
int dbIndex, QString keyPrefix) {
if (connection.isNull() || dbIndex < 0) return;
emit newKeyDialog(NewKeyRequest(connection, dbIndex, callback, keyPrefix));
}
void KeyFactory::submitNewKeyRequest(NewKeyRequest r) {
QSharedPointer result = createModel(
r.keyType(), r.connection(), r.keyName().toUtf8(), r.dbIndex(), -1);
if (!result) return;
auto onRowAdded = [this, r, result](const QString& err) {
if (err.size() > 0) {
emit error(err);
return;
}
r.callback();
emit keyAdded();
};
r.connection()->cmd(
{"PING"}, this, r.dbIndex(),
[onRowAdded, result, r](const RedisClient::Response& resp) {
auto testResp = resp.value().toByteArray();
if (testResp != "PONG") {
return onRowAdded(testResp);
}
auto val = r.value();
if (!r.valueFilePath().isEmpty() && QFile::exists(r.valueFilePath())) {
QFile valueFile(r.valueFilePath());
if (!valueFile.open(QIODevice::ReadOnly)) {
return onRowAdded(QCoreApplication::translate(
"RESP", "Cannot open file with key value"));
}
val["value"] = valueFile.readAll();
}
result->addRow(val, onRowAdded);
},
onRowAdded);
}
QSharedPointer KeyFactory::createModel(
QString type, QSharedPointer connection,
QByteArray keyFullPath, int dbIndex, long long ttl) {
if (type == "string") {
return QSharedPointer(
new StringKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type == "list") {
return QSharedPointer(
new ListKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type == "set") {
return QSharedPointer(
new SetKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type == "zset") {
return QSharedPointer(
new SortedSetKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type == "hash") {
return QSharedPointer(
new HashKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type == "ReJSON-RL" || type == "ReJSON") {
return QSharedPointer(
new ReJSONKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type == "stream") {
return QSharedPointer(
new StreamKeyModel(connection, keyFullPath, dbIndex, ttl));
} else if (type.startsWith("MBbloom")) {
QString ff = type.endsWith("CF")? "cf" : "bf";
return QSharedPointer(
new BloomFilterKeyModel(connection, keyFullPath, dbIndex, ttl, ff));
}
return QSharedPointer(
new UnknownKeyModel(connection, keyFullPath, dbIndex, ttl, type));
}
================================================
FILE: src/app/models/key-models/keyfactory.h
================================================
#pragma once
#include
#include "exception.h"
#include "modules/value-editor/abstractkeyfactory.h"
#include "newkeyrequest.h"
#include "modules/connections-tree/operations.h"
class KeyFactory : public QObject, public ValueEditor::AbstractKeyFactory {
Q_OBJECT
public:
KeyFactory();
void loadKey(
QSharedPointer connection,
QByteArray keyFullPath, int dbIndex,
std::function, const QString&)>
callback) override;
public slots:
void createNewKeyRequest(
QSharedPointer connection,
QSharedPointer
callback,
int dbIndex, QString keyPrefix);
void submitNewKeyRequest(NewKeyRequest r);
signals:
void newKeyDialog(NewKeyRequest r);
void keyAdded();
void error(const QString& err);
private:
QSharedPointer createModel(
QString type, QSharedPointer