Finish work on Server/Login Page for alpha build

This commit is contained in:
Prayag committed 2022-03-23 22:32:34 +05:30
1 parent ec85b89e87
commit c862011e7b
15 files changed
+570 -376

No files matched your search

+3 -1
View File
@@ -19,7 +19,9 @@
"license": "MIT", "license": "MIT",
"config": { "config": {
"forge": { "forge": {
"packagerConfig": {}, "packagerConfig": {
"icon": "./src/assets/icon.ico"
},
"makers": [ "makers": [
{ {
"name": "@electron-forge/maker-squirrel", "name": "@electron-forge/maker-squirrel",
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 402 KiB

+16
View File
@@ -0,0 +1,16 @@
const { Jellyfin } = require('@thornbill/jellyfin-sdk');
const config = require('../config');
var apiclient = new Jellyfin({
clientInfo: {
name: 'Mordern Jellyfin client in Electron',
version: "0.0.1"
},
deviceInfo: {
name: "JellyPlayer",
id: "JellyPlayerClient"
}
});
var api = apiclient.createApi(config.get('serverUrl'));
module.exports = api;
+10 -17
View File
@@ -2,7 +2,7 @@ const { app, BrowserWindow } = require('electron');
const config = require("./config"); const config = require("./config");
const emitter = require("./common/emitter"); const emitter = require("./common/emitter");
const LoginPage = require("./pages/login"); const LoginPage = require("./pages/login");
const HomePage = require("./pages/home"); const MainPage = require("./pages/main");
async function createWindow() { async function createWindow() {
var splash = new BrowserWindow({ var splash = new BrowserWindow({
@@ -16,24 +16,19 @@ async function createWindow() {
} }
}); });
splash.loadFile('./src/render/html/splash.html'); splash.loadFile('./src/render/html/splash.html');
var homePage = new HomePage(); var mainPage = new MainPage();
var loginPage = new LoginPage(); var loginPage = new LoginPage();
loginPage.window.on('ready-to-show', () => { loginPage.window.on('ready-to-show', () => {
splash.destroy(); splash.destroy();
if (!config.get('serverUrl')) { if (config.get('openHome') == false) {
loginPage.showLogin();
} else if (config.get('openHome') == false) {
loginPage.showLogin(); loginPage.showLogin();
} else if (config.get('openHome') == true) {
loginPage.hideLogin();
mainPage.showMain();
} }
emitter.on('logged-in', () => { emitter.on('logged-in', () => {
loginPage.hideLogin(); loginPage.hideLogin();
homePage.showHome(); mainPage.showMain();
});
emitter.on('closeHome', () => {
homePage.hideHome();
config.set('openHome', false);
app.relaunch();
app.exit(0);
}); });
}); });
} }
@@ -42,8 +37,6 @@ app.whenReady().then(() => {
createWindow(); createWindow();
}); });
app.on('window-all-closed', () => { emitter.on('close-app', () => {
if (process.platform !== 'darwin') { app.quit();
app.exit(0); });
}
});
+32 -42
View File
@@ -1,20 +1,16 @@
const { app, BrowserWindow, ipcMain, nativeImage } = require('electron'); const { app, BrowserWindow, ipcMain } = require('electron');
const got = require('got'); const got = require('got');
const emitter = require('../common/emitter'); const emitter = require('../common/emitter');
const config = require('../config'); const config = require('../config');
const { Jellyfin } = require('@thornbill/jellyfin-sdk'); const api = require('../common/apiclient');
var icon = nativeImage.createFromPath('../assets/icon.png');
class LoginPage { class LoginPage {
constructor() { constructor() {
this.createWindow(); this.createWindow();
this.setConfig(); this.setConfig();
this.onstartUp(); this.onstartUp();
this.authUser(); this.authUser();
this.logoutUser();
this.getUserlist();
this.clearData(); this.clearData();
this.apiclient = api;
} }
createWindow() { createWindow() {
this.window = new BrowserWindow({ this.window = new BrowserWindow({
@@ -28,12 +24,15 @@ class LoginPage {
contextIsolation: false contextIsolation: false
}, },
show: false, show: false,
icon: icon icon: "../assets/icon.ico"
}); });
this.window.loadFile("./src/render/html/login.html"); this.window.loadFile("./src/render/html/login.html");
this.window.webContents.openDevTools();
this.window.setMenu(null); this.window.setMenu(null);
this.window.maximize(); this.window.maximize();
this.window.webContents.openDevTools();
this.window.on('closed', () => {
emitter.emit('close-app');
});
} }
onstartUp() { onstartUp() {
ipcMain.on('check-server-status', (event) => { ipcMain.on('check-server-status', (event) => {
@@ -41,6 +40,7 @@ class LoginPage {
if (response.body == '"Jellyfin Server"') { if (response.body == '"Jellyfin Server"') {
event.sender.send('server-online'); event.sender.send('server-online');
this.serverOnline = true; this.serverOnline = true;
this.getUserlist();
} }
else { else {
event.sender.send('server-offline'); event.sender.send('server-offline');
@@ -50,14 +50,16 @@ class LoginPage {
let error; let error;
event.sender.send('server-offline'); event.sender.send('server-offline');
if (typeof er == 'string') { if (typeof er == 'string') {
error = e; error = er;
} else { } else {
error = "Can't connect to Jellyfin server"; error = "Can't connect to Jellyfin server";
} }
console.log(error);
}); });
}); });
ipcMain.on('reload-page', () => { ipcMain.on('reload-page', () => {
this.window.reload(); app.relaunch();
app.quit();
}); });
} }
setConfig() { setConfig() {
@@ -68,9 +70,8 @@ class LoginPage {
event.sender.send('is-jf-server'); event.sender.send('is-jf-server');
config.set('serverUrl', serverUrl); config.set('serverUrl', serverUrl);
config.set('serverGo', true); config.set('serverGo', true);
this.window.reload(); this.getUserlist();
} } else {
else {
event.sender.send('not-jf-server'); event.sender.send('not-jf-server');
} }
}).catch((er) => { }).catch((er) => {
@@ -85,25 +86,19 @@ class LoginPage {
}); });
} }
getUserlist() { getUserlist() {
this.apiclient = new Jellyfin({ this.window.once('ready-to-show', async () => {
clientInfo: { if (this.getUsers != false) {
name: 'Mordern Jellyfin client in Electron', ipcMain.on('waiting-for-userlist', async (event) => {
version: "0.0.1" this.users = await this.apiclient.userApi.getPublicUsers();
}, if (await this.users.length == 0) {
deviceInfo: { event.sender.send('no-public-users');
name: "JellyPlayer", } else {
id: "JellyPlayerClient" event.sender.send('userlist', this.users.data);
}
});
} }
}); ipcMain.on('userlist-recieved', () => {
this.api = this.apiclient.createApi(config.get('serverUrl')); this.getUsers = false;
this.window.once('ready-to-show', () => {
ipcMain.on('waiting-for-userlist', async (event) => {
let users = await this.api.userApi.getPublicUsers();
if (users.data.length == 0) {
event.sender.send('no-public-users');
} else {
event.sender.send('userlist', users.data);
}
}); });
}); });
} }
@@ -112,7 +107,7 @@ class LoginPage {
if (config.get('openHome') == true) { if (config.get('openHome') == true) {
if (this.serverOnline == true) { if (this.serverOnline == true) {
try { try {
auth = await this.api.authenticateUserByName(config.get('user.name'), config.get('user.pass')); auth = await this.apiclient.authenticateUserByName(config.get('user.name'), config.get('user.pass'));
emitter.emit('logged-in'); emitter.emit('logged-in');
} catch (err) { } catch (err) {
console.log(err); console.log(err);
@@ -122,7 +117,7 @@ class LoginPage {
this.window.once('ready-to-show', () => { this.window.once('ready-to-show', () => {
ipcMain.on('user-auth-details', async (event, user) => { ipcMain.on('user-auth-details', async (event, user) => {
try { try {
auth = await this.api.authenticateUserByName(user[0], user[1]); auth = await this.apiclient.authenticateUserByName(user[0], user[1]);
if (user[2] == true) { if (user[2] == true) {
config.set('user.name', user[0]); config.set('user.name', user[0]);
config.set('user.pass', user[1]); config.set('user.pass', user[1]);
@@ -130,7 +125,7 @@ class LoginPage {
} }
emitter.emit('logged-in'); emitter.emit('logged-in');
} catch (err) { } catch (err) {
console.log("err"); console.log(err);
event.sender.send('user-auth-failed'); event.sender.send('user-auth-failed');
} }
@@ -138,16 +133,11 @@ class LoginPage {
}); });
} }
} }
logoutUser() {
emitter.on('logout-user', async () => {
await this.api.logout();
emitter.emit('closeHome');
});
}
clearData() { clearData() {
ipcMain.on('clear-user-data', async () => { ipcMain.on('clear-user-data', async () => {
config.clear(); config.clear();
this.window.reload(); app.relaunch();
app.quit();
}); });
} }
showLogin() { showLogin() {
+10 -8
View File
@@ -4,7 +4,7 @@ const emitter = require('../common/emitter');
const config = require('../config'); const config = require('../config');
const { Jellyfin } = require('@thornbill/jellyfin-sdk'); const { Jellyfin } = require('@thornbill/jellyfin-sdk');
class HomePage { class MainPage {
constructor() { constructor() {
this.createWindow(); this.createWindow();
this.logoutRequest(); this.logoutRequest();
@@ -21,23 +21,25 @@ class HomePage {
nodeIntegration: true nodeIntegration: true
} }
}); });
this.window.loadFile("./src/render/html/home.html"); this.window.loadFile("./src/render/html/main.html");
this.window.webContents.openDevTools(); this.window.webContents.openDevTools();
this.window.setMenu(null);
this.window.maximize();
this.window.on('closed', () => {
emitter.emit('close-app');
});
} }
logoutRequest() { logoutRequest() {
ipcMain.on('logout-user', () => { ipcMain.on('logout-user', () => {
emitter.emit('logout-user'); emitter.emit('logout-user');
}); });
} }
showHome() { showMain() {
this.window.show(); this.window.show();
} }
hideHome() { hideMain() {
this.window.hide(); this.window.hide();
} }
closeHome() {
this.window.close();
}
} }
module.exports = HomePage; module.exports = MainPage;
+8 -5
View File
@@ -1,15 +1,18 @@
/** @format */ /** @format */
@import url("https://fonts.googleapis.com/css2?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");
@import url("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,200;1,300;1,400;1,500;1,600;1,700&display=swap");
:root { :root {
--main-bg: #0d0326; --main-bg: #0d0326;
--warning-yellow: #e5df30; --warning-yellow: #f18e06;
--error-red: #b33a3a; --warning-bg: rgba(220, 128, 1, 0.16);
--error-red: #a94442;
--error-red-darker-1: #8b2e2e; --error-red-darker-1: #8b2e2e;
--error-red-bg: #240e0ea0;
--yes-green: #18be12;
--yes-green-darker-1: #15a010;
--rounding: 10px; --rounding: 10px;
--rounding-1: 5px; --rounding-1: 5px;
--transition-time-fast-1: 100ms; --transition-time-fast-2: 100ms;
--transition-time-fast-1: 150ms;
--transition-time-default: 250ms; --transition-time-default: 250ms;
--transition-time-slow-1: 350ms; --transition-time-slow-1: 350ms;
} }
+271 -71
View File
@@ -27,7 +27,7 @@ main {
height: 100vh; height: 100vh;
z-index: 1; z-index: 1;
display: flex; display: flex;
justify-content: flex-start; /* justify-content: flex-start; */
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
} }
@@ -61,16 +61,31 @@ main {
.page > button { .page > button {
width: 60vw; width: 60vw;
max-width: 32em;
}
.page.manual__login {
position: relative;
} }
.server__cont, .server__cont,
.user__cont, .user__cont,
.manual__input { .manual__input {
position: static; position: static;
width: 60vw; width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
max-width: 30em; max-width: 30em;
} }
.manual__input {
width: 60vw;
display: flex;
flex-flow: column;
align-items: stretch;
justify-content: center;
}
.server__cont { .server__cont {
display: flex; display: flex;
flex-flow: column; flex-flow: column;
@@ -84,7 +99,7 @@ button.clicky {
button.clicky::after { button.clicky::after {
content: ""; content: "";
box-shadow: 0 0 15px 40px white; box-shadow: 0 0 15px 40px var(--clr);
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
@@ -111,6 +126,7 @@ input[type="password"] {
} }
button { button {
--clr: currentColor;
overflow: hidden; overflow: hidden;
background: #ffffff4b; background: #ffffff4b;
border: 2px solid white; border: 2px solid white;
@@ -161,10 +177,12 @@ input:focus + .input__label,
font-size: calc(60vw / 20); font-size: calc(60vw / 20);
} }
.info svg { .info i {
color: var(--warning-yellow); color: var(--warning-yellow);
height: 100%; font-size: min(1.5em, 30px);
width: min(1.5em, 30px); height: -webkit-fit-content;
height: -moz-fit-content;
height: fit-content;
} }
.info div { .info div {
@@ -175,76 +193,138 @@ input:focus + .input__label,
width: fit-content; width: fit-content;
} }
.popup { .alert {
position: fixed; position: absolute;
top: 50%; box-sizing: content-box;
left: 50%; width: 50vw;
transform: translate(-50%, -50%); max-width: 20em;
width: 40vw;
height: 30vh;
min-height: 15em;
min-width: 25em;
}
.icon {
height: 40%;
display: flex; display: flex;
align-items: flex-start; left: 20px;
justify-content: flex-start; background: var(--background);
}
.icon svg {
width: auto;
height: 100%;
}
.error .icon svg {
color: var(--error-red);
}
.waring .icon svg {
color: var(--warning-yellow);
}
.popup .text {
font-family: "IBM Plex Mono";
font-weight: 300;
}
.popup__exit__btn {
border-radius: 100px;
border: none;
background: var(--error-red);
color: white; color: white;
transition: background var(--transition-time-default); border-radius: var(--rounding);
font-weight: 600;
justify-content: center;
align-items: center;
box-shadow: 0 0 30px rgb(0 0 0 / 0.5);
overflow: hidden;
-webkit-animation: comeIn var(--transition-time-default) forwards;
animation: comeIn var(--transition-time-default) forwards;
} }
.popup__exit__btn:hover { .alert .icon {
background: var(--error-red-darker-1); font-size: 2.5em;
background: var(--color);
height: 100%;
flex-shrink: 0;
flex-grow: 1;
padding: 15px;
}
.alert .msg {
padding: 0 15px;
}
.warning {
--background: var(--warning-bg);
--color: var(--warning-yellow);
}
.alert.error {
--background: var(--main-bg);
--color: var(--error-red);
}
.dialog {
position: fixed;
background: var(--main-bg);
z-index: 1;
height: -webkit-fit-content;
height: -moz-fit-content;
height: fit-content;
inset: 50% 0 0 50%;
transform: translate(-50%, -50%);
box-sizing: content-box;
padding: 20px;
color: black;
border-radius: var(--rounding);
box-shadow: 0 10px 35px rgba(5, 5, 5, 0.7);
max-width: 20em;
}
.dialog .icon {
color: var(--color);
border-left: 5px solid;
padding: 0 0 0 15px;
font-size: 3em;
margin-left: -20px;
}
.dialog.error {
--color: var(--error-red);
}
.dialog.warning {
--color: var(--warning-yellow);
}
.dialog .title {
font-size: 2em;
font-weight: 600;
color: rgb(255 255 255 / 90%);
}
.dialog .msg {
font-size: 1.25em;
font-weight: 400;
color: rgb(255 255 255 / 65%);
margin: 0.5em 0;
}
.buttons {
display: flex;
gap: 10px;
}
.dialog__close {
position: fixed;
width: 100vw;
height: 100vh;
background: rgba(5, 5, 5, 0.5);
z-index: 0;
} }
.error.active, .error.active,
.popup__exit.active { .dialog.active,
-webkit-animation: fadeIn var(--transition-time-slow-1); .warning.active,
animation: fadeIn var(--transition-time-slow-1); .dialog__close.active {
-webkit-animation: fadeIn var(--transition-time-fast-1);
animation: fadeIn var(--transition-time-fast-1);
display: block; display: block;
visibility: visible; visibility: visible;
} }
.popup__exit { .dialog.fadeOut,
position: fixed; .dialog__close.fadeOut {
width: 100vw; -webkit-animation: fadeOut var(--transition-time-fast-1) forwards;
height: 100vh; animation: fadeOut var(--transition-time-fast-1) forwards;
background: rgba(0, 0, 0, 0.3);
opacity: 1;
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
} }
.popup__exit.fadeOut, .alert.goOut {
.popup.error.fadeOut { -webkit-animation: goOut var(--transition-time-default) forwards;
-webkit-animation: fadeOut var(--transition-time-slow-1) forwards; animation: goOut var(--transition-time-default) forwards;
animation: fadeOut var(--transition-time-slow-1) forwards; }
.alert .load {
position: absolute;
bottom: 0;
height: 5px;
background: white;
width: 100%;
transform: scaleX(0);
-webkit-animation: load 3s forwards;
animation: load 3s forwards linear;
transform-origin: left;
} }
.loader { .loader {
@@ -279,10 +359,13 @@ section.user__cont {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
overflow: auto hidden; overflow: auto hidden;
gap: 1em;
} }
.user__card { .user__card {
width: 50%; width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
overflow: hidden; overflow: hidden;
flex-shrink: 0; flex-shrink: 0;
} }
@@ -328,14 +411,41 @@ section.user__cont {
grid-gap: 10px; grid-gap: 10px;
} }
.user__info .name { .title__name {
text-shadow: 0 0 8px #00000057; -webkit-filter: drop-shadow(0 0 8px #00000057);
filter: drop-shadow(0 0 8px #00000057);
text-align: center; text-align: center;
width: 100%; width: -webkit-fit-content;
font-weight: 300; width: -moz-fit-content;
width: fit-content;
font-weight: 500;
padding: 0; padding: 0;
margin: 0; margin: 0;
font-size: min(2em, calc(100vw / 25)); font-size: calc(100vw / 15);
position: relative;
margin-bottom: 0.5em;
align-self: center;
}
.title__name::after {
content: "";
width: 70%;
height: 2px;
position: absolute;
bottom: -2px;
left: 50%;
transform: translateX(-50%);
background: white;
}
.user__info .title__name::after,
.manual__login .title__name::after {
all: unset;
}
.user__info .title__name {
font-size: calc(100vw / 20);
margin-bottom: 0;
} }
.user__info .user__img { .user__info .user__img {
@@ -364,8 +474,8 @@ section.user__cont {
.tick path { .tick path {
stroke: white; stroke: white;
stroke-dasharray: 100%; stroke-dasharray: 100%;
stroke-dashoffset: 100%; stroke-dashoffset: -100%;
transition: stroke-dashoffset var(--transition-time-fast-1); transition: stroke-dashoffset var(--transition-time-fast-2);
} }
input[type="checkbox"]:checked + .tick > path { input[type="checkbox"]:checked + .tick > path {
@@ -381,6 +491,34 @@ input[type="checkbox"]:checked + .tick > path {
margin: 0; margin: 0;
} }
.manual__form {
display: flex;
flex-flow: column;
gap: 20px;
row-gap: 20px;
-moz-column-gap: 20px;
column-gap: 20px;
}
.back {
position: absolute;
top: 0;
left: 0;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
z-index: 1;
padding: 0.3em 0.5em;
font-size: 1.5em;
background: rgb(20 20 20 / 0.5);
border-radius: 0 0 5px 0;
transition: background var(--transition-time-fast-1);
}
.back:hover {
background: rgb(20 20 20 / 0.7);
}
/*Animations*/ /*Animations*/
@-webkit-keyframes fadeInBg { @-webkit-keyframes fadeInBg {
0% { 0% {
@@ -447,3 +585,65 @@ input[type="checkbox"]:checked + .tick > path {
opacity: 0; 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) {
.title__name {
font-size: 2.7em;
}
}
File renamed without changes.
+41 -46
View File
@@ -6,6 +6,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../css/login.css"> <link rel="stylesheet" href="../css/login.css">
<link rel="stylesheet" href="../css/global.css"> <link rel="stylesheet" href="../css/global.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<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">
<title>Jellyfin</title> <title>Jellyfin</title>
</head> </head>
<body> <body>
@@ -47,10 +51,7 @@
<span class="btn__label">Save</span> <span class="btn__label">Save</span>
</button> </button>
<div class="info"> <div class="info">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-square" viewBox="0 0 16 16"> <i class="bi bi-info-square"></i>
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"/>
<path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
</svg>
<div> <div>
Enter your Jellyfin server address above<br> Enter your Jellyfin server address above<br>
Example: https://jellyfin.mydomain.com or http://192.168.25.35:8096 Example: https://jellyfin.mydomain.com or http://192.168.25.35:8096
@@ -60,57 +61,51 @@
</section> </section>
</section> </section>
<section class="page users hide"> <section class="page users hide">
<h3 class="title__name">Users</h3>
<section class="user__cont"></section> <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()"> <button class="change__server clicky" onclick="changeServer()">
<span>Change Server</span> <span>Change Server</span>
</button> </button>
</section> </section>
<section class="page manual__login hide"> <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 class="manual__input"></section>
</section> </section>
<div class="popup__exit hide"></div> <div class="loader hide">
<div class="popup error hide"> <svg width="52" height="12" viewBox="0 0 52 12" fill="none" xmlns="http://www.w3.org/2000/svg" xml:space="preserve">
<div class="icon"> <circle cx="6" cy="6" r="6" fill="white">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle" viewBox="0 0 16 16"> <animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate>
<path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/> </circle>
<path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/> <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> </svg>
</div> </div>
<h2 class="text">Can't determine if the entered Server address is a valid Jellyfin Server</h2> </main>
<button class="popup__exit__btn clicky"> <script>if (typeof module === 'object') {
<span class="btn__label">Try Again</span> window.module = module;
</button> module = undefined;
</div> };
<div class="loader hide"> </script>
<svg width="52" height="12" viewBox="0 0 52 12" fill="none" xmlns="http://www.w3.org/2000/svg" xml:space="preserve"> <script src="https://cdn.jsdelivr.net/gh/jquery/jquery@3.6.0/dist/jquery.min.js"></script>
<circle cx="6" cy="6" r="6" fill="white"> <script src="https://cdn.jsdelivr.net/npm/jquery.scrollto@2.1.3/jquery.scrollTo.min.js"></script>
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.1"></animate> <script src="../js/login.js"></script>
</circle>
<circle cx="26" cy="6" r="6" fill="white"> <script>if (window.module) module = window.module;</script>
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.2"></animate>
</circle> <script>
<circle cx="46" cy="6" r="6" fill="white"> function normalizeColor(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]}["SCREEN","LINEAR_LIGHT"].reduce(((e,n,t)=>Object.assign(e,{[n]:t})),{});class MiniGl{constructor(e,n,t,i=!1){const s=this,o=-1!==document.location.search.toLowerCase().indexOf("debug=webgl");s.canvas=e,s.gl=s.canvas.getContext("webgl",{antialias:!0}),s.meshes=[];const r=s.gl;n&&t&&this.setSize(n,t),s.lastDebugMsg,s.debug=i&&o?function(e){const n=new Date;n-s.lastDebugMsg>1e3&&console.log("---"),console.log(n.toLocaleTimeString()+Array(Math.max(0,32-e.length)).join(" ")+e+": ",...Array.from(arguments).slice(1)),s.lastDebugMsg=n}:()=>{},Object.defineProperties(s,{Material:{enumerable:!1,value:class{constructor(e,n,t={}){const i=this;function o(e,n){const t=r.createShader(e);return r.shaderSource(t,n),r.compileShader(t),r.getShaderParameter(t,r.COMPILE_STATUS)||console.error(r.getShaderInfoLog(t)),s.debug("Material.compileShaderSource",{source:n}),t}function a(e,n){return Object.entries(e).map((([e,t])=>t.getDeclaration(e,n))).join("\n")}i.uniforms=t,i.uniformInstances=[];const l="\n precision highp float;\n ";i.vertexSource=`\n ${l}\n attribute vec4 position;\n attribute vec2 uv;\n attribute vec2 uvNorm;\n ${a(s.commonUniforms,"vertex")}\n ${a(t,"vertex")}\n ${e}\n `,i.Source=`\n ${l}\n ${a(s.commonUniforms,"fragment")}\n ${a(t,"fragment")}\n ${n}\n `,i.vertexShader=o(r.VERTEX_SHADER,i.vertexSource),i.fragmentShader=o(r.FRAGMENT_SHADER,i.Source),i.program=r.createProgram(),r.attachShader(i.program,i.vertexShader),r.attachShader(i.program,i.fragmentShader),r.linkProgram(i.program),r.getProgramParameter(i.program,r.LINK_STATUS)||console.error(r.getProgramInfoLog(i.program)),r.useProgram(i.program),i.attachUniforms(void 0,s.commonUniforms),i.attachUniforms(void 0,i.uniforms)}attachUniforms(e,n){const t=this;void 0===e?Object.entries(n).forEach((([e,n])=>{t.attachUniforms(e,n)})):"array"==n.type?n.value.forEach(((n,i)=>t.attachUniforms(`${e}[${i}]`,n))):"struct"==n.type?Object.entries(n.value).forEach((([n,i])=>t.attachUniforms(`${e}.${n}`,i))):(s.debug("Material.attachUniforms",{name:e,uniform:n}),t.uniformInstances.push({uniform:n,location:r.getUniformLocation(t.program,e)}))}}},Uniform:{enumerable:!1,value:class{constructor(e){this.type="float",Object.assign(this,e),this.typeFn={float:"1f",int:"1i",vec2:"2fv",vec3:"3fv",vec4:"4fv",mat4:"Matrix4fv"}[this.type]||"1f",this.update()}update(e){void 0!==this.value&&r[`uniform${this.typeFn}`](e,0===this.typeFn.indexOf("Matrix")?this.transpose:this.value,0===this.typeFn.indexOf("Matrix")?this.value:null)}getDeclaration(e,n,t){const i=this;if(i.excludeFrom!==n){if("array"===i.type)return i.value[0].getDeclaration(e,n,i.value.length)+`\nconst int ${e}_length = ${i.value.length};`;if("struct"===i.type){let s=e.replace("u_","");return s=s.charAt(0).toUpperCase()+s.slice(1),`uniform struct ${s} \n {\n`+Object.entries(i.value).map((([e,t])=>t.getDeclaration(e,n).replace(/^uniform/,""))).join("")+`\n} ${e}${t>0?`[${t}]`:""};`}return`uniform ${i.type} ${e}${t>0?`[${t}]`:""};`}}}},PlaneGeometry:{enumerable:!1,value:class{constructor(e,n,t,i,o){r.createBuffer(),this.attributes={position:new s.Attribute({target:r.ARRAY_BUFFER,size:3}),uv:new s.Attribute({target:r.ARRAY_BUFFER,size:2}),uvNorm:new s.Attribute({target:r.ARRAY_BUFFER,size:2}),index:new s.Attribute({target:r.ELEMENT_ARRAY_BUFFER,size:3,type:r.UNSIGNED_SHORT})},this.setTopology(t,i),this.setSize(e,n,o)}setTopology(e=1,n=1){const t=this;t.xSegCount=e,t.ySegCount=n,t.vertexCount=(t.xSegCount+1)*(t.ySegCount+1),t.quadCount=t.xSegCount*t.ySegCount*2,t.attributes.uv.values=new Float32Array(2*t.vertexCount),t.attributes.uvNorm.values=new Float32Array(2*t.vertexCount),t.attributes.index.values=new Uint16Array(3*t.quadCount);for(let e=0;e<=t.ySegCount;e++)for(let n=0;n<=t.xSegCount;n++){const i=e*(t.xSegCount+1)+n;if(t.attributes.uv.values[2*i]=n/t.xSegCount,t.attributes.uv.values[2*i+1]=1-e/t.ySegCount,t.attributes.uvNorm.values[2*i]=n/t.xSegCount*2-1,t.attributes.uvNorm.values[2*i+1]=1-e/t.ySegCount*2,n<t.xSegCount&&e<t.ySegCount){const s=e*t.xSegCount+n;t.attributes.index.values[6*s]=i,t.attributes.index.values[6*s+1]=i+1+t.xSegCount,t.attributes.index.values[6*s+2]=i+1,t.attributes.index.values[6*s+3]=i+1,t.attributes.index.values[6*s+4]=i+1+t.xSegCount,t.attributes.index.values[6*s+5]=i+2+t.xSegCount}}t.attributes.uv.update(),t.attributes.uvNorm.update(),t.attributes.index.update(),s.debug("Geometry.setTopology",{uv:t.attributes.uv,uvNorm:t.attributes.uvNorm,index:t.attributes.index})}setSize(e=1,n=1,t="xz"){const i=this;i.width=e,i.height=n,i.orientation=t,i.attributes.position.values&&i.attributes.position.values.length===3*i.vertexCount||(i.attributes.position.values=new Float32Array(3*i.vertexCount));const o=e/-2Line truncated
<animate attributeName="opacity" dur="1s" values="0;1;0" repeatCount="indefinite" begin="0.3"></animate> let gradient = new Gradient();
</circle> gradient.initGradient("#background", "#aa5cc3","#00a4dc", "#003C50", "#3E2247");
</svg> </script>
</div>
</main>
<script>if (typeof module === 'object') {
window.module = module;
module = undefined;
};
</script>
<script src="https://cdn.jsdelivr.net/gh/jquery/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.scrollto@2.1.3/jquery.scrollTo.min.js"></script>
<script src="../js/login.js"></script>
<script>if (window.module) module = window.module;</script>
<script>
function normalizeColor(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]}["SCREEN","LINEAR_LIGHT"].reduce(((e,n,t)=>Object.assign(e,{[n]:t})),{});class MiniGl{constructor(e,n,t,i=!1){const s=this,o=-1!==document.location.search.toLowerCase().indexOf("debug=webgl");s.canvas=e,s.gl=s.canvas.getContext("webgl",{antialias:!0}),s.meshes=[];const r=s.gl;n&&t&&this.setSize(n,t),s.lastDebugMsg,s.debug=i&&o?function(e){const n=new Date;n-s.lastDebugMsg>1e3&&console.log("---"),console.log(n.toLocaleTimeString()+Array(Math.max(0,32-e.length)).join(" ")+e+": ",...Array.from(arguments).slice(1)),s.lastDebugMsg=n}:()=>{},Object.defineProperties(s,{Material:{enumerable:!1,value:class{constructor(e,n,t={}){const i=this;function o(e,n){const t=r.createShader(e);return r.shaderSource(t,n),r.compileShader(t),r.getShaderParameter(t,r.COMPILE_STATUS)||console.error(r.getShaderInfoLog(t)),s.debug("Material.compileShaderSource",{source:n}),t}function a(e,n){return Object.entries(e).map((([e,t])=>t.getDeclaration(e,n))).join("\n")}i.uniforms=t,i.uniformInstances=[];const l="\n precision highp float;\n ";i.vertexSource=`\n ${l}\n attribute vec4 position;\n attribute vec2 uv;\n attribute vec2 uvNorm;\n ${a(s.commonUniforms,"vertex")}\n ${a(t,"vertex")}\n ${e}\n `,i.Source=`\n ${l}\n ${a(s.commonUniforms,"fragment")}\n ${a(t,"fragment")}\n ${n}\n `,i.vertexShader=o(r.VERTEX_SHADER,i.vertexSource),i.fragmentShader=o(r.FRAGMENT_SHADER,i.Source),i.program=r.createProgram(),r.attachShader(i.program,i.vertexShader),r.attachShader(i.program,i.fragmentShader),r.linkProgram(i.program),r.getProgramParameter(i.program,r.LINK_STATUS)||console.error(r.getProgramInfoLog(i.program)),r.useProgram(i.program),i.attachUniforms(void 0,s.commonUniforms),i.attachUniforms(void 0,i.uniforms)}attachUniforms(e,n){const t=this;void 0===e?Object.entries(n).forEach((([e,n])=>{t.attachUniforms(e,n)})):"array"==n.type?n.value.forEach(((n,i)=>t.attachUniforms(`${e}[${i}]`,n))):"struct"==n.type?Object.entries(n.value).forEach((([n,i])=>t.attachUniforms(`${e}.${n}`,i))):(s.debug("Material.attachUniforms",{name:e,uniform:n}),t.uniformInstances.push({uniform:n,location:r.getUniformLocation(t.program,e)}))}}},Uniform:{enumerable:!1,value:class{constructor(e){this.type="float",Object.assign(this,e),this.typeFn={float:"1f",int:"1i",vec2:"2fv",vec3:"3fv",vec4:"4fv",mat4:"Matrix4fv"}[this.type]||"1f",this.update()}update(e){void 0!==this.value&&r[`uniform${this.typeFn}`](e,0===this.typeFn.indexOf("Matrix")?this.transpose:this.value,0===this.typeFn.indexOf("Matrix")?this.value:null)}getDeclaration(e,n,t){const i=this;if(i.excludeFrom!==n){if("array"===i.type)return i.value[0].getDeclaration(e,n,i.value.length)+`\nconst int ${e}_length = ${i.value.length};`;if("struct"===i.type){let s=e.replace("u_","");return s=s.charAt(0).toUpperCase()+s.slice(1),`uniform struct ${s} \n {\n`+Object.entries(i.value).map((([e,t])=>t.getDeclaration(e,n).replace(/^uniform/,""))).join("")+`\n} ${e}${t>0?`[${t}]`:""};`}return`uniform ${i.type} ${e}${t>0?`[${t}]`:""};`}}}},PlaneGeometry:{enumerable:!1,value:class{constructor(e,n,t,i,o){r.createBuffer(),this.attributes={position:new s.Attribute({target:r.ARRAY_BUFFER,size:3}),uv:new s.Attribute({target:r.ARRAY_BUFFER,size:2}),uvNorm:new s.Attribute({target:r.ARRAY_BUFFER,size:2}),index:new s.Attribute({target:r.ELEMENT_ARRAY_BUFFER,size:3,type:r.UNSIGNED_SHORT})},this.setTopology(t,i),this.setSize(e,n,o)}setTopology(e=1,n=1){const t=this;t.xSegCount=e,t.ySegCount=n,t.vertexCount=(t.xSegCount+1)*(t.ySegCount+1),t.quadCount=t.xSegCount*t.ySegCount*2,t.attributes.uv.values=new Float32Array(2*t.vertexCount),t.attributes.uvNorm.values=new Float32Array(2*t.vertexCount),t.attributes.index.values=new Uint16Array(3*t.quadCount);for(let e=0;e<=t.ySegCount;e++)for(let n=0;n<=t.xSegCount;n++){const i=e*(t.xSegCount+1)+n;if(t.attributes.uv.values[2*i]=n/t.xSegCount,t.attributes.uv.values[2*i+1]=1-e/t.ySegCount,t.attributes.uvNorm.values[2*i]=n/t.xSegCount*2-1,t.attributes.uvNorm.values[2*i+1]=1-e/t.ySegCount*2,n<t.xSegCount&&e<t.ySegCount){const s=e*t.xSegCount+n;t.attributes.index.values[6*s]=i,t.attributes.index.values[6*s+1]=i+1+t.xSegCount,t.attributes.index.values[6*s+2]=i+1,t.attributes.index.values[6*s+3]=i+1,t.attributes.index.values[6*s+4]=i+1+t.xSegCount,t.attributes.index.values[6*s+5]=i+2+t.xSegCount}}t.attributes.uv.update(),t.attributes.uvNorm.update(),t.attributes.index.update(),s.debug("Geometry.setTopology",{uv:t.attributes.uv,uvNorm:t.attributes.uvNorm,index:t.attributes.index})}setSize(e=1,n=1,t="xz"){const i=this;i.width=e,i.height=n,i.orientation=t,i.attributes.position.values&&i.attributes.position.values.length===3*i.vertexCount||(i.attributes.position.values=new Float32Array(3*i.vertexCount));const o=e/-2,r=nLine truncated
let gradient = new Gradient();
gradient.initGradient("#background", "#aa5cc3","#00a4dc", "#003C50", "#3E2247");
</script>
</body> </body>
</html> </html>
@@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="alternate" href="../css/home.css" type="application/atom+xml" title="Atom"> <link rel="alternate" href="../css/main.css" type="application/atom+xml" title="Atom">
<title>Document</title> <title>Document</title>
</head> </head>
<body> <body>
@@ -16,7 +16,7 @@
}; };
</script> </script>
<script src="../js/home.js"></script> <script src="../js/main.js"></script>
<script>if (window.module) module = window.module;</script> <script>if (window.module) module = window.module;</script>
</body> </body>
View File
Whitespace-only changes.
+177 -184
View File
@@ -1,5 +1,4 @@
const { ipcRenderer } = require("electron"); const { ipcRenderer } = require("electron");
const got = require('got');
const emitter = require('../../common/emitter'); const emitter = require('../../common/emitter');
const config = require("../../config"); const config = require("../../config");
const serverForm = document.querySelector('.server__cont'); const serverForm = document.querySelector('.server__cont');
@@ -14,29 +13,30 @@ const createUserList = () => {
document.querySelector('.loader').classList.remove('hide'); document.querySelector('.loader').classList.remove('hide');
ipcRenderer.on('userlist', (event, userlist) => { ipcRenderer.on('userlist', (event, userlist) => {
console.log(userlist); console.log(userlist);
event.sender.send('userlist-recieved');
userlist.forEach(user => { userlist.forEach(user => {
if (user.PrimaryImageTag) { 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)"> html = `<div class="user__card" data-user="${user.Name}" data-userid="${user.Id}" onclick="createEnterPassword(this.dataset.user, true, this.dataset.userid)">
<div class="content"> <div class="content">
<img class="user__img" src="${config.get('serverUrl')}/Users/${user.Id}/Images/Primary"> <img class="user__img" src="${config.get('serverUrl')}/Users/${user.Id}/Images/Primary">
<h1>${user.Name}</h1> <h1>${user.Name}</h1>
</div> </div>
</div>`; </div>`;
} }
else if (!user.PrimaryImageTag) { else if (!user.PrimaryImageTag) {
html = `<div class="user__card" data-user="${user.Name}" onclick="createEnterPassword(this.dataset.user, false)"> html = `<div class="user__card" data-user="${user.Name}" onclick="createEnterPassword(this.dataset.user, false)">
<div class="content"> <div class="content">
<img class="user__svg" src="../svg/avatar.svg"> <img class="user__svg" src="../svg/avatar.svg">
<h1>${user.Name}</h1> <h1>${user.Name}</h1>
</div> </div>
</div>`; </div>`;
} }
document.querySelector('.user__cont').insertAdjacentHTML('beforeend', html); document.querySelector('.user__cont').insertAdjacentHTML('beforeend', html);
}); });
document.querySelector('.users').classList.remove('hide'); document.querySelector('.users').classList.remove('hide');
document.querySelector('.users').scrollIntoView({ behavior: "smooth" }); document.querySelector('.users').scrollIntoView({ behavior: "smooth" });
document.querySelector('.loader').classList.add('hide'); document.querySelector('.loader').classList.add('hide');
setInterval(() => { setTimeout(() => {
document.querySelector('.server').classList.add('hide'); document.querySelector('.server').classList.add('hide');
}, 1000); }, 1000);
// $('main').scrollTo('.users', '2s'); // $('main').scrollTo('.users', '2s');
@@ -44,91 +44,119 @@ const createUserList = () => {
ipcRenderer.on('no-public-users', () => { ipcRenderer.on('no-public-users', () => {
document.querySelector('.loader').classList.add('hide'); document.querySelector('.loader').classList.add('hide');
createManualLogin(); createManualLogin();
document.querySelector('.manual__login').classList.remove('hide'); setTimeout(() => {
document.querySelector('.manual__login').scrollIntoView({ behavior: "smooth" }); document.querySelector('.server').classList.add('hide');
}, 1000);
}); });
}; };
const closePopup = () => { const closeDialog = () => {
document.querySelector('.popup__exit').addEventListener('click', () => { document.querySelector('.dialog').classList.remove('active');
document.querySelector('.error').classList.remove('active'); document.querySelector('.dialog__close').classList.remove('active');
document.querySelector('.error').classList.add('fadeOut'); document.querySelector('.dialog').classList.add('fadeOut');
document.querySelector('.popup__exit').classList.remove('active'); document.querySelector('.dialog__close').classList.add('fadeOut');
document.querySelector('.popup__exit').classList.add('fadeOut'); setTimeout(() => {
setTimeout(() => { document.querySelector('.dialog').classList.remove('fadeOut');
document.querySelector('.error').classList.remove('fadeOut'); document.querySelector('.dialog__close').classList.remove('fadeOut');
document.querySelector('.popup__exit').classList.remove('fadeOut'); document.querySelector('.dialog').remove();
document.querySelector('.error').classList.add('hide'); document.querySelector('.dialog__close').remove();
document.querySelector('.popup__exit').classList.add('hide'); }, 305);
}, 305);
});
document.querySelector('.popup__exit__btn').addEventListener('click', () => {
document.querySelector('.error').classList.remove('active');
document.querySelector('.error').classList.add('fadeOut');
document.querySelector('.popup__exit').classList.remove('active');
document.querySelector('.popup__exit').classList.add('fadeOut');
setTimeout(() => {
document.querySelector('.error').classList.remove('fadeOut');
document.querySelector('.popup__exit').classList.remove('fadeOut');
document.querySelector('.error').classList.add('hide');
document.querySelector('.popup__exit').classList.add('hide');
}, 300);
});
}; };
const createServerErr = () => { const createAlert = (type, msg, page) => {
document.querySelector('.error').classList.remove('hide'); html = `<div class="alert ${type}">
document.querySelector('.error').classList.add('active'); <div class="icon">
document.querySelector('.popup__exit').classList.remove('hide'); <i class="bi bi-exclamation-octagon"></i>
document.querySelector('.popup__exit').classList.add('active'); </div>
closePopup(); <div class="msg">
${msg}
</div>
<div class="load"></div>
</div>`;
document.querySelector(page).insertAdjacentHTML('beforeend', html);
setTimeout(() => {
document.querySelector('.alert').classList.add('goOut');
setTimeout(() => {
document.querySelector('.alert').remove();
}, 1000);
}, 3000);
};
const createDialog = (title, msg, btn, type) => {
html = `<div class="dialog ${type}">
<div class="icon">
<i class="bi bi-exclamation-octagon"></i>
</div>
<div class="title">
${title}
</div>
<div class="msg">
${msg}
</div>
</div>
<div class="dialog__close"></div>`;
document.querySelector('main').insertAdjacentHTML('beforeend', html);
if (btn == "yes__no") {
html = `<div class="buttons">
<button class="clicky yes" onclick="sendClearDataRequest()">
<label>Yes</label>
</button>
<button class="clicky no" onclick="closeDialog()">
<label>No</label>
</button>
</div>`;
document.querySelector('.dialog').insertAdjacentHTML('beforeend', html);
} else if (btn == "remove__server") {
html = `<div class="buttons">
<button class="clicky rem__serv" onclick="sendClearDataRequest()">
<label>Remove Server</label>
</button>
<button class="clicky reload" onclick="ipcRenderer.send('reload-page')">
<label>Restart JellyPlayer</label>
</button>
</div>`;
document.querySelector('.dialog').insertAdjacentHTML('beforeend', html);
}
document.querySelector('.dialog').classList.add('active');
document.querySelector('.dialog__close').classList.add('active');
document.querySelector('.dialog__close').addEventListener('click', () => {
closeDialog();
});
document.querySelector('.loader').classList.add('hide');
}; };
const sendClearDataRequest = () => { const sendClearDataRequest = () => {
ipcRenderer.send('clear-user-data'); ipcRenderer.send('clear-user-data');
console.log('cleardata');
}; };
if (config.get('serverGo') == true) {
document.querySelector('.loader').classList.remove('hide');
ipcRenderer.send('check-server-status');
ipcRenderer.on('server-online', () => {
document.querySelector('.loader').classList.add('hide');
createUserList();
});
ipcRenderer.on('server-offline', () => {
html = `<button class="popup__cleardata__button" onclick="sendClearDataRequest()">
<span class="btn__label">Clear Data</span>
</button>`;
document.querySelector('.loader').classList.add('hide');
document.querySelector('.popup__exit__btn').addEventListener('click', () => {
ipcRenderer.send('reload-page');
});
document.querySelector('.error').insertAdjacentHTML('beforeend', html);
createServerErr();
});
} else if (config.get('serverGo') == false) {
saveBtn.onclick = () => {
ipcRenderer.send('setServer', serverUrl.value);
document.querySelector('.loader').classList.remove('hide');
ipcRenderer.on('not-jf-server', () => {
document.querySelector('.loader').classList.add('hide');
createServerErr();
});
};
}
const createManualLogin = () => { const createManualLogin = () => {
html = `<div class="one"> html = `<h3 class="title__name">Login</h3>
<input type="text" value="" class="user__name"> <div class="manual__form user">
<input type="password" value="" class="user__password"> <div class="input">
<input class="remember__user" type="checkbox" value="true"> <input type="text" value="" class="user__name" onblur="setLabelPos(this)">
<input type="button" value="Login" class="user__login" onclick="sendAuthInfo()"> <label class="input__label" for="user__name">Username</label>
</div>`; </div>
<div class="input">
<input type="password" value="" class="user__password" onblur="setLabelPos(this)">
<label class="input__label" for="user__password">Password</label>
</div>
<div class="input checkbox">
<label>Remember me</label>
<input class="remember__user" type="checkbox" value="true" style="-webkit-appearance: none;">
<svg class="tick" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.854 3.646L6.5 11L2.646 7.146" stroke="black" stroke-linecap="round"/>
</svg>
</div>
<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()">
<span>Change Server</span>
</button>
</div>`;
document.querySelector('.manual__input').insertAdjacentHTML('beforeend', html); document.querySelector('.manual__input').insertAdjacentHTML('beforeend', html);
document.querySelector('.manual__login').classList.remove('hide');
document.querySelector('.manual__login').scrollIntoView({ behavior: "smooth" });
}; };
const setLabelPos = (element) => { const setLabelPos = (element) => {
@@ -140,119 +168,84 @@ const setLabelPos = (element) => {
}; };
const createEnterPassword = (userName, userImg, userId) => { const createEnterPassword = (userName, userImg, userId) => {
if (userImg == true) { html = `<div class="user">
html = `<div class="user"> <div class="user__info">
<div class="user__info"> <h3 class="title__name">Hello, ${userName}</h3>
<img class="user__img" src="${config.get('serverUrl')}/Users/${userId}/Images/Primary"> </div>
<h3 class="name">Hello, ${userName}</h3> <div class="input">
</div> <input type="password" value="" class="user__password" onblur="setLabelPos(this)">
<div class="input"> <label for="user__password" class="input__label">Password</label>
<input type="password" value="" class="user__password" onblur="setLabelPos(this)"> </div>
<label for="user__password" class="input__label">Password</label> <div class="input checkbox">
</div> <label>Remember me</label>
<div class="input checkbox"> <input class="remember__user" type="checkbox" value="true" style="-webkit-appearance: none;">
<label>Remember me</label> <svg class="tick" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<input class="remember__user" type="checkbox" value="true" style="-webkit-appearance: none;"> <path d="M13.854 3.646L6.5 11L2.646 7.146" stroke="black" stroke-linecap="round"/>
<svg class="tick" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> </svg>
<path d="M13.854 3.646L6.5 11L2.646 7.146" stroke="black" stroke-linecap="round"/> </div>
</svg> <button class="user__login clicky" data-user="${userName}" onclick="sendAuthInfo(this.dataset.user, document.querySelector('.user__password').value, document.querySelector('.remember__user'))">
</div> <span>Login</span>
<button class="user__login clicky" data-user="${userName}" onclick="sendAuthInfo(this.dataset.user, document.querySelector('.user__password').value, document.querySelector('.remember__user'))"> </button>
<span>Login</span> </div>`;
</button>
</div>`;
} else if (userImg == false) {
html = `<div class="user">
<div class="user__info">
<img class="user__svg" src="../svg/avatar.svg">
<h3 class="name">Hello, ${userName}</h3>
</div>
<div class="input">
<input type="password" value="" class="user__password" onblur="setLabelPos(this)">
<label for="user__password" class="input__label">Password</label>
</div>
<div class="input checkbox">
<label>Remember me</label>
<input class="remember__user" type="checkbox" value="true" style="-webkit-appearance: none;">
<svg class="tick" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.854 3.646L6.5 11L2.646 7.146" stroke="black" stroke-linecap="round"/>
</svg>
</div>
<button class="user__login clicky" data-user="${userName}" onclick="sendAuthInfo(this.dataset.user, document.querySelector('.user__password').value, document.querySelector('.remember__user'))">
<span>Login</span>
</button>
</div>`;
}
document.querySelector('.manual__input').insertAdjacentHTML('beforeend', html); document.querySelector('.manual__input').insertAdjacentHTML('beforeend', html);
if (userImg == true) {
html = `<img class="user__img" src="${config.get('serverUrl')}/Users/${userId}/Images/Primary"></img>`;
document.querySelector('.manual__input').querySelector('.user__info').insertAdjacentHTML('afterbegin', html);
} else if (userImg == false) {
html = `<img class="user__svg" src="../svg/avatar.svg">`;
document.querySelector('.manual__input').querySelector('.user__info').insertAdjacentHTML('afterbegin', html);
}
document.querySelector('.manual__login').classList.remove('hide'); document.querySelector('.manual__login').classList.remove('hide');
document.querySelector('.manual__login').scrollIntoView({ behavior: "smooth" }); document.querySelector('.manual__login').scrollIntoView({ behavior: "smooth" });
setInterval(() => {
document.querySelector('.users').classList.add('hide');
}, 1000);
}; };
const sendAuthInfo = (userName, password, checkbox) =>{ const sendAuthInfo = (userName, password, checkbox) => {
if (checkbox.checked == true) { if (checkbox.checked == true) {
ipcRenderer.send('user-auth-details', [userName, password, true]); ipcRenderer.send('user-auth-details', [userName, password, true]);
} else { } else {
ipcRenderer.send('user-auth-details', [userName, password, false]); ipcRenderer.send('user-auth-details', [userName, password, false]);
} }
ipcRenderer.on('user-auth-failed', () => {
console.log('heloo');
document.querySelector('.error').querySelector('.text').innerHTML = "Unable to login Please check your password";
createServerErr();
});
}; };
const changeServer = () => { const changeServer = () => {
html = `<div class="popup warning hide"> createDialog('Are you sure?', "You want to remove this server", "yes__no", "warning");
<div class="icon"> };
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-triangle" viewBox="0 0 16 16">
<path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017.163.163 0 0 1-.054-.06.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/>
<path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/>
</svg>
</div>
<h2 class="text">Are you sure, you want to remove your existing server?</h2>
<button class="popup__exit__btn yes clicky" onclick="sendClearDataRequest()">
<span class="btn__label">Yes</span>
</button>
<button class="popup__exit__btn no clicky">
<span class="btn__label">No</span>
</button>
</div>`;
document.querySelector('main').insertAdjacentHTML('beforeend', html);
document.querySelector('.warning').classList.remove('hide');
document.querySelector('.warning').classList.add('active');
document.querySelector('.popup__exit').classList.remove('hide');
document.querySelector('.popup__exit').classList.add('active');
document.querySelector('.popup__exit').addEventListener('click', () => { const goBack = (from, to, loginForm, button) => {
document.querySelector('.warning').classList.remove('active'); to.scrollIntoView({ behavior: "smooth" });
document.querySelector('.warning').classList.add('fadeOut'); setTimeout(() => {
document.querySelector('.popup__exit').classList.remove('active'); from.classList.add('hide');
document.querySelector('.popup__exit').classList.add('fadeOut'); from.querySelector(`.${loginForm}`).remove();
setTimeout(() => { html = `<section class="${loginForm}"></section>`;
document.querySelector('.warning').classList.remove('fadeOut'); from.insertAdjacentHTML('beforeend', html);
document.querySelector('.popup__exit').classList.remove('fadeOut'); }, 1000);
document.querySelector('.warning').classList.add('hide'); };
document.querySelector('.popup__exit').classList.add('hide');
document.querySelector('.warning').remove(); if (config.get('serverGo') == true) {
}, 305); document.querySelector('.loader').classList.remove('hide');
ipcRenderer.send('check-server-status');
ipcRenderer.on('server-online', () => {
document.querySelector('.loader').classList.add('hide');
createUserList();
}); });
ipcRenderer.on('server-offline', () => {
document.querySelector('.popup__exit__btn').addEventListener('click', () => { createDialog('Error', "Cant connect to the jellyfin server", "remove__server", "error");
document.querySelector('.warning').classList.remove('active');
document.querySelector('.warning').classList.add('fadeOut');
document.querySelector('.popup__exit').classList.remove('active');
document.querySelector('.popup__exit').classList.add('fadeOut');
setTimeout(() => {
document.querySelector('.warning').classList.remove('fadeOut');
document.querySelector('.popup__exit').classList.remove('fadeOut');
document.querySelector('.warning').classList.add('hide');
document.querySelector('.popup__exit').classList.add('hide');
document.querySelector('.warning').remove();
}, 305);
}); });
}; } else if (config.get('serverGo') == false) {
saveBtn.addEventListener('click', () => {
ipcRenderer.send('setServer', serverUrl.value);
document.querySelector('.loader').classList.remove('hide');
}, true);
ipcRenderer.on('not-jf-server', () => {
document.querySelector('.loader').classList.add('hide');
createAlert('error', "Can't detrmine if the give server address is a valid Jellyfin server", ".server");
});
ipcRenderer.on('is-jf-server', () => {
createUserList();
});
}
ipcRenderer.on('user-auth-failed', () => {
console.log(1);
createAlert('error', "Unable to login. Please check your password", ".manual__login");
});
File renamed without changes.