Warning, /network/neochat/src/qml/Captcha.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtWebView
0007 
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamiaddons.formcard as FormCard
0010 
0011 import org.kde.neochat
0012 
0013 LoginStep {
0014     id: root
0015 
0016     FormCard.AbstractFormDelegate {
0017         background: null
0018         contentItem: WebView {
0019             id: webview
0020             url: "http://localhost:20847"
0021             implicitHeight: 500
0022             onLoadingChanged: {
0023                 webview.runJavaScript("document.body.style.background = '" + Kirigami.Theme.backgroundColor + "'");
0024             }
0025 
0026             Timer {
0027                 id: timer
0028                 repeat: true
0029                 running: true
0030                 interval: 300
0031                 onTriggered: {
0032                     if (!webview.visible) {
0033                         return;
0034                     }
0035                     webview.runJavaScript("!!grecaptcha ? grecaptcha.getResponse() : \"\"", function (response) {
0036                         if (!webview.visible || !response)
0037                             return;
0038                         timer.running = false;
0039                         Registration.recaptchaResponse = response;
0040                     });
0041                 }
0042             }
0043         }
0044     }
0045     previousAction: Kirigami.Action {
0046         onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml")
0047     }
0048 }