Added some more debug flags to stop spewing the console.

This commit is contained in:
Mark Washeim 2022-12-01 11:00:18 +01:00
parent 8d8abed078
commit c485cedb3d
16 changed files with 76 additions and 18 deletions

View file

@ -7,6 +7,7 @@ import "../lib/API.js" as Logic
Page { Page {
property bool debug: false
// Python connections and signals, callable from QML side // Python connections and signals, callable from QML side
// This is not ideal but keeps the page from erroring out on redirect // This is not ideal but keeps the page from erroring out on redirect
@ -17,13 +18,13 @@ Page {
importModule('server', function () {}); importModule('server', function () {});
setHandler('finished', function(newvalue) { setHandler('finished', function(newvalue) {
console.debug(newvalue) if(debug) console.debug(newvalue)
}); });
startDownload(); startDownload();
} }
function startDownload() { function startDownload() {
call('server.downloader.serve', function() {}); call('server.downloader.serve', function() {});
console.debug("called") if (debug) console.debug("called")
} }
} }
@ -67,7 +68,7 @@ Page {
"https://github.com/poetaster/harbour-tooter#readme", //website on the login screen "https://github.com/poetaster/harbour-tooter#readme", //website on the login screen
function(data) { function(data) {
console.log(data) if (debug) console.log(data)
var conf = JSON.parse(data) var conf = JSON.parse(data)
conf.instance = instance.text; conf.instance = instance.text;
conf.login = false; conf.login = false;
@ -78,8 +79,8 @@ Page {
conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri']; conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri'];
delete Logic.conf;*/ delete Logic.conf;*/
Logic.conf = conf; Logic.conf = conf;
console.log(JSON.stringify(conf)) if(debug) console.log(JSON.stringify(conf))
console.log(JSON.stringify(Logic.conf)) if(debug) console.log(JSON.stringify(Logic.conf))
// we got our application // we got our application
// our user to it! // our user to it!
@ -88,7 +89,7 @@ Page {
"code", // oauth method "code", // oauth method
["read", "write", "follow"] //scopes ["read", "write", "follow"] //scopes
); );
console.log(url) if(debug) console.log(url)
webView.url = url webView.url = url
webView.visible = true webView.visible = true
} }
@ -128,8 +129,8 @@ Page {
} }
onRecvAsyncMessage: { onRecvAsyncMessage: {
console.log('async changed: ' + url) if(debug) console.log('async changed: ' + url)
console.debug(message) if(debug) console.debug(message)
switch (message) { switch (message) {
case "embed:contentOrientationChanged": case "embed:contentOrientationChanged":
break break
@ -153,7 +154,7 @@ Page {
} }
onLoadingChanged: { onLoadingChanged: {
console.log('loading changed: ' + url) if(debug) console.log('loading changed: ' + url)
if ( if (
(url+"").substr(0, 38) === 'http://localhost:8000/index.html?code=' || (url+"").substr(0, 38) === 'http://localhost:8000/index.html?code=' ||
(url+"").substr(0, 39) === 'https://localhost:8000/index.html?code=' (url+"").substr(0, 39) === 'https://localhost:8000/index.html?code='
@ -165,7 +166,7 @@ Page {
var authCode = vars["code"]; var authCode = vars["code"];
console.log(authCode) if(debug) console.log(authCode)
Logic.api.getAccessTokenFromAuthCode( Logic.api.getAccessTokenFromAuthCode(
Logic.conf["client_id"], Logic.conf["client_id"],
@ -174,10 +175,10 @@ Page {
authCode, authCode,
function(data) { function(data) {
// AAAND DATA CONTAINS OUR TOKEN! // AAAND DATA CONTAINS OUR TOKEN!
console.log(data) if(debug) console.log(data)
data = JSON.parse(data) data = JSON.parse(data)
console.log(JSON.stringify(data)) if(debug) console.log(JSON.stringify(data))
console.log(JSON.stringify(data.access_token)) if(debug) console.log(JSON.stringify(data.access_token))
Logic.conf["api_user_token"] = data.access_token Logic.conf["api_user_token"] = data.access_token
Logic.conf["login"] = true; Logic.conf["login"] = true;
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"]) Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])

View file

@ -29,12 +29,13 @@ Page {
property bool muting: false property bool muting: false
property bool domain_blocking: false property bool domain_blocking: false
property date created_at property date created_at
property bool debug: false
WorkerScript { WorkerScript {
id: worker id: worker
source: "../lib/Worker.js" source: "../lib/Worker.js"
onMessage: { onMessage: {
console.log(JSON.stringify(messageObject)) if (debug) console.log(JSON.stringify(messageObject))
if(messageObject.action.indexOf("accounts/search") > -1 ){ if(messageObject.action.indexOf("accounts/search") > -1 ){
user_id = messageObject.data.id user_id = messageObject.data.id
followers_count = messageObject.data.followers_count followers_count = messageObject.data.followers_count
@ -54,7 +55,7 @@ Page {
} }
if(messageObject.action === "accounts/relationships/"){ if(messageObject.action === "accounts/relationships/"){
console.log(JSON.stringify(messageObject)) if (debug) console.log(JSON.stringify(messageObject))
following = messageObject.data.following following = messageObject.data.following
requested = messageObject.data.requested requested = messageObject.data.requested
followed_by = messageObject.data.followed_by followed_by = messageObject.data.followed_by
@ -190,9 +191,9 @@ Page {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
onLinkActivated: { onLinkActivated: {
var test = link.split("/") var test = link.split("/")
console.log(link) if (debug) console.log(link)
console.log(JSON.stringify(test)) if (debug) console.log(JSON.stringify(test))
console.log(JSON.stringify(test.length)) if (debug) console.log(JSON.stringify(test.length))
if (test.length === 5 && (test[3] === "tags" || test[3] === "tag") ) { if (test.length === 5 && (test[3] === "tags" || test[3] === "tag") ) {
pageStack.pop(pageStack.find(function(page) { pageStack.pop(pageStack.find(function(page) {
var check = page.isFirstPage === true; var check = page.isFirstPage === true;

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>um bei den Übersetzungen mitzuhelfen.</translation> <translation>um bei den Übersetzungen mitzuhelfen.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>για να βοηθήσετε την μετάφραση της εφαρμογής στην γλώσσα σας.</translation> <translation>για να βοηθήσετε την μετάφραση της εφαρμογής στην γλώσσα σας.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>para ayudar con traducciones.</translation> <translation>para ayudar con traducciones.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>pour aider à traduire cette application.</translation> <translation>pour aider à traduire cette application.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>per aiutare nella traduzione dell&apos;app.</translation> <translation>per aiutare nella traduzione dell&apos;app.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>om deze app te helpen vertalen in jouw taal.</translation> <translation>om deze app te helpen vertalen in jouw taal.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>voor te helpen met dezen app in uw taal te vertalen.</translation> <translation>voor te helpen met dezen app in uw taal te vertalen.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>per ajudar a traduire laplicacion dins vòstra lenga.</translation> <translation>per ajudar a traduire laplicacion dins vòstra lenga.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>чтобы помочь с переводом приложения на ваш язык.</translation> <translation>чтобы помочь с переводом приложения на ваш язык.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>и помозите у преводу апликације на други језик.</translation> <translation>и помозите у преводу апликације на други језик.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>för att hjälpa till med app-översättning till ditt språk.</translation> <translation>för att hjälpa till med app-översättning till ditt språk.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>使.</translation> <translation>使.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>

View file

@ -375,6 +375,10 @@
<source>to help with app translation to your language.</source> <source>to help with app translation to your language.</source>
<translation>to help with app translation to your language.</translation> <translation>to help with app translation to your language.</translation>
</message> </message>
<message>
<source>Development</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VisualContainer</name> <name>VisualContainer</name>