mirror of
https://gitlab.com/RemixDev/deemix-gui-pyweb.git
synced 2025-01-01 12:26:13 +00:00
Removed webview as it's not possible to build it on windows and macOS
This commit is contained in:
parent
ef80347f20
commit
7c158bb39c
2
app.py
2
app.py
|
@ -13,7 +13,7 @@ def initialize():
|
||||||
settings = initSettings()
|
settings = initSettings()
|
||||||
|
|
||||||
def shutdown(interface=None):
|
def shutdown(interface=None):
|
||||||
print(getQueue())
|
getQueue()
|
||||||
cancelAllDownloads(interface)
|
cancelAllDownloads(interface)
|
||||||
if interface:
|
if interface:
|
||||||
interface.send("toast", {'msg': "Server is closed."})
|
interface.send("toast", {'msg': "Server is closed."})
|
||||||
|
|
36
server.py
36
server.py
|
@ -1,7 +1,5 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import webbrowser
|
|
||||||
from functools import wraps
|
|
||||||
|
|
||||||
from flask import Flask, render_template, request, session
|
from flask import Flask, render_template, request, session
|
||||||
from flask_socketio import SocketIO, emit
|
from flask_socketio import SocketIO, emit
|
||||||
|
@ -86,26 +84,6 @@ def logout():
|
||||||
status = 1
|
status = 1
|
||||||
emit('logged_out', status)
|
emit('logged_out', status)
|
||||||
|
|
||||||
@socketio.on('loginpage')
|
|
||||||
def login_app():
|
|
||||||
emit('toast', {'msg': "Logging in...", 'icon': 'loading', 'dismiss': False, 'id': "login-toast"})
|
|
||||||
loginWindow = webview.create_window('Login into deezer.com', 'https://www.deezer.com/login', user_agent="Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30")
|
|
||||||
while (loginWindow and loginWindow.get_current_url().startswith("https://www.deezer.com")):
|
|
||||||
time.sleep(1)
|
|
||||||
if loginWindow:
|
|
||||||
url = loginWindow.get_current_url()
|
|
||||||
loginWindow.destroy()
|
|
||||||
arl = url[url.find("arl%3D")+6:]
|
|
||||||
arl = arl[:arl.find("&")]
|
|
||||||
# Login function
|
|
||||||
if not session['dz'].logged_in:
|
|
||||||
result = session['dz'].login_via_arl(arl)
|
|
||||||
else:
|
|
||||||
result = 2
|
|
||||||
emit('logged_in', {'status': result, 'arl': arl, 'user': app.getUser(session['dz'])})
|
|
||||||
else:
|
|
||||||
emit('logged_in', {'status': 0})
|
|
||||||
|
|
||||||
@socketio.on('mainSearch')
|
@socketio.on('mainSearch')
|
||||||
def mainSearch(data):
|
def mainSearch(data):
|
||||||
emit('mainSearch', app.mainSearch(session['dz'], data['term']))
|
emit('mainSearch', app.mainSearch(session['dz'], data['term']))
|
||||||
|
@ -139,20 +117,6 @@ def saveSettings(settings):
|
||||||
app.saveSettings_link(settings)
|
app.saveSettings_link(settings)
|
||||||
socket_interface.send('updateSettings', settings)
|
socket_interface.send('updateSettings', settings)
|
||||||
|
|
||||||
# Example code leftover, could be usefull later on
|
|
||||||
@server.route('/choose/path', methods=['POST'])
|
|
||||||
def choose_path():
|
|
||||||
dirs = webview.windows[0].create_file_dialog(webview.FOLDER_DIALOG)
|
|
||||||
if dirs and len(dirs) > 0:
|
|
||||||
directory = dirs[0]
|
|
||||||
if isinstance(directory, bytes):
|
|
||||||
directory = directory.decode('utf-8')
|
|
||||||
response = {'status': 'ok', 'directory': directory}
|
|
||||||
else:
|
|
||||||
response = {'status': 'cancel'}
|
|
||||||
|
|
||||||
return jsonify(response)
|
|
||||||
|
|
||||||
def run_server(port):
|
def run_server(port):
|
||||||
print("Starting server at http://127.0.0.1:"+str(port))
|
print("Starting server at http://127.0.0.1:"+str(port))
|
||||||
socketio.run(server, host='0.0.0.0', port=port)
|
socketio.run(server, host='0.0.0.0', port=port)
|
||||||
|
|
Loading…
Reference in a new issue