Finish work on Server/Login Page for alpha build
This commit is contained in:
15 files changed
+507
-313
No files matched your search
+3
-1
@@ -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 |
@@ -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;
|
||||||
+9
-16
@@ -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);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
+29
-39
@@ -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,26 +86,20 @@ 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',
|
|
||||||
version: "0.0.1"
|
|
||||||
},
|
|
||||||
deviceInfo: {
|
|
||||||
name: "JellyPlayer",
|
|
||||||
id: "JellyPlayerClient"
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.api = this.apiclient.createApi(config.get('serverUrl'));
|
|
||||||
this.window.once('ready-to-show', () => {
|
|
||||||
ipcMain.on('waiting-for-userlist', async (event) => {
|
ipcMain.on('waiting-for-userlist', async (event) => {
|
||||||
let users = await this.api.userApi.getPublicUsers();
|
this.users = await this.apiclient.userApi.getPublicUsers();
|
||||||
if (users.data.length == 0) {
|
if (await this.users.length == 0) {
|
||||||
event.sender.send('no-public-users');
|
event.sender.send('no-public-users');
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('userlist', users.data);
|
event.sender.send('userlist', this.users.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
ipcMain.on('userlist-recieved', () => {
|
||||||
|
this.getUsers = false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async authUser() {
|
async authUser() {
|
||||||
@@ -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() {
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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
@@ -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.
+12
-17
@@ -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,27 +61,21 @@
|
|||||||
</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="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"/>
|
|
||||||
</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">
|
<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">
|
<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">
|
<circle cx="6" cy="6" r="6" fill="white">
|
||||||
|
|||||||
@@ -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>
|
||||||
Whitespace-only changes.
+147
-154
@@ -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,6 +13,7 @@ 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)">
|
||||||
@@ -36,7 +36,7 @@ const createUserList = () => {
|
|||||||
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('.error').classList.remove('fadeOut');
|
document.querySelector('.dialog').classList.remove('fadeOut');
|
||||||
document.querySelector('.popup__exit').classList.remove('fadeOut');
|
document.querySelector('.dialog__close').classList.remove('fadeOut');
|
||||||
document.querySelector('.error').classList.add('hide');
|
document.querySelector('.dialog').remove();
|
||||||
document.querySelector('.popup__exit').classList.add('hide');
|
document.querySelector('.dialog__close').remove();
|
||||||
}, 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 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>`;
|
</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,11 +168,9 @@ 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">
|
||||||
<img class="user__img" src="${config.get('serverUrl')}/Users/${userId}/Images/Primary">
|
<h3 class="title__name">Hello, ${userName}</h3>
|
||||||
<h3 class="name">Hello, ${userName}</h3>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<input type="password" value="" class="user__password" onblur="setLabelPos(this)">
|
<input type="password" value="" class="user__password" onblur="setLabelPos(this)">
|
||||||
@@ -161,34 +187,16 @@ const createEnterPassword = (userName, userImg, userId) => {
|
|||||||
<span>Login</span>
|
<span>Login</span>
|
||||||
</button>
|
</button>
|
||||||
</div>`;
|
</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) => {
|
||||||
@@ -197,62 +205,47 @@ const sendAuthInfo = (userName, password, checkbox) =>{
|
|||||||
} 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', () => {
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
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.
Reference in new issue
Block a user