version v0.6.7 with moderation

This commit is contained in:
LubuWest 2023-02-09 21:39:43 +01:00
commit 48a70b8395
46 changed files with 2106 additions and 1026 deletions

View file

@ -0,0 +1,70 @@
// This file is part of Friendiqa
// https://git.friendi.ca/lubuwest/Friendiqa
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
//
// 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.
//
// In addition, as a special exception, the copyright holders give
// permission to link the code of portions of this program with the
// OpenSSL library under certain conditions as described in each
// individual source file, and distribute linked combinations including
// the two.
//
// You must obey the GNU General Public License in all respects for all
// of the code used other than OpenSSL. If you modify file(s) with this
// exception, you may extend this exception to your version of the
// file(s), but you are not obligated to do so. If you do not wish to do
// so, delete this exception statement from your version. If you delete
// this exception statement from all source files in the program, then
// also delete it here.
//
// 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 <http://www.gnu.org/licenses/>.
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.12
Dialog {
id: rulesDialog
height: parent.height/2
width: parent.width
anchors.centerIn: parent
title: qsTr("Accept instance rules")
property string rules: ""
standardButtons: Dialog.Yes | Dialog.No
modal: true
onAccepted: {
username.visible=true;
password.visible=true;
ruleButton.visible=false;
confirmation.visible=true
}
onRejected: {close()}
ScrollView{
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
width: root.width-2*root.fontFactor*osSettings.bigFontSize
height:parent.height
clip:true
Text {
x:1; y:1
width: root.width-4*root.fontFactor*osSettings.bigFontSize
wrapMode: TextEdit.Wrap
color: Material.primaryTextColor
linkColor: Material.accentColor
textFormat: Text.PlainText
font.family: "Noto Sans"
font.pointSize: osSettings.systemFontSize
text: rules
}
}
}

View file

@ -74,6 +74,7 @@ Page{
useritems=useritems+"MenuItem{font.pointSize: osSettings.bigFontSize;width:accountPage.width*2/3; text:'"+accountPage.users[i].username+
"'; onTriggered: {Service.readConfig(db,function(obj){
userButton.text=obj.username;
servername.text=obj.server;
serverModel.insert(0,{text:obj.server})
accountPage.setServericon(obj.server);
username.text= obj.username;
@ -148,7 +149,7 @@ Page{
x: 4*root.fontFactor*osSettings.bigFontSize
y: 3.5*root.fontFactor*osSettings.bigFontSize
width: root.width-5*root.fontFactor*osSettings.bigFontSize
height: 2.5*root.fontFactor*osSettings.bigFontSize//5*mm;
height: 2.5*root.fontFactor*osSettings.bigFontSize
font.pointSize: osSettings.systemFontSize
text:"https://"
onFocusChanged:{
@ -199,10 +200,32 @@ Page{
ListElement{text:"https://venera.social"}
}
MButton {
id: ruleButton
x: root.fontFactor*osSettings.bigFontSize; y: 6*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm;
visible: (osSettings.osType=="Android") && (userButton.text== qsTr("User"))
height: 2*root.fontFactor*osSettings.bigFontSize;
text: qsTr("Instance rules")
font.pointSize: osSettings.bigFontSize
onClicked:{
Helperjs.friendicaWebRequest(servername.text+"/api/v1/instance/rules",root,function(rules){
let rulestext="";
let rulesarray=JSON.parse(rules)
for (let rule in rulesarray){
rulestext=rulestext+rulesarray[rule].text+"\n"
}
var component = Qt.createComponent("qrc:/qml/configqml/AcceptRules.qml");
var rulesdialog = component.createObject(root,{"rules": rulestext});
rulesdialog.open()
})
}
}
TextField {
id: username
x: root.fontFactor*osSettings.bigFontSize; y: 6*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(userButton.text!= qsTr("User")):true
placeholderText: qsTr("Nickname")
selectByMouse: true
onEditingFinished: {
@ -219,6 +242,7 @@ Page{
id: password
x: root.fontFactor*osSettings.bigFontSize; y: 9*root.fontFactor*osSettings.bigFontSize; width: root.width-9*mm; //height: 5*mm;
font.pointSize: osSettings.systemFontSize
visible: (osSettings.osType=="Android")?(userButton.text!= qsTr("User")):true
selectByMouse: true
echoMode: TextInput.Password
placeholderText: qsTr("Password")
@ -243,6 +267,7 @@ Page{
wrapMode: TextEdit.NoWrap
onTextChanged: imagestoredir=imagestore.text
}
MButton {
x: root.width-3*root.fontFactor*osSettings.bigFontSize; y: 13*root.fontFactor*osSettings.bigFontSize;
height: 2*root.fontFactor*osSettings.bigFontSize;
@ -252,7 +277,6 @@ Page{
onClicked:{imagestoreDialog.open()}
}
FileDialog {
id: imagestoreDialog
title: "Please choose a directory"
@ -265,7 +289,6 @@ Page{
}
}
BusyIndicator{
id: accountBusy
anchors.horizontalCenter: parent.horizontalCenter
@ -276,56 +299,56 @@ Page{
}
MButton {
x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
text: qsTr("Confirm")
font.pointSize: osSettings.bigFontSize
onClicked:{
accountBusy.running=true;//servername.displayText
var userconfig={server: servername.displayText, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir,interval: ""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
id:confirmation
x: root.fontFactor*osSettings.bigFontSize; y: 16*root.fontFactor*osSettings.bigFontSize
text: qsTr("Confirm")
font.pointSize: osSettings.bigFontSize
visible: (osSettings.osType=="Android")?userButton.text!= qsTr("User"):true
onClicked:{
accountBusy.running=true;//servername.displayText
var userconfig={server: servername.displayText, username: username.text, password:Qt.btoa(password.text), imagestore:imagestoredir,interval: ""};
var errormessage="";
if (servername.text==""){errormessage=qsTr("No server given! ")}
else if (username.text==""){errormessage+=qsTr("No nickname given! ")}
else if (password.text=="") {errormessage+=qsTr("No password given! ")}
else if (imagestoredir=="") {errormessage+=qsTr("No image directory given!")}
else {errormessage=""}
if (errormessage=="") {
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials.json?skip_status=true",root,function(obj){
accountBusy.running=false;
try{var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('error')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
{
filesystem.makePath(filesystem.homePath+"/"+username.text);
}
filesystem.Directory=imagestoredir //userconfig.imagestore;
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
userconfig.accountId=credentials.id
Service.storeConfig(db,userconfig);
Service.readConfig(db,function(userconfig){
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
});
accountPage.users=storedUsers});
//reset values
login=userconfig;
news=[];
contactlist=[];
rootstack.currentIndex=0;
newstypeSignal("refresh");
},"isActive",0);
//Service.requestProfile(userconfig,db,root,function(nc){root.newContacts=nc});
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root)
rootstackView.pop()
}
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password!"),root)};
else {errormessage=""}
if (errormessage=="") {
Helperjs.friendicaRequest(userconfig,"/api/account/verify_credentials.json?skip_status=true",root,function(obj){
accountBusy.running=false;
try{var credentials=JSON.parse(obj);
if (credentials.hasOwnProperty('error')){
Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)
}
else{
if (users.length==0){Service.setDefaultOptions(db);}
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
{
filesystem.makePath(filesystem.homePath+"/"+username.text);
}
filesystem.Directory=imagestoredir
filesystem.makeDir("contacts");
filesystem.makeDir("albums");
userconfig.accountId=credentials.id
Service.storeConfig(db,userconfig);
Service.readConfig(db,function(userconfig){
Helperjs.readData(db,"config","",function(storedUsers){
storedUsers.sort(function(obj1, obj2) {
return obj1.isActive - obj2.isActive;
});
accountPage.users=storedUsers});
//reset values
login=userconfig;
news=[];
contactlist=[];
rootstack.currentIndex=0;
newstypeSignal("refresh");
},"isActive",0);
Helperjs.showMessage(qsTr("Success"),qsTr("Name")+": "+credentials.name+"\nScreen Name: "+credentials.screen_name,root)
rootstackView.pop()
}
}catch(e){Helperjs.showMessage(qsTr("Error"),qsTr("Wrong password or 2FA enabled!"),root)};
})}
else {Helperjs.showMessage(qsTr("Error"), errormessage,root)}
@ -379,7 +402,7 @@ Page{
servericon.source="";
username.text=""
password.text=""
imagestore.text="" //filesystem.homePath+"/.friendiqa/"+username.text//""
imagestore.text=""
userButton.text=qsTr("User")
}
}

View file

@ -43,7 +43,7 @@ Page{
font.pointSize: osSettings.systemFontSize
color:Material.primaryTextColor
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: "<b>Friendiqa v0.6.6 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
text: "<b>Friendiqa v0.6.7 </b><br>Licensed under GPL 3 with the exception of OpenSSL <br> "+
"Website <a href='https://friendiqa.ma-nic.de'>https://friendiqa.ma-nic.de</a><br>"+
"Sourcecode: <a href='https://git.friendi.ca/LubuWest/Friendiqa'>https://git.friendi.ca/LubuWest/Friendiqa</a><br>"+
"Privacy Policy: <a href='https://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md'>http://git.friendi.ca/lubuwest/Friendiqa/src/branch/master/PrivacyPolicy.md</a><br>"+