Upload files
This commit is contained in:
14 files changed
+9468
No files matched your search
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true,
|
||||||
|
"es2021": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"prettier",
|
||||||
|
"google"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"prettier"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"prettier/prettier": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
+89
@@ -0,0 +1,89 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# Webpack
|
||||||
|
.webpack/
|
||||||
|
|
||||||
|
# Electron-Forge
|
||||||
|
out/
|
||||||
Generated
+5283
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,68 @@
|
|||||||
|
{
|
||||||
|
"name": "jellyplayer",
|
||||||
|
"productName": "jellyplayer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Modern Jellyfin Client",
|
||||||
|
"main": "./src/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron-forge start",
|
||||||
|
"package": "electron-forge package",
|
||||||
|
"make": "electron-forge make",
|
||||||
|
"publish": "electron-forge publish",
|
||||||
|
"lint": "echo \"No linting configured\""
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": {
|
||||||
|
"name": "Prayag",
|
||||||
|
"email": "prayagprajapati.17@gmail.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"config": {
|
||||||
|
"forge": {
|
||||||
|
"packagerConfig": {},
|
||||||
|
"makers": [
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-squirrel",
|
||||||
|
"config": {
|
||||||
|
"name": "jellyplayer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-zip",
|
||||||
|
"platforms": [
|
||||||
|
"darwin"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-deb",
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-rpm",
|
||||||
|
"config": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@thornbill/jellyfin-sdk": "^0.4.1",
|
||||||
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
|
"electron-store": "^8.0.1",
|
||||||
|
"events": "^3.3.0",
|
||||||
|
"got": "^11.8.3",
|
||||||
|
"got-fetch": "^4.0.3"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@electron-forge/cli": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-deb": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-squirrel": "^6.0.0-beta.63",
|
||||||
|
"@electron-forge/maker-zip": "^6.0.0-beta.63",
|
||||||
|
"electron": "17.0.0",
|
||||||
|
"eslint": "^8.8.0",
|
||||||
|
"eslint-config-google": "^0.14.0",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
|
"prettier": "^2.5.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
const events = require('events');
|
||||||
|
const emitter = new events.EventEmitter();
|
||||||
|
module.exports = emitter;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const Store = require('electron-store');
|
||||||
|
|
||||||
|
const schema = {
|
||||||
|
serverUrl: {
|
||||||
|
type: 'string',
|
||||||
|
default: ""
|
||||||
|
},
|
||||||
|
|
||||||
|
serverGo: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = new Store({ schema });
|
||||||
|
|
||||||
|
module.exports = config;
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
const { app, BrowserWindow } = require('electron');
|
||||||
|
const config = require("./config");
|
||||||
|
const LoginPage = require("./pages/login");
|
||||||
|
|
||||||
|
let loginPage;
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
// mainWindow.webContents.openDevTools();
|
||||||
|
if (config.get("server.go") != true) {
|
||||||
|
loginPage = new LoginPage();
|
||||||
|
}
|
||||||
|
// let window = new BrowserWindow({
|
||||||
|
// width: 800,
|
||||||
|
// height: 700,
|
||||||
|
// center: true,
|
||||||
|
// resizable: true,
|
||||||
|
// maximizable: true,
|
||||||
|
// show: true,
|
||||||
|
// webPreferences: {
|
||||||
|
// nodeIntegration: true
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// // window.loadFile("../render/html/login.html");
|
||||||
|
// window.loadFile('./src/render/html/login.html')
|
||||||
|
}
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
const { app, BrowserWindow, ipcMain } = require('electron');
|
||||||
|
const got = require('got');
|
||||||
|
const emitter = require('../common/emitter');
|
||||||
|
const config = require('../config');
|
||||||
|
const ApiClient = require('@thornbill/jellyfin-sdk');
|
||||||
|
const { Jellyfin } = require('@thornbill/jellyfin-sdk');
|
||||||
|
|
||||||
|
class LoginPage {
|
||||||
|
constructor() {
|
||||||
|
this.createWindow();
|
||||||
|
this.setConfig();
|
||||||
|
}
|
||||||
|
createWindow() {
|
||||||
|
this.window = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 700,
|
||||||
|
center: true,
|
||||||
|
resizable: true,
|
||||||
|
maximizable: true,
|
||||||
|
show: true,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.window.loadFile("./src/render/html/login.html");
|
||||||
|
this.window.webContents.openDevTools();
|
||||||
|
}
|
||||||
|
setConfig() {
|
||||||
|
if (config.get('serverGo') == false) {
|
||||||
|
ipcMain.on('setServer', (event, serverUrl) => {
|
||||||
|
serverUrl = serverUrl.replace(/\/+$/, '');
|
||||||
|
got.post(`${serverUrl}/System/Ping`).then(async (response) => {
|
||||||
|
if (response.body == '"Jellyfin Server"') {
|
||||||
|
config.set('serverUrl', serverUrl);
|
||||||
|
config.set('serverGo', true);
|
||||||
|
this.getUserlist();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log(response.body);
|
||||||
|
}
|
||||||
|
}).catch((er) => {
|
||||||
|
console.log(er);
|
||||||
|
let error;
|
||||||
|
|
||||||
|
if (typeof er == 'string') {
|
||||||
|
error = e;
|
||||||
|
} else {
|
||||||
|
error = "The given server url is not a Jellyfin server url";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// this.apiclient = new ApiClient();
|
||||||
|
});
|
||||||
|
} else if (config.get('serverGo') == true) {
|
||||||
|
this.getUserlist();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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', () => {
|
||||||
|
ipcMain.on('waiting-for-userlist', async (event) => {
|
||||||
|
let api = this.apiclient.createApi(config.get('serverUrl'));
|
||||||
|
let users = await api.userApi.getPublicUsers();
|
||||||
|
console.log(users.data);
|
||||||
|
event.sender.send('userlist', users.data);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = LoginPage;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
display: none !important;
|
||||||
|
visibility: hidden !important;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<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="stylesheet" href="../css/login.css">
|
||||||
|
<title>Jellyfin</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<section class="server__cont">
|
||||||
|
<input type="url" class="input__text server__url">
|
||||||
|
<input type="button" class="input__btn save__server" value="Save">
|
||||||
|
</section>
|
||||||
|
<section class="user__cont"></section>
|
||||||
|
</main>
|
||||||
|
<script src="../js/login.js"></script>
|
||||||
|
<script>if (typeof module === 'object') {
|
||||||
|
window.module = module;
|
||||||
|
module = undefined;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script type="module" src="https://cdn.jsdelivr.net/gh/jquery/jquery@3.6.0/dist/jquery.min.js"></script>
|
||||||
|
|
||||||
|
<script>if (window.module) module = window.module;</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
const { ipcRenderer } = require("electron");
|
||||||
|
const emitter = require('../../common/emitter');
|
||||||
|
// const {fetch} = require('got-fetch');
|
||||||
|
const config = require("../../config");
|
||||||
|
const serverForm = document.querySelector('.server__cont');
|
||||||
|
const serverUrl = document.querySelector('.server__url');
|
||||||
|
const saveBtn = document.querySelector('.save__server');
|
||||||
|
|
||||||
|
let html;
|
||||||
|
|
||||||
|
if (config.get('serverGo') == true) {
|
||||||
|
ipcRenderer.send("waiting-for-userlist");
|
||||||
|
serverForm.classList.add("hide");
|
||||||
|
ipcRenderer.on('userlist', (event, userlist) => {
|
||||||
|
console.log(userlist);
|
||||||
|
userlist.forEach(user => {
|
||||||
|
if (user.PrimaryImageTag) {
|
||||||
|
html = `<div><h1>${user.Name}</h1><img src="${config.get('serverUrl')}/Users/${user.Id}/Images/Primary"></div>`;
|
||||||
|
}
|
||||||
|
else if (!user.PrimaryImageTag) {
|
||||||
|
html = `<div><h1>${user.Name}</h1><img src="../svg/avatar.svg"></div>`;
|
||||||
|
}
|
||||||
|
document.querySelector('.user__cont').insertAdjacentHTML('beforeend', html);
|
||||||
|
console.log(user);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (config.get('serverGo') == false) {
|
||||||
|
saveBtn.onclick = () => {
|
||||||
|
ipcRenderer.send('setServer', serverUrl.value);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M11 6C11 6.79565 10.6839 7.55871 10.1213 8.12132C9.55871 8.68393 8.79565 9 8 9C7.20435 9 6.44129 8.68393 5.87868 8.12132C5.31607 7.55871 5 6.79565 5 6C5 5.20435 5.31607 4.44129 5.87868 3.87868C6.44129 3.31607 7.20435 3 8 3C8.79565 3 9.55871 3.31607 10.1213 3.87868C10.6839 4.44129 11 5.20435 11 6Z" fill="url(#paint0_linear_2_5)"/>
|
||||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 8C0 5.87827 0.842855 3.84344 2.34315 2.34315C3.84344 0.842855 5.87827 0 8 0C10.1217 0 12.1566 0.842855 13.6569 2.34315C15.1571 3.84344 16 5.87827 16 8C16 10.1217 15.1571 12.1566 13.6569 13.6569C12.1566 15.1571 10.1217 16 8 16C5.87827 16 3.84344 15.1571 2.34315 13.6569C0.842855 12.1566 0 10.1217 0 8ZM8 1C6.68178 1.00007 5.39037 1.37236 4.2744 2.07403C3.15844 2.77569 2.26328 3.77821 1.69196 4.96619C1.12065 6.15418 0.896386 7.47934 1.045 8.78916C1.19361 10.099 1.70905 11.3402 2.532 12.37C3.242 11.226 4.805 10 8 10C11.195 10 12.757 11.225 13.468 12.37C14.2909 11.3402 14.8064 10.099 14.955 8.78916C15.1036 7.47934 14.8794 6.15418 14.308 4.96619C13.7367 3.77821 12.8416 2.77569 11.7256 2.07403C10.6096 1.37236 9.31822 1.00007 8 1Z" fill="url(#paint1_linear_2_5)"/>
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="paint0_linear_2_5" x1="0" y1="0" x2="16" y2="16" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0.249497" stop-color="#3E2247"/>
|
||||||
|
<stop offset="1" stop-color="#003C50"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="paint1_linear_2_5" x1="0" y1="0" x2="16" y2="16" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0.249497" stop-color="#3E2247"/>
|
||||||
|
<stop offset="1" stop-color="#003C50"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
Reference in new issue
Block a user