File indexing completed on 2024-04-14 15:02:47

0001 /*
0002    SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QUrl>
0010 
0011 QUrl createStatusUrl(const QString &input)
0012 {
0013     QString fixedUrl;
0014     if (!input.startsWith(QLatin1String("http://")) && !input.startsWith(QLatin1String("https://"))) {
0015         fixedUrl.append(QLatin1String("https://"));
0016         fixedUrl.append(input);
0017     } else {
0018         fixedUrl = input;
0019     }
0020 
0021     QUrl url(fixedUrl);
0022 
0023     if (!url.path().endsWith(QLatin1Char('/'))) {
0024         url.setPath(url.path() + QLatin1Char('/'));
0025     }
0026 
0027     url.setPath(url.path() + QLatin1String("status.php"));
0028 
0029     return url;
0030 }