Complete login page
This commit is contained in:
8 files changed
+983
-856
No files matched your search
@@ -25,6 +25,15 @@ def restart():
|
||||
status = QProcess.startDetached(sys.executable, sys.argv)
|
||||
|
||||
class Backend(QObject):
|
||||
@Slot(result=bool)
|
||||
def onStartup(self):
|
||||
if storage.getItem("serverGo") == "True":
|
||||
ping = requests.get(f"{storage.getItem('server')}/System/Ping")
|
||||
if ping.content == b'"Jellyfin Server"':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@Slot(str, result=bool)
|
||||
def saveServer(self, data):
|
||||
ping = requests.get(f"{data}/System/Ping")
|
||||
@@ -54,7 +63,7 @@ class Backend(QObject):
|
||||
return item
|
||||
|
||||
@Slot(str, str)
|
||||
def setAuthInfo(self, userName, Pw):
|
||||
def setAuthInfoDatabase(self, userName, Pw):
|
||||
print(f"User: {userName}, Password: {Pw}")
|
||||
storage.setItem("UserName", userName)
|
||||
storage.setItem("UserPw", Pw)
|
||||
@@ -63,6 +72,11 @@ class Backend(QObject):
|
||||
def clearStorage(self):
|
||||
storage.clear()
|
||||
restart()
|
||||
|
||||
@Slot()
|
||||
def restart(self):
|
||||
QApplication.quit()
|
||||
status = QProcess.startDetached(sys.executable, sys.argv)
|
||||
|
||||
class LoginWin(QMainWindow):
|
||||
def __init__(self):
|
||||
@@ -94,6 +108,7 @@ class LoginWin(QMainWindow):
|
||||
|
||||
def handleLoaded(self, ok):
|
||||
if ok:
|
||||
print("s")
|
||||
self.view.page().setDevToolsPage(self.inspector.page())
|
||||
self.inspector.show()
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<file>renderer/css/login.css</file>
|
||||
<file>renderer/css/global.css</file>
|
||||
<file>renderer/js/login.js</file>
|
||||
<file>renderer/js/main.js</file>
|
||||
<file>renderer/svg/avatar.svg</file>
|
||||
<file>renderer/svg/loader.svg</file>
|
||||
<file>assets/logo.svg</file>
|
||||
|
||||
+659
-636
File diff suppressed because it is too large.
Load diff
@@ -22,6 +22,12 @@
|
||||
--transition-time-slow-2: 550ms;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body,
|
||||
html {
|
||||
margin: 0 !important;
|
||||
@@ -71,3 +77,180 @@ button {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*Animations*/
|
||||
@-webkit-keyframes fadeInBg {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInBg {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
top: calc(50% + 150px);
|
||||
}
|
||||
100% {
|
||||
opactiy: 1;
|
||||
top: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
top: calc(50% + 150px);
|
||||
}
|
||||
100% {
|
||||
opactiy: 1;
|
||||
top: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeOut {
|
||||
0% {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
top: 50%;
|
||||
}
|
||||
99% {
|
||||
display: block;
|
||||
opacity: 0;
|
||||
top: calc(50% + 150px);
|
||||
}
|
||||
100% {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
top: 50%;
|
||||
}
|
||||
99% {
|
||||
display: block;
|
||||
opacity: 0;
|
||||
top: calc(50% + 150px);
|
||||
}
|
||||
100% {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeInOpac {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInOpac {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeOutOpac {
|
||||
0% {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
}
|
||||
99% {
|
||||
display: block;
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOutOpac {
|
||||
0% {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
}
|
||||
99% {
|
||||
display: block;
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes comeIn {
|
||||
0% {
|
||||
bottom: -100%;
|
||||
}
|
||||
100% {
|
||||
bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes comeIn {
|
||||
0% {
|
||||
bottom: -100%;
|
||||
}
|
||||
100% {
|
||||
bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes goOut {
|
||||
0% {
|
||||
bottom: 20px;
|
||||
}
|
||||
100% {
|
||||
bottom: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes goOut {
|
||||
0% {
|
||||
bottom: 20px;
|
||||
}
|
||||
100% {
|
||||
bottom: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes load {
|
||||
0% {
|
||||
transform: scaleX(0);
|
||||
}
|
||||
100% {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes load {
|
||||
0% {
|
||||
transform: scaleX(0);
|
||||
}
|
||||
100% {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
+18
-136
@@ -1,11 +1,5 @@
|
||||
/** @format */
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
height: 10px;
|
||||
}
|
||||
@@ -19,7 +13,8 @@
|
||||
background: rgb(255 255 255/1);
|
||||
}
|
||||
|
||||
main {
|
||||
main,
|
||||
.main__page {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
contain: strict;
|
||||
@@ -318,18 +313,26 @@ input:focus + .input__label,
|
||||
|
||||
.error.active,
|
||||
.dialog.active,
|
||||
.warning.active,
|
||||
.dialog__close.active {
|
||||
-webkit-animation: fadeIn var(--transition-time-fast-1);
|
||||
animation: fadeIn var(--transition-time-fast-1);
|
||||
.warning.active {
|
||||
-webkit-animation: fadeIn var(--transition-time-fast-2);
|
||||
animation: fadeIn var(--transition-time-fast-2);
|
||||
display: block;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.dialog.fadeOut,
|
||||
.dialog.fadeOut {
|
||||
-webkit-animation: fadeOut var(--transition-time-fast-2) forwards;
|
||||
animation: fadeOut var(--transition-time-fast-2) forwards;
|
||||
}
|
||||
|
||||
.dialog__close.fadeOut {
|
||||
-webkit-animation: fadeOut var(--transition-time-fast-1) forwards;
|
||||
animation: fadeOut var(--transition-time-fast-1) forwards;
|
||||
-webkit-animation: fadeOutOpac var(--transition-time-fast-2) forwards;
|
||||
animation: fadeOutOpac var(--transition-time-fast-2) forwards;
|
||||
}
|
||||
|
||||
.dialog__close.active {
|
||||
-webkit-animation: fadeInOpac var(--transition-time-fast-2) forwards;
|
||||
animation: fadeInOpac var(--transition-time-fast-2) forwards;
|
||||
}
|
||||
|
||||
.alert.goOut {
|
||||
@@ -381,6 +384,7 @@ section.user__cont {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
overflow: auto hidden;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.user__card {
|
||||
@@ -544,128 +548,6 @@ input[type="checkbox"]:checked + .tick > path {
|
||||
.back:hover {
|
||||
background: rgb(20 20 20 / 0.7);
|
||||
}
|
||||
|
||||
/*Animations*/
|
||||
@-webkit-keyframes fadeInBg {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeInBg {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opactiy: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
0% {
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
opactiy: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeOut {
|
||||
0% {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
}
|
||||
99% {
|
||||
display: block;
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
}
|
||||
99% {
|
||||
display: block;
|
||||
opacity: 0;
|
||||
}
|
||||
100% {
|
||||
display: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes comeIn {
|
||||
0% {
|
||||
bottom: -100%;
|
||||
}
|
||||
100% {
|
||||
bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes comeIn {
|
||||
0% {
|
||||
bottom: -100%;
|
||||
}
|
||||
100% {
|
||||
bottom: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes goOut {
|
||||
0% {
|
||||
bottom: 20px;
|
||||
}
|
||||
100% {
|
||||
bottom: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes goOut {
|
||||
0% {
|
||||
bottom: 20px;
|
||||
}
|
||||
100% {
|
||||
bottom: -100%;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes load {
|
||||
0% {
|
||||
transform: scaleX(0);
|
||||
}
|
||||
100% {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes load {
|
||||
0% {
|
||||
transform: scaleX(0);
|
||||
}
|
||||
100% {
|
||||
transform: scaleX(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*Scaling for other display*/
|
||||
|
||||
@media (min-width: 800px) {
|
||||
|
||||
+58
-56
@@ -11,77 +11,79 @@
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet" crossorigin>
|
||||
<title>JellyPlayer</title>
|
||||
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||
<script>
|
||||
"use strict";var ReflectOwnKeys,R="object"==typeof Reflect?Reflect:null,ReflectApply=R&&"function"==typeof R.apply?R.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}ReflectOwnKeys=R&&"function"==typeof R.ownKeys?R.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var NumberIsNaN=Number.isNaN||function(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var defaultMaxListeners=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,n,r){var i,o,s;if(checkListener(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=_getMaxListeners(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,ProcessEmitWarning(u)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=onceWrapper.bind(r);return i.listener=n,r.wrapFn=i,i}function _listeners(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?unwrapListeners(i):arrayClone(i,i.length)}function listenerCount(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function arrayClone(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function once(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,o,{once:!0}),"error"!==t&&addErrorHandlerIfEventEmitter(e,i,{once:!0})}))}function addErrorHandlerIfEventEmitter(e,t,n){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,n)}function eventTargetAgnosticAddListener(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(e){if("number"!=typeof e||e<0||NumberIsNaN(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");defaultMaxListeners=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||NumberIsNaN(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)ReflectApply(u,this,t);else{var f=u.length,v=arrayClone(u,f);for(n=0;n<f;++n)ReflectApply(v[n],this,t)}return!0},EventEmitter.prototype.addListener=function(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.onLine truncated
|
||||
window.emitter = new EventEmitter();
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
||||
<script type="module">
|
||||
import { UserApi } from 'https://cdn.jsdelivr.net/npm/@jellyfin/client-axios/+esm';
|
||||
window.UserApi = UserApi
|
||||
console.log(UserApi);
|
||||
import { UserApi, UserLibraryApi } from 'https://cdn.jsdelivr.net/npm/@jellyfin/client-axios/+esm';
|
||||
window.UserApi = UserApi;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="background">
|
||||
<div class="purple"></div>
|
||||
<div class="blue"></div>
|
||||
</div>
|
||||
<main>
|
||||
<section class="page server">
|
||||
<section class="server__cont">
|
||||
<div class="logo">
|
||||
<object data="../../assets/logo.svg" type="image/svg+xml"></object>
|
||||
</div>
|
||||
<div class="form__cont">
|
||||
<div class="input">
|
||||
<input id="serverUrl" type="url" class="input__text server__url" onblur="setLabelPos(this)">
|
||||
<label for="serverUrl" class="input__label">Server Address</label>
|
||||
<div id="background">
|
||||
<div class="purple"></div>
|
||||
<div class="blue"></div>
|
||||
</div>
|
||||
<div class="main__page login">
|
||||
<section class="page server">
|
||||
<section class="server__cont">
|
||||
<div class="logo">
|
||||
<object data="../../assets/logo.svg" type="image/svg+xml"></object>
|
||||
</div>
|
||||
<button class="input__btn save__server clicky">
|
||||
<span class="btn__label">Save</span>
|
||||
</button>
|
||||
<div class="info">
|
||||
<i class="bi bi-info-square"></i>
|
||||
<div>
|
||||
Enter your Jellyfin server address above<br>
|
||||
Example: https://jellyfin.mydomain.com or http://192.168.25.35:8096
|
||||
<div class="form__cont">
|
||||
<div class="input">
|
||||
<input id="serverUrl" type="url" class="input__text server__url" onblur="setLabelPos(this)">
|
||||
<label for="serverUrl" class="input__label">Server Address</label>
|
||||
</div>
|
||||
<button class="input__btn save__server clicky">
|
||||
<span class="btn__label">Save</span>
|
||||
</button>
|
||||
<div class="info">
|
||||
<i class="bi bi-info-square"></i>
|
||||
<div>
|
||||
Enter your Jellyfin server address above<br>
|
||||
Example: https://jellyfin.mydomain.com or http://192.168.25.35:8096
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
<section class="page users hide">
|
||||
<h3 class="title__name">Users</h3>
|
||||
<section class="user__cont"></section>
|
||||
<button class="change__server clicky" onclick="createManualLogin();document.querySelector('.manual__login').classList.remove('hide');document.querySelector('.manual__login').scrollIntoView({ behavior: 'smooth' });setInterval(() => {document.querySelector('.server').classList.add('hide');}, 1000);">
|
||||
<span>Manual Login</span>
|
||||
</button>
|
||||
<button class="change__server clicky" onclick="changeServer()">
|
||||
<span>Change Server</span>
|
||||
</button>
|
||||
</section>
|
||||
<section class="page manual__login hide">
|
||||
<div class="back" onclick="goBack(document.querySelector('.manual__login'), document.querySelector('.users'), 'manual__input')">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
<section class="page users hide">
|
||||
<h3 class="title__name">Users</h3>
|
||||
<section class="user__cont"></section>
|
||||
<button class="change__server clicky" onclick="createManualLogin(true);document.querySelector('.manual__login').classList.remove('hide');document.querySelector('.manual__login').scrollIntoView({ behavior: 'smooth' });setInterval(() => {document.querySelector('.server').classList.add('hide');}, 1000);">
|
||||
<span>Manual Login</span>
|
||||
</button>
|
||||
<button class="change__server clicky" onclick="changeServer('.users')">
|
||||
<span>Change Server</span>
|
||||
</button>
|
||||
</section>
|
||||
<section class="page manual__login hide">
|
||||
<div class="back" onclick="goBack(document.querySelector('.manual__login'), document.querySelector('.users'), 'manual__input')">
|
||||
<i class="bi bi-arrow-left"></i>
|
||||
</div>
|
||||
<section class="manual__input"></section>
|
||||
</section>
|
||||
<div class="loader hide">
|
||||
<svg width="52" height="12" viewBox="0 0 52 12" fill="none" xmlns="http://www.w3.org/2000/svg" xml:space="preserve">
|
||||
<circle cx="6" cy="6" r="6" fill="white">
|
||||
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate>
|
||||
</circle>
|
||||
<circle cx="26" cy="6" r="6" fill="white">
|
||||
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate>
|
||||
</circle>
|
||||
<circle cx="46" cy="6" r="6" fill="white">
|
||||
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate>
|
||||
</circle>
|
||||
</svg>
|
||||
</div>
|
||||
<section class="manual__input"></section>
|
||||
</section>
|
||||
<div class="loader hide">
|
||||
<svg width="52" height="12" viewBox="0 0 52 12" fill="none" xmlns="http://www.w3.org/2000/svg" xml:space="preserve">
|
||||
<circle cx="6" cy="6" r="6" fill="white">
|
||||
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate>
|
||||
</circle>
|
||||
<circle cx="26" cy="6" r="6" fill="white">
|
||||
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate>
|
||||
</circle>
|
||||
<circle cx="46" cy="6" r="6" fill="white">
|
||||
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate>
|
||||
</circle>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
<script src="qrc:/renderer/js/login.js" defer></script>
|
||||
<script src="qrc:/renderer/js/main.js" defer></script>
|
||||
</main>
|
||||
<script src="qrc:///qtwebchannel/qwebchannel.js"></script>
|
||||
<script src="qrc:/renderer/js/login.js" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
+40
-27
@@ -2,7 +2,6 @@ const serverForm = document.querySelector('.server__cont');
|
||||
const serverUrl = document.querySelector('.server__url');
|
||||
const saveBtn = document.querySelector('.save__server');
|
||||
const user__cont = document.querySelector('.users');
|
||||
const emitter = new EventEmitter();
|
||||
let html;
|
||||
var server;
|
||||
|
||||
@@ -34,8 +33,8 @@ window.onload = () => {
|
||||
});
|
||||
return value;
|
||||
};
|
||||
window.setAuthInfo = async (userName, Pw) => {
|
||||
await window.backend.setAuthInfo(userName, Pw);
|
||||
window.setAuthInfoDatabase = async (userName, Pw) => {
|
||||
await window.backend.setAuthInfoDatabase(userName, Pw);
|
||||
};
|
||||
getServerStat = async () => {
|
||||
await window.backend.getValuesFromDatabaseBool("serverGo", (data) => {
|
||||
@@ -55,14 +54,21 @@ window.onload = () => {
|
||||
console.log(`Is Jf Server = ${dat}`);
|
||||
if (dat == true) {
|
||||
emitter.emit('is-jf-server');
|
||||
getServerStat();
|
||||
window.getServer();
|
||||
} else if (dat == false) {
|
||||
emitter.emit('not-jf-server');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
emitter.on("get-server-saved", async () => {
|
||||
window.serverOnline = await window.backend.onStartup();
|
||||
if (window.serverOnline == true) {
|
||||
window.getServer();
|
||||
} else {
|
||||
emitter.emit("server-url", "offline");
|
||||
}
|
||||
});
|
||||
|
||||
emitter.on("get-server", async () => {
|
||||
window.getServer();
|
||||
});
|
||||
@@ -78,7 +84,7 @@ const createUserList = async (server) => {
|
||||
let users = await window.userApi.getPublicUsers();
|
||||
let userlist = users.data;
|
||||
console.log(userlist);
|
||||
if (userlist != []) {
|
||||
if (userlist.length != 0) {
|
||||
userlist.forEach(user => {
|
||||
if (user.PrimaryImageTag) {
|
||||
html = `<div class="user__card" data-user="${user.Name}" data-userid="${user.Id}" onclick="createEnterPassword(this.dataset.user, true, this.dataset.userid)">
|
||||
@@ -105,9 +111,9 @@ const createUserList = async (server) => {
|
||||
setTimeout(() => {
|
||||
document.querySelector('.server').classList.add('hide');
|
||||
}, 1000);
|
||||
}else if (this.userlist.length == 0) {
|
||||
}else if (userlist.length == 0) {
|
||||
document.querySelector('.loader').classList.add('hide');
|
||||
createManualLogin();
|
||||
createManualLogin(false);
|
||||
setTimeout(() => {
|
||||
document.querySelector('.server').classList.add('hide');
|
||||
}, 1000);
|
||||
@@ -146,7 +152,7 @@ const createAlert = (type, msg, page) => {
|
||||
}, 3005);
|
||||
};
|
||||
|
||||
const createDialog = (title, msg, btn, type) => {
|
||||
const createDialog = (title, msg, btn, type, page) => {
|
||||
html = `<div class="dialog ${type}">
|
||||
<div class="icon">
|
||||
<i class="bi bi-exclamation-octagon"></i>
|
||||
@@ -159,7 +165,7 @@ const createDialog = (title, msg, btn, type) => {
|
||||
</div>
|
||||
</div>
|
||||
<div class="dialog__close"></div>`;
|
||||
document.querySelector('main').insertAdjacentHTML('beforeend', html);
|
||||
document.querySelector(page).insertAdjacentHTML('beforeend', html);
|
||||
if (btn == "yes__no") {
|
||||
html = `<div class="buttons">
|
||||
<button class="clicky yes" onclick="sendClearDataRequest()">
|
||||
@@ -175,7 +181,7 @@ const createDialog = (title, msg, btn, type) => {
|
||||
<button class="clicky rem__serv" onclick="sendClearDataRequest()">
|
||||
<label>Remove Server</label>
|
||||
</button>
|
||||
<button class="clicky reload" onclick="ipcRenderer.send('reload-page')">
|
||||
<button class="clicky reload" onclick="window.backend.restart()">
|
||||
<label>Restart JellyPlayer</label>
|
||||
</button>
|
||||
</div>`;
|
||||
@@ -193,7 +199,7 @@ const sendClearDataRequest = () => {
|
||||
window.backend.clearStorage();
|
||||
};
|
||||
|
||||
const createManualLogin = () => {
|
||||
const createManualLogin = (from_users) => {
|
||||
html = `<h3 class="title__name">Login</h3>
|
||||
<div class="manual__form user">
|
||||
<div class="input">
|
||||
@@ -214,10 +220,13 @@ const createManualLogin = () => {
|
||||
<button class="clicky user__login" onclick="sendAuthInfo(document.querySelector('.user__name').value, document.querySelector('.user__password').value, document.querySelector('.remember__user'))">
|
||||
<label>Login</label>
|
||||
</button>
|
||||
<button class="change__server clicky" onclick="changeServer()">
|
||||
<button class="change__server clicky" onclick="changeServer('.manual__login')">
|
||||
<span>Change Server</span>
|
||||
</button>
|
||||
</div>`;
|
||||
if (from_users == false) {
|
||||
document.querySelector('.back').classList.add("hide");
|
||||
}
|
||||
document.querySelector('.manual__input').insertAdjacentHTML('beforeend', html);
|
||||
document.querySelector('.manual__login').classList.remove('hide');
|
||||
document.querySelector(".purple").classList.add("active");
|
||||
@@ -276,7 +285,7 @@ const sendAuthInfo = (userName, password, checkbox) => {
|
||||
Pw: password
|
||||
}
|
||||
});
|
||||
return authUser.data;
|
||||
emitter.emit("logged-in", [authUser.data.AccessToken]);
|
||||
} catch (error) {
|
||||
console.log(`[Err]Can't login, Reason: ${error}`);
|
||||
createAlert("error", "Invalid Username or Password entered try again", ".manual__login");
|
||||
@@ -285,13 +294,13 @@ const sendAuthInfo = (userName, password, checkbox) => {
|
||||
};
|
||||
if (auth() != "err") {
|
||||
if (checkbox.checked == true) {
|
||||
window.setAuthInfo(userName, password);
|
||||
window.setAuthInfoDatabase(userName, password);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const changeServer = () => {
|
||||
createDialog('Are you sure?', "You want to remove this server", "yes__no", "warning");
|
||||
const changeServer = (page) => {
|
||||
createDialog('Are you sure?', "You want to remove this server", "yes__no", "warning", page);
|
||||
};
|
||||
|
||||
const goBack = (from, to, loginForm) => {
|
||||
@@ -305,17 +314,21 @@ const goBack = (from, to, loginForm) => {
|
||||
}, 1000);
|
||||
};
|
||||
emitter.on("serverGo-true", () => {
|
||||
emitter.emit('get-server');
|
||||
emitter.emit('get-server-saved');
|
||||
emitter.on("server-url", (server) => {
|
||||
window.ax = axios.create({
|
||||
headers: {
|
||||
Authorization: vanilla_token
|
||||
}
|
||||
});
|
||||
window.userApi = new window.UserApi(undefined, server, window.ax);
|
||||
document.querySelector('.loader').classList.remove('hide');
|
||||
document.querySelector('.loader').classList.add('hide');
|
||||
createUserList(server);
|
||||
if (server != "offline") {
|
||||
window.ax = axios.create({
|
||||
headers: {
|
||||
Authorization: vanilla_token
|
||||
}
|
||||
});
|
||||
window.userApi = new window.UserApi(undefined, server, window.ax);
|
||||
document.querySelector('.loader').classList.remove('hide');
|
||||
document.querySelector('.loader').classList.add('hide');
|
||||
createUserList(server);
|
||||
} else {
|
||||
createDialog("Error", "Can't connect to Jellyfin server", "remove__server", "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
emitter.on("serverGo-false", () => {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
const mainPageCont = document.querySelector("main");
|
||||
emitter.on("logged-in", (token) => {
|
||||
html = `<div class="main__page main"></div>`;
|
||||
mainPageCont.insertAdjacentHTML("beforeend", html);
|
||||
const mainPage = document.querySelector(".main");
|
||||
mainPage.innerHTML = token;
|
||||
mainPage.scrollIntoView({ behavior: "smooth" });
|
||||
});
|
||||
Reference in new issue
Block a user