Unverified Commit 4bc1e841 authored by Haelwenn's avatar Haelwenn

LoginPage.qml: clean it out

parent 880f3c06
......@@ -62,11 +62,11 @@ Page {
TextField {
id: instance
focus: true
label: qsTr("Enter an Mastodon instance URL")
label: qsTr("Enter an instance URL")
text: "https://"
placeholderText: "https://mastodon.social"
placeholderText: "https://social.example.org"
width: parent.width
validator: RegExpValidator { regExp: /^(ftp|http|https):\/\/[^ "]+$/ }
validator: RegExpValidator { regExp: /^(http|https):\/\/[^ "]+$/ }
EnterKey.enabled: instance.acceptableInput;
EnterKey.iconSource: "image://theme/icon-m-enter-next"
EnterKey.onClicked: {
......@@ -76,8 +76,6 @@ Page {
["read", "write", "follow"], //scopes
"https://git.pleroma.social/pleroma/harbour-kyclos", //website on the login screen
function(data) {
console.log(data)
var conf = JSON.parse(data)
conf.instance = instance.text;
conf.login = false;
......@@ -89,8 +87,6 @@ Page {
conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri'];
delete Logic.conf;*/
Logic.conf = conf;
console.log(JSON.stringify(conf))
console.log(JSON.stringify(Logic.conf))
// we got our application
// our user to it!
......@@ -99,31 +95,13 @@ Page {
"code", // oauth method
["read", "write", "follow"] //scopes
);
console.log(url)
webView.url = url
webView.visible = true
}
);
}
}
Label {
anchors {
left: parent.left
right: parent.right
leftMargin: Theme.paddingLarge
rightMargin: Theme.paddingLarge
}
width: parent.width
wrapMode: Text.WordWrap
color: Theme.secondaryHighlightColor
font.pixelSize: Theme.fontSizeExtraSmall
text: qsTr("Mastodon is a free, open-source social network. A decentralized alternative to commercial platforms, it avoids the risks of a single company monopolizing your communication. Pick a server that you trust — whichever you choose, you can interact with everyone else. Anyone can run their own Mastodon instance and participate in the social network seamlessly.")
}
}
}
SilicaWebView {
......@@ -138,7 +116,6 @@ Page {
opacity: 0
onLoadingChanged: {
console.log(url)
if (
(url+"").substr(0, 37) === 'http://localhost/harbour-kyclos?code=' ||
(url+"").substr(0, 38) === 'https://localhost/harbour-kyclos?code='
......@@ -150,8 +127,6 @@ Page {
var authCode = vars["code"];
console.log(authCode)
Logic.api.getAccessTokenFromAuthCode(
Logic.conf["client_id"],
Logic.conf["client_secret"],
......@@ -159,10 +134,7 @@ Page {
authCode,
function(data) {
// AAAND DATA CONTAINS OUR TOKEN!
console.log(data)
data = JSON.parse(data)
console.log(JSON.stringify(data))
console.log(JSON.stringify(data.access_token))
Logic.conf["api_user_token"] = data.access_token
Logic.conf["login"] = true;
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment