Compare commits

...

8 commits

Author SHA1 Message Date
Denis Fedoseev
d8054e9d3a Russian translation fix 2023-11-19 19:11:35 +00:00
Denis Fedoseev
f4dec08dc4 name fix 2023-11-19 21:40:30 +03:00
Mark Washeim
0482162788 Fix: cleanup 2023-10-11 12:40:13 +02:00
Mark Washeim
776485be90 [Release] 1.1.8, Amber Authentication framework 2023-10-11 12:39:33 +02:00
Mark Washeim
2e4ec198cc Fix: add backwards compatible compression for rpms, meta data 2023-10-08 11:21:36 +02:00
Mark Washeim
052564963b
Merge pull request #32 from vige/amber-web-auth
Use Amber Web Authorization for login
2023-10-08 11:18:09 +02:00
Ville Nummela
1550be76f0 Remove python webserver
As Amber Web Authorization framework already provides callback
webserver, python implementation is no longer needed.

Signed-off-by: Ville Nummela <ville.nummela@jolla.com>
2023-10-06 16:49:49 +03:00
Ville Nummela
1244b85093 Login via amber web authorization
Signed-off-by: Ville Nummela <ville@nummela.org>
2023-10-06 16:36:21 +03:00
26 changed files with 51 additions and 2816 deletions

2
.gitignore vendored
View file

@ -1,3 +1,3 @@
*.user
README.md
harbour-tooterb.pro.user
harbour-tooterb.pro.user*

View file

@ -3,10 +3,10 @@ Type=Application
X-Nemo-Application-Type=silica-qt5
Icon=harbour-tooterb
Exec=harbour-tooterb
Name=Tooter β
Name=Tooter beta
#[X-Sailjail]
#OrganizationName=de.poetaster
#ApplicationName=harbour-tooterb
#Permissions=Compatibility;Internet;Camera;Audio;MediaIndexing;RemovableMedia;UserDirs
[X-Sailjail]
OrganizationName=de.poetaster
ApplicationName=tooter
Permissions=Internet;Audio;MediaIndexing;RemovableMedia;UserDirs

View file

@ -74,8 +74,6 @@ DISTFILES += qml/harbour-tooterb.qml \
qml/pages/LoginPage.qml \
qml/pages/Browser.qml \
qml/lib/API.js \
qml/lib/server.py \
qml/lib/index.html \
qml/images/icon-s-following \
qml/images/icon-s-bookmark \
qml/images/icon-m-bookmark \
@ -86,8 +84,8 @@ DISTFILES += qml/harbour-tooterb.qml \
qml/lib/Worker.js \
config/icon-lock-harbour-tooterb.png \
config/x-harbour.tooterb.activity.conf \
rpm/harbour-tooterb.changes.run \
rpm/harbour-tooterb.changes \
rpm/harbour-tooterb.changes.run.in \
rpm/harbour-tooterb.spec \
translations/*.ts \
harbour-tooterb.desktop

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,26 +0,0 @@
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<style>
body { font-family: sans-serif; background-color:black;}
button { width: 32%; font-size: 20px; height: 40px; }
#output { width: 100%; text-align: center; font-size: 120px; }
</style>
<script type="text/javascript">
function action(topic) {
var output = document.getElementById('output');
output.textContent = {"one": "1", "two": "2", "three": "3"}[topic]
}
function send(topic) {
var customEvent = new CustomEvent("framescript:log",
{detail: { topic: topic}});
document.dispatchEvent(customEvent);
}
</script>
</head>
<body>
<div id="output"><p>Login Complete</p></div>
</body>
</html>

View file

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
# POETASTER
import sys
sys.path.append('/usr/share/harbour-tooterb/qml')
sys.path.append('/usr/share/harbour-tooterb/qml/lib')
sys.path.append('/usr/share/harbour-tooterb/qml/pages')
# POETASTER
import pyotherside
import threading
import time
import random
import os
import http.server
import socketserver
PORT = 8000
directory = '/usr/share/harbour-tooterb/qml/lib'
Handler = http.server.SimpleHTTPRequestHandler
os.chdir(directory)
def serveMe():
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
pyotherside.send('finished', PORT)
httpd.serve_forever()
class Downloader:
def __init__(self):
# Set bgthread to a finished thread so we never
# have to check if it is None.
self.bgthread = threading.Thread()
self.bgthread.start()
def serve(self):
if self.bgthread.is_alive():
return
self.bgthread = threading.Thread(target=serveMe)
self.bgthread.start()
downloader = Downloader()

View file

@ -1,35 +1,13 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.WebView 1.0
import Sailfish.WebEngine 1.0
import io.thp.pyotherside 1.5
import Amber.Web.Authorization 1.0
import "../lib/API.js" as Logic
Page {
property bool debug: false
// Python connections and signals, callable from QML side
// This is not ideal but keeps the page from erroring out on redirect
Python {
id: py
Component.onCompleted: {
addImportPath(Qt.resolvedUrl('../lib/'));
importModule('server', function () {});
setHandler('finished', function(newvalue) {
if(debug) console.debug(newvalue)
});
startDownload();
}
function startDownload() {
call('server.downloader.serve', function() {});
if (debug) console.debug("called")
}
}
id: loginPage
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
@ -50,6 +28,28 @@ Page {
text: qsTr("Instance")
}
OAuth2Ac {
id: mastodonOAuth
authorizationEndpoint: instance.text + "/oauth/authorize"
tokenEndpoint: instance.text + "/oauth/token"
scopes: ["read", "write", "follow"]
redirectListener.port: 7538
onErrorOccurred: console.log("Mastodon OAuth2 Error: " + error.code + " = " + error.message + " : " + error.httpCode)
onReceivedAuthorizationCode: {
console.log("Got auth code, about to request token.")
}
onReceivedAccessToken: {
console.log("Got access token: " + token.access_token)
Logic.conf["api_user_token"] = token.access_token
Logic.conf["login"] = true;
Logic.api.setConfig("api_user_token", Logic.conf["api_user_token"])
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {})
}
}
TextField {
id: instance
focus: true
@ -63,7 +63,7 @@ Page {
EnterKey.onClicked: {
Logic.api = Logic.mastodonAPI({ instance: instance.text, api_user_token: "" });
Logic.api.registerApplication("Tooter",
'http://localhost:8000/index.html', // redirect uri, we will need this later on
"http://127.0.0.1:7538",
["read", "write", "follow"], //scopes
"https://github.com/poetaster/harbour-tooter#readme", //website on the login screen
function(data) {
@ -73,25 +73,16 @@ Page {
conf.instance = instance.text;
conf.login = false;
/*conf['login'] = false;
conf['mastodon_client_id'] = data['mastodon_client_id'];
conf['mastodon_client_secret'] = data['mastodon_client_secret'];
conf['mastodon_client_redirect_uri'] = data['mastodon_client_redirect_uri'];
delete Logic.conf;*/
Logic.conf = conf;
if(debug) console.log(JSON.stringify(conf))
if(debug) console.log(JSON.stringify(Logic.conf))
// we got our application
// our user to it!
var url = Logic.api.generateAuthLink(Logic.conf["client_id"],
Logic.conf["redirect_uri"],
"code", // oauth method
["read", "write", "follow"] //scopes
);
if(debug) console.log(url)
webView.url = url
webView.visible = true
mastodonOAuth.clientId = conf["client_id"]
mastodonOAuth.clientSecret = conf["client_secret"];
mastodonOAuth.authorizeInBrowser()
}
);
}
@ -114,96 +105,4 @@ Page {
}
}
}
WebView {
id: webView
/* This will probably be required from 4.4 on. */
Component.onCompleted: {
WebEngineSettings.setPreference("security.disable_cors_checks", true, WebEngineSettings.BoolPref)
WebEngineSettings.setPreference("security.fileuri.strict_origin_policy", false, WebEngineSettings.BoolPref)
}
onViewInitialized: {
//webview.loadFrameScript(Qt.resolvedUrl("../html/framescript.js"));
//webview.addMessageListener("webview:action");
//webview.runJavaScript("return latlon('" + lat + "','" + lon + "')");
}
onRecvAsyncMessage: {
if(debug) console.log('async changed: ' + url)
if(debug) console.debug(message)
switch (message) {
case "embed:contentOrientationChanged":
break
case "webview:action":
break
}
}
visible: false
//opacity: 0
anchors.fill: parent
/*{
top: parent.top
left: parent.left
right: parent.right
bottom: parent.bottom
}*/
onLoadingChanged: {
if(debug) console.log('loading changed: ' + url)
if (
(url+"").substr(0, 38) === 'http://localhost:8000/index.html?code=' ||
(url+"").substr(0, 39) === 'https://localhost:8000/index.html?code='
) {
visible = false;
var vars = {};
(url+"").replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value;}); /* found on https://html-online.com/articles/get-url-parameters-javascript/ */
var authCode = vars["code"];
if(debug) console.log(authCode)
Logic.api.getAccessTokenFromAuthCode(
Logic.conf["client_id"],
Logic.conf["client_secret"],
Logic.conf["redirect_uri"],
authCode,
function(data) {
// AAAND DATA CONTAINS OUR TOKEN!
if(debug) console.log(data)
data = JSON.parse(data)
if(debug) console.log(JSON.stringify(data))
if(debug) 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"])
pageStack.replace(Qt.resolvedUrl("MainPage.qml"), {})
}
)
}
/*switch (loadRequest.status)
{
case WebView.LoadSucceededStatus:
opacity = 1
break
case WebView.LoadFailedStatus:
//opacity = 0
break
default:
//opacity = 0
break
}*/
}
FadeAnimation on opacity {}
PullDownMenu {
MenuItem {
text: qsTr("Reload")
onClicked: webView.reload()
}
}
}
}

View file

@ -29,7 +29,7 @@ Page {
property bool muting: false
property bool domain_blocking: false
property date created_at
property bool debug: false
property bool debug: true
WorkerScript {
id: worker
@ -162,13 +162,13 @@ Page {
id: txtContainer
width: parent.width
height: profilePage.isPortrait ? Math.min( txtNote.height, parent.height * 0.5 ) : Math.min( txtNote.height, parent.height * 0.2 )
visible: {
/*visible: {
if ((note.text === "") || ( note.text === "<p></p>" )) {
false
} else {
true
}
}
}*/
SilicaFlickable {
id: txtFlickable

View file

@ -4,7 +4,7 @@
# generate changelog from well formatted Git commit messages and tag
# annotations.
git-change-log
#sfdk-changelog
# Here are some basic examples how to change from the default behavior. Run
# git-change-log --help inside the Sailfish OS SDK chroot or build engine to

View file

@ -6,6 +6,7 @@
Name: harbour-tooterb
# >> macros
%define _binary_payload w2.xzdio
# << macros
%{!?qtc_qmake:%define qtc_qmake %qmake}
@ -13,7 +14,7 @@ Name: harbour-tooterb
%{!?qtc_make:%define qtc_make make}
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Tooter β
Version: 1.1.7
Version: 1.1.8
Release: 1
Group: Qt/Qt
License: GPLv3
@ -21,8 +22,7 @@ URL: https://github.com/poetaster/harbour-tooter#readme
Source0: %{name}-%{version}.tar.bz2
Requires: sailfishsilica-qt5 >= 0.10.9
Requires: nemo-qml-plugin-configuration-qt5
Requires: nemo-qml-plugin-notifications-qt5
Requires: pyotherside-qml-plugin-python3-qt5
Requires: amber-web-authorization
BuildRequires: qt5-qttools-linguist
BuildRequires: pkgconfig(sailfishapp) >= 1.0.2

View file

@ -18,6 +18,7 @@
#include "notifications.h"
#include "dbus.h"
int main(int argc, char *argv[])
{
QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon ist ein freies, quelloffenes soziales Netzwerk. Im Gegensatz zu kommerziellen Plattformen, ist Mastodon als dezentrales Netzwerk konzipiert. Somit wird das Risiko vermieden, dass ein einziges Unternehmen die volle Kontrolle über die Kommunikation der Benutzer hat. Benutzer können einer beliebigen Instanz beitreten oder selbst eine eigene betreiben.</translation>
</message>
<message>
<source>Reload</source>
<translation>Neu laden</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reload</source>
<translation type="unfinished">Επαναφόρτωση</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon es una red social libre y de código abierto. Una alternativa descentralizada a las plataformas comerciales, evita los riesgos de una única compañía que monopolice tu comunicación. Elije un servidor en el que confíes cualquiera que elijas, puede interactuar con todos los demás. Cualquiera puede ejecutar su propia instancia de Mastodon y participar en la red social sin problemas.</translation>
</message>
<message>
<source>Reload</source>
<translation>Volver a cargar</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon est un réseau libre et open source : une alternative décentralisée aux plateformes commerciales, afin déviter le contrôle monopolistique de vos communications par une entreprise. Choisissez un serveur dans lequel vous avez confiance - quelque que soit votre choix vous pourrez interagir avec tous les utilisateurs du réseau Mastodon. Tout le monde peut monter sa propre instance Mastodon et ainsi contribuer à la croissance du réseau.</translation>
</message>
<message>
<source>Reload</source>
<translation>Recharger</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon è un servizio di rete sociale in software libero, costituito in una federazione d&apos;istanze. Mastodon fa parte del più ampio Fediverso, permettendo ai suoi utenti di interagire anche con utenti su diverse piattaforme aperte che supportano lo stesso protocollo.</translation>
</message>
<message>
<source>Reload</source>
<translation>Ricarica</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon is een vrij sociaal netwerk. Als gedecentraliseerd alternatief voor commerciële platformen, vermijdt het de risicos van een enkel bedrijf dat je communicatie monopoliseert. Kies een server die je vertrouwt welke je ook kiest, je kunt met iedereen communiceren. Iedereen kan zelf een Mastodon-instantie hebben en naadloos deelnemen aan het sociale netwerk.</translation>
</message>
<message>
<source>Reload</source>
<translation>Herladen</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon is e vrij sociaal netwerk. Als gedecentraliseerd alternatief voor commerciële platformen, vermijdt het de risicos van één enkel bedrijf dat uw communicatie monopoliseert. Kiest ne server die ge vertrouwt dewelken dat ge ook kiest, ge kunt met iedereen communiceren. Iedereen kan zelf een Mastodon-instantie hebben en naadloos deelnemen aan het sociaal netwerk.</translation>
</message>
<message>
<source>Reload</source>
<translation>Herladen</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon es un malhum liure e open source. Es una alternativa descentralizada a las plataformas comercialas, per empachar qu&apos;una sola entrepresa monopolize vòstras comunicacions. Causissètz un servidor que vos fisatz - qualque siá vòstre causida poiretz interagir amb los autres. Tot lo monde pòt montar sa pròpria instància Mastodon e atal participar a construire un malhum mai solid.</translation>
</message>
<message>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reload</source>
<translation type="unfinished">Załaduj ponownie</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -5,15 +5,15 @@
<name>API</name>
<message>
<source>favourited</source>
<translation>избранное</translation>
<translation>добавил в избранное</translation>
</message>
<message>
<source>followed you</source>
<translation>следую за тобой</translation>
<translation>подписался</translation>
</message>
<message>
<source>boosted</source>
<translation>росту</translation>
<translation>поделился</translation>
</message>
<message>
<source>said</source>
@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon - бесплатная социальная сеть с открытым исходным кодом. Децентрализованная альтернатива коммерческим платформам позволяет избежать рисков, связанных с тем, что одна компания монополизирует ваше общение. Выберите сервер, которому вы доверяете - в зависимости от того, что вы выберете, вы можете взаимодействовать со всеми остальными. Любой может запустить свой собственный экземпляр Mastodon и беспрепятственно участвовать в социальной сети.</translation>
</message>
<message>
<source>Reload</source>
<translation>Перезарядка</translation>
</message>
</context>
<context>
<name>MainPage</name>
@ -180,15 +176,15 @@
<name>MiniStatus</name>
<message>
<source>boosted</source>
<translation>росту</translation>
<translation>поделился</translation>
</message>
<message>
<source>favourited</source>
<translation>любимый</translation>
<translation>понравилось</translation>
</message>
<message>
<source>followed you</source>
<translation>следую за тобой</translation>
<translation>подписался</translation>
</message>
</context>
<context>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Reload</source>
<translation type="unfinished">учитај још</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon är ett fritt socialt nätverk byggt öppen källkod. Ett decentraliserat alternativ till kommersiella plattformar. Det undviker riskerna med att ett enda företag monopoliserar din kommunikation. Välj en server som du litar , oavsett vad du väljer kan du interagera med alla andra. Vem som helst kan köra sin egen Mastodon-instans och delta i det sociala nätverket sömlöst.</translation>
</message>
<message>
<source>Reload</source>
<translation>Läs in igen</translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>Mastodon Mastodon </translation>
</message>
<message>
<source>Reload</source>
<translation></translation>
</message>
</context>
<context>
<name>MainPage</name>

View file

@ -114,10 +114,6 @@
<source>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.</source>
<translation>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.</translation>
</message>
<message>
<source>Reload</source>
<translation>Reload</translation>
</message>
</context>
<context>
<name>MainPage</name>