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

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 emitter = require("./common/emitter");
const LoginPage = require("./pages/login");
const HomePage = require("./pages/home");
const MainPage = require("./pages/main");
async function createWindow() {
var splash = new BrowserWindow({
@@ -16,24 +16,19 @@ async function createWindow() {
}
});
splash.loadFile('./src/render/html/splash.html');
var homePage = new HomePage();
var mainPage = new MainPage();
var loginPage = new LoginPage();
loginPage.window.on('ready-to-show', () => {
splash.destroy();
if (!config.get('serverUrl')) {
loginPage.showLogin();
} else if (config.get('openHome') == false) {
if (config.get('openHome') == false) {
loginPage.showLogin();
} else if (config.get('openHome') == true) {
loginPage.hideLogin();
mainPage.showMain();
}
emitter.on('logged-in', () => {
loginPage.hideLogin();
homePage.showHome();
});
emitter.on('closeHome', () => {
homePage.hideHome();
config.set('openHome', false);
app.relaunch();
app.exit(0);
mainPage.showMain();
});
});
}
@@ -42,8 +37,6 @@ app.whenReady().then(() => {
createWindow();
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.exit(0);
}
});
emitter.on('close-app', () => {
app.quit();
});
+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 emitter = require('../common/emitter');
const config = require('../config');
const { Jellyfin } = require('@thornbill/jellyfin-sdk');
var icon = nativeImage.createFromPath('../assets/icon.png');
const api = require('../common/apiclient');
class LoginPage {
constructor() {
this.createWindow();
this.setConfig();
this.onstartUp();
this.authUser();
this.logoutUser();
this.getUserlist();
this.clearData();
this.apiclient = api;
}
createWindow() {
this.window = new BrowserWindow({
@@ -28,12 +24,15 @@ class LoginPage {
contextIsolation: false
},
show: false,
icon: icon
icon: "../assets/icon.ico"
});
this.window.loadFile("./src/render/html/login.html");
this.window.webContents.openDevTools();
this.window.setMenu(null);
this.window.maximize();
this.window.webContents.openDevTools();
this.window.on('closed', () => {
emitter.emit('close-app');
});
}
onstartUp() {
ipcMain.on('check-server-status', (event) => {
@@ -41,6 +40,7 @@ class LoginPage {
if (response.body == '"Jellyfin Server"') {
event.sender.send('server-online');
this.serverOnline = true;
this.getUserlist();
}
else {
event.sender.send('server-offline');
@@ -50,14 +50,16 @@ class LoginPage {
let error;
event.sender.send('server-offline');
if (typeof er == 'string') {
error = e;
error = er;
} else {
error = "Can't connect to Jellyfin server";
}
console.log(error);
});
});
ipcMain.on('reload-page', () => {
this.window.reload();
app.relaunch();
app.quit();
});
}
setConfig() {
@@ -68,9 +70,8 @@ class LoginPage {
event.sender.send('is-jf-server');
config.set('serverUrl', serverUrl);
config.set('serverGo', true);
this.window.reload();
}
else {
this.getUserlist();
} else {
event.sender.send('not-jf-server');
}
}).catch((er) => {
@@ -85,25 +86,19 @@ class LoginPage {
});
}
getUserlist() {
this.apiclient = new Jellyfin({
clientInfo: {
name: 'Mordern Jellyfin client in Electron',
version: "0.0.1"
},
deviceInfo: {
name: "JellyPlayer",
id: "JellyPlayerClient"
this.window.once('ready-to-show', async () => {
if (this.getUsers != false) {
ipcMain.on('waiting-for-userlist', async (event) => {
this.users = await this.apiclient.userApi.getPublicUsers();
if (await this.users.length == 0) {
event.sender.send('no-public-users');
} else {
event.sender.send('userlist', this.users.data);
}
});
}
});
this.api = this.apiclient.createApi(config.get('serverUrl'));
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);
}
ipcMain.on('userlist-recieved', () => {
this.getUsers = false;
});
});
}
@@ -112,7 +107,7 @@ class LoginPage {
if (config.get('openHome') == true) {
if (this.serverOnline == true) {
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');
} catch (err) {
console.log(err);
@@ -122,7 +117,7 @@ class LoginPage {
this.window.once('ready-to-show', () => {
ipcMain.on('user-auth-details', async (event, user) => {
try {
auth = await this.api.authenticateUserByName(user[0], user[1]);
auth = await this.apiclient.authenticateUserByName(user[0], user[1]);
if (user[2] == true) {
config.set('user.name', user[0]);
config.set('user.pass', user[1]);
@@ -130,7 +125,7 @@ class LoginPage {
}
emitter.emit('logged-in');
} catch (err) {
console.log("err");
console.log(err);
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() {
ipcMain.on('clear-user-data', async () => {
config.clear();
this.window.reload();
app.relaunch();
app.quit();
});
}
showLogin() {
+10 -8
View File
@@ -4,7 +4,7 @@ const emitter = require('../common/emitter');
const config = require('../config');
const { Jellyfin } = require('@thornbill/jellyfin-sdk');
class HomePage {
class MainPage {
constructor() {
this.createWindow();
this.logoutRequest();
@@ -21,23 +21,25 @@ class HomePage {
nodeIntegration: true
}
});
this.window.loadFile("./src/render/html/home.html");
this.window.loadFile("./src/render/html/main.html");
this.window.webContents.openDevTools();
this.window.setMenu(null);
this.window.maximize();
this.window.on('closed', () => {
emitter.emit('close-app');
});
}
logoutRequest() {
ipcMain.on('logout-user', () => {
emitter.emit('logout-user');
});
}
showHome() {
showMain() {
this.window.show();
}
hideHome() {
hideMain() {
this.window.hide();
}
closeHome() {
this.window.close();
}
}
module.exports = HomePage;
module.exports = MainPage;
+8 -5
View File
@@ -1,15 +1,18 @@
/** @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 {
--main-bg: #0d0326;
--warning-yellow: #e5df30;
--error-red: #b33a3a;
--warning-yellow: #f18e06;
--warning-bg: rgba(220, 128, 1, 0.16);
--error-red: #a94442;
--error-red-darker-1: #8b2e2e;
--error-red-bg: #240e0ea0;
--yes-green: #18be12;
--yes-green-darker-1: #15a010;
--rounding: 10px;
--rounding-1: 5px;
--transition-time-fast-1: 100ms;
--transition-time-fast-2: 100ms;
--transition-time-fast-1: 150ms;
--transition-time-default: 250ms;
--transition-time-slow-1: 350ms;
}
+271 -71
View File
@@ -27,7 +27,7 @@ main {
height: 100vh;
z-index: 1;
display: flex;
justify-content: flex-start;
/* justify-content: flex-start; */
align-items: center;
overflow: hidden;
}
@@ -61,16 +61,31 @@ main {
.page > button {
width: 60vw;
max-width: 32em;
}
.page.manual__login {
position: relative;
}
.server__cont,
.user__cont,
.manual__input {
position: static;
width: 60vw;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
max-width: 30em;
}
.manual__input {
width: 60vw;
display: flex;
flex-flow: column;
align-items: stretch;
justify-content: center;
}
.server__cont {
display: flex;
flex-flow: column;
@@ -84,7 +99,7 @@ button.clicky {
button.clicky::after {
content: "";
box-shadow: 0 0 15px 40px white;
box-shadow: 0 0 15px 40px var(--clr);
position: absolute;
width: 100%;
height: 100%;
@@ -111,6 +126,7 @@ input[type="password"] {
}
button {
--clr: currentColor;
overflow: hidden;
background: #ffffff4b;
border: 2px solid white;
@@ -161,10 +177,12 @@ input:focus + .input__label,
font-size: calc(60vw / 20);
}
.info svg {
.info i {
color: var(--warning-yellow);
height: 100%;
width: min(1.5em, 30px);
font-size: min(1.5em, 30px);
height: -webkit-fit-content;
height: -moz-fit-content;
height: fit-content;
}
.info div {
@@ -175,76 +193,138 @@ input:focus + .input__label,
width: fit-content;
}
.popup {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 40vw;
height: 30vh;
min-height: 15em;
min-width: 25em;
}
.icon {
height: 40%;
.alert {
position: absolute;
box-sizing: content-box;
width: 50vw;
max-width: 20em;
display: flex;
align-items: flex-start;
justify-content: flex-start;
}
.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);
left: 20px;
background: var(--background);
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 {
background: var(--error-red-darker-1);
.alert .icon {
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,
.popup__exit.active {
-webkit-animation: fadeIn var(--transition-time-slow-1);
animation: fadeIn var(--transition-time-slow-1);
.dialog.active,
.warning.active,
.dialog__close.active {
-webkit-animation: fadeIn var(--transition-time-fast-1);
animation: fadeIn var(--transition-time-fast-1);
display: block;
visibility: visible;
}
.popup__exit {
position: fixed;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.3);
opacity: 1;
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
.dialog.fadeOut,
.dialog__close.fadeOut {
-webkit-animation: fadeOut var(--transition-time-fast-1) forwards;
animation: fadeOut var(--transition-time-fast-1) forwards;
}
.popup__exit.fadeOut,
.popup.error.fadeOut {
-webkit-animation: fadeOut var(--transition-time-slow-1) forwards;
animation: fadeOut var(--transition-time-slow-1) forwards;
.alert.goOut {
-webkit-animation: goOut var(--transition-time-default) forwards;
animation: goOut var(--transition-time-default) 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 {
@@ -279,10 +359,13 @@ section.user__cont {
display: flex;
justify-content: space-between;
overflow: auto hidden;
gap: 1em;
}
.user__card {
width: 50%;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
overflow: hidden;
flex-shrink: 0;
}
@@ -328,14 +411,41 @@ section.user__cont {
grid-gap: 10px;
}
.user__info .name {
text-shadow: 0 0 8px #00000057;
.title__name {
-webkit-filter: drop-shadow(0 0 8px #00000057);
filter: drop-shadow(0 0 8px #00000057);
text-align: center;
width: 100%;
font-weight: 300;
width: -webkit-fit-content;
width: -moz-fit-content;
width: fit-content;
font-weight: 500;
padding: 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 {
@@ -364,8 +474,8 @@ section.user__cont {
.tick path {
stroke: white;
stroke-dasharray: 100%;
stroke-dashoffset: 100%;
transition: stroke-dashoffset var(--transition-time-fast-1);
stroke-dashoffset: -100%;
transition: stroke-dashoffset var(--transition-time-fast-2);
}
input[type="checkbox"]:checked + .tick > path {
@@ -381,6 +491,34 @@ input[type="checkbox"]:checked + .tick > path {
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*/
@-webkit-keyframes fadeInBg {
0% {
@@ -447,3 +585,65 @@ input[type="checkbox"]:checked + .tick > path {
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">
<link rel="stylesheet" href="../css/login.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>
</head>
<body>
@@ -47,10 +51,7 @@
<span class="btn__label">Save</span>
</button>
<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">
<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>
<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
@@ -60,57 +61,51 @@
</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>
</div>
<section class="manual__input"></section>
</section>
<div class="popup__exit hide"></div>
<div class="popup error hide">
<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"/>
<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>
<h2 class="text">Can't determine if the entered Server address is a valid Jellyfin Server</h2>
<button class="popup__exit__btn clicky">
<span class="btn__label">Try Again</span>
</button>
</div>
<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>
</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>
</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/-2Line truncated
let gradient = new Gradient();
gradient.initGradient("#background", "#aa5cc3","#00a4dc", "#003C50", "#3E2247");
</script>
</body>
</html>
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<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>
</head>
<body>
@@ -16,7 +16,7 @@
};
</script>
<script src="../js/home.js"></script>
<script src="../js/main.js"></script>
<script>if (window.module) module = window.module;</script>
</body>
View File
Whitespace-only changes.
+177 -184
View File
@@ -1,5 +1,4 @@
const { ipcRenderer } = require("electron");
const got = require('got');
const emitter = require('../../common/emitter');
const config = require("../../config");
const serverForm = document.querySelector('.server__cont');
@@ -14,29 +13,30 @@ const createUserList = () => {
document.querySelector('.loader').classList.remove('hide');
ipcRenderer.on('userlist', (event, userlist) => {
console.log(userlist);
event.sender.send('userlist-recieved');
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)">
<div class="content">
<img class="user__img" src="${config.get('serverUrl')}/Users/${user.Id}/Images/Primary">
<h1>${user.Name}</h1>
</div>
</div>`;
<div class="content">
<img class="user__img" src="${config.get('serverUrl')}/Users/${user.Id}/Images/Primary">
<h1>${user.Name}</h1>
</div>
</div>`;
}
else if (!user.PrimaryImageTag) {
html = `<div class="user__card" data-user="${user.Name}" onclick="createEnterPassword(this.dataset.user, false)">
<div class="content">
<img class="user__svg" src="../svg/avatar.svg">
<h1>${user.Name}</h1>
</div>
</div>`;
<div class="content">
<img class="user__svg" src="../svg/avatar.svg">
<h1>${user.Name}</h1>
</div>
</div>`;
}
document.querySelector('.user__cont').insertAdjacentHTML('beforeend', html);
});
document.querySelector('.users').classList.remove('hide');
document.querySelector('.users').scrollIntoView({ behavior: "smooth" });
document.querySelector('.loader').classList.add('hide');
setInterval(() => {
setTimeout(() => {
document.querySelector('.server').classList.add('hide');
}, 1000);
// $('main').scrollTo('.users', '2s');
@@ -44,91 +44,119 @@ const createUserList = () => {
ipcRenderer.on('no-public-users', () => {
document.querySelector('.loader').classList.add('hide');
createManualLogin();
document.querySelector('.manual__login').classList.remove('hide');
document.querySelector('.manual__login').scrollIntoView({ behavior: "smooth" });
setTimeout(() => {
document.querySelector('.server').classList.add('hide');
}, 1000);
});
};
const closePopup = () => {
document.querySelector('.popup__exit').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');
}, 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 closeDialog = () => {
document.querySelector('.dialog').classList.remove('active');
document.querySelector('.dialog__close').classList.remove('active');
document.querySelector('.dialog').classList.add('fadeOut');
document.querySelector('.dialog__close').classList.add('fadeOut');
setTimeout(() => {
document.querySelector('.dialog').classList.remove('fadeOut');
document.querySelector('.dialog__close').classList.remove('fadeOut');
document.querySelector('.dialog').remove();
document.querySelector('.dialog__close').remove();
}, 305);
};
const createServerErr = () => {
document.querySelector('.error').classList.remove('hide');
document.querySelector('.error').classList.add('active');
document.querySelector('.popup__exit').classList.remove('hide');
document.querySelector('.popup__exit').classList.add('active');
closePopup();
const createAlert = (type, msg, page) => {
html = `<div class="alert ${type}">
<div class="icon">
<i class="bi bi-exclamation-octagon"></i>
</div>
<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 = () => {
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 = () => {
html = `<div class="one">
<input type="text" value="" class="user__name">
<input type="password" value="" class="user__password">
<input class="remember__user" type="checkbox" value="true">
<input type="button" value="Login" class="user__login" onclick="sendAuthInfo()">
</div>`;
html = `<h3 class="title__name">Login</h3>
<div class="manual__form user">
<div class="input">
<input type="text" value="" class="user__name" onblur="setLabelPos(this)">
<label class="input__label" for="user__name">Username</label>
</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__login').classList.remove('hide');
document.querySelector('.manual__login').scrollIntoView({ behavior: "smooth" });
};
const setLabelPos = (element) => {
@@ -140,119 +168,84 @@ const setLabelPos = (element) => {
};
const createEnterPassword = (userName, userImg, userId) => {
if (userImg == true) {
html = `<div class="user">
<div class="user__info">
<img class="user__img" src="${config.get('serverUrl')}/Users/${userId}/Images/Primary">
<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>`;
} 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>`;
}
html = `<div class="user">
<div class="user__info">
<h3 class="title__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);
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').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) {
ipcRenderer.send('user-auth-details', [userName, password, true]);
} else {
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 = () => {
html = `<div class="popup warning hide">
<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');
createDialog('Are you sure?', "You want to remove this server", "yes__no", "warning");
};
document.querySelector('.popup__exit').addEventListener('click', () => {
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);
const goBack = (from, to, loginForm, button) => {
to.scrollIntoView({ behavior: "smooth" });
setTimeout(() => {
from.classList.add('hide');
from.querySelector(`.${loginForm}`).remove();
html = `<section class="${loginForm}"></section>`;
from.insertAdjacentHTML('beforeend', html);
}, 1000);
};
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();
});
document.querySelector('.popup__exit__btn').addEventListener('click', () => {
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);
ipcRenderer.on('server-offline', () => {
createDialog('Error', "Cant connect to the jellyfin server", "remove__server", "error");
});
};
} 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.