6#include "localdatabasemanager.h"
7#include "localdatabasemanager_p.h"
8#include "searchfullhashjob.h"
9#include "updatedatabaseinfo.h"
10#include "urlhashing.h"
11#include "webengineviewer_debug.h"
13#include <KSharedConfig>
15#include <QCryptographicHash>
17using namespace WebEngineViewer;
19Q_GLOBAL_STATIC(LocalDataBaseManagerPrivate, s_localDataBaseManager)
21LocalDataBaseManager::LocalDataBaseManager(LocalDataBaseManagerPrivate *impl,
QObject *parent)
25 qRegisterMetaType<WebEngineViewer::UpdateDataBaseInfo>();
26 qRegisterMetaType<WebEngineViewer::CreatePhishingUrlDataBaseJob::DataBaseDownloadResult>();
27 qRegisterMetaType<WebEngineViewer::CreatePhishingUrlDataBaseJob::ContraintsCompressionType>();
30LocalDataBaseManager::LocalDataBaseManager(
QObject *parent)
35LocalDataBaseManager::~LocalDataBaseManager() =
default;
37void LocalDataBaseManager::initialize()
42void LocalDataBaseManager::checkUrl(
const QUrl &url)
46 WebEngineViewer::UrlHashing urlHashing(url);
60 Q_EMIT checkUrlFinished(url, WebEngineViewer::CheckPhishingUrlUtil::Ok);
63 if (d->mNewClientState.isEmpty()) {
64 qCWarning(WEBENGINEVIEWER_LOG) <<
"Database client state is unknown";
65 Q_EMIT checkUrlFinished(url, WebEngineViewer::CheckPhishingUrlUtil::Unknown);
68 job->setDatabaseState(
QStringList() << d->mNewClientState);
69 job->setSearchHashs(conflictHashs);
70 job->setSearchFullHashForUrl(url);
71 connect(job, &SearchFullHashJob::result,
this, [
this](CheckPhishingUrlUtil::UrlStatus
status,
const QUrl &url) {
78 qCWarning(WEBENGINEVIEWER_LOG) <<
"Database not ok";
79 Q_EMIT checkUrlFinished(url, WebEngineViewer::CheckPhishingUrlUtil::Unknown);
81 if (d->mFile.checkFileChanged()) {
86#include "moc_localdatabasemanager.cpp"
The LocalDataBaseManager class.
The SearchFullHashJob class.
Q_SCRIPTABLE CaptureState status()
bool contains(QByteArrayView bv) const const
QByteArray toBase64(Base64Options options) const const
iterator insert(const Key &key, const T &value)
bool isEmpty() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)