From b48fd101e2c74c34f78b9f2212efe117f9e87931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Tue, 24 Sep 2019 17:54:59 +0800 Subject: Common CA certificates is bundled in APK and then copied to files directory on Android --- controller.cxx | 15 +++++++++++++++ kelakon.pro | 3 +++ qrtclient | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/controller.cxx b/controller.cxx index d69a6d6..d007855 100644 --- a/controller.cxx +++ b/controller.cxx @@ -1,3 +1,6 @@ +#ifdef ANDROID +#include +#endif #include #include #include @@ -6,7 +9,19 @@ Controller::Controller(QObject* parent) : QObject{parent} { +#ifdef ANDROID + QFile file{"assets:/certs/ca-certificates.crt"}; + file.copy(QDir{QStandardPaths::writableLocation + (QStandardPaths::AppDataLocation)}.absolutePath() + % "/ca-certificates.crt"); + auto path = QDir{QStandardPaths::writableLocation + (QStandardPaths::AppDataLocation)}.absolutePath() + % "/ca-certificates.crt"; + auto client = new RTClient::Client{"https://darapsa.co.id/rt" + , path.toLatin1().constData()}; +#else auto client = new RTClient::Client{"https://darapsa.co.id/rt"}; +#endif client->moveToThread(&thread); connect(&thread, &QThread::finished, client, &QObject::deleteLater); diff --git a/kelakon.pro b/kelakon.pro index ba344b5..97b543a 100644 --- a/kelakon.pro +++ b/kelakon.pro @@ -39,6 +39,9 @@ android { QT += svg DISTFILES += android/AndroidManifest.xml ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android + certs.path = /assets/certs + certs.files = /etc/ssl/certs/ca-certificates.crt + INSTALLS += certs } debug: DEFINES += DEBUG diff --git a/qrtclient b/qrtclient index a018a70..1897791 160000 --- a/qrtclient +++ b/qrtclient @@ -1 +1 @@ -Subproject commit a018a703dade256a26f1e3f13591734c0ad171ef +Subproject commit 18977911a7645333c1887bfbbee96520226b3989 -- cgit v1.2.3