Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e8b612c974 |
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
release/app/node_modules
|
||||||
|
release/app/dist
|
||||||
|
src/server/node_modules
|
||||||
@@ -5,60 +5,53 @@
|
|||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import { dependencies as externals } from '../../release/app/package.json';
|
import { dependencies as externals } from '../../release/app/package.json';
|
||||||
import webpackPaths from './webpack.paths';
|
import webpackPaths from './webpack.paths';
|
||||||
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
|
|
||||||
|
|
||||||
const createStyledComponentsTransformer = require('typescript-plugin-styled-components').default;
|
|
||||||
|
|
||||||
const styledComponentsTransformer = createStyledComponentsTransformer();
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
const configuration: webpack.Configuration = {
|
||||||
externals: [...Object.keys(externals || {})],
|
externals: [...Object.keys(externals || {})],
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
test: /\.[jt]sx?$/,
|
test: /\.[jt]sx?$/,
|
||||||
use: {
|
use: {
|
||||||
loader: 'ts-loader',
|
loader: 'ts-loader',
|
||||||
options: {
|
options: {
|
||||||
// Remove this line to enable type checking in webpack builds
|
// Remove this line to enable type checking in webpack builds
|
||||||
transpileOnly: true,
|
transpileOnly: true,
|
||||||
getCustomTransformers: () => ({ before: [styledComponentsTransformer] }),
|
},
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
// https://github.com/webpack/webpack/issues/1114
|
|
||||||
library: {
|
|
||||||
type: 'commonjs2',
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
path: webpackPaths.srcPath,
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
output: {
|
||||||
* Determine the array of extensions that should be used to resolve modules.
|
// https://github.com/webpack/webpack/issues/1114
|
||||||
*/
|
library: {
|
||||||
resolve: {
|
type: 'commonjs2',
|
||||||
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
|
|
||||||
fallback: {
|
|
||||||
child_process: false,
|
|
||||||
},
|
|
||||||
plugins: [new TsconfigPathsPlugin({ baseUrl: webpackPaths.srcPath })],
|
|
||||||
modules: [webpackPaths.srcPath, 'node_modules'],
|
|
||||||
},
|
},
|
||||||
|
|
||||||
stats: 'errors-only',
|
path: webpackPaths.srcPath,
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'production',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the array of extensions that should be used to resolve modules.
|
||||||
|
*/
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
|
||||||
|
fallback: {
|
||||||
|
child_process: false,
|
||||||
|
},
|
||||||
|
modules: [webpackPaths.srcPath, 'node_modules'],
|
||||||
|
},
|
||||||
|
|
||||||
|
stats: 'errors-only',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default configuration;
|
export default configuration;
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
import 'webpack-dev-server';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
|
|
||||||
const { version } = require('../../package.json');
|
|
||||||
|
|
||||||
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
|
|
||||||
// at the dev webpack config is not accidentally run in a production environment
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
checkNodeEnv('development');
|
|
||||||
}
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
devtool: 'inline-source-map',
|
|
||||||
|
|
||||||
mode: 'development',
|
|
||||||
|
|
||||||
target: ['web'],
|
|
||||||
|
|
||||||
entry: {
|
|
||||||
remote: path.join(webpackPaths.srcRemotePath, 'index.tsx'),
|
|
||||||
worker: path.join(webpackPaths.srcRemotePath, 'service-worker.ts'),
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.dllPath,
|
|
||||||
publicPath: '/',
|
|
||||||
filename: '[name].js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
use: [
|
|
||||||
'style-loader',
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
modules: true,
|
|
||||||
sourceMap: true,
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
include: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
||||||
exclude: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
// Fonts
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// Images
|
|
||||||
{
|
|
||||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*
|
|
||||||
* By default, use 'development' as NODE_ENV. This can be overriden with
|
|
||||||
* 'staging', for example, by changing the ENV variables in the npm scripts
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'development',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
debug: true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: path.join('index.html'),
|
|
||||||
template: path.join(webpackPaths.srcRemotePath, 'index.ejs'),
|
|
||||||
favicon: path.join(webpackPaths.assetsPath, 'icons', 'favicon.ico'),
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true,
|
|
||||||
removeComments: true,
|
|
||||||
},
|
|
||||||
isBrowser: true,
|
|
||||||
env: process.env.NODE_ENV,
|
|
||||||
isDevelopment: process.env.NODE_ENV !== 'production',
|
|
||||||
nodeModules: webpackPaths.appNodeModulesPath,
|
|
||||||
templateParameters: {
|
|
||||||
version,
|
|
||||||
prod: false,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
|
|
||||||
node: {
|
|
||||||
__dirname: false,
|
|
||||||
__filename: false,
|
|
||||||
},
|
|
||||||
|
|
||||||
watch: true,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
/**
|
|
||||||
* Build config for electron renderer process
|
|
||||||
*/
|
|
||||||
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
import deleteSourceMaps from '../scripts/delete-source-maps';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
|
|
||||||
const { version } = require('../../package.json');
|
|
||||||
|
|
||||||
checkNodeEnv('production');
|
|
||||||
deleteSourceMaps();
|
|
||||||
|
|
||||||
const devtoolsConfig =
|
|
||||||
process.env.DEBUG_PROD === 'true'
|
|
||||||
? {
|
|
||||||
devtool: 'source-map',
|
|
||||||
}
|
|
||||||
: {};
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
...devtoolsConfig,
|
|
||||||
|
|
||||||
mode: 'production',
|
|
||||||
|
|
||||||
target: ['web'],
|
|
||||||
|
|
||||||
entry: {
|
|
||||||
remote: path.join(webpackPaths.srcRemotePath, 'index.tsx'),
|
|
||||||
worker: path.join(webpackPaths.srcRemotePath, 'service-worker.ts'),
|
|
||||||
},
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.distRemotePath,
|
|
||||||
publicPath: './',
|
|
||||||
filename: '[name].js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?(a|c)ss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
modules: true,
|
|
||||||
sourceMap: true,
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
include: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s?(a|c)ss$/,
|
|
||||||
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
|
||||||
exclude: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
// Fonts
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// Images
|
|
||||||
{
|
|
||||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
optimization: {
|
|
||||||
minimize: true,
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({
|
|
||||||
parallel: true,
|
|
||||||
}),
|
|
||||||
new CssMinimizerPlugin(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
DEBUG_PROD: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: 'remote.css',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: 'index.html',
|
|
||||||
template: path.join(webpackPaths.srcRemotePath, 'index.ejs'),
|
|
||||||
favicon: path.join(webpackPaths.assetsPath, 'icons', 'favicon.ico'),
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true,
|
|
||||||
removeComments: true,
|
|
||||||
},
|
|
||||||
isBrowser: true,
|
|
||||||
env: process.env.NODE_ENV,
|
|
||||||
isDevelopment: process.env.NODE_ENV !== 'production',
|
|
||||||
templateParameters: {
|
|
||||||
version,
|
|
||||||
prod: true,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
||||||
@@ -22,16 +22,21 @@ if (process.env.NODE_ENV === 'production') {
|
|||||||
const port = process.env.PORT || 4343;
|
const port = process.env.PORT || 4343;
|
||||||
const manifest = path.resolve(webpackPaths.dllPath, 'renderer.json');
|
const manifest = path.resolve(webpackPaths.dllPath, 'renderer.json');
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||||
const requiredByDLLConfig = module.parent!.filename.includes('webpack.config.renderer.dev.dll');
|
const requiredByDLLConfig = module.parent!.filename.includes(
|
||||||
|
'webpack.config.renderer.dev.dll'
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Warn if the DLL is not built
|
* Warn if the DLL is not built
|
||||||
*/
|
*/
|
||||||
if (!requiredByDLLConfig && !(fs.existsSync(webpackPaths.dllPath) && fs.existsSync(manifest))) {
|
if (
|
||||||
|
!requiredByDLLConfig &&
|
||||||
|
!(fs.existsSync(webpackPaths.dllPath) && fs.existsSync(manifest))
|
||||||
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
chalk.black.bgYellow.bold(
|
chalk.black.bgYellow.bold(
|
||||||
'The DLL files are missing. Sit back while we build them for you with "npm run build-dll"',
|
'The DLL files are missing. Sit back while we build them for you with "npm run build-dll"'
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
execSync('npm run postinstall');
|
execSync('npm run postinstall');
|
||||||
}
|
}
|
||||||
@@ -67,10 +72,7 @@ const configuration: webpack.Configuration = {
|
|||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: {
|
options: {
|
||||||
modules: {
|
modules: true,
|
||||||
localIdentName: '[name]__[local]--[hash:base64:5]',
|
|
||||||
exportLocalsConvention: 'camelCaseOnly',
|
|
||||||
},
|
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
importLoaders: 1,
|
importLoaders: 1,
|
||||||
},
|
},
|
||||||
@@ -171,14 +173,6 @@ const configuration: webpack.Configuration = {
|
|||||||
.on('close', (code: number) => process.exit(code!))
|
.on('close', (code: number) => process.exit(code!))
|
||||||
.on('error', (spawnError) => console.error(spawnError));
|
.on('error', (spawnError) => console.error(spawnError));
|
||||||
|
|
||||||
console.log('Starting remote.js builder...');
|
|
||||||
const remoteProcess = spawn('npm', ['run', 'start:remote'], {
|
|
||||||
shell: true,
|
|
||||||
stdio: 'inherit',
|
|
||||||
})
|
|
||||||
.on('close', (code: number) => process.exit(code!))
|
|
||||||
.on('error', (spawnError) => console.error(spawnError));
|
|
||||||
|
|
||||||
console.log('Starting Main Process...');
|
console.log('Starting Main Process...');
|
||||||
spawn('npm', ['run', 'start:main'], {
|
spawn('npm', ['run', 'start:main'], {
|
||||||
shell: true,
|
shell: true,
|
||||||
@@ -186,7 +180,6 @@ const configuration: webpack.Configuration = {
|
|||||||
})
|
})
|
||||||
.on('close', (code: number) => {
|
.on('close', (code: number) => {
|
||||||
preloadProcess.kill();
|
preloadProcess.kill();
|
||||||
remoteProcess.kill();
|
|
||||||
process.exit(code!);
|
process.exit(code!);
|
||||||
})
|
})
|
||||||
.on('error', (spawnError) => console.error(spawnError));
|
.on('error', (spawnError) => console.error(spawnError));
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ const configuration: webpack.Configuration = {
|
|||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: {
|
options: {
|
||||||
modules: {
|
modules: true,
|
||||||
localIdentName: '[name]__[local]--[hash:base64:5]',
|
|
||||||
exportLocalsConvention: 'camelCaseOnly',
|
|
||||||
},
|
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
importLoaders: 1,
|
importLoaders: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,132 +13,128 @@ import webpackPaths from './webpack.paths';
|
|||||||
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
|
// When an ESLint server is running, we can't set the NODE_ENV so we'll check if it's
|
||||||
// at the dev webpack config is not accidentally run in a production environment
|
// at the dev webpack config is not accidentally run in a production environment
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
checkNodeEnv('development');
|
checkNodeEnv('development');
|
||||||
}
|
}
|
||||||
|
|
||||||
const port = process.env.PORT || 4343;
|
const port = process.env.PORT || 4343;
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
const configuration: webpack.Configuration = {
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
|
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
|
|
||||||
target: ['web', 'electron-renderer'],
|
target: ['web', 'electron-renderer'],
|
||||||
|
|
||||||
entry: [
|
entry: [
|
||||||
`webpack-dev-server/client?http://localhost:${port}/dist`,
|
`webpack-dev-server/client?http://localhost:${port}/dist`,
|
||||||
'webpack/hot/only-dev-server',
|
'webpack/hot/only-dev-server',
|
||||||
path.join(webpackPaths.srcRendererPath, 'index.tsx'),
|
path.join(webpackPaths.srcRendererPath, 'index.tsx'),
|
||||||
],
|
],
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
path: webpackPaths.distRendererPath,
|
path: webpackPaths.distRendererPath,
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
filename: 'renderer.dev.js',
|
filename: 'renderer.dev.js',
|
||||||
library: {
|
library: {
|
||||||
type: 'umd',
|
type: 'umd',
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.s?css$/,
|
test: /\.s?css$/,
|
||||||
use: [
|
use: [
|
||||||
'style-loader',
|
'style-loader',
|
||||||
{
|
{
|
||||||
loader: 'css-loader',
|
loader: 'css-loader',
|
||||||
options: {
|
options: {
|
||||||
modules: {
|
modules: true,
|
||||||
localIdentName: '[name]__[local]--[hash:base64:5]',
|
sourceMap: true,
|
||||||
exportLocalsConvention: 'camelCaseOnly',
|
importLoaders: 1,
|
||||||
},
|
|
||||||
sourceMap: true,
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
include: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s?css$/,
|
|
||||||
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
||||||
exclude: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
// Fonts
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// Images
|
|
||||||
{
|
|
||||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
'sass-loader',
|
||||||
],
|
],
|
||||||
},
|
include: /\.module\.s?(c|a)ss$/,
|
||||||
plugins: [
|
},
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
{
|
||||||
|
test: /\.s?css$/,
|
||||||
/**
|
use: ['style-loader', 'css-loader', 'sass-loader'],
|
||||||
* Create global constants which can be configured at compile time.
|
exclude: /\.module\.s?(c|a)ss$/,
|
||||||
*
|
},
|
||||||
* Useful for allowing different behaviour between development builds and
|
// Fonts
|
||||||
* release builds
|
{
|
||||||
*
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
type: 'asset/resource',
|
||||||
* development checks
|
},
|
||||||
*
|
// Images
|
||||||
* By default, use 'development' as NODE_ENV. This can be overriden with
|
{
|
||||||
* 'staging', for example, by changing the ENV variables in the npm scripts
|
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
||||||
*/
|
type: 'asset/resource',
|
||||||
new webpack.EnvironmentPlugin({
|
},
|
||||||
NODE_ENV: 'development',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
debug: true,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new ReactRefreshWebpackPlugin(),
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: path.join('index.html'),
|
|
||||||
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
|
|
||||||
favicon: path.join(webpackPaths.assetsPath, 'icons', 'favicon.ico'),
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true,
|
|
||||||
removeComments: true,
|
|
||||||
},
|
|
||||||
isBrowser: false,
|
|
||||||
env: process.env.NODE_ENV,
|
|
||||||
isDevelopment: process.env.NODE_ENV !== 'production',
|
|
||||||
nodeModules: webpackPaths.appNodeModulesPath,
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
|
|
||||||
node: {
|
/**
|
||||||
__dirname: false,
|
* Create global constants which can be configured at compile time.
|
||||||
__filename: false,
|
*
|
||||||
},
|
* Useful for allowing different behaviour between development builds and
|
||||||
|
* release builds
|
||||||
|
*
|
||||||
|
* NODE_ENV should be production so that modules do not perform certain
|
||||||
|
* development checks
|
||||||
|
*
|
||||||
|
* By default, use 'development' as NODE_ENV. This can be overriden with
|
||||||
|
* 'staging', for example, by changing the ENV variables in the npm scripts
|
||||||
|
*/
|
||||||
|
new webpack.EnvironmentPlugin({
|
||||||
|
NODE_ENV: 'development',
|
||||||
|
}),
|
||||||
|
|
||||||
devServer: {
|
new webpack.LoaderOptionsPlugin({
|
||||||
port,
|
debug: true,
|
||||||
compress: true,
|
}),
|
||||||
hot: true,
|
|
||||||
headers: { 'Access-Control-Allow-Origin': '*' },
|
new ReactRefreshWebpackPlugin(),
|
||||||
static: {
|
|
||||||
publicPath: '/',
|
new HtmlWebpackPlugin({
|
||||||
},
|
filename: path.join('index.html'),
|
||||||
historyApiFallback: {
|
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
|
||||||
verbose: true,
|
minify: {
|
||||||
},
|
collapseWhitespace: true,
|
||||||
setupMiddlewares(middlewares) {
|
removeAttributeQuotes: true,
|
||||||
return middlewares;
|
removeComments: true,
|
||||||
},
|
},
|
||||||
|
isBrowser: false,
|
||||||
|
env: process.env.NODE_ENV,
|
||||||
|
isDevelopment: process.env.NODE_ENV !== 'production',
|
||||||
|
nodeModules: webpackPaths.appNodeModulesPath,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
|
||||||
|
node: {
|
||||||
|
__dirname: false,
|
||||||
|
__filename: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
devServer: {
|
||||||
|
port,
|
||||||
|
compress: true,
|
||||||
|
hot: true,
|
||||||
|
headers: { 'Access-Control-Allow-Origin': '*' },
|
||||||
|
static: {
|
||||||
|
publicPath: '/',
|
||||||
},
|
},
|
||||||
|
historyApiFallback: {
|
||||||
|
verbose: true,
|
||||||
|
},
|
||||||
|
setupMiddlewares(middlewares) {
|
||||||
|
return middlewares;
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
export default merge(baseConfig, configuration);
|
||||||
|
|||||||
@@ -1,135 +0,0 @@
|
|||||||
/**
|
|
||||||
* Build config for electron renderer process
|
|
||||||
*/
|
|
||||||
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
||||||
import TerserPlugin from 'terser-webpack-plugin';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
|
||||||
import { merge } from 'webpack-merge';
|
|
||||||
|
|
||||||
import checkNodeEnv from '../scripts/check-node-env';
|
|
||||||
import deleteSourceMaps from '../scripts/delete-source-maps';
|
|
||||||
import baseConfig from './webpack.config.base';
|
|
||||||
import webpackPaths from './webpack.paths';
|
|
||||||
|
|
||||||
checkNodeEnv('production');
|
|
||||||
deleteSourceMaps();
|
|
||||||
|
|
||||||
const devtoolsConfig =
|
|
||||||
process.env.DEBUG_PROD === 'true'
|
|
||||||
? {
|
|
||||||
devtool: 'source-map',
|
|
||||||
}
|
|
||||||
: {};
|
|
||||||
|
|
||||||
const configuration: webpack.Configuration = {
|
|
||||||
...devtoolsConfig,
|
|
||||||
|
|
||||||
mode: 'production',
|
|
||||||
|
|
||||||
target: ['web'],
|
|
||||||
|
|
||||||
entry: [path.join(webpackPaths.srcRendererPath, 'index.tsx')],
|
|
||||||
|
|
||||||
output: {
|
|
||||||
path: webpackPaths.distWebPath,
|
|
||||||
publicPath: 'auto',
|
|
||||||
filename: 'renderer.js',
|
|
||||||
library: {
|
|
||||||
type: 'umd',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.s?(a|c)ss$/,
|
|
||||||
use: [
|
|
||||||
MiniCssExtractPlugin.loader,
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
modules: {
|
|
||||||
localIdentName: '[name]__[local]--[hash:base64:5]',
|
|
||||||
exportLocalsConvention: 'camelCaseOnly',
|
|
||||||
},
|
|
||||||
sourceMap: true,
|
|
||||||
importLoaders: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
'sass-loader',
|
|
||||||
],
|
|
||||||
include: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.s?(a|c)ss$/,
|
|
||||||
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
|
||||||
exclude: /\.module\.s?(c|a)ss$/,
|
|
||||||
},
|
|
||||||
// Fonts
|
|
||||||
{
|
|
||||||
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
// Images
|
|
||||||
{
|
|
||||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
|
||||||
type: 'asset/resource',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
optimization: {
|
|
||||||
minimize: true,
|
|
||||||
minimizer: [
|
|
||||||
new TerserPlugin({
|
|
||||||
parallel: true,
|
|
||||||
}),
|
|
||||||
new CssMinimizerPlugin(),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
/**
|
|
||||||
* Create global constants which can be configured at compile time.
|
|
||||||
*
|
|
||||||
* Useful for allowing different behaviour between development builds and
|
|
||||||
* release builds
|
|
||||||
*
|
|
||||||
* NODE_ENV should be production so that modules do not perform certain
|
|
||||||
* development checks
|
|
||||||
*/
|
|
||||||
new webpack.EnvironmentPlugin({
|
|
||||||
NODE_ENV: 'production',
|
|
||||||
DEBUG_PROD: false,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new MiniCssExtractPlugin({
|
|
||||||
filename: 'style.css',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new BundleAnalyzerPlugin({
|
|
||||||
analyzerMode: process.env.ANALYZE === 'true' ? 'server' : 'disabled',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: 'index.html',
|
|
||||||
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
|
|
||||||
favicon: path.join(webpackPaths.assetsPath, 'icons', 'favicon.ico'),
|
|
||||||
minify: {
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true,
|
|
||||||
removeComments: true,
|
|
||||||
},
|
|
||||||
isBrowser: false,
|
|
||||||
isDevelopment: process.env.NODE_ENV !== 'production',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default merge(baseConfig, configuration);
|
|
||||||
@@ -5,9 +5,7 @@ const rootPath = path.join(__dirname, '../..');
|
|||||||
const dllPath = path.join(__dirname, '../dll');
|
const dllPath = path.join(__dirname, '../dll');
|
||||||
|
|
||||||
const srcPath = path.join(rootPath, 'src');
|
const srcPath = path.join(rootPath, 'src');
|
||||||
const assetsPath = path.join(rootPath, 'assets');
|
|
||||||
const srcMainPath = path.join(srcPath, 'main');
|
const srcMainPath = path.join(srcPath, 'main');
|
||||||
const srcRemotePath = path.join(srcPath, 'remote');
|
|
||||||
const srcRendererPath = path.join(srcPath, 'renderer');
|
const srcRendererPath = path.join(srcPath, 'renderer');
|
||||||
|
|
||||||
const releasePath = path.join(rootPath, 'release');
|
const releasePath = path.join(rootPath, 'release');
|
||||||
@@ -18,29 +16,23 @@ const srcNodeModulesPath = path.join(srcPath, 'node_modules');
|
|||||||
|
|
||||||
const distPath = path.join(appPath, 'dist');
|
const distPath = path.join(appPath, 'dist');
|
||||||
const distMainPath = path.join(distPath, 'main');
|
const distMainPath = path.join(distPath, 'main');
|
||||||
const distRemotePath = path.join(distPath, 'remote');
|
|
||||||
const distRendererPath = path.join(distPath, 'renderer');
|
const distRendererPath = path.join(distPath, 'renderer');
|
||||||
const distWebPath = path.join(distPath, 'web');
|
|
||||||
|
|
||||||
const buildPath = path.join(releasePath, 'build');
|
const buildPath = path.join(releasePath, 'build');
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
assetsPath,
|
rootPath,
|
||||||
rootPath,
|
dllPath,
|
||||||
dllPath,
|
srcPath,
|
||||||
srcPath,
|
srcMainPath,
|
||||||
srcMainPath,
|
srcRendererPath,
|
||||||
srcRemotePath,
|
releasePath,
|
||||||
srcRendererPath,
|
appPath,
|
||||||
releasePath,
|
appPackagePath,
|
||||||
appPath,
|
appNodeModulesPath,
|
||||||
appPackagePath,
|
srcNodeModulesPath,
|
||||||
appNodeModulesPath,
|
distPath,
|
||||||
srcNodeModulesPath,
|
distMainPath,
|
||||||
distPath,
|
distRendererPath,
|
||||||
distMainPath,
|
buildPath,
|
||||||
distRemotePath,
|
|
||||||
distRendererPath,
|
|
||||||
distWebPath,
|
|
||||||
buildPath,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,29 +5,20 @@ import fs from 'fs';
|
|||||||
import webpackPaths from '../configs/webpack.paths';
|
import webpackPaths from '../configs/webpack.paths';
|
||||||
|
|
||||||
const mainPath = path.join(webpackPaths.distMainPath, 'main.js');
|
const mainPath = path.join(webpackPaths.distMainPath, 'main.js');
|
||||||
const remotePath = path.join(webpackPaths.distMainPath, 'remote.js');
|
|
||||||
const rendererPath = path.join(webpackPaths.distRendererPath, 'renderer.js');
|
const rendererPath = path.join(webpackPaths.distRendererPath, 'renderer.js');
|
||||||
|
|
||||||
if (!fs.existsSync(mainPath)) {
|
if (!fs.existsSync(mainPath)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
chalk.whiteBright.bgRed.bold(
|
chalk.whiteBright.bgRed.bold(
|
||||||
'The main process is not built yet. Build it by running "npm run build:main"',
|
'The main process is not built yet. Build it by running "npm run build:main"'
|
||||||
),
|
)
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs.existsSync(remotePath)) {
|
|
||||||
throw new Error(
|
|
||||||
chalk.whiteBright.bgRed.bold(
|
|
||||||
'The remote process is not built yet. Build it by running "npm run build:remote"',
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(rendererPath)) {
|
if (!fs.existsSync(rendererPath)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
chalk.whiteBright.bgRed.bold(
|
chalk.whiteBright.bgRed.bold(
|
||||||
'The renderer process is not built yet. Build it by running "npm run build:renderer"',
|
'The renderer process is not built yet. Build it by running "npm run build:renderer"'
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,5 @@ import webpackPaths from '../configs/webpack.paths';
|
|||||||
|
|
||||||
export default function deleteSourceMaps() {
|
export default function deleteSourceMaps() {
|
||||||
rimraf.sync(path.join(webpackPaths.distMainPath, '*.js.map'));
|
rimraf.sync(path.join(webpackPaths.distMainPath, '*.js.map'));
|
||||||
rimraf.sync(path.join(webpackPaths.distRemotePath, '*.js.map'));
|
|
||||||
rimraf.sync(path.join(webpackPaths.distRendererPath, '*.js.map'));
|
rimraf.sync(path.join(webpackPaths.distRendererPath, '*.js.map'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,97 +1,75 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
extends: ['erb', 'plugin:typescript-sort-keys/recommended'],
|
extends: ['erb', 'plugin:typescript-sort-keys/recommended'],
|
||||||
ignorePatterns: ['.erb/*', 'server'],
|
parserOptions: {
|
||||||
parser: '@typescript-eslint/parser',
|
createDefaultProgram: true,
|
||||||
parserOptions: {
|
ecmaVersion: 2020,
|
||||||
createDefaultProgram: true,
|
project: './tsconfig.json',
|
||||||
ecmaVersion: 12,
|
sourceType: 'module',
|
||||||
parser: '@typescript-eslint/parser',
|
tsconfigRootDir: __dirname,
|
||||||
project: './tsconfig.json',
|
},
|
||||||
sourceType: 'module',
|
plugins: ['import', 'sort-keys-fix'],
|
||||||
tsconfigRootDir: './',
|
rules: {
|
||||||
},
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
plugins: ['@typescript-eslint', 'import', 'sort-keys-fix'],
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
rules: {
|
// A temporary hack related to IDE not resolving correct package.json
|
||||||
'@typescript-eslint/naming-convention': 'off',
|
'import/no-extraneous-dependencies': 'off',
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'import/no-unresolved': 'error',
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
'import/order': [
|
||||||
'@typescript-eslint/no-shadow': ['off'],
|
'error',
|
||||||
'@typescript-eslint/no-unused-vars': ['error'],
|
{
|
||||||
'@typescript-eslint/no-use-before-define': ['error'],
|
alphabetize: {
|
||||||
'default-case': 'off',
|
caseInsensitive: true,
|
||||||
'import/extensions': 'off',
|
order: 'asc',
|
||||||
'import/no-absolute-path': 'off',
|
|
||||||
// A temporary hack related to IDE not resolving correct package.json
|
|
||||||
'import/no-extraneous-dependencies': 'off',
|
|
||||||
'import/no-unresolved': 'error',
|
|
||||||
'import/order': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
alphabetize: {
|
|
||||||
caseInsensitive: true,
|
|
||||||
order: 'asc',
|
|
||||||
},
|
|
||||||
groups: ['builtin', 'external', 'internal', ['parent', 'sibling']],
|
|
||||||
'newlines-between': 'never',
|
|
||||||
pathGroups: [
|
|
||||||
{
|
|
||||||
group: 'external',
|
|
||||||
pattern: 'react',
|
|
||||||
position: 'before',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
pathGroupsExcludedImportTypes: ['react'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'import/prefer-default-export': 'off',
|
|
||||||
'jsx-a11y/click-events-have-key-events': 'off',
|
|
||||||
'jsx-a11y/interactive-supports-focus': 'off',
|
|
||||||
'jsx-a11y/media-has-caption': 'off',
|
|
||||||
'no-await-in-loop': 'off',
|
|
||||||
'no-console': 'off',
|
|
||||||
'no-nested-ternary': 'off',
|
|
||||||
'no-restricted-syntax': 'off',
|
|
||||||
'no-shadow': 'off',
|
|
||||||
'no-underscore-dangle': 'off',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'no-use-before-define': 'off',
|
|
||||||
'prefer-destructuring': 'off',
|
|
||||||
'react/function-component-definition': 'off',
|
|
||||||
'react/jsx-filename-extension': [2, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }],
|
|
||||||
'react/jsx-no-useless-fragment': 'off',
|
|
||||||
'react/jsx-props-no-spreading': 'off',
|
|
||||||
'react/jsx-sort-props': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
callbacksLast: true,
|
|
||||||
ignoreCase: false,
|
|
||||||
noSortAlphabetically: false,
|
|
||||||
reservedFirst: true,
|
|
||||||
shorthandFirst: true,
|
|
||||||
shorthandLast: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
'react/no-array-index-key': 'off',
|
|
||||||
'react/react-in-jsx-scope': 'off',
|
|
||||||
'react/require-default-props': 'off',
|
|
||||||
'sort-keys-fix/sort-keys-fix': 'warn',
|
|
||||||
},
|
|
||||||
settings: {
|
|
||||||
'import/parsers': {
|
|
||||||
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
||||||
},
|
|
||||||
'import/resolver': {
|
|
||||||
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
|
|
||||||
node: {
|
|
||||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
||||||
},
|
|
||||||
typescript: {
|
|
||||||
alwaysTryTypes: true,
|
|
||||||
project: './tsconfig.json',
|
|
||||||
},
|
|
||||||
webpack: {
|
|
||||||
config: require.resolve('./.erb/configs/webpack.config.eslint.ts'),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
groups: ['builtin', 'external', 'internal', ['parent', 'sibling']],
|
||||||
|
'newlines-between': 'never',
|
||||||
|
pathGroups: [
|
||||||
|
{
|
||||||
|
group: 'external',
|
||||||
|
pattern: 'react',
|
||||||
|
position: 'before',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
pathGroupsExcludedImportTypes: ['react'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
|
'jsx-a11y/click-events-have-key-events': 'off',
|
||||||
|
'jsx-a11y/interactive-supports-focus': 'off',
|
||||||
|
'jsx-a11y/media-has-caption': 'off',
|
||||||
|
'no-await-in-loop': 'off',
|
||||||
|
'no-console': 'off',
|
||||||
|
'no-nested-ternary': 'off',
|
||||||
|
'no-restricted-syntax': 'off',
|
||||||
|
'react/jsx-props-no-spreading': 'off',
|
||||||
|
'react/jsx-sort-props': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
callbacksLast: true,
|
||||||
|
ignoreCase: false,
|
||||||
|
noSortAlphabetically: false,
|
||||||
|
reservedFirst: true,
|
||||||
|
shorthandFirst: true,
|
||||||
|
shorthandLast: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// Since React 17 and typescript 4.1 you can safely disable the rule
|
||||||
|
'react/react-in-jsx-scope': 'off',
|
||||||
|
'sort-keys-fix/sort-keys-fix': 'warn',
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
'import/parsers': {
|
||||||
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
||||||
},
|
},
|
||||||
|
'import/resolver': {
|
||||||
|
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
|
||||||
|
node: {
|
||||||
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
typescript: {},
|
||||||
|
webpack: {
|
||||||
|
config: require.resolve('./.erb/configs/webpack.config.eslint.ts'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
ko_fi: jeffvli
|
github: [electron-react-boilerplate, amilajack]
|
||||||
|
patreon: amilajack
|
||||||
|
open_collective: electron-react-boilerplate-594
|
||||||
|
|||||||
@@ -4,6 +4,18 @@ about: You're having technical issues. 🐞
|
|||||||
labels: 'bug'
|
labels: 'bug'
|
||||||
---
|
---
|
||||||
|
|
||||||
|
<!-- Please use the following issue template or your issue will be closed -->
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
<!-- If the following boxes are not ALL checked, your issue is likely to be closed -->
|
||||||
|
|
||||||
|
- [ ] Using npm
|
||||||
|
- [ ] Using an up-to-date [`main` branch](https://github.com/electron-react-boilerplate/electron-react-boilerplate/tree/main)
|
||||||
|
- [ ] Using latest version of devtools. [Check the docs for how to update](https://electron-react-boilerplate.js.org/docs/dev-tools/)
|
||||||
|
- [ ] Tried solutions mentioned in [#400](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/400)
|
||||||
|
- [ ] For issue in production release, add devtools output of `DEBUG_PROD=true npm run build && npm start`
|
||||||
|
|
||||||
## Expected Behavior
|
## Expected Behavior
|
||||||
|
|
||||||
<!--- What should have happened? -->
|
<!--- What should have happened? -->
|
||||||
@@ -11,8 +23,6 @@ labels: 'bug'
|
|||||||
## Current Behavior
|
## Current Behavior
|
||||||
|
|
||||||
<!--- What went wrong? -->
|
<!--- What went wrong? -->
|
||||||
<!-- Add screenshots to help explain your problem -->
|
|
||||||
<!-- (Open the browser dev tools in the menu or using CTRL + SHIFT + I) -->
|
|
||||||
|
|
||||||
## Steps to Reproduce
|
## Steps to Reproduce
|
||||||
|
|
||||||
@@ -34,12 +44,24 @@ labels: 'bug'
|
|||||||
## Context
|
## Context
|
||||||
|
|
||||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||||
|
<!--- Did you make any changes to the boilerplate after cloning it? -->
|
||||||
|
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||||
|
|
||||||
## Your Environment
|
## Your Environment
|
||||||
|
|
||||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||||
|
|
||||||
- Application version (e.g. v0.1.0) :
|
- Node version :
|
||||||
- Operating System and version (e.g. Windows 10) :
|
- electron-react-boilerplate version or branch :
|
||||||
- Server and version (e.g. Navidrome v0.48.0) :
|
- Operating System and version :
|
||||||
- Node version (if developing locally) :
|
- Link to your project :
|
||||||
|
|
||||||
|
<!---
|
||||||
|
❗️❗️ Also, please consider donating (https://opencollective.com/electron-react-boilerplate-594) ❗️❗️
|
||||||
|
|
||||||
|
Donations will ensure the following:
|
||||||
|
|
||||||
|
🔨 Long term maintenance of the project
|
||||||
|
🛣 Progress on the roadmap
|
||||||
|
🐛 Quick responses to bug reports and help requests
|
||||||
|
-->
|
||||||
|
|||||||
@@ -4,6 +4,16 @@ about: Ask a question.❓
|
|||||||
labels: 'question'
|
labels: 'question'
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- Question issues will be closed. -->
|
## Summary
|
||||||
<!-- Ask questions in the discussions tab: Please use discussions https://github.com/jeffvli/feishin/discussions -->
|
|
||||||
<!-- Or join the Discord/Matrix servers: https://discord.gg/FVKpcMDy5f https://matrix.to/#/#sonixd:matrix.org -->
|
<!-- What do you need help with? -->
|
||||||
|
|
||||||
|
<!---
|
||||||
|
❗️❗️ Also, please consider donating (https://opencollective.com/electron-react-boilerplate-594) ❗️❗️
|
||||||
|
|
||||||
|
Donations will ensure the following:
|
||||||
|
|
||||||
|
🔨 Long term maintenance of the project
|
||||||
|
🛣 Progress on the roadmap
|
||||||
|
🐛 Quick responses to bug reports and help requests
|
||||||
|
-->
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
---
|
---
|
||||||
name: Feature request
|
name: Feature request
|
||||||
about: Request a feature to be added to Feishin 🎉
|
about: You want something added to the boilerplate. 🎉
|
||||||
labels: 'enhancement'
|
labels: 'enhancement'
|
||||||
---
|
---
|
||||||
|
|
||||||
## What do you want to be added?
|
<!---
|
||||||
|
❗️❗️ Also, please consider donating (https://opencollective.com/electron-react-boilerplate-594) ❗️❗️
|
||||||
|
|
||||||
## Additional context
|
Donations will ensure the following:
|
||||||
|
|
||||||
<!-- Is this a server-specific feature? (e.g. Jellyfin only). -->
|
🔨 Long term maintenance of the project
|
||||||
|
🛣 Progress on the roadmap
|
||||||
|
🐛 Quick responses to bug reports and help requests
|
||||||
|
-->
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
requiredHeaders:
|
requiredHeaders:
|
||||||
- Prerequisites
|
- Prerequisites
|
||||||
- Expected Behavior
|
- Expected Behavior
|
||||||
- Current Behavior
|
- Current Behavior
|
||||||
- Possible Solution
|
- Possible Solution
|
||||||
- Your Environment
|
- Your Environment
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ daysUntilStale: 60
|
|||||||
daysUntilClose: 7
|
daysUntilClose: 7
|
||||||
# Issues with these labels will never be considered stale
|
# Issues with these labels will never be considered stale
|
||||||
exemptLabels:
|
exemptLabels:
|
||||||
- discussion
|
- discussion
|
||||||
- security
|
- security
|
||||||
# Label to use when marking an issue as stale
|
# Label to use when marking an issue as stale
|
||||||
staleLabel: wontfix
|
staleLabel: wontfix
|
||||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
markComment: >
|
markComment: >
|
||||||
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Thank you
|
||||||
|
for your contributions.
|
||||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
closeComment: false
|
closeComment: false
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
# Referenced from: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#introduction
|
|
||||||
name: Publish Docker to GHCR
|
|
||||||
permissions: write-all
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*.*.*'
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=pr
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
# Referenced from: https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#introduction
|
|
||||||
name: Publish Docker to GHCR (Manual)
|
|
||||||
|
|
||||||
on: workflow_dispatch
|
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
|
||||||
with:
|
|
||||||
registry: ${{ env.REGISTRY }}
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
||||||
with:
|
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
name: Publish Linux (Manual)
|
|
||||||
|
|
||||||
on: workflow_dispatch
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- name: Install Node and NPM
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
|
|
||||||
- name: Publish releases
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
uses: nick-invision/retry@v2.8.2
|
|
||||||
with:
|
|
||||||
timeout_minutes: 30
|
|
||||||
max_attempts: 3
|
|
||||||
retry_on: error
|
|
||||||
command: |
|
|
||||||
npm run postinstall
|
|
||||||
npm run build
|
|
||||||
npm exec electron-builder -- --publish always --linux
|
|
||||||
on_retry_command: npm cache clean --force
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
name: Publish Windows and macOS (Manual)
|
|
||||||
|
|
||||||
on: workflow_dispatch
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
|
|
||||||
- name: Install Node and NPM
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
|
|
||||||
- name: Publish releases
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
uses: nick-invision/retry@v2.8.2
|
|
||||||
with:
|
|
||||||
timeout_minutes: 30
|
|
||||||
max_attempts: 3
|
|
||||||
retry_on: error
|
|
||||||
command: |
|
|
||||||
npm run postinstall
|
|
||||||
npm run build
|
|
||||||
npm exec electron-builder -- --publish always --win --mac
|
|
||||||
on_retry_command: npm cache clean --force
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
name: Comment on pull request
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: ['Publish (PR)']
|
|
||||||
types: [completed]
|
|
||||||
jobs:
|
|
||||||
pr_comment:
|
|
||||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/github-script@v6
|
|
||||||
with:
|
|
||||||
# This snippet is public-domain, taken from
|
|
||||||
# https://github.com/oprypin/nightly.link/blob/master/.github/workflows/pr-comment.yml
|
|
||||||
script: |
|
|
||||||
async function upsertComment(owner, repo, issue_number, purpose, body) {
|
|
||||||
const {data: comments} = await github.rest.issues.listComments(
|
|
||||||
{owner, repo, issue_number});
|
|
||||||
const marker = `<!-- bot: ${purpose} -->`;
|
|
||||||
body = marker + "\n" + body;
|
|
||||||
const existing = comments.filter((c) => c.body.includes(marker));
|
|
||||||
if (existing.length > 0) {
|
|
||||||
const last = existing[existing.length - 1];
|
|
||||||
core.info(`Updating comment ${last.id}`);
|
|
||||||
await github.rest.issues.updateComment({
|
|
||||||
owner, repo,
|
|
||||||
body,
|
|
||||||
comment_id: last.id,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
core.info(`Creating a comment in issue / PR #${issue_number}`);
|
|
||||||
await github.rest.issues.createComment({issue_number, body, owner, repo});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const {owner, repo} = context.repo;
|
|
||||||
const run_id = ${{github.event.workflow_run.id}};
|
|
||||||
const pull_requests = ${{ toJSON(github.event.workflow_run.pull_requests) }};
|
|
||||||
if (!pull_requests.length) {
|
|
||||||
return core.error("This workflow doesn't match any pull requests!");
|
|
||||||
}
|
|
||||||
const artifacts = await github.paginate(
|
|
||||||
github.rest.actions.listWorkflowRunArtifacts, {owner, repo, run_id});
|
|
||||||
if (!artifacts.length) {
|
|
||||||
return core.error(`No artifacts found`);
|
|
||||||
}
|
|
||||||
let body = `Download the artifacts for this pull request:\n`;
|
|
||||||
for (const art of artifacts) {
|
|
||||||
body += `\n* [${art.name}.zip](https://nightly.link/${owner}/${repo}/actions/artifacts/${art.id}.zip)`;
|
|
||||||
}
|
|
||||||
core.info("Review thread message body:", body);
|
|
||||||
for (const pr of pull_requests) {
|
|
||||||
await upsertComment(owner, repo, pr.number,
|
|
||||||
"nightly-link", body);
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
name: Publish (PR)
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- development
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout git repo
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Install Node and NPM
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
npm install --legacy-peer-deps
|
|
||||||
|
|
||||||
- name: Build releases
|
|
||||||
uses: nick-invision/retry@v2.8.2
|
|
||||||
with:
|
|
||||||
timeout_minutes: 30
|
|
||||||
max_attempts: 3
|
|
||||||
retry_on: error
|
|
||||||
command: |
|
|
||||||
npm run postinstall
|
|
||||||
npm run build
|
|
||||||
npm run package:pr
|
|
||||||
on_retry_command: npm cache clean --force
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: windows-binaries
|
|
||||||
path: |
|
|
||||||
release/build/*.exe
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: linux-binaries
|
|
||||||
path: |
|
|
||||||
release/build/*.AppImage
|
|
||||||
release/build/*.deb
|
|
||||||
release/build/*.rpm
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: macos-binaries
|
|
||||||
path: |
|
|
||||||
release/build/*.dmg
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
# To enable auto publishing to github, update your electron publisher
|
||||||
|
# config in package.json > "build" and remove the conditional below
|
||||||
|
if: ${{ github.repository_owner == 'electron-react-boilerplate' }}
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout git repo
|
||||||
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install Node and NPM
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
npm install --legacy-peer-deps
|
||||||
|
|
||||||
|
- name: Publish releases
|
||||||
|
env:
|
||||||
|
# These values are used for auto updates signing
|
||||||
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
|
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }}
|
||||||
|
CSC_LINK: ${{ secrets.CSC_LINK }}
|
||||||
|
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||||
|
# This is used for uploading release assets to github
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
npm run postinstall
|
||||||
|
npm run build
|
||||||
|
npm exec electron-builder -- --publish always --win --mac --linux
|
||||||
@@ -3,32 +3,32 @@ name: Test
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Install Node.js and NPM
|
- name: Install Node.js and NPM
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
||||||
- name: npm install
|
- name: npm install
|
||||||
run: |
|
run: |
|
||||||
npm install --legacy-peer-deps
|
npm install --legacy-peer-deps
|
||||||
|
|
||||||
- name: npm test
|
- name: npm test
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
npm run lint
|
npm run package
|
||||||
npm run package
|
npm run lint
|
||||||
npm exec tsc
|
npm exec tsc
|
||||||
npm test
|
npm test
|
||||||
|
|||||||
@@ -1,22 +1,8 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 100,
|
"trailingComma": "es5",
|
||||||
"semi": true,
|
"tabWidth": 2,
|
||||||
"singleQuote": true,
|
"semi": true,
|
||||||
"tabWidth": 4,
|
"singleQuote": true,
|
||||||
"useTabs": false,
|
"printWidth": 100,
|
||||||
"overrides": [
|
"arrowParens": "always"
|
||||||
{
|
|
||||||
"files": ["**/*.css", "**/*.scss", "**/*.html"],
|
|
||||||
"options": {
|
|
||||||
"singleQuote": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"trailingComma": "all",
|
|
||||||
"bracketSpacing": true,
|
|
||||||
"arrowParens": "always",
|
|
||||||
"proseWrap": "never",
|
|
||||||
"htmlWhitespaceSensitivity": "strict",
|
|
||||||
"endOfLine": "lf",
|
|
||||||
"singleAttributePerLine": true
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
{
|
{
|
||||||
"customSyntax": "postcss-styled-syntax",
|
"processors": ["stylelint-processor-styled-components"],
|
||||||
"extends": [
|
"customSyntax": "postcss-scss",
|
||||||
"stylelint-config-standard",
|
"extends": [
|
||||||
"stylelint-config-styled-components",
|
"stylelint-config-standard-scss",
|
||||||
"stylelint-config-recess-order"
|
"stylelint-config-styled-components",
|
||||||
|
"stylelint-config-rational-order"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"color-function-notation": ["legacy"],
|
||||||
|
"declaration-empty-line-before": null,
|
||||||
|
"order/properties-order": [],
|
||||||
|
"plugin/rational-order": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
"border-in-box-model": false,
|
||||||
|
"empty-line-between-groups": false
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"rules": {
|
"selector-type-case": ["lower", { "ignoreTypes": ["/^\\$\\w+/"] }],
|
||||||
"declaration-empty-line-before": null,
|
"selector-type-no-unknown": [
|
||||||
"declaration-block-no-redundant-longhand-properties": null,
|
true,
|
||||||
"selector-class-pattern": null,
|
{ "ignoreTypes": ["/-styled-mixin/", "/^\\$\\w+/"] }
|
||||||
"selector-type-case": ["lower", { "ignoreTypes": ["/^\\$\\w+/"] }],
|
],
|
||||||
"selector-type-no-unknown": [true, { "ignoreTypes": ["/-styled-mixin/", "/^\\$\\w+/"] }],
|
"value-keyword-case": ["lower", { "ignoreKeywords": ["dummyValue"] }],
|
||||||
"declaration-colon-newline-after": null,
|
"declaration-colon-newline-after": null
|
||||||
"property-no-vendor-prefix": null
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"EditorConfig.EditorConfig",
|
"EditorConfig.EditorConfig",
|
||||||
"stylelint.vscode-stylelint",
|
"stylelint.vscode-stylelint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode"
|
||||||
"clinyong.vscode-css-modules",
|
]
|
||||||
"Huuums.vscode-fast-folder-structure"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Electron: Main",
|
"name": "Electron: Main",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"protocol": "inspector",
|
"protocol": "inspector",
|
||||||
"runtimeExecutable": "npm",
|
"runtimeExecutable": "npm",
|
||||||
"runtimeArgs": ["run start:main --inspect=5858 --remote-debugging-port=9223"],
|
"runtimeArgs": [
|
||||||
"preLaunchTask": "Start Webpack Dev"
|
"run start:main --inspect=5858 --remote-debugging-port=9223"
|
||||||
},
|
],
|
||||||
{
|
"preLaunchTask": "Start Webpack Dev"
|
||||||
"name": "Electron: Renderer",
|
},
|
||||||
"type": "chrome",
|
{
|
||||||
"request": "attach",
|
"name": "Electron: Renderer",
|
||||||
"port": 9223,
|
"type": "chrome",
|
||||||
"webRoot": "${workspaceFolder}",
|
"request": "attach",
|
||||||
"timeout": 15000
|
"port": 9223,
|
||||||
}
|
"webRoot": "${workspaceFolder}",
|
||||||
],
|
"timeout": 15000
|
||||||
"compounds": [
|
}
|
||||||
{
|
],
|
||||||
"name": "Electron: All",
|
"compounds": [
|
||||||
"configurations": ["Electron: Main", "Electron: Renderer"]
|
{
|
||||||
}
|
"name": "Electron: All",
|
||||||
]
|
"configurations": ["Electron: Main", "Electron: Renderer"]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,72 +1,30 @@
|
|||||||
{
|
{
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
".eslintrc": "jsonc",
|
".eslintrc": "jsonc",
|
||||||
".prettierrc": "jsonc",
|
".prettierrc": "jsonc",
|
||||||
".eslintignore": "ignore"
|
".eslintignore": "ignore"
|
||||||
},
|
},
|
||||||
"eslint.validate": ["typescript"],
|
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
|
||||||
"eslint.workingDirectories": [
|
"editor.tabSize": 2,
|
||||||
{ "directory": "./", "changeProcessCWD": true },
|
"editor.codeActionsOnSave": {
|
||||||
{ "directory": "./server", "changeProcessCWD": true }
|
"source.fixAll.eslint": true,
|
||||||
],
|
"source.fixAll.stylelint": false
|
||||||
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
|
},
|
||||||
"editor.codeActionsOnSave": {
|
"css.validate": false,
|
||||||
"source.fixAll.eslint": true,
|
"less.validate": false,
|
||||||
"source.fixAll.stylelint": true,
|
"scss.validate": false,
|
||||||
"source.organizeImports": false,
|
"javascript.validate.enable": false,
|
||||||
"source.formatDocument": true
|
"javascript.format.enable": false,
|
||||||
},
|
"typescript.format.enable": false,
|
||||||
"css.validate": true,
|
"search.exclude": {
|
||||||
"less.validate": false,
|
".git": true,
|
||||||
"scss.validate": true,
|
".eslintcache": true,
|
||||||
"scss.lint.unknownAtRules": "warning",
|
".erb/dll": true,
|
||||||
"scss.lint.unknownProperties": "warning",
|
"release/{build,app/dist}": true,
|
||||||
"javascript.validate.enable": false,
|
"node_modules": true,
|
||||||
"javascript.format.enable": false,
|
"npm-debug.log.*": true,
|
||||||
"typescript.format.enable": false,
|
"test/**/__snapshots__": true,
|
||||||
"search.exclude": {
|
"package-lock.json": true,
|
||||||
".git": true,
|
"*.{css,sass,scss}.d.ts": true
|
||||||
".eslintcache": true,
|
}
|
||||||
".erb/dll": true,
|
|
||||||
"release/{build,app/dist}": true,
|
|
||||||
"node_modules": true,
|
|
||||||
"npm-debug.log.*": true,
|
|
||||||
"test/**/__snapshots__": true,
|
|
||||||
"package-lock.json": true,
|
|
||||||
"*.{css,sass,scss}.d.ts": true
|
|
||||||
},
|
|
||||||
"i18n-ally.localesPaths": ["src/i18n", "src/i18n/locales"],
|
|
||||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
|
||||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
||||||
"stylelint.validate": ["css", "scss", "typescript", "typescriptreact"],
|
|
||||||
"typescript.updateImportsOnFileMove.enabled": "always",
|
|
||||||
"[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
|
||||||
"[typescriptreact]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
|
||||||
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": true,
|
|
||||||
"folderTemplates.structures": [
|
|
||||||
{
|
|
||||||
"name": "TypeScript Feature Component With CSS Modules",
|
|
||||||
"omitParentDirectory": true,
|
|
||||||
"structure": [
|
|
||||||
{
|
|
||||||
"fileName": "<FTName | kebabcase>.tsx",
|
|
||||||
"template": "Functional Component with CSS Modules"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fileName": "<FTName | kebabcase>.module.scss"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"folderTemplates.fileTemplates": {
|
|
||||||
"Functional Component with CSS Modules": [
|
|
||||||
"import styles from './<FTName | kebabcase>.module.scss';",
|
|
||||||
"",
|
|
||||||
"interface <FTName | pascalcase>Props {}",
|
|
||||||
"",
|
|
||||||
"export const <FTName | pascalcase> = ({}: <FTName | pascalcase>Props) => {",
|
|
||||||
" return <div></div>;",
|
|
||||||
"};"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"type": "npm",
|
"type": "npm",
|
||||||
"label": "Start Webpack Dev",
|
"label": "Start Webpack Dev",
|
||||||
"script": "start:renderer",
|
"script": "start:renderer",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
"problemMatcher": {
|
"problemMatcher": {
|
||||||
"owner": "custom",
|
"owner": "custom",
|
||||||
"pattern": {
|
"pattern": {
|
||||||
"regexp": "____________"
|
"regexp": "____________"
|
||||||
},
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"activeOnStart": true,
|
"activeOnStart": true,
|
||||||
"beginsPattern": "Compiling\\.\\.\\.$",
|
"beginsPattern": "Compiling\\.\\.\\.$",
|
||||||
"endsPattern": "(Compiled successfully|Failed to compile)\\.$"
|
"endsPattern": "(Compiled successfully|Failed to compile)\\.$"
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,585 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
[0.15.0] - 2022-04-13
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added setting to save and resume the current queue between sessions (#130) (Thanks @kgarner7)
|
||||||
|
- Added a simple "play random" button to the player bar (#276)
|
||||||
|
- Added new seek/volume sliders (#272)
|
||||||
|
- Seeking/dragging is now more responsive
|
||||||
|
- Added improved discord rich presence (#286)
|
||||||
|
- Added download button on the playlist view (#266)
|
||||||
|
- (Jellyfin) Added "genre" column to the artist list
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Swapped the order of "Seek Forward/Backward" and "Next/Prev Track" buttons on the player bar
|
||||||
|
- Global volume is now calculated logarithmically (#275) (Thanks @gelaechter)
|
||||||
|
- "Auto playlist" is now named "Play Random" (#276)
|
||||||
|
- "Now playing" option is now available on the "Start page" setting
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Playing songs by double clicking on a list should now play in the proper order (#279)
|
||||||
|
- (Linux) Fixed MPRIS metadata not updating when player automatically increments (#263)
|
||||||
|
- Application fonts now loaded locally instead of from Google CDN (#284)
|
||||||
|
- Enabling "Default to Album List on Artist Page" no longer performs a double redirect when entering the artist page (#271)
|
||||||
|
- Stop button is no longer disabled when playback is stopped (#273)
|
||||||
|
- Various package updates (#288) (Thanks @kgarner7)
|
||||||
|
- Top control bar show no longer be accessible when not logged in (#267)
|
||||||
|
|
||||||
|
[0.14.0] - 2022-03-12
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added zoom options via hotkeys (#252)
|
||||||
|
- Zoom in: CTRL + SHIFT + =
|
||||||
|
- Zoom out: CTRL + SHIFT + -
|
||||||
|
- Added PLAY context menu options to the Genre view (#239)
|
||||||
|
- Added STOP button to the main player controls (#252)
|
||||||
|
- Added "System Notifications" option to display native notifications when the song automatically changes (#245)
|
||||||
|
- Added arm64 build (#238)
|
||||||
|
- New languages
|
||||||
|
- Spanish (Thanks @ami-sc) (#250)
|
||||||
|
- Sinhala (Thanks @hirusha-adi) (#254)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Jellyfin) Fixed the order of returned songs when playing from the Folder view using the context menu (#240)
|
||||||
|
- (Linux) Reset MPRIS position to 0 when using "previous track" resets the song 0 (#249)
|
||||||
|
- Fixed JavaScript error when removing all songs from the queue using the context menu (#248)
|
||||||
|
- Fixed Ampache server support by adding .view to all Subsonic API endpoints (#253)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- (Windows) Removed the cover art display when hovering Sonixd on the taskbar (due to new sidebar position) (#242)
|
||||||
|
|
||||||
|
[0.13.1] - 2022-02-16
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed startup crash on all OS if the default settings file is not present (#237)
|
||||||
|
|
||||||
|
[0.13.0] - 2022-02-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added new searchbar and search UI (#227, #228)
|
||||||
|
- Added playback controls to the Sonixd tray menu (#225)
|
||||||
|
- Added playlist selections to the `Start Page` config option
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Sidebar changes (#206)
|
||||||
|
|
||||||
|
- Allow resizing of the sidebar when expanded
|
||||||
|
- Allow a toggle of the playerbar's cover art to the sidebar when expanded
|
||||||
|
- Display playlist list on the sidebar under the navigation
|
||||||
|
- Allow configuration of the display of sidebar elements
|
||||||
|
|
||||||
|
- Changed the `Artist` row on the playerbar to use a comma delimited list of the song's artists rather than the album artist (#218)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed the player volume not resetting to its default value when resetting a song while crossfading (#228)
|
||||||
|
- (Jellyfin) Fixed artist list not displaying user favorites
|
||||||
|
- (Jellyfin) Fixed `bitrate` column not properly by its numeric value (#220)
|
||||||
|
- Fixed javascript exception when incrementing/decrementing the queue (#230)
|
||||||
|
- Fixed popups/tooltips not using the configured font
|
||||||
|
|
||||||
|
[0.12.1] - 2022-02-02
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed translation syntax error causing application to crash when deleting playlists from the context menu (#216)
|
||||||
|
- Fixed Player behavior (#217)
|
||||||
|
- No longer scrobbles an additional time after the last song ends when repeat is off
|
||||||
|
- (Jellyfin) Properly handles scrobbling the player's pause/resume and time position
|
||||||
|
|
||||||
|
[0.12.0] - 2022-01-31
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added support for language/translations (#146) (Thanks @gelaechter)
|
||||||
|
- German translation added (Thanks @gelaechter)
|
||||||
|
- Simplified Chinese translation added (Thanks @fangxx3863)
|
||||||
|
- (Windows) Added media keys with desktop overlay (#79) (Thanks @GermanDarknes)
|
||||||
|
- (Subsonic) Added support for `/getLyrics` to display the current song's lyrics in a popup (#151)
|
||||||
|
- (Jellyfin) Added song list page
|
||||||
|
- Added config to choose the default Album/Song list sort on startup (#169)
|
||||||
|
- Added config to choose the application start page (#176) (Thanks @GermanDarknes)
|
||||||
|
- Added config for pagination for Album/Song list pages
|
||||||
|
- (Windows) Added option to set custom directory on installation (#184)
|
||||||
|
- Added config to set the default artist page to the album list (#199)
|
||||||
|
- Added info mode for the Now Playing page (#160)
|
||||||
|
- Added release notes popup
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Player behavior
|
||||||
|
- `Media Stop` now stops the track and resets it instead of clearing the queue (#200)
|
||||||
|
- `Media Prev` now resets to the start of the song if pressed after 5 seconds (#207)
|
||||||
|
- `Media Prev` now resets to the start of the song if repeat is off and is the first song of the queue (#207)
|
||||||
|
- `Media Next` now does nothing if repeat is off and is the last song of the queue (#207)
|
||||||
|
- Playing a single track in the queue without repeat no longer plays the track twice (#205)
|
||||||
|
- Scrobbling
|
||||||
|
- (Jellyfin) Scrobbling has been reverted to use the `/sessions/playing` endpoint to support the Playback Reporting plugin (#187)
|
||||||
|
- Scrobbling occurs after 5 seconds has elapsed for the current track as to not instantly mark the song as played
|
||||||
|
- Pressing `CTRL + F` or the search button now focuses the text in the searchbar (#203) (Thanks @WeekendWarrior1)
|
||||||
|
- Changed loading indicators for all pages
|
||||||
|
- OBS scrobble now outputs an image.txt file instead of the downloading the cover image (#136)
|
||||||
|
- Player Bar
|
||||||
|
- Album name now appears under the artist
|
||||||
|
- (Subsonic) 5-star rating is available
|
||||||
|
- Clicking on the cover art now displays a full-size image
|
||||||
|
- Clicking on the song name now redirects to the Now Playing queue
|
||||||
|
- (Jellyfin) Removed track limit for "Auto Playlist"
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (macOS) Fixed macOS exit behavior (#198) (Thanks @zackslash)
|
||||||
|
- (Linux) Fixed MPRIS `position` result (#162)
|
||||||
|
- (Subsonic) Fixed artist page crashing the application if server does not support `/getArtistInfo2` (#170)
|
||||||
|
- (Jellyfin) Fixed `View all songs` returning songs out of their album track order
|
||||||
|
- (Jellyfin) Fixed the "Latest Albums" on the album artist page displaying no albums
|
||||||
|
- Fixed card overlay button color on click
|
||||||
|
- Fixed buttons on the Album page to work better with light mode
|
||||||
|
- Fixed unfavorite button on Album page
|
||||||
|
|
||||||
|
[0.11.0] - 2022-01-01
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added external integrations
|
||||||
|
- Added Discord rich presence to display the currently playing song (#155)
|
||||||
|
- Added OBS (Open Broadcaster Software) scrobbling to send current track metadata to desktop or the Tuna plugin (#136)
|
||||||
|
- Added a `Native` option for Titlebar Style (#148) (Thanks @gelaechter)
|
||||||
|
- (Jellyfin) Added toggle to allow transcoding for non-directplay compatible filetypes (#158)
|
||||||
|
- Additional MPRIS support
|
||||||
|
- Added metadata:
|
||||||
|
- `albumArtist`, `discNumber`, `trackNumber`, `useCount`, `genre`
|
||||||
|
- Added events:
|
||||||
|
- `seek`, `position`, `volume`, `repeat`, `shuffle`
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Overhauled the Artist page
|
||||||
|
- (Jellyfin) Split albums by album artist OR compilation
|
||||||
|
- (Jellyfin) Added artist genres
|
||||||
|
- (Subsonic) Added Top Songs section
|
||||||
|
- Moved related artists to the main page scrolling menu
|
||||||
|
- Added `View All Songs` button to view all songs by the artist
|
||||||
|
- Added artist radio (mix) button
|
||||||
|
- Horizontal scrolling menu no longer displays scrollbar
|
||||||
|
- Changed button styling on Playlist/Album/Artist pages
|
||||||
|
- Changed page image styling to use the card on Playlist/Album/Artist pages
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed various MPRIS features
|
||||||
|
- Synchronized the play/pause state between the player and MPRIS client when pausing from Sonixd (#152)
|
||||||
|
- Fixed the identity of Sonixd to use the app name instead of description (#163)
|
||||||
|
- Fixed various submenus opening in the right-click context menu when the option is disabled (#164)
|
||||||
|
- Fixed compatibility with older Subsonic API servers (now targets Subsonic v1.13.0) (#144)
|
||||||
|
- Fixed playback causing heavily increased CPU/Power usage #145)
|
||||||
|
|
||||||
|
[0.10.0] - 2021-12-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added 2 new default themes
|
||||||
|
- City Lights
|
||||||
|
- One Dark
|
||||||
|
- Added additional album filters (#66)
|
||||||
|
- Genres (AND/OR)
|
||||||
|
- Artists (AND/OR)
|
||||||
|
- Years (FROM/TO)
|
||||||
|
- Added external column sort filters for multiple pages (#66)
|
||||||
|
- Added item counter to page titles
|
||||||
|
- `Play Count` column has been added to albums (only works for Navidrome)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Config page has been fully refreshed to a new look
|
||||||
|
- Config popover on the action bar now includes all config tabs
|
||||||
|
- Tooltips
|
||||||
|
- Increased default tooltip delay from 250ms -> 500ms
|
||||||
|
- Increased tooltip delay on card overlay buttons to 1000ms
|
||||||
|
- Grid view
|
||||||
|
- Placeholder images for playlists, albums, and artists have been updated (inspired from Jellyfin Web UI)
|
||||||
|
- Card title/subtitle width decreased from 100% to default length
|
||||||
|
- Separate card info section from image/overlay buttons on hover
|
||||||
|
- Popovers (config, auto playlist, etc)
|
||||||
|
- Now have decreased opacity
|
||||||
|
- Enabling/disabling global media keys no longer requires app restart
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Jellyfin) Fixed `Recently Played` and `Most Played` filters on the Dashboard page (#114)
|
||||||
|
- (Jellyfin) Fixed server scrobble (#126)
|
||||||
|
- No longer sends the `/playing` request on song start (prevents song being marked as played when it starts)
|
||||||
|
- Fixed song play count increasing multiple times per play
|
||||||
|
- (Jellyfin) Fixed tracks without embedded art displaying placeholder (#128)
|
||||||
|
- (Jellyfin) Fixed song `Path` property not displaying data
|
||||||
|
- (Subsonic) Fixed login check for Funkwhale servers (#135)
|
||||||
|
- Fixed persistent grid-view scroll position
|
||||||
|
- Fixed list-view columns
|
||||||
|
- `Visibility` column now properly displays data
|
||||||
|
- Selected media folder is now cleared from settings on disconnect (prevents errors when signing into a new server)
|
||||||
|
- Fixed adding/removing artist as favorite on the Artist page not updating
|
||||||
|
- Fixed search bar not properly handling Asian keyboard inputs
|
||||||
|
|
||||||
|
## [0.9.1] - 2021-12-07
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- List-view scroll position is now persistent for the following:
|
||||||
|
- Now Playing
|
||||||
|
- Playlist list
|
||||||
|
- Favorites (all)
|
||||||
|
- Album list
|
||||||
|
- Artist list
|
||||||
|
- Genre list
|
||||||
|
- Grid-view scroll position is now persistent for the following:
|
||||||
|
- Playlist list
|
||||||
|
- Favorites (album/artist)
|
||||||
|
- Album list
|
||||||
|
- Artist list
|
||||||
|
- (Jellyfin) Changed audio stream URL to force transcoding off (#108)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Jellyfin) Fixed the player not sending the "finish" condition when the song meets the scrobble condition (unresolved from 0.9.0) (#111)
|
||||||
|
|
||||||
|
## [0.9.0] - 2021-12-06
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added 2 new default themes
|
||||||
|
- Plex-like
|
||||||
|
- Spotify-like
|
||||||
|
- Added volume control improvements
|
||||||
|
- Volume value tooltip while hovering the slider
|
||||||
|
- Mouse scroll wheel controls volume while hovering the slider
|
||||||
|
- Clicking the volume icon will mute/unmute
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Overhauled all default themes
|
||||||
|
- Rounded buttons, inputs, etc.
|
||||||
|
- Changed grid card hover effects
|
||||||
|
- Removed hover scale
|
||||||
|
- Removed default background on overlay buttons
|
||||||
|
- Moved border to only the image instead of full card
|
||||||
|
- Album page
|
||||||
|
- Genre(s) are now listed on a line separate from the artists
|
||||||
|
- Album artist is now distinct from track artists
|
||||||
|
- Increased length of the genre/artist line from 70% -> 80%
|
||||||
|
- The genre/artist line is now scrollable using the mouse wheel
|
||||||
|
- (Jellyfin) List view
|
||||||
|
- `Artist` column now uses the album artist property
|
||||||
|
- `Title (Combined)` column now displays all track artists, comma-delimited instead of the album artist
|
||||||
|
- `Genre` column now displays all genres, comma-delimited, left-aligned
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Jellyfin) Fixed the player not sending the "finish" condition when the song meets the scrobble condition
|
||||||
|
- (Jellyfin) Fixed album lists not sorting by the `genre` column
|
||||||
|
- (Jellyfin)(API) Fixed the A-Z(Artist) not sorting by Album Artist on the album list
|
||||||
|
- (Jellyfin)(API) Fixed auto playlist not respecting the selected music folder
|
||||||
|
- (Jellyfin)(API) Fixed the artist page not respecting the selected music folder
|
||||||
|
|
||||||
|
## [0.8.5] - 2021-11-25
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed default (OOBE) title column not display data (#104)
|
||||||
|
|
||||||
|
## [0.8.4] - 2021-11-25
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Jellyfin)(Linux) Fixed JS MPRIS error when switching tracks due to unrounded song duration
|
||||||
|
- (Linux) Fixed MPRIS artist, genre, and coverart not updating on track change
|
||||||
|
|
||||||
|
## [0.8.3] - 2021-11-25
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Subsonic) Fixed playing a folder from the folder view
|
||||||
|
- Fixed rating context menu option available from the Genre page
|
||||||
|
|
||||||
|
## [0.8.2] - 2021-11-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added option to disable auto updates
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed gapless playback on certain \*sonic servers (#100)
|
||||||
|
- Fixed playerbar coverart not redirecting to `Now Playing` page
|
||||||
|
|
||||||
|
## [0.8.1] - 2021-11-24
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Subsonic) Fixed errors blocking playlists from being deleted
|
||||||
|
|
||||||
|
## [0.8.0] - 2021-11-24
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added Jellyfin server support (#87)
|
||||||
|
- Supports full Sonixd feature-set (except ratings)
|
||||||
|
- Added a mini config popover to change list/grid view options on the top action bar
|
||||||
|
- Added system audio device selector (#96)
|
||||||
|
- Added context menu option `Set rating` to bulk set ratings for songs (and albums/artists on Navidrome) (#95)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Reduced cached image from 500px -> 350px (to match max grid size)
|
||||||
|
- Grid/header images now respect image aspect ratio returned by the server
|
||||||
|
- Playback filter input now uses a regex validation before allowing you to add
|
||||||
|
- Renamed all `Name` columns to `Title`
|
||||||
|
- Search bar now clears after pressing enter to globally search
|
||||||
|
- Added borders to popovers
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed application performance issues when player is crossfading to the next track
|
||||||
|
- Fixed null entries showing at the beginning of descending sort on playlist/now playing lists
|
||||||
|
- Tooltips no longer pop up on the artist/playlist description when null
|
||||||
|
|
||||||
|
## [0.7.0] - 2021-11-15
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added download buttons on the Album and Artist pages (#29)
|
||||||
|
- Allows you to download (via browser) or copy download links to your clipboard (to use with a download manager)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed default tooltip delay from `500ms` -> `250ms`
|
||||||
|
- Moved search bar from page header to the main layout action bar
|
||||||
|
- Added notice for macOS media keys to require trusted accessibility in the client
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed auto playlist and album fetch in Gonic servers
|
||||||
|
- Fixed the macOS titlebar styling to better match the original (#83)
|
||||||
|
- Fixed thumbnailclip error when resizing the application in macOS (#84)
|
||||||
|
- Fixed playlist page not using cached image
|
||||||
|
|
||||||
|
## [0.6.0] - 2021-11-09
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added additional grid-view customization options (#74)
|
||||||
|
- Gap size (spaces between cards)
|
||||||
|
- Alignment (left-align, center-align)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed default album/artist uncached image sizes from `150px` -> `350px`
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- (Windows) Fixed default taskbar thumbnail on Windows10 when minimized to use window instead of album cover (#73)
|
||||||
|
- Fixed playback settings unable to change via the UI
|
||||||
|
- Crossfade duration
|
||||||
|
- Polling interval
|
||||||
|
- Volume fade
|
||||||
|
- Fixed header styling on the Config page breaking at smaller window widths (#72)
|
||||||
|
- Fixed the position of the description tooltip on the Artist page
|
||||||
|
- Fixed the `Add to playlist` popover showing underneath the modal in modal-view
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Removed unused `fonts.size.pageTitle` theme property
|
||||||
|
|
||||||
|
## [0.5.0] - 2021-11-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added extensible theming (#60)
|
||||||
|
- Added playback presets (gapless, fade, normal) to the config
|
||||||
|
- Added persistence for column sort for all list-views (except playlist and search) (#47)
|
||||||
|
- Added playback filters to the config to filter out songs based on regex (#53)
|
||||||
|
- Added music folder selector in auto playlist (this may or may not work depending on your server)
|
||||||
|
- Added improved playlist, artist, and album pages
|
||||||
|
- Added dynamic images on the Playlist page for servers that don't support playlist images (e.g. Navidrome)
|
||||||
|
- Added link to open the local `settings.json` file
|
||||||
|
- Added setting to use legacy authentication (#63)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Improved overall application keyboard accessibility
|
||||||
|
- Playback no longer automatically starts if adding songs to the queue using `Add to queue`
|
||||||
|
- Prevent accidental page navigation when using [Ctrl/Shift + Click] when multi-selecting rows in list-view
|
||||||
|
- Standardized buttons between the Now Playing page and the mini player
|
||||||
|
- "Add random" renamed to "Auto playlist"
|
||||||
|
- Increased 'info' notification timeout from 1500ms -> 2000ms
|
||||||
|
- Changed default mini player columns to better fit
|
||||||
|
- Updated default themes to more modern standards (Default Dark, Default Light)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed title sort on the `Title (Combined)` column on the album list
|
||||||
|
- Fixed 2nd song in queue being skipped when using the "Play" button multiple pages (album, artist, auto playlist)
|
||||||
|
- Fixed `Title` column not showing the title on the Folder page (#69)
|
||||||
|
- Fixed context menu windows showing underneath the mini player
|
||||||
|
- Fixed `Add to queue (next)` adding songs to the wrong unshuffled index when shuffle is enabled
|
||||||
|
- Fixed local search on the root Folder page
|
||||||
|
- Fixed input picker dropdowns following the page on scroll
|
||||||
|
- Fixed the current playing song not highlighted when using `Add to queue` on an empty play queue
|
||||||
|
- Fixed artist list not using the `artistImageUrl` returned by Navidrome
|
||||||
|
|
||||||
|
## [0.4.1] - 2021-10-27
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added links to the genre column on the list-view
|
||||||
|
- Added page forward/back buttons to main layout
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Increase delay when completing mouse drag select in list view from `100ms` -> `200ms`
|
||||||
|
- Change casing for main application name `sonixd` -> `Sonixd`
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed Linux media hotkey support (MPRIS)
|
||||||
|
- Added commands for additional events `play` and `pause` (used by KDE's media player overlay)
|
||||||
|
- Set status to `Playing` when initially starting a song
|
||||||
|
- Set current song metadata when track automatically changes instead of only when it manually changes
|
||||||
|
- Fixed filtered link to Album List on the Album page
|
||||||
|
- Fixed filtered link to Album List on the Dashboard page
|
||||||
|
- Fixed font color for lists/tables in panels
|
||||||
|
- Affects the search view song list and column selector list
|
||||||
|
|
||||||
|
## [0.4.0] - 2021-10-26
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added music folder selector (#52)
|
||||||
|
- Added media hotkeys / MPRIS support for Linux (#50)
|
||||||
|
- This is due to dbus overriding the global shortcuts that electron sends
|
||||||
|
- Added advanced column selector component
|
||||||
|
- Drag-n-drop list
|
||||||
|
- Individual resizable columns
|
||||||
|
- (Windows) Added tray (Thanks @ncarmic4) (#45)
|
||||||
|
- Settings to minimize/exit to tray
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Page selections are now persistent
|
||||||
|
- Active tab on config page
|
||||||
|
- Active tab on favorites page
|
||||||
|
- Filter selector on album list page
|
||||||
|
- Playlists can now be saved after being sorted using column filters
|
||||||
|
- Folder view
|
||||||
|
- Now shows all root folders in the list instead of in the input picker
|
||||||
|
- Now shows music folders in the input picker
|
||||||
|
- Now uses loader when switching pages
|
||||||
|
- Changed styling for various views/components
|
||||||
|
- Look & Feel setting page now split up into multiple panels
|
||||||
|
- Renamed context menu button `Remove from current` -> `Remove selected`
|
||||||
|
- Page header titles width increased from `45%` -> `80%`
|
||||||
|
- Renamed `Scan library` -> `Scan`
|
||||||
|
- All pages no longer refetch data when clicking back into the application
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed shift-click multi select on a column-sorted list-view
|
||||||
|
- Fixed right-click context menu showing up behind all modals (#55)
|
||||||
|
- Fixed mini player showing up behind tag picker elements
|
||||||
|
- Fixed duration showing up as `NaN:NaN` when duration is null or invalid
|
||||||
|
- Fixed albums showing as a folder in Navidrome instances
|
||||||
|
|
||||||
|
## [0.3.0] - 2021-10-16
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added folder browser (#1)
|
||||||
|
- Added context menu button `View in folder`
|
||||||
|
- Requires that your server has support for the original `/getIndexes` and `/getMusicDirectory` endpoints
|
||||||
|
- Added configurable row-hover highlight for list-view
|
||||||
|
- (Windows) Added playback controls in thumbnail toolbar (#32)
|
||||||
|
- (Windows/macOS) Added window size/position remembering on application close (#31)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed styling for various views/components
|
||||||
|
- Tooltips added on grid-view card hover buttons
|
||||||
|
- Mini-player removed rounded borders and increased opacity
|
||||||
|
- Mini-player removed animation on open/close
|
||||||
|
- Search bar now activated from button -> input on click / CTRL+F
|
||||||
|
- Page header toolbar buttons styling consistency
|
||||||
|
- Album list filter moved from right -> left
|
||||||
|
- Reordered context menu button `Move selected to [...]`
|
||||||
|
- Decreased horizontal width of expanded sidebar from 193px -> 165px
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed duplicate scrobble requests when pause/resuming a song after the scrobble threshold (#30)
|
||||||
|
- Fixed genre column not applying in the song list-view
|
||||||
|
- Fixed default titlebar set on first run
|
||||||
|
|
||||||
|
## [0.2.1] - 2021-10-11
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed using play buttons on the artist view not starting playback
|
||||||
|
- Fixed favoriting on horizontal scroll menu on dashboard/search views
|
||||||
|
- Fixed typo on default artist list viewtype
|
||||||
|
- Fixed artist image selection on artist view
|
||||||
|
|
||||||
|
## [0.2.0] - 2021-10-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added setting to enable scrobbling playing/played tracks to your server (#17)
|
||||||
|
- Added setting to change between macOS and Windows styled titlebar (#23)
|
||||||
|
- Added app/build versions and update checker on the config page (#18)
|
||||||
|
- Added 'view in modal' button on the list-view context menu (#8)
|
||||||
|
- Added a persistent indicator on grid-view cards for favorited albums/artists (#7)
|
||||||
|
- Added buttons for 'Add to queue (next)' and 'Add to queue (later)' (#6)
|
||||||
|
- Added left/right scroll buttons to the horizontal scrolling menu (dashboard/search)
|
||||||
|
- Added last.fm link to artist page
|
||||||
|
- Added link to cache location to open in local file explorer
|
||||||
|
- Added reset to default for cache location
|
||||||
|
- Added additional tooltips
|
||||||
|
- Grid-view card title and subtitle buttons
|
||||||
|
- Cover art on the player bar
|
||||||
|
- Header titles on album/artist pages
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Changed starring logic on grid-view card to update local cache instead of refetch
|
||||||
|
- Changed styling for various views/components
|
||||||
|
- Use dynamically sized hover buttons on grid-view cards depending on the card size
|
||||||
|
- Decreased size of buttons on album/playlist/artist pages
|
||||||
|
- Input picker text color changed from primary theme color to primary text color
|
||||||
|
- Crossfade type config changed from radio buttons to input picker
|
||||||
|
- Disconnect button color from red to default
|
||||||
|
- Tooltip styling updated to better match default theme
|
||||||
|
- Changed tag links to text links on album page
|
||||||
|
- Changed page header images to use cache (album/artist)
|
||||||
|
- Artist image now falls back to last.fm if no local image
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed song & image caching (#16)
|
||||||
|
- Fixed set default artist list view type on first startup
|
||||||
|
|
||||||
|
## [0.1.0] - 2021-10-06
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Initial release
|
||||||
|
|||||||
@@ -1,18 +1,42 @@
|
|||||||
# --- Builder stage
|
# Stage 1 - Build frontend
|
||||||
FROM node:18-alpine as builder
|
FROM node:16.5-alpine as ui-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . .
|
||||||
|
RUN npm install && npm run build:renderer
|
||||||
|
|
||||||
# Scripts include electron-specific dependencies, which we don't need
|
# Stage 2 - Build server
|
||||||
RUN npm install --legacy-peer-deps --ignore-scripts
|
FROM node:16.5-alpine as server-builder
|
||||||
RUN npm run build:web
|
WORKDIR /app
|
||||||
|
COPY src/server .
|
||||||
|
RUN ls -lh
|
||||||
|
RUN npm install
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
# --- Production stage
|
# Stage 3 - Deploy
|
||||||
FROM nginx:alpine-slim
|
FROM node:16.5-alpine
|
||||||
|
WORKDIR /root
|
||||||
|
RUN mkdir appdata
|
||||||
|
RUN mkdir sonixd-server
|
||||||
|
RUN mkdir sonixd-client
|
||||||
|
|
||||||
COPY --chown=nginx:nginx --from=builder /app/release/app/dist/web /usr/share/nginx/html
|
# Install server modules
|
||||||
COPY ng.conf.template /etc/nginx/templates/default.conf.template
|
COPY src/server/package.json ./sonixd-server
|
||||||
|
RUN cd ./sonixd-server && npm install --production
|
||||||
|
|
||||||
ENV PUBLIC_PATH="/"
|
# Add server build files
|
||||||
EXPOSE 9180
|
COPY --from=server-builder /app/dist ./sonixd-server
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
COPY --from=server-builder /app/prisma ./sonixd-server/prisma
|
||||||
|
|
||||||
|
# Add client build files
|
||||||
|
COPY --from=ui-builder /app/release/app/dist/renderer ./sonixd-client
|
||||||
|
|
||||||
|
COPY docker-entrypoint.sh ./sonixd-server/docker-entrypoint.sh
|
||||||
|
RUN chmod +x ./sonixd-server/docker-entrypoint.sh
|
||||||
|
|
||||||
|
RUN cd ./sonixd-server && npx prisma generate
|
||||||
|
RUN npm install pm2 -g
|
||||||
|
|
||||||
|
WORKDIR /root/sonixd-server
|
||||||
|
|
||||||
|
EXPOSE 9321
|
||||||
|
CMD ["sh", "docker-entrypoint.sh"]
|
||||||
|
|||||||
@@ -1,106 +1,129 @@
|
|||||||
<img src="assets/icons/icon.png" alt="logo" title="feishin" align="right" height="60px" />
|
<img src="assets/icon.png" alt="sonixd logo" title="sonixd" align="right" height="60px" />
|
||||||
|
|
||||||
# Feishin
|
# Sonixd
|
||||||
|
|
||||||
<p align="center">
|
<a href="https://github.com/jeffvli/sonixd/releases">
|
||||||
<a href="https://github.com/jeffvli/feishin/blob/main/LICENSE">
|
<img src="https://img.shields.io/github/v/release/jeffvli/sonixd?style=flat-square&color=blue"
|
||||||
<img src="https://img.shields.io/github/license/jeffvli/feishin?style=flat-square&color=brightgreen"
|
alt="Release">
|
||||||
alt="License">
|
</a>
|
||||||
</a>
|
<a href="https://github.com/jeffvli/sonixd/blob/main/LICENSE">
|
||||||
<a href="https://github.com/jeffvli/feishin/releases">
|
<img src="https://img.shields.io/github/license/jeffvli/sonixd?style=flat-square&color=brightgreen"
|
||||||
<img src="https://img.shields.io/github/v/release/jeffvli/feishin?style=flat-square&color=blue"
|
alt="License">
|
||||||
alt="Release">
|
</a>
|
||||||
</a>
|
<a href="https://github.com/jeffvli/sonixd/releases">
|
||||||
<a href="https://github.com/jeffvli/feishin/releases">
|
<img src="https://img.shields.io/github/downloads/jeffvli/sonixd/total?style=flat-square&color=orange"
|
||||||
<img src="https://img.shields.io/github/downloads/jeffvli/feishin/total?style=flat-square&color=orange"
|
alt="Downloads">
|
||||||
alt="Downloads">
|
</a>
|
||||||
</a>
|
<a href="https://discord.gg/FVKpcMDy5f">
|
||||||
</p>
|
<img src="https://img.shields.io/discord/922656312888811530?color=red&label=discord&logo=discord&logoColor=white"
|
||||||
<p align="center">
|
alt="Discord">
|
||||||
<a href="https://discord.gg/FVKpcMDy5f">
|
</a>
|
||||||
<img src="https://img.shields.io/discord/922656312888811530?color=black&label=discord&logo=discord&logoColor=white"
|
<a href="https://matrix.to/#/#sonixd:matrix.org">
|
||||||
alt="Discord">
|
<img src="https://img.shields.io/matrix/sonixd:matrix.org?color=red&label=matrix&logo=matrix&logoColor=white"
|
||||||
</a>
|
alt="Matrix">
|
||||||
<a href="https://matrix.to/#/#sonixd:matrix.org">
|
</a>
|
||||||
<img src="https://img.shields.io/matrix/sonixd:matrix.org?color=black&label=matrix&logo=matrix&logoColor=white"
|
|
||||||
alt="Matrix">
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
Rewrite of [Sonixd](https://github.com/jeffvli/sonixd).
|
Sonixd is a cross-platform desktop client built for Subsonic-API (and Jellyfin in 0.8.0+) compatible music servers. This project was inspired by the many existing clients, but aimed to address a few key issues including <strong>scalability</strong>, <strong>library management</strong>, and <strong>user experience</strong>.
|
||||||
|
|
||||||
|
- [**Usage documentation & FAQ**](https://github.com/jeffvli/sonixd/discussions/15)
|
||||||
|
- [**Theming documentation**](https://github.com/jeffvli/sonixd/discussions/61)
|
||||||
|
|
||||||
|
Sonixd has been tested on the following: [Navidrome](https://github.com/navidrome/navidrome), [Airsonic](https://github.com/airsonic/airsonic), [Airsonic-Advanced](https://github.com/airsonic-advanced/airsonic-advanced), [Gonic](https://github.com/sentriz/gonic), [Astiga](https://asti.ga/), [Jellyfin](https://github.com/jellyfin/jellyfin)
|
||||||
|
|
||||||
|
### [Demo Sonixd using Navidrome](https://github.com/jeffvli/sonixd/discussions/244)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- [x] MPV player backend
|
- HTML5 audio with crossfading and gapless\* playback
|
||||||
- [x] Web player backend
|
- Drag and drop rows with multi-select
|
||||||
- [x] Modern UI
|
- Modify and save playlists intuitively
|
||||||
- [x] Scrobble playback to your server
|
- Handles large playlists and queues
|
||||||
- [x] Smart playlist editor (Navidrome)
|
- Global mediakeys (and partial MPRIS) support
|
||||||
- [x] Synchronized and unsynchronized lyrics support
|
- Multi-theme support
|
||||||
- [ ] [Request a feature](https://github.com/jeffvli/feishin/issues) or [view taskboard](https://github.com/users/jeffvli/projects/5/views/1)
|
- Supports all Subsonic/Jellyfin API compatible servers
|
||||||
|
- Built with Electron, React with the [rsuite v4](https://github.com/rsuite/rsuite) component library
|
||||||
|
|
||||||
|
<h5>* Gapless playback is artifically created using the crossfading players so it may not be perfect, YMMV.</h5>
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
<a href="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_full_screen_player.png"><img src="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_full_screen_player.png" width="49.5%"/></a> <a href="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_album_artist_detail.png"><img src="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_album_artist_detail.png" width="49.5%"/></a> <a href="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_album_detail.png"><img src="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_album_detail.png" width="49.5%"/></a> <a href="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_smart_playlist.png"><img src="https://raw.githubusercontent.com/jeffvli/feishin/development/media/preview_smart_playlist.png" width="49.5%"/></a>
|
<a href="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/album.png"><img src="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/album.png" width="49.5%"/></a>
|
||||||
|
<a href="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/artist.png"><img src="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/artist.png" width="49.5%"/></a>
|
||||||
|
<a href="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/search.png"><img src="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/search.png" width="49.5%"/></a>
|
||||||
|
<a href="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/now_playing.png"><img src="https://raw.githubusercontent.com/jeffvli/sonixd/main/assets/screenshots/0.13.1/now_playing.png" width="49.5%"/></a>
|
||||||
|
|
||||||
## Getting Started
|
## Install
|
||||||
|
|
||||||
### Desktop (recommended)
|
You can install sonixd by downloading the [latest release](https://github.com/jeffvli/sonixd/releases) for your specified operating system.
|
||||||
|
|
||||||
Download the [latest desktop client](https://github.com/jeffvli/feishin/releases). The desktop client is the recommended way to use Feishin. It supports both the MPV and web player backends, as well as includes built-in fetching for lyrics.
|
---
|
||||||
|
|
||||||
If you're using a device running macOS 12 (Monterey) or higher, [check here](https://github.com/jeffvli/feishin/issues/104#issuecomment-1553914730) for instructions on how to remove the app from quarantine.
|
### Windows
|
||||||
|
|
||||||
### Web and Docker
|
If you prefer not to download the release binary, you can install using `winget`.
|
||||||
|
|
||||||
Visit [https://feishin.vercel.app](https://feishin.vercel.app) to use the hosted web version of Feishin. The web client only supports the web player backend.
|
Using your favorite terminal (cmd/pwsh):
|
||||||
|
|
||||||
Feishin is also available as a Docker image. The images are hosted via `ghcr.io` and are available to view [here](https://github.com/jeffvli/feishin/pkgs/container/feishin). You can run the container using the following commands:
|
```
|
||||||
|
winget install sonixd
|
||||||
```bash
|
|
||||||
# Run the latest version
|
|
||||||
docker run --name feishin --port 9180:9180 ghcr.io/jeffvli/feishin:latest
|
|
||||||
|
|
||||||
# Build the image locally
|
|
||||||
docker build -t feishin .
|
|
||||||
docker run --name feishin --port 9180:9180 feishin
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Configuration
|
---
|
||||||
|
|
||||||
1. Upon startup you will be greeted with a prompt to select the path to your MPV binary. If you do not have MPV installed, you can download it [here](https://mpv.io/installation/) or install it using any package manager supported by your OS. After inputting the path, restart the app.
|
### Arch Linux
|
||||||
|
|
||||||
2. After restarting the app, you will be prompted to select a server. Click the `Open menu` button and select `Manage servers`. Click the `Add server` button in the popup and fill out all applicable details. You will need to enter the full URL to your server, including the protocol and port if applicable (e.g. `https://navidrome.my-server.com` or `http://192.168.0.1:4533`).
|
There is an AUR package of the latest AppImage release available [here](https://aur.archlinux.org/packages/sonixd-appimage).
|
||||||
|
|
||||||
- **Navidrome** - For the best experience, select "Save password" when creating the server and configure the `SessionTimeout` setting in your Navidrome config to a larger value (e.g. 72h).
|
To install it you can use your favourite AUR package manager and install the package: `sonixd-appimage`
|
||||||
|
|
||||||
3. _Optional_ - If you want to host Feishin on a subpath (not `/`), then pass in the following environment variable: `PUBLIC_PATH=PATH`. For example, to host on `/feishin`, pass in `PUBLIC_PATH=/feishin`.
|
For example using `yay`:
|
||||||
|
|
||||||
## FAQ
|
```
|
||||||
|
yay -S sonixd-appimage
|
||||||
|
```
|
||||||
|
|
||||||
### MPV is either not working or is rapidly switching between pause/play states
|
If you encounter any problems please comment on the [AUR](https://aur.archlinux.org/packages/sonixd-appimage) or contact the [maintainer](mailto:robin@blckct.io) directly before you open an issue here.
|
||||||
|
|
||||||
First thing to do is check that your MPV binary path is correct. Navigate to the settings page and re-set the path and restart the app. If your issue still isn't resolved, try reinstalling MPV. Known working versions include `v0.35.x` and `v0.36.x`. `v0.34.x` is a known broken version.
|
---
|
||||||
|
|
||||||
### What music servers does Feishin support?
|
Once installed, run the application and sign in to your music server with the following details. If you are using [airsonic-advanced](https://github.com/airsonic-advanced/airsonic-advanced), you will need to make sure that you create a `decodable` credential for your login user within the admin control panel.
|
||||||
|
|
||||||
Feishin supports any music server that implements a [Navidrome](https://www.navidrome.org/) or [Jellyfin](https://jellyfin.org/) API. **Subsonic API is not currently supported**. This will likely be added in [later when the new Subsonic API is decided on](https://support.symfonium.app/t/subsonic-servers-participation/1233).
|
- Server - `e.g. http://localhost:4040/`
|
||||||
|
- User name - `e.g. admin`
|
||||||
|
- Password - `e.g. supersecret!`
|
||||||
|
|
||||||
- [Navidrome](https://github.com/navidrome/navidrome)
|
If you have any questions, feel free to check out the [Usage Documentation & FAQ](https://github.com/jeffvli/sonixd/discussions/15).
|
||||||
- [Jellyfin](https://github.com/jellyfin/jellyfin)
|
|
||||||
- [Funkwhale](https://funkwhale.audio/) - TBD
|
|
||||||
- Subsonic-compatible servers - TBD
|
|
||||||
|
|
||||||
## Development
|
## Development / Contributing
|
||||||
|
|
||||||
Built and tested using Node `v16.15.0`.
|
This project is built off of [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate) v2.3.0.
|
||||||
|
If you want to contribute to this project, please first create an [issue](https://github.com/jeffvli/sonixd/issues/new) or [discussion](https://github.com/jeffvli/sonixd/discussions/new) so that we can both discuss the idea and its feasability for integration.
|
||||||
|
|
||||||
This project is built off of [electron-react-boilerplate](https://github.com/electron-react-boilerplate/electron-react-boilerplate) v4.6.0.
|
First, clone the repo via git and install dependencies (Windows development now requires additional setup, see [#232](https://github.com/jeffvli/sonixd/issues/232)):
|
||||||
|
|
||||||
## Translation
|
```bash
|
||||||
|
git clone https://github.com/jeffvli/sonixd.git
|
||||||
|
yarn install
|
||||||
|
```
|
||||||
|
|
||||||
This project uses [Weblate](https://hosted.weblate.org/projects/feishin/) for translations. If you would like to contribute, please visit the link and submit a translation.
|
Start the app in the `dev` environment:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn start
|
||||||
|
```
|
||||||
|
|
||||||
|
To package apps for the local platform:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn package
|
||||||
|
```
|
||||||
|
|
||||||
|
If you receive errors while packaging the application, try upgrading/downgrading your Node version (tested on v14.18.0).
|
||||||
|
|
||||||
|
If you are unable to run via debug in VS Code, check troubleshooting steps [here](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/2757#issuecomment-784200527).
|
||||||
|
|
||||||
|
If your devtools extensions are failing to run/install, check troubleshooting steps [here](https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/2788).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[GNU General Public License v3.0 ©](https://github.com/jeffvli/feishin/blob/dev/LICENSE)
|
[GNU General Public License v3.0 ©](https://github.com/jeffvli/sonixd/blob/main/LICENSE)
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
type Styles = Record<string, string>;
|
type Styles = Record<string, string>;
|
||||||
|
|
||||||
declare module '*.svg' {
|
declare module '*.svg' {
|
||||||
const content: string;
|
const content: string;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.png' {
|
declare module '*.png' {
|
||||||
const content: string;
|
const content: string;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.jpg' {
|
declare module '*.jpg' {
|
||||||
const content: string;
|
const content: string;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.scss' {
|
declare module '*.scss' {
|
||||||
const content: Styles;
|
const content: Styles;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.sass' {
|
declare module '*.sass' {
|
||||||
const content: Styles;
|
const content: Styles;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.css' {
|
declare module '*.css' {
|
||||||
const content: Styles;
|
const content: Styles;
|
||||||
export default content;
|
export default content;
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 896 B |
|
Before Width: | Height: | Size: 971 B |
|
Before Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 524 B |
@@ -0,0 +1,47 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: sonixd_db
|
||||||
|
image: postgres:13
|
||||||
|
volumes:
|
||||||
|
- ${DATABASE_PERSIST_PATH}:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=${DATABASE_USERNAME}
|
||||||
|
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
|
||||||
|
- POSTGRES_DB=${DATABASE_NAME}
|
||||||
|
ports:
|
||||||
|
- '${DATABASE_PORT}:5432'
|
||||||
|
restart: unless-stopped
|
||||||
|
server:
|
||||||
|
container_name: sonixd_server
|
||||||
|
volumes:
|
||||||
|
- ./src/server:/app # Synchronise docker container with local change
|
||||||
|
- /app/node_modules # Avoid re-copying local node_modules. Cache in container.
|
||||||
|
build:
|
||||||
|
context: ./src/server
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
environment:
|
||||||
|
- APP_BASE_URL=${APP_BASE_URL}
|
||||||
|
- DATABASE_URL=postgresql://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@db/${DATABASE_NAME}?schema=public&connection_limit=14&pool_timeout=20
|
||||||
|
- DATABASE_PORT=${DATABASE_PORT}
|
||||||
|
- TOKEN_SECRET=${TOKEN_SECRET}
|
||||||
|
ports:
|
||||||
|
- '9321:9321'
|
||||||
|
restart: unless-stopped
|
||||||
|
prisma:
|
||||||
|
container_name: sonixd_prisma_studio
|
||||||
|
volumes:
|
||||||
|
- ./src/server/prisma:/app/prisma
|
||||||
|
build:
|
||||||
|
context: ./src/server/prisma
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- server
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgresql://${DATABASE_USERNAME}:${DATABASE_PASSWORD}@db/${DATABASE_NAME}?schema=public
|
||||||
|
ports:
|
||||||
|
- '5555:5555'
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
container_name: sonixd_db
|
||||||
|
image: postgres:13
|
||||||
|
ports:
|
||||||
|
- '5432:5432'
|
||||||
|
volumes:
|
||||||
|
- ${DB_PERSIST_PATH}:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=${DB_USERNAME}
|
||||||
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
|
- POSTGRES_DB=${DB_NAME}
|
||||||
|
server:
|
||||||
|
container_name: sonixd
|
||||||
|
image: sonixd:latest
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
environment:
|
||||||
|
- APP_BASE_URL=${APP_BASE_URL}
|
||||||
|
- DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@db/${DB_NAME}?schema=public&connection_limit=14&pool_timeout=20
|
||||||
|
- DATABASE_SECRET=${DB_SECRET}
|
||||||
|
ports:
|
||||||
|
- '9321:9321'
|
||||||
|
restart: always
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
npx prisma migrate deploy
|
||||||
|
npx ts-node prisma/seed.ts
|
||||||
|
pm2-runtime server.js
|
||||||
|
Before Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 644 KiB |
|
Before Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 465 KiB |
|
Before Width: | Height: | Size: 887 KiB |
|
Before Width: | Height: | Size: 396 KiB |
@@ -1,19 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 9180;
|
|
||||||
sendfile on;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
gzip on;
|
|
||||||
gzip_http_version 1.1;
|
|
||||||
gzip_disable "MSIE [1-6]\.";
|
|
||||||
gzip_min_length 256;
|
|
||||||
gzip_vary on;
|
|
||||||
gzip_proxied expired no-cache no-store private auth;
|
|
||||||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
|
|
||||||
gzip_comp_level 9;
|
|
||||||
|
|
||||||
location ${PUBLIC_PATH} {
|
|
||||||
alias /usr/share/nginx/html/;
|
|
||||||
try_files $uri $uri/ /index.html =404;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,334 +1,309 @@
|
|||||||
{
|
{
|
||||||
"name": "feishin",
|
"name": "sonixd",
|
||||||
"productName": "Feishin",
|
"productName": "Sonixd",
|
||||||
"description": "Feishin music server",
|
"description": "A full-featured Subsonic/Jellyfin compatible music player",
|
||||||
"version": "0.4.1",
|
"scripts": {
|
||||||
"scripts": {
|
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
|
||||||
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\" \"npm run build:remote\"",
|
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
|
||||||
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
|
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
|
||||||
"build:remote": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.remote.prod.ts",
|
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
|
||||||
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
|
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
|
||||||
"build:web": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.web.prod.ts",
|
"lint:styles": "npx stylelint **/*.tsx",
|
||||||
"build:docker": "npm run build:web && docker build -t jeffvli/feishin .",
|
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
|
||||||
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
|
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
|
||||||
"lint": "concurrently \"npm run lint:code\" \"npm run lint:styles\"",
|
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
|
||||||
"lint:code": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
"start:main": "cross-env NODE_ENV=development electron -r ts-node/register/transpile-only ./src/main/main.ts",
|
||||||
"lint:styles": "npx stylelint **/*.tsx --fix",
|
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
||||||
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
|
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
|
||||||
"package:pr": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never --win --mac --linux",
|
"start:web": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.web.ts",
|
||||||
"package:dev": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never --dir",
|
"test": "jest",
|
||||||
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
|
"prepare": "husky install",
|
||||||
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
|
"i18next": "i18next -c src/renderer/i18n/i18next-parser.config.js",
|
||||||
"start:main": "cross-env NODE_ENV=development electron -r ts-node/register/transpile-only ./src/main/main.ts",
|
"docker:up": "docker compose --file docker-compose.dev.yml --env-file .env.dev up --detach && docker compose --file docker-compose.dev.yml --env-file .env.dev logs -f",
|
||||||
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
"docker:down": "docker compose --file docker-compose.dev.yml --env-file .env.dev down && docker image rm sonixd_prisma",
|
||||||
"start:remote": "cross-env NODE_ENV=developemnt TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.remote.dev.ts",
|
"docker:migrate": "cd src/server && npx prisma generate && docker exec -ti sonixd_server sh -c \"npx prisma generate && npx prisma db push\"",
|
||||||
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
|
"docker:reset": "docker exec -ti sonixd_server sh -c \"npx prisma migrate reset && npx prisma db push && npx ts-node prisma/seed.ts\""
|
||||||
"start:web": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack serve --config ./.erb/configs/webpack.config.renderer.web.ts",
|
},
|
||||||
"test": "jest",
|
"lint-staged": {
|
||||||
"prepare": "husky install",
|
"*.{js,jsx,ts,tsx}": [
|
||||||
"i18next": "i18next -c src/i18n/i18next-parser.config.js",
|
"cross-env NODE_ENV=development eslint --cache"
|
||||||
"prod:buildserver": "pwsh -c \"./scripts/server-build.ps1\"",
|
|
||||||
"prod:publishserver": "pwsh -c \"./scripts/server-publish.ps1\""
|
|
||||||
},
|
|
||||||
"lint-staged": {
|
|
||||||
"*.{js,jsx,ts,tsx}": [
|
|
||||||
"cross-env NODE_ENV=development eslint --cache"
|
|
||||||
],
|
|
||||||
"*.json,.{eslintrc,prettierrc}": [
|
|
||||||
"prettier --ignore-path .eslintignore --parser json --write"
|
|
||||||
],
|
|
||||||
"*.{css,scss}": [
|
|
||||||
"prettier --ignore-path .eslintignore --single-quote --write"
|
|
||||||
],
|
|
||||||
"*.{html,md,yml}": [
|
|
||||||
"prettier --ignore-path .eslintignore --single-quote --write"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"productName": "Feishin",
|
|
||||||
"appId": "org.jeffvli.feishin",
|
|
||||||
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
|
|
||||||
"asar": true,
|
|
||||||
"asarUnpack": "**\\*.{node,dll}",
|
|
||||||
"files": [
|
|
||||||
"dist",
|
|
||||||
"node_modules",
|
|
||||||
"package.json"
|
|
||||||
],
|
|
||||||
"afterSign": ".erb/scripts/notarize.js",
|
|
||||||
"electronVersion": "25.8.1",
|
|
||||||
"mac": {
|
|
||||||
"target": {
|
|
||||||
"target": "default",
|
|
||||||
"arch": [
|
|
||||||
"arm64",
|
|
||||||
"x64"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"icon": "assets/icons/icon.icns",
|
|
||||||
"type": "distribution",
|
|
||||||
"hardenedRuntime": true,
|
|
||||||
"entitlements": "assets/entitlements.mac.plist",
|
|
||||||
"entitlementsInherit": "assets/entitlements.mac.plist",
|
|
||||||
"gatekeeperAssess": false
|
|
||||||
},
|
|
||||||
"dmg": {
|
|
||||||
"contents": [
|
|
||||||
{
|
|
||||||
"x": 130,
|
|
||||||
"y": 220
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"x": 410,
|
|
||||||
"y": 220,
|
|
||||||
"type": "link",
|
|
||||||
"path": "/Applications"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"win": {
|
|
||||||
"target": [
|
|
||||||
"nsis",
|
|
||||||
"zip"
|
|
||||||
],
|
|
||||||
"icon": "assets/icons/icon.ico"
|
|
||||||
},
|
|
||||||
"linux": {
|
|
||||||
"target": [
|
|
||||||
"AppImage",
|
|
||||||
"tar.xz"
|
|
||||||
],
|
|
||||||
"icon": "assets/icons/icon.png",
|
|
||||||
"category": "Development"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"app": "release/app",
|
|
||||||
"buildResources": "assets",
|
|
||||||
"output": "release/build"
|
|
||||||
},
|
|
||||||
"extraResources": [
|
|
||||||
"./assets/**"
|
|
||||||
],
|
|
||||||
"publish": {
|
|
||||||
"provider": "github",
|
|
||||||
"owner": "jeffvli",
|
|
||||||
"repo": "feishin"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/jeffvli/feishin.git"
|
|
||||||
},
|
|
||||||
"author": {
|
|
||||||
"name": "jeffvli",
|
|
||||||
"url": "https://github.com/jeffvli/"
|
|
||||||
},
|
|
||||||
"contributors": [],
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/jeffvli/feishin/issues"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"subsonic",
|
|
||||||
"navidrome",
|
|
||||||
"airsonic",
|
|
||||||
"jellyfin",
|
|
||||||
"react",
|
|
||||||
"electron"
|
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/jeffvli/feishin",
|
"*.json,.{eslintrc,prettierrc}": [
|
||||||
"jest": {
|
"prettier --ignore-path .eslintignore --parser json --write"
|
||||||
"testURL": "http://localhost/",
|
],
|
||||||
"testEnvironment": "jsdom",
|
"*.{css,scss}": [
|
||||||
"transform": {
|
"prettier --ignore-path .eslintignore --single-quote --write"
|
||||||
"\\.(ts|tsx|js|jsx)$": "ts-jest"
|
],
|
||||||
},
|
"*.{html,md,yml}": [
|
||||||
"moduleNameMapper": {
|
"prettier --ignore-path .eslintignore --single-quote --write"
|
||||||
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/.erb/mocks/fileMock.js",
|
]
|
||||||
"\\.(css|less|sass|scss)$": "identity-obj-proxy"
|
},
|
||||||
},
|
"build": {
|
||||||
"moduleFileExtensions": [
|
"productName": "Sonixd",
|
||||||
"js",
|
"appId": "org.erb.sonixd",
|
||||||
"jsx",
|
"artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
|
||||||
"ts",
|
"asar": true,
|
||||||
"tsx",
|
"asarUnpack": "**\\*.{node,dll}",
|
||||||
"json"
|
"files": [
|
||||||
],
|
"dist",
|
||||||
"moduleDirectories": [
|
"node_modules",
|
||||||
"node_modules",
|
"package.json"
|
||||||
"release/app/node_modules"
|
],
|
||||||
],
|
"afterSign": ".erb/scripts/notarize.js",
|
||||||
"testPathIgnorePatterns": [
|
"mac": {
|
||||||
"release/app/dist"
|
"target": {
|
||||||
],
|
"target": "default",
|
||||||
"setupFiles": [
|
"arch": [
|
||||||
"./.erb/scripts/check-build-exists.ts"
|
"arm64",
|
||||||
|
"x64"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"type": "distribution",
|
||||||
|
"hardenedRuntime": true,
|
||||||
|
"entitlements": "assets/entitlements.mac.plist",
|
||||||
|
"entitlementsInherit": "assets/entitlements.mac.plist",
|
||||||
|
"gatekeeperAssess": false
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"dmg": {
|
||||||
"@electron/rebuild": "^3.2.10",
|
"contents": [
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
|
{
|
||||||
"@stylelint/postcss-css-in-js": "^0.38.0",
|
"x": 130,
|
||||||
"@teamsupercell/typings-for-css-modules-loader": "^2.5.1",
|
"y": 220
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
},
|
||||||
"@testing-library/react": "^13.0.0",
|
{
|
||||||
"@types/electron-localshortcut": "^3.1.0",
|
"x": 410,
|
||||||
"@types/jest": "^27.4.1",
|
"y": 220,
|
||||||
"@types/lodash": "^4.14.188",
|
"type": "link",
|
||||||
"@types/md5": "^2.3.2",
|
"path": "/Applications"
|
||||||
"@types/node": "^17.0.23",
|
}
|
||||||
"@types/react": "^18.0.25",
|
]
|
||||||
"@types/react-dom": "^18.0.8",
|
|
||||||
"@types/react-test-renderer": "^17.0.1",
|
|
||||||
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
|
||||||
"@types/react-window": "^1.8.5",
|
|
||||||
"@types/react-window-infinite-loader": "^1.0.6",
|
|
||||||
"@types/styled-components": "^5.1.26",
|
|
||||||
"@types/terser-webpack-plugin": "^5.0.4",
|
|
||||||
"@types/webpack-bundle-analyzer": "^4.4.1",
|
|
||||||
"@types/webpack-env": "^1.16.3",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
||||||
"@typescript-eslint/parser": "^5.47.0",
|
|
||||||
"browserslist-config-erb": "^0.0.3",
|
|
||||||
"chalk": "^4.1.2",
|
|
||||||
"concurrently": "^7.1.0",
|
|
||||||
"core-js": "^3.21.1",
|
|
||||||
"cross-env": "^7.0.3",
|
|
||||||
"css-loader": "^6.7.1",
|
|
||||||
"css-minimizer-webpack-plugin": "^3.4.1",
|
|
||||||
"detect-port": "^1.3.0",
|
|
||||||
"electron": "^25.8.1",
|
|
||||||
"electron-builder": "^24.6.3",
|
|
||||||
"electron-devtools-installer": "^3.2.0",
|
|
||||||
"electron-notarize": "^1.2.1",
|
|
||||||
"electronmon": "^2.0.2",
|
|
||||||
"eslint": "^8.30.0",
|
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
|
||||||
"eslint-config-erb": "^4.0.3",
|
|
||||||
"eslint-import-resolver-typescript": "^2.7.1",
|
|
||||||
"eslint-import-resolver-webpack": "^0.13.2",
|
|
||||||
"eslint-plugin-compat": "^4.0.2",
|
|
||||||
"eslint-plugin-import": "^2.26.0",
|
|
||||||
"eslint-plugin-jest": "^26.1.3",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
||||||
"eslint-plugin-promise": "^6.0.0",
|
|
||||||
"eslint-plugin-react": "^7.29.4",
|
|
||||||
"eslint-plugin-react-hooks": "^4.4.0",
|
|
||||||
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
||||||
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
|
||||||
"file-loader": "^6.2.0",
|
|
||||||
"html-webpack-plugin": "^5.5.0",
|
|
||||||
"husky": "^7.0.4",
|
|
||||||
"i18next-parser": "^6.6.0",
|
|
||||||
"identity-obj-proxy": "^3.0.0",
|
|
||||||
"jest": "^27.5.1",
|
|
||||||
"lint-staged": "^12.3.7",
|
|
||||||
"mini-css-extract-plugin": "^2.6.0",
|
|
||||||
"postcss-scss": "^4.0.4",
|
|
||||||
"postcss-styled-syntax": "^0.5.0",
|
|
||||||
"postcss-syntax": "^0.36.2",
|
|
||||||
"prettier": "^2.6.2",
|
|
||||||
"react-refresh": "^0.12.0",
|
|
||||||
"react-refresh-typescript": "^2.0.4",
|
|
||||||
"react-test-renderer": "^18.0.0",
|
|
||||||
"rimraf": "^3.0.2",
|
|
||||||
"sass": "^1.49.11",
|
|
||||||
"sass-loader": "^12.6.0",
|
|
||||||
"style-loader": "^3.3.1",
|
|
||||||
"stylelint": "^15.10.3",
|
|
||||||
"stylelint-config-css-modules": "^4.3.0",
|
|
||||||
"stylelint-config-recess-order": "^4.3.0",
|
|
||||||
"stylelint-config-standard": "^34.0.0",
|
|
||||||
"stylelint-config-standard-scss": "^4.0.0",
|
|
||||||
"stylelint-config-styled-components": "^0.1.1",
|
|
||||||
"terser-webpack-plugin": "^5.3.1",
|
|
||||||
"ts-jest": "^27.1.4",
|
|
||||||
"ts-loader": "^9.2.8",
|
|
||||||
"ts-node": "^10.7.0",
|
|
||||||
"tsconfig-paths-webpack-plugin": "^4.0.0",
|
|
||||||
"typescript": "^5.2.2",
|
|
||||||
"typescript-plugin-styled-components": "^3.0.0",
|
|
||||||
"url-loader": "^4.1.1",
|
|
||||||
"webpack": "^5.71.0",
|
|
||||||
"webpack-bundle-analyzer": "^4.5.0",
|
|
||||||
"webpack-cli": "^4.9.2",
|
|
||||||
"webpack-dev-server": "^4.8.0",
|
|
||||||
"webpack-merge": "^5.8.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"win": {
|
||||||
"@ag-grid-community/client-side-row-model": "^28.2.1",
|
"target": [
|
||||||
"@ag-grid-community/core": "^28.2.1",
|
"nsis",
|
||||||
"@ag-grid-community/infinite-row-model": "^28.2.1",
|
"zip"
|
||||||
"@ag-grid-community/react": "^28.2.1",
|
]
|
||||||
"@ag-grid-community/styles": "^28.2.1",
|
|
||||||
"@emotion/react": "^11.10.4",
|
|
||||||
"@mantine/core": "^6.0.17",
|
|
||||||
"@mantine/dates": "^6.0.17",
|
|
||||||
"@mantine/form": "^6.0.17",
|
|
||||||
"@mantine/hooks": "^6.0.17",
|
|
||||||
"@mantine/modals": "^6.0.17",
|
|
||||||
"@mantine/notifications": "^6.0.17",
|
|
||||||
"@mantine/utils": "^6.0.17",
|
|
||||||
"@tanstack/react-query": "^4.32.1",
|
|
||||||
"@tanstack/react-query-devtools": "^4.32.1",
|
|
||||||
"@tanstack/react-query-persist-client": "^4.32.1",
|
|
||||||
"@ts-rest/core": "^3.23.0",
|
|
||||||
"@xhayper/discord-rpc": "^1.0.24",
|
|
||||||
"axios": "^1.4.0",
|
|
||||||
"clsx": "^2.0.0",
|
|
||||||
"cmdk": "^0.2.0",
|
|
||||||
"dayjs": "^1.11.6",
|
|
||||||
"electron-debug": "^3.2.0",
|
|
||||||
"electron-localshortcut": "^3.2.1",
|
|
||||||
"electron-log": "^4.4.6",
|
|
||||||
"electron-store": "^8.1.0",
|
|
||||||
"electron-updater": "^4.6.5",
|
|
||||||
"fast-average-color": "^9.3.0",
|
|
||||||
"format-duration": "^2.0.0",
|
|
||||||
"framer-motion": "^10.13.0",
|
|
||||||
"fuse.js": "^6.6.2",
|
|
||||||
"history": "^5.3.0",
|
|
||||||
"i18next": "^21.10.0",
|
|
||||||
"idb-keyval": "^6.2.1",
|
|
||||||
"immer": "^9.0.21",
|
|
||||||
"is-electron": "^2.2.2",
|
|
||||||
"lodash": "^4.17.21",
|
|
||||||
"md5": "^2.3.0",
|
|
||||||
"memoize-one": "^6.0.0",
|
|
||||||
"nanoid": "^3.3.3",
|
|
||||||
"net": "^1.0.2",
|
|
||||||
"node-mpv": "github:jeffvli/Node-MPV",
|
|
||||||
"overlayscrollbars": "^2.2.1",
|
|
||||||
"overlayscrollbars-react": "^0.5.1",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-dom": "^18.2.0",
|
|
||||||
"react-error-boundary": "^3.1.4",
|
|
||||||
"react-i18next": "^11.18.6",
|
|
||||||
"react-icons": "^4.10.1",
|
|
||||||
"react-player": "^2.11.0",
|
|
||||||
"react-router": "^6.16.0",
|
|
||||||
"react-router-dom": "^6.16.0",
|
|
||||||
"react-simple-img": "^3.0.0",
|
|
||||||
"react-virtualized-auto-sizer": "^1.0.17",
|
|
||||||
"react-window": "^1.8.9",
|
|
||||||
"react-window-infinite-loader": "^1.0.9",
|
|
||||||
"styled-components": "^6.0.8",
|
|
||||||
"swiper": "^9.3.1",
|
|
||||||
"zod": "^3.21.4",
|
|
||||||
"zustand": "^4.3.9"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"linux": {
|
||||||
"styled-components": "^6"
|
"target": [
|
||||||
|
"AppImage",
|
||||||
|
"tar.xz"
|
||||||
|
],
|
||||||
|
"icon": "assets/icons/placeholder.png",
|
||||||
|
"category": "Development"
|
||||||
},
|
},
|
||||||
"devEngines": {
|
"directories": {
|
||||||
"node": ">=14.x",
|
"app": "release/app",
|
||||||
"npm": ">=7.x"
|
"buildResources": "assets",
|
||||||
|
"output": "release/build"
|
||||||
},
|
},
|
||||||
"browserslist": [],
|
"extraResources": [
|
||||||
"electronmon": {
|
"./assets/**"
|
||||||
"patterns": [
|
],
|
||||||
"!server",
|
"publish": {
|
||||||
"!src/renderer"
|
"provider": "github",
|
||||||
]
|
"owner": "jeffvli",
|
||||||
|
"repo": "sonixd"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jeffvli/sonixd.git"
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "jeffvli",
|
||||||
|
"url": "https://github.com/jeffvli/"
|
||||||
|
},
|
||||||
|
"contributors": [],
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jeffvli/sonixd/issues"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"subsonic",
|
||||||
|
"navidrome",
|
||||||
|
"airsonic",
|
||||||
|
"jellyfin",
|
||||||
|
"react",
|
||||||
|
"electron"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/jeffvli/sonixd",
|
||||||
|
"jest": {
|
||||||
|
"testURL": "http://localhost/",
|
||||||
|
"testEnvironment": "jsdom",
|
||||||
|
"transform": {
|
||||||
|
"\\.(ts|tsx|js|jsx)$": "ts-jest"
|
||||||
|
},
|
||||||
|
"moduleNameMapper": {
|
||||||
|
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/.erb/mocks/fileMock.js",
|
||||||
|
"\\.(css|less|sass|scss)$": "identity-obj-proxy"
|
||||||
|
},
|
||||||
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"jsx",
|
||||||
|
"ts",
|
||||||
|
"tsx",
|
||||||
|
"json"
|
||||||
|
],
|
||||||
|
"moduleDirectories": [
|
||||||
|
"node_modules",
|
||||||
|
"release/app/node_modules"
|
||||||
|
],
|
||||||
|
"testPathIgnorePatterns": [
|
||||||
|
"release/app/dist"
|
||||||
|
],
|
||||||
|
"setupFiles": [
|
||||||
|
"./.erb/scripts/check-build-exists.ts"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
|
||||||
|
"@stylelint/postcss-css-in-js": "^0.38.0",
|
||||||
|
"@teamsupercell/typings-for-css-modules-loader": "^2.5.1",
|
||||||
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
|
"@testing-library/react": "^13.0.0",
|
||||||
|
"@types/jest": "^27.4.1",
|
||||||
|
"@types/lodash": "^4.14.182",
|
||||||
|
"@types/md5": "^2.3.2",
|
||||||
|
"@types/node": "^17.0.23",
|
||||||
|
"@types/react": "^17.0.43",
|
||||||
|
"@types/react-dom": "^17.0.14",
|
||||||
|
"@types/react-lazy-load-image-component": "^1.5.2",
|
||||||
|
"@types/react-slider": "^1.3.1",
|
||||||
|
"@types/react-test-renderer": "^17.0.1",
|
||||||
|
"@types/react-virtualized-auto-sizer": "^1.0.1",
|
||||||
|
"@types/react-window": "^1.8.5",
|
||||||
|
"@types/react-window-infinite-loader": "^1.0.6",
|
||||||
|
"@types/styled-components": "^5.1.25",
|
||||||
|
"@types/terser-webpack-plugin": "^5.0.4",
|
||||||
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
||||||
|
"@types/webpack-env": "^1.16.3",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.18.0",
|
||||||
|
"@typescript-eslint/parser": "^5.18.0",
|
||||||
|
"browserslist-config-erb": "^0.0.3",
|
||||||
|
"chalk": "^4.1.2",
|
||||||
|
"concurrently": "^7.1.0",
|
||||||
|
"core-js": "^3.21.1",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"css-loader": "^6.7.1",
|
||||||
|
"css-minimizer-webpack-plugin": "^3.4.1",
|
||||||
|
"detect-port": "^1.3.0",
|
||||||
|
"electron": "^18.0.1",
|
||||||
|
"electron-builder": "^23.0.3",
|
||||||
|
"electron-devtools-installer": "^3.2.0",
|
||||||
|
"electron-notarize": "^1.2.1",
|
||||||
|
"electron-rebuild": "^3.2.7",
|
||||||
|
"electronmon": "^2.0.2",
|
||||||
|
"eslint": "^8.12.0",
|
||||||
|
"eslint-config-airbnb-base": "^15.0.0",
|
||||||
|
"eslint-config-erb": "^4.0.3",
|
||||||
|
"eslint-import-resolver-typescript": "^2.7.1",
|
||||||
|
"eslint-import-resolver-webpack": "^0.13.2",
|
||||||
|
"eslint-plugin-compat": "^4.0.2",
|
||||||
|
"eslint-plugin-import": "^2.26.0",
|
||||||
|
"eslint-plugin-jest": "^26.1.3",
|
||||||
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
||||||
|
"eslint-plugin-promise": "^6.0.0",
|
||||||
|
"eslint-plugin-react": "^7.29.4",
|
||||||
|
"eslint-plugin-react-hooks": "^4.4.0",
|
||||||
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
||||||
|
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
||||||
|
"file-loader": "^6.2.0",
|
||||||
|
"html-webpack-plugin": "^5.5.0",
|
||||||
|
"husky": "^7.0.4",
|
||||||
|
"i18next-parser": "^6.3.0",
|
||||||
|
"identity-obj-proxy": "^3.0.0",
|
||||||
|
"jest": "^27.5.1",
|
||||||
|
"lint-staged": "^12.3.7",
|
||||||
|
"mini-css-extract-plugin": "^2.6.0",
|
||||||
|
"postcss-scss": "^4.0.4",
|
||||||
|
"postcss-syntax": "^0.36.2",
|
||||||
|
"prettier": "^2.6.2",
|
||||||
|
"react-refresh": "^0.12.0",
|
||||||
|
"react-refresh-typescript": "^2.0.4",
|
||||||
|
"react-test-renderer": "^18.0.0",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"sass": "^1.49.11",
|
||||||
|
"sass-loader": "^12.6.0",
|
||||||
|
"style-loader": "^3.3.1",
|
||||||
|
"stylelint": "^14.9.1",
|
||||||
|
"stylelint-config-rational-order": "^0.1.2",
|
||||||
|
"stylelint-config-standard-scss": "^4.0.0",
|
||||||
|
"stylelint-config-styled-components": "^0.1.1",
|
||||||
|
"stylelint-order": "^5.0.0",
|
||||||
|
"stylelint-processor-styled-components": "^1.10.0",
|
||||||
|
"terser-webpack-plugin": "^5.3.1",
|
||||||
|
"ts-jest": "^27.1.4",
|
||||||
|
"ts-loader": "^9.2.8",
|
||||||
|
"ts-node": "^10.7.0",
|
||||||
|
"typescript": "^4.6.4",
|
||||||
|
"typescript-plugin-styled-components": "^2.0.0",
|
||||||
|
"url-loader": "^4.1.1",
|
||||||
|
"webpack": "^5.71.0",
|
||||||
|
"webpack-bundle-analyzer": "^4.5.0",
|
||||||
|
"webpack-cli": "^4.9.2",
|
||||||
|
"webpack-dev-server": "^4.8.0",
|
||||||
|
"webpack-merge": "^5.8.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@jellyfin/client-axios": "^10.7.8",
|
||||||
|
"@mantine/core": "^5.0.0",
|
||||||
|
"@mantine/form": "^5.0.0",
|
||||||
|
"@mantine/hooks": "^5.0.0",
|
||||||
|
"axios": "^0.26.1",
|
||||||
|
"electron-debug": "^3.2.0",
|
||||||
|
"electron-log": "^4.4.6",
|
||||||
|
"electron-updater": "^4.6.5",
|
||||||
|
"format-duration": "^2.0.0",
|
||||||
|
"framer-motion": "^6.4.2",
|
||||||
|
"history": "^5.3.0",
|
||||||
|
"i18next": "^21.6.16",
|
||||||
|
"immer": "^9.0.15",
|
||||||
|
"is-electron": "^2.2.1",
|
||||||
|
"lodash": "^4.17.21",
|
||||||
|
"md5": "^2.3.0",
|
||||||
|
"nanoid": "^3.3.3",
|
||||||
|
"net": "^1.0.2",
|
||||||
|
"node-mpv": "^2.0.0-beta.2",
|
||||||
|
"react": "^18.0.0",
|
||||||
|
"react-dom": "^18.0.0",
|
||||||
|
"react-helmet-async": "^1.3.0",
|
||||||
|
"react-i18next": "^11.16.7",
|
||||||
|
"react-lazy-load-image-component": "^1.5.4",
|
||||||
|
"react-player": "^2.10.0",
|
||||||
|
"react-query": "^4.0.0-beta.23",
|
||||||
|
"react-router": "^6.3.0",
|
||||||
|
"react-router-dom": "^6.3.0",
|
||||||
|
"react-slider": "^2.0.0",
|
||||||
|
"react-spaces": "^0.3.4",
|
||||||
|
"react-use": "^17.3.2",
|
||||||
|
"react-virtualized-auto-sizer": "^1.0.6",
|
||||||
|
"react-window": "^1.8.7",
|
||||||
|
"react-window-infinite-loader": "^1.0.8",
|
||||||
|
"styled-components": "^5.3.5",
|
||||||
|
"tabler-icons-react": "^1.46.0",
|
||||||
|
"zustand": "^4.0.0-rc.1"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"styled-components": "^5"
|
||||||
|
},
|
||||||
|
"devEngines": {
|
||||||
|
"node": ">=14.x",
|
||||||
|
"npm": ">=7.x"
|
||||||
|
},
|
||||||
|
"browserslist": [],
|
||||||
|
"prettier": {
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
".prettierrc",
|
||||||
|
".eslintrc"
|
||||||
|
],
|
||||||
|
"options": {
|
||||||
|
"parser": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "feishin",
|
"name": "sonixd",
|
||||||
"version": "0.4.1",
|
"version": "1.0.0-alpha1",
|
||||||
"description": "",
|
"description": "A full-featured Subsonic/Jellyfin compatible desktop client",
|
||||||
"main": "./dist/main/main.js",
|
"main": "./dist/main/main.js",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "jeffvli",
|
"name": "jeffvli",
|
||||||
"url": "https://github.com/jeffvli/"
|
"url": "https://github.com/jeffvli/"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"electron-rebuild": "node -r ts-node/register ../../.erb/scripts/electron-rebuild.js",
|
"electron-rebuild": "node -r ts-node/register ../../.erb/scripts/electron-rebuild.js",
|
||||||
"link-modules": "node -r ts-node/register ../../.erb/scripts/link-modules.ts",
|
"link-modules": "node -r ts-node/register ../../.erb/scripts/link-modules.ts",
|
||||||
"postinstall": "npm run electron-rebuild && npm run link-modules"
|
"postinstall": "npm run electron-rebuild && npm run link-modules"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {},
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"license": "MIT"
|
||||||
"mpris-service": "^2.1.2",
|
|
||||||
"ws": "^8.13.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"electron": "25.3.0"
|
|
||||||
},
|
|
||||||
"license": "GPL-3.0"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import '@testing-library/jest-dom';
|
import '@testing-library/jest-dom';
|
||||||
import { render } from '@testing-library/react';
|
// import { render } from '@testing-library/react';
|
||||||
import { App } from '../renderer/app';
|
// import { App } from 'renderer/app';
|
||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
it('should render', () => {
|
// eslint-disable-next-line jest/no-commented-out-tests
|
||||||
expect(render(<App />)).toBeTruthy();
|
// it('should render', () => {
|
||||||
});
|
// expect(render(<App />)).toBeTruthy();
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import i18n from 'i18next';
|
||||||
|
import { initReactI18next } from 'react-i18next';
|
||||||
|
const en = require('./locales/en.json');
|
||||||
|
|
||||||
|
const resources = {
|
||||||
|
en: { translation: en },
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Languages = [
|
||||||
|
{
|
||||||
|
label: 'English',
|
||||||
|
value: 'en',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
i18n
|
||||||
|
.use(initReactI18next) // passes i18n down to react-i18next
|
||||||
|
.init({
|
||||||
|
fallbackLng: 'en',
|
||||||
|
// language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
|
||||||
|
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
|
||||||
|
// if you're using a language detector, do not define the lng option
|
||||||
|
interpolation: {
|
||||||
|
escapeValue: false, // react already safes from xss
|
||||||
|
},
|
||||||
|
|
||||||
|
lng: 'en',
|
||||||
|
|
||||||
|
resources,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default i18n;
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
import { PostProcessorModule } from 'i18next';
|
|
||||||
import i18n from 'i18next';
|
|
||||||
import { initReactI18next } from 'react-i18next';
|
|
||||||
import en from './locales/en.json';
|
|
||||||
|
|
||||||
const resources = {
|
|
||||||
en: { translation: en },
|
|
||||||
};
|
|
||||||
|
|
||||||
export const languages = [
|
|
||||||
{
|
|
||||||
label: 'English',
|
|
||||||
value: 'en',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const lowerCasePostProcessor: PostProcessorModule = {
|
|
||||||
type: 'postProcessor',
|
|
||||||
name: 'lowerCase',
|
|
||||||
process: (value: string) => {
|
|
||||||
return value.toLocaleLowerCase();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const upperCasePostProcessor: PostProcessorModule = {
|
|
||||||
type: 'postProcessor',
|
|
||||||
name: 'upperCase',
|
|
||||||
process: (value: string) => {
|
|
||||||
return value.toLocaleUpperCase();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const titleCasePostProcessor: PostProcessorModule = {
|
|
||||||
type: 'postProcessor',
|
|
||||||
name: 'titleCase',
|
|
||||||
process: (value: string) => {
|
|
||||||
return value.replace(/\w\S*/g, (txt) => {
|
|
||||||
return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const sentenceCasePostProcessor: PostProcessorModule = {
|
|
||||||
type: 'postProcessor',
|
|
||||||
name: 'sentenceCase',
|
|
||||||
process: (value: string) => {
|
|
||||||
const sentences = value.split('. ');
|
|
||||||
|
|
||||||
return sentences
|
|
||||||
.map((sentence) => {
|
|
||||||
return sentence.charAt(0).toUpperCase() + sentence.slice(1).toLocaleLowerCase();
|
|
||||||
})
|
|
||||||
.join('. ');
|
|
||||||
},
|
|
||||||
};
|
|
||||||
i18n.use(lowerCasePostProcessor)
|
|
||||||
.use(upperCasePostProcessor)
|
|
||||||
.use(titleCasePostProcessor)
|
|
||||||
.use(sentenceCasePostProcessor)
|
|
||||||
.use(initReactI18next) // passes i18n down to react-i18next
|
|
||||||
.init({
|
|
||||||
fallbackLng: 'en',
|
|
||||||
// language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
|
|
||||||
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
|
|
||||||
// if you're using a language detector, do not define the lng option
|
|
||||||
interpolation: {
|
|
||||||
escapeValue: false, // react already safes from xss
|
|
||||||
},
|
|
||||||
resources,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default i18n;
|
|
||||||
@@ -1,44 +1,117 @@
|
|||||||
// Reference: https://github.com/i18next/i18next-parser#options
|
// i18next-parser.config.js
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
contextSeparator: '_',
|
contextSeparator: '_',
|
||||||
createOldCatalogs: true,
|
// Key separator used in your translation keys
|
||||||
customValueTemplate: null,
|
|
||||||
defaultNamespace: 'translation',
|
createOldCatalogs: true,
|
||||||
defaultValue: '',
|
|
||||||
failOnUpdate: false,
|
// Exit with an exit code of 1 when translations are updated (for CI purpose)
|
||||||
failOnWarnings: false,
|
customValueTemplate: null,
|
||||||
i18nextOptions: null,
|
|
||||||
indentation: 4,
|
// Save the \_old files
|
||||||
input: [
|
defaultNamespace: 'translation',
|
||||||
'../renderer/components/**/*.{js,jsx,ts,tsx}',
|
|
||||||
'../renderer/features/**/*.{js,jsx,ts,tsx}',
|
// Default namespace used in your i18next config
|
||||||
'../renderer/layouts/**/*.{js,jsx,ts,tsx}',
|
defaultValue: '',
|
||||||
'!../src/node_modules/**',
|
|
||||||
'!../src/**/*.prod.js',
|
// Exit with an exit code of 1 on warnings
|
||||||
],
|
failOnUpdate: false,
|
||||||
keepRemoved: false,
|
|
||||||
keySeparator: '.',
|
// Display info about the parsing including some stats
|
||||||
lexers: {
|
failOnWarnings: false,
|
||||||
default: ['JavascriptLexer'],
|
|
||||||
handlebars: ['HandlebarsLexer'],
|
// The locale to compare with default values to determine whether a default value has been changed.
|
||||||
hbs: ['HandlebarsLexer'],
|
// If this is set and a default value differs from a translation in the specified locale, all entries
|
||||||
htm: ['HTMLLexer'],
|
// for that key across locales are reset to the default value, and existing translations are moved to
|
||||||
html: ['HTMLLexer'],
|
// the `_old` file.
|
||||||
js: ['JavascriptLexer'],
|
i18nextOptions: null,
|
||||||
jsx: ['JsxLexer'],
|
|
||||||
mjs: ['JavascriptLexer'],
|
// Default value to give to empty keys
|
||||||
ts: ['JavascriptLexer'],
|
// You may also specify a function accepting the locale, namespace, and key as arguments
|
||||||
tsx: ['JsxLexer'],
|
indentation: 2,
|
||||||
},
|
|
||||||
lineEnding: 'auto',
|
// Plural separator used in your translation keys
|
||||||
locales: ['en'],
|
// If you want to use plain english keys, separators such as `_` might conflict. You might want to set `pluralSeparator` to a different string that does not occur in your keys.
|
||||||
namespaceSeparator: false,
|
input: [
|
||||||
output: 'src/renderer/i18n/locales/$LOCALE.json',
|
'../components/**/*.{js,jsx,ts,tsx}',
|
||||||
pluralSeparator: '_',
|
'../features/**/*.{js,jsx,ts,tsx}',
|
||||||
resetDefaultValueLocale: 'en',
|
'../layouts/**/*.{js,jsx,ts,tsx}',
|
||||||
skipDefaultValues: false,
|
'!../../src/node_modules/**',
|
||||||
sort: true,
|
'!../../src/**/*.prod.js',
|
||||||
useKeysAsDefaultValue: true,
|
],
|
||||||
verbose: false,
|
|
||||||
|
// Indentation of the catalog files
|
||||||
|
keepRemoved: false,
|
||||||
|
|
||||||
|
// Keep keys from the catalog that are no longer in code
|
||||||
|
keySeparator: '.',
|
||||||
|
|
||||||
|
// Key separator used in your translation keys
|
||||||
|
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
|
||||||
|
// see below for more details
|
||||||
|
lexers: {
|
||||||
|
default: ['JavascriptLexer'],
|
||||||
|
handlebars: ['HandlebarsLexer'],
|
||||||
|
|
||||||
|
hbs: ['HandlebarsLexer'],
|
||||||
|
htm: ['HTMLLexer'],
|
||||||
|
|
||||||
|
html: ['HTMLLexer'],
|
||||||
|
js: ['JavascriptLexer'],
|
||||||
|
jsx: ['JsxLexer'],
|
||||||
|
|
||||||
|
mjs: ['JavascriptLexer'],
|
||||||
|
// if you're writing jsx inside .js files, change this to JsxLexer
|
||||||
|
ts: ['JavascriptLexer'],
|
||||||
|
|
||||||
|
tsx: ['JsxLexer'],
|
||||||
|
},
|
||||||
|
|
||||||
|
lineEnding: 'auto',
|
||||||
|
|
||||||
|
// Control the line ending. See options at https://github.com/ryanve/eol
|
||||||
|
locales: ['en'],
|
||||||
|
|
||||||
|
// An array of the locales in your applications
|
||||||
|
namespaceSeparator: false,
|
||||||
|
|
||||||
|
// Namespace separator used in your translation keys
|
||||||
|
// If you want to use plain english keys, separators such as `.` and `:` will conflict. You might want to set `keySeparator: false` and `namespaceSeparator: false`. That way, `t('Status: Loading...')` will not think that there are a namespace and three separator dots for instance.
|
||||||
|
output: 'src/renderer/i18n/locales/$LOCALE.json',
|
||||||
|
|
||||||
|
// Supports $LOCALE and $NAMESPACE injection
|
||||||
|
// Supports JSON (.json) and YAML (.yml) file formats
|
||||||
|
// Where to write the locale files relative to process.cwd()
|
||||||
|
pluralSeparator: '_',
|
||||||
|
|
||||||
|
// If you wish to customize the value output the value as an object, you can set your own format.
|
||||||
|
// ${defaultValue} is the default value you set in your translation function.
|
||||||
|
// Any other custom property will be automatically extracted.
|
||||||
|
//
|
||||||
|
// Example:
|
||||||
|
// {
|
||||||
|
// message: "${defaultValue}",
|
||||||
|
// description: "${maxLength}", //
|
||||||
|
// }
|
||||||
|
resetDefaultValueLocale: 'en',
|
||||||
|
|
||||||
|
// Whether or not to sort the catalog. Can also be a [compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#parameters)
|
||||||
|
skipDefaultValues: false,
|
||||||
|
|
||||||
|
// An array of globs that describe where to look for source files
|
||||||
|
// relative to the location of the configuration file
|
||||||
|
sort: true,
|
||||||
|
|
||||||
|
// Whether to ignore default values
|
||||||
|
// You may also specify a function accepting the locale and namespace as arguments
|
||||||
|
useKeysAsDefaultValue: true,
|
||||||
|
|
||||||
|
// Whether to use the keys as the default value; ex. "Hello": "Hello", "World": "World"
|
||||||
|
// This option takes precedence over the `defaultValue` and `skipDefaultValues` options
|
||||||
|
// You may also specify a function accepting the locale and namespace as arguments
|
||||||
|
verbose: false,
|
||||||
|
// If you wish to customize options in internally used i18next instance, you can define an object with any
|
||||||
|
// configuration property supported by i18next (https://www.i18next.com/overview/configuration-options).
|
||||||
|
// { compatibilityJSON: 'v3' } can be used to generate v3 compatible plurals.
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,606 +1,9 @@
|
|||||||
{
|
{
|
||||||
"action": {
|
"player": {
|
||||||
"addToFavorites": "add to $t(entity.favorite_other)",
|
"next": "player.next",
|
||||||
"addToPlaylist": "add to $t(entity.playlist_one)",
|
"play": "player.play",
|
||||||
"clearQueue": "clear queue",
|
"prev": "player.prev",
|
||||||
"createPlaylist": "create $t(entity.playlist_one)",
|
"seekBack": "player.seekBack",
|
||||||
"deletePlaylist": "delete $t(entity.playlist_one)",
|
"seekForward": "player.seekForward"
|
||||||
"deselectAll": "deselect all",
|
}
|
||||||
"editPlaylist": "edit $t(entity.playlist_one)",
|
|
||||||
"goToPage": "go to page",
|
|
||||||
"moveToBottom": "move to bottom",
|
|
||||||
"moveToTop": "move to top",
|
|
||||||
"refresh": "$t(common.refresh)",
|
|
||||||
"removeFromFavorites": "remove from $t(entity.favorite_other)",
|
|
||||||
"removeFromPlaylist": "remove from $t(entity.playlist_one)",
|
|
||||||
"removeFromQueue": "remove from queue",
|
|
||||||
"setRating": "set rating",
|
|
||||||
"toggleSmartPlaylistEditor": "toggle $t(entity.smartPlaylist) editor",
|
|
||||||
"viewPlaylists": "view $t(entity.playlist_other)"
|
|
||||||
},
|
|
||||||
"common": {
|
|
||||||
"action_one": "action",
|
|
||||||
"action_other": "actions",
|
|
||||||
"add": "add",
|
|
||||||
"areYouSure": "are you sure?",
|
|
||||||
"ascending": "ascending",
|
|
||||||
"backward": "backward",
|
|
||||||
"biography": "biography",
|
|
||||||
"bitrate": "bitrate",
|
|
||||||
"bpm": "bpm",
|
|
||||||
"cancel": "cancel",
|
|
||||||
"center": "center",
|
|
||||||
"channel_one": "channel",
|
|
||||||
"channel_other": "channels",
|
|
||||||
"clear": "clear",
|
|
||||||
"collapse": "collapse",
|
|
||||||
"comingSoon": "coming soon...",
|
|
||||||
"configure": "configure",
|
|
||||||
"confirm": "confirm",
|
|
||||||
"create": "create",
|
|
||||||
"currentSong": "current $t(entity.track_one)",
|
|
||||||
"decrease": "decrease",
|
|
||||||
"delete": "delete",
|
|
||||||
"descending": "descending",
|
|
||||||
"description": "description",
|
|
||||||
"disable": "disable",
|
|
||||||
"disc": "disc",
|
|
||||||
"dismiss": "dismiss",
|
|
||||||
"duration": "duration",
|
|
||||||
"edit": "edit",
|
|
||||||
"enable": "enable",
|
|
||||||
"expand": "expand",
|
|
||||||
"favorite": "favorite",
|
|
||||||
"filter_one": "filter",
|
|
||||||
"filter_other": "filters",
|
|
||||||
"filters": "filters",
|
|
||||||
"forceRestartRequired": "restart to apply changes... close the notification to restart",
|
|
||||||
"forward": "forward",
|
|
||||||
"gap": "gap",
|
|
||||||
"home": "home",
|
|
||||||
"increase": "increase",
|
|
||||||
"left": "left",
|
|
||||||
"limit": "limit",
|
|
||||||
"manage": "manage",
|
|
||||||
"maximize": "maximize",
|
|
||||||
"menu": "menu",
|
|
||||||
"minimize": "minimize",
|
|
||||||
"modified": "modified",
|
|
||||||
"name": "name",
|
|
||||||
"no": "no",
|
|
||||||
"none": "none",
|
|
||||||
"noResultsFromQuery": "the query returned no results",
|
|
||||||
"note": "note",
|
|
||||||
"ok": "ok",
|
|
||||||
"owner": "owner",
|
|
||||||
"path": "path",
|
|
||||||
"playerMustBePaused": "player must be paused",
|
|
||||||
"previousSong": "previous $t(entity.track_one)",
|
|
||||||
"quit": "quit",
|
|
||||||
"random": "random",
|
|
||||||
"rating": "rating",
|
|
||||||
"refresh": "refresh",
|
|
||||||
"reset": "reset",
|
|
||||||
"resetToDefault": "reset to default",
|
|
||||||
"restartRequired": "restart required",
|
|
||||||
"right": "right",
|
|
||||||
"save": "save",
|
|
||||||
"saveAndReplace": "save and replace",
|
|
||||||
"saveAs": "save as",
|
|
||||||
"search": "search",
|
|
||||||
"setting": "setting",
|
|
||||||
"setting_other": "settings",
|
|
||||||
"size": "size",
|
|
||||||
"sortOrder": "order",
|
|
||||||
"title": "title",
|
|
||||||
"trackNumber": "track",
|
|
||||||
"unknown": "unknown",
|
|
||||||
"version": "version",
|
|
||||||
"year": "year",
|
|
||||||
"yes": "yes"
|
|
||||||
},
|
|
||||||
"entity": {
|
|
||||||
"album_one": "album",
|
|
||||||
"album_other": "albums",
|
|
||||||
"albumArtist_one": "album artist",
|
|
||||||
"albumArtist_other": "album artists",
|
|
||||||
"albumArtistCount_one": "{{count}} album artist",
|
|
||||||
"albumArtistCount_other": "{{count}} album artists",
|
|
||||||
"albumWithCount_one": "{{count}} album",
|
|
||||||
"albumWithCount_other": "{{count}} albums",
|
|
||||||
"artist_one": "artist",
|
|
||||||
"artist_other": "artists",
|
|
||||||
"artistWithCount_one": "{{count}} artist",
|
|
||||||
"artistWithCount_other": "{{count}} artists",
|
|
||||||
"favorite_one": "favorite",
|
|
||||||
"favorite_other": "favorites",
|
|
||||||
"folder_one": "folder",
|
|
||||||
"folder_other": "folders",
|
|
||||||
"folderWithCount_one": "{{count}} folder",
|
|
||||||
"folderWithCount_other": "{{count}} folders",
|
|
||||||
"genre_one": "genre",
|
|
||||||
"genre_other": "genres",
|
|
||||||
"genreWithCount_one": "{{count}} genre",
|
|
||||||
"genreWithCount_other": "{{count}} genres",
|
|
||||||
"playlist_one": "playlist",
|
|
||||||
"playlist_other": "playlists",
|
|
||||||
"playlistWithCount_one": "{{count}} playlist",
|
|
||||||
"playlistWithCount_other": "{{count}} playlists",
|
|
||||||
"smartPlaylist": "smart $t(entity.playlist_one)",
|
|
||||||
"track_one": "track",
|
|
||||||
"track_other": "tracks",
|
|
||||||
"trackWithCount_one": "{{count}} track",
|
|
||||||
"trackWithCount_other": "{{count}} tracks"
|
|
||||||
},
|
|
||||||
"error": {
|
|
||||||
"apiRouteError": "unable to route request",
|
|
||||||
"audioDeviceFetchError": "an error occurred when trying to get audio devices",
|
|
||||||
"authenticationFailed": "authentication failed",
|
|
||||||
"credentialsRequired": "credentials required",
|
|
||||||
"endpointNotImplementedError": "endpoint {{endpoint} is not implemented for {{serverType}}",
|
|
||||||
"genericError": "an error occurred",
|
|
||||||
"invalidServer": "invalid server",
|
|
||||||
"localFontAccessDenied": "access denied to local fonts",
|
|
||||||
"loginRateError": "too many login attempts, please try again in a few seconds",
|
|
||||||
"mpvRequired": "MPV required",
|
|
||||||
"playbackError": "an error occurred when trying to play the media",
|
|
||||||
"remoteDisableError": "an error occurred when trying to $t(common.disable) the remote server",
|
|
||||||
"remoteEnableError": "an error occurred when trying to $t(common.enable) the remote server",
|
|
||||||
"remotePortError": "an error occurred when trying to set the remote server port",
|
|
||||||
"remotePortWarning": "restart the server to apply the new port",
|
|
||||||
"serverNotSelectedError": "no server selected",
|
|
||||||
"serverRequired": "server required",
|
|
||||||
"sessionExpiredError": "your session has expired",
|
|
||||||
"systemFontError": "an error occurred when trying to get system fonts"
|
|
||||||
},
|
|
||||||
"filter": {
|
|
||||||
"albumArtist": "$t(entity.albumArtist_one)",
|
|
||||||
"artist": "$t(entity.artist_one)",
|
|
||||||
"biography": "biography",
|
|
||||||
"bitrate": "bitrate",
|
|
||||||
"bpm": "bpm",
|
|
||||||
"communityRating": "community rating",
|
|
||||||
"criticRating": "critic rating",
|
|
||||||
"dateAdded": "date added",
|
|
||||||
"disc": "disc",
|
|
||||||
"duration": "duration",
|
|
||||||
"favorited": "favorited",
|
|
||||||
"fromYear": "from year",
|
|
||||||
"isCompilation": "is compilation",
|
|
||||||
"isFavorited": "is favorited",
|
|
||||||
"isRated": "is rated",
|
|
||||||
"isRecentlyPlayed": "is recently played",
|
|
||||||
"lastPlayed": "last played",
|
|
||||||
"mostPlayed": "most played",
|
|
||||||
"name": "name",
|
|
||||||
"note": "note",
|
|
||||||
"path": "path",
|
|
||||||
"playCount": "play count",
|
|
||||||
"random": "random",
|
|
||||||
"rating": "rating",
|
|
||||||
"recentlyAdded": "recently added",
|
|
||||||
"recentlyPlayed": "recently played",
|
|
||||||
"releaseDate": "release date",
|
|
||||||
"releaseYear": "release year",
|
|
||||||
"search": "search",
|
|
||||||
"songCount": "song count",
|
|
||||||
"title": "title",
|
|
||||||
"toYear": "to year",
|
|
||||||
"trackNumber": "track"
|
|
||||||
},
|
|
||||||
"form": {
|
|
||||||
"addServer": {
|
|
||||||
"error_savePassword": "an error occurred when trying to save the password",
|
|
||||||
"ignoreCors": "ignore cors ($t(common.restartRequired))",
|
|
||||||
"ignoreSsl": "ignore ssl ($t(common.restartRequired))",
|
|
||||||
"input_legacyAuthentication": "enable legacy authentication",
|
|
||||||
"input_name": "server name",
|
|
||||||
"input_password": "password",
|
|
||||||
"input_savePassword": "save password",
|
|
||||||
"input_url": "url",
|
|
||||||
"input_username": "username",
|
|
||||||
"success": "server added successfully",
|
|
||||||
"title": "add server"
|
|
||||||
},
|
|
||||||
"addToPlaylist": {
|
|
||||||
"input_playlists": "$t(entity.playlist_other)",
|
|
||||||
"input_skipDuplicates": "skip duplicates",
|
|
||||||
"success": "added {{message}} $t(entity.song_other) to {{numOfPlaylists}} $t(entity.playlist_other)",
|
|
||||||
"title": "add to $t(entity.playlist_one)"
|
|
||||||
},
|
|
||||||
"createPlaylist": {
|
|
||||||
"input_description": "$t(common.description)",
|
|
||||||
"input_name": "$t(common.name)",
|
|
||||||
"input_owner": "$t(common.owner)",
|
|
||||||
"input_public": "public",
|
|
||||||
"success": "$t(entity.playlist_one) created successfully",
|
|
||||||
"title": "create $t(entity.playlist_one)"
|
|
||||||
},
|
|
||||||
"deletePlaylist": {
|
|
||||||
"input_confirm": "type the name of the $t(entity.playlist_one) to confirm",
|
|
||||||
"success": "$t(entity.playlist_one) deleted successfully",
|
|
||||||
"title": "delete $t(entity.playlist_one)"
|
|
||||||
},
|
|
||||||
"editPlaylist": {
|
|
||||||
"title": "edit $t(entity.playlist_one)"
|
|
||||||
},
|
|
||||||
"lyricSearch": {
|
|
||||||
"input_artist": "$t(entity.artist_one)",
|
|
||||||
"input_name": "$t(common.name)",
|
|
||||||
"title": "lyric search"
|
|
||||||
},
|
|
||||||
"queryEditor": {
|
|
||||||
"input_optionMatchAll": "match all",
|
|
||||||
"input_optionMatchAny": "match any"
|
|
||||||
},
|
|
||||||
"updateServer": {
|
|
||||||
"success": "server updated successfully",
|
|
||||||
"title": "update server"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"page": {
|
|
||||||
"albumArtistList": {
|
|
||||||
"title": "$t(entity.albumArtist_other)"
|
|
||||||
},
|
|
||||||
"albumDetail": {
|
|
||||||
"moreFromArtist": "more from this $t(entity.genre_one)",
|
|
||||||
"moreFromGeneric": "more from {{item}}"
|
|
||||||
},
|
|
||||||
"albumList": {
|
|
||||||
"title": "$t(entity.album_other)"
|
|
||||||
},
|
|
||||||
"appMenu": {
|
|
||||||
"collapseSidebar": "collapse sidebar",
|
|
||||||
"expandSidebar": "expand sidebar",
|
|
||||||
"goBack": "go back",
|
|
||||||
"goForward": "go forward",
|
|
||||||
"manageServers": "manage servers",
|
|
||||||
"openBrowserDevtools": "open browser devtools",
|
|
||||||
"quit": "$t(common.quit)",
|
|
||||||
"selectServer": "select server",
|
|
||||||
"settings": "$t(common.setting_other)",
|
|
||||||
"version": "version {{version}}"
|
|
||||||
},
|
|
||||||
"contextMenu": {
|
|
||||||
"addFavorite": "$t(action.addToFavorites)",
|
|
||||||
"addLast": "$t(player.addLast)",
|
|
||||||
"addNext": "$t(player.addNext)",
|
|
||||||
"addToFavorites": "$t(action.addToFavorites)",
|
|
||||||
"addToPlaylist": "$t(action.addToPlaylist)",
|
|
||||||
"createPlaylist": "$t(action.createPlaylist)",
|
|
||||||
"deletePlaylist": "$t(action.deletePlaylist)",
|
|
||||||
"deselectAll": "$t(action.deselectAll)",
|
|
||||||
"moveToBottom": "$t(action.moveToBottom)",
|
|
||||||
"moveToTop": "$t(action.moveToTop)",
|
|
||||||
"numberSelected": "{{count}} selected",
|
|
||||||
"play": "$t(player.play)",
|
|
||||||
"removeFromFavorites": "$t(action.removeFromFavorites)",
|
|
||||||
"removeFromPlaylist": "$t(action.removeFromPlaylist)",
|
|
||||||
"removeFromQueue": "$t(action.removeFromQueue)",
|
|
||||||
"setRating": "$t(action.setRating)"
|
|
||||||
},
|
|
||||||
"fullscreenPlayer": {
|
|
||||||
"config": {
|
|
||||||
"dynamicBackground": "dynamic background",
|
|
||||||
"followCurrentLyric": "follow current lyric",
|
|
||||||
"lyricAlignment": "lyric alignment",
|
|
||||||
"lyricGap": "lyric gap",
|
|
||||||
"lyricSize": "lyric size",
|
|
||||||
"opacity": "opacity",
|
|
||||||
"showLyricMatch": "show lyric match",
|
|
||||||
"showLyricProvider": "show lyric provider",
|
|
||||||
"synchronized": "synchronized",
|
|
||||||
"unsynchronized": "unsynchronized",
|
|
||||||
"useImageAspectRatio": "use image aspect ratio"
|
|
||||||
},
|
|
||||||
"lyrics": "lyrics",
|
|
||||||
"related": "related",
|
|
||||||
"upNext": "up next"
|
|
||||||
},
|
|
||||||
"genreList": {
|
|
||||||
"title": "$t(entity.genre_other)"
|
|
||||||
},
|
|
||||||
"globalSearch": {
|
|
||||||
"commands": {
|
|
||||||
"goToPage": "go to page",
|
|
||||||
"searchFor": "search for {{query}}",
|
|
||||||
"serverCommands": "server commands"
|
|
||||||
},
|
|
||||||
"title": "commands"
|
|
||||||
},
|
|
||||||
"home": {
|
|
||||||
"explore": "explore from your library",
|
|
||||||
"mostPlayed": "most played",
|
|
||||||
"newlyAdded": "newly added releases",
|
|
||||||
"recentlyPlayed": "recently played",
|
|
||||||
"title": "$t(common.home)"
|
|
||||||
},
|
|
||||||
"playlistList": {
|
|
||||||
"title": "$t(entity.playlist_other)"
|
|
||||||
},
|
|
||||||
"setting": {
|
|
||||||
"generalTab": "general",
|
|
||||||
"hotkeysTab": "hotkeys",
|
|
||||||
"playbackTab": "playback",
|
|
||||||
"windowTab": "window"
|
|
||||||
},
|
|
||||||
"sidebar": {
|
|
||||||
"albumArtists": "$t(entity.albumArtist_other)",
|
|
||||||
"albums": "$t(entity.album_other)",
|
|
||||||
"artists": "$t(entity.artist_other)",
|
|
||||||
"folders": "$t(entity.folder_other)",
|
|
||||||
"genres": "$t(entity.genre_other)",
|
|
||||||
"home": "$t(common.home)",
|
|
||||||
"nowPlaying": "now playing",
|
|
||||||
"playlists": "$t(entity.playlist_other)",
|
|
||||||
"search": "$t(common.search)",
|
|
||||||
"settings": "$t(entity.setting_other)",
|
|
||||||
"tracks": "$t(entity.track_other)"
|
|
||||||
},
|
|
||||||
"trackList": {
|
|
||||||
"title": "$t(entity.track_other)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"player": {
|
|
||||||
"addLast": "add last",
|
|
||||||
"addNext": "add next",
|
|
||||||
"favorite": "favorite",
|
|
||||||
"mute": "mute",
|
|
||||||
"muted": "muted",
|
|
||||||
"next": "next",
|
|
||||||
"play": "play",
|
|
||||||
"playbackFetchCancel": "this is taking a while... close the notification to cancel",
|
|
||||||
"playbackFetchInProgress": "loading songs...",
|
|
||||||
"playbackFetchNoResults": "no songs found",
|
|
||||||
"playbackSpeed": "playback speed",
|
|
||||||
"playRandom": "play random",
|
|
||||||
"previous": "previous",
|
|
||||||
"queue_clear": "clear queue",
|
|
||||||
"queue_moveToBottom": "move selected to top",
|
|
||||||
"queue_moveToTop": "move selected to bottom",
|
|
||||||
"queue_remove": "remove selected",
|
|
||||||
"repeat": "repeat",
|
|
||||||
"repeat_all": "repeat all",
|
|
||||||
"repeat_off": "repeat disabled",
|
|
||||||
"repeat_one": "repeat one",
|
|
||||||
"shuffle": "shuffle",
|
|
||||||
"shuffle_off": "shuffle disabled",
|
|
||||||
"skip": "skip",
|
|
||||||
"skip_back": "skip backwards",
|
|
||||||
"skip_forward": "skip forwards",
|
|
||||||
"stop": "stop",
|
|
||||||
"toggleFullscreenPlayer": "toggle fullscreen player",
|
|
||||||
"unfavorite": "unfavorite"
|
|
||||||
},
|
|
||||||
"setting": {
|
|
||||||
"accentColor": "accent color",
|
|
||||||
"accentColor_description": "sets the accent color for the application",
|
|
||||||
"applicationHotkeys": "application hotkeys",
|
|
||||||
"applicationHotkeys_description": "configure application hotkeys. toggle the checkbox to set as a global hotkey (desktop only)",
|
|
||||||
"audioDevice": "audio device",
|
|
||||||
"audioDevice_description": "select the audio device to use for playback (web player only)",
|
|
||||||
"audioExclusiveMode": "audio exclusive mode",
|
|
||||||
"audioExclusiveMode_description": "enable exclusive output mode. In this mode, the system is usually locked out, and only mpv will be able to output audio",
|
|
||||||
"audioPlayer": "audio player",
|
|
||||||
"audioPlayer_description": "select the audio player to use for playback",
|
|
||||||
"crossfadeDuration": "crossfade duration",
|
|
||||||
"crossfadeDuration_description": "sets the duration of the crossfade effect",
|
|
||||||
"crossfadeStyle": "crossfade style",
|
|
||||||
"crossfadeStyle_description": "select the crossfade style to use for the audio player",
|
|
||||||
"customFontPath": "custom font path",
|
|
||||||
"customFontPath_description": "sets the path to the custom font to use for the application",
|
|
||||||
"disableAutomaticUpdates": "disable automatic updates",
|
|
||||||
"disableLibraryUpdateOnStartup": "disable checking for new versions on startup",
|
|
||||||
"discordApplicationId": "{{discord}} application id",
|
|
||||||
"discordApplicationId_description": "the application id for {{discord}} rich presence (defaults to {{defaultId}}",
|
|
||||||
"discordIdleStatus": "show rich presence idle status",
|
|
||||||
"discordIdleStatus_description": "when enabled, update status while player is idle",
|
|
||||||
"discordRichPresence": "{{discord}} rich presence",
|
|
||||||
"discordRichPresence_description": "enable playback status in {{discord}} rich presence. Image keys are: {{icon}}, {{playing}}, and {{paused}} ",
|
|
||||||
"discordUpdateInterval": "{{discord}} rich presence update interval",
|
|
||||||
"discordUpdateInterval_description": "the time in seconds between each update (minimum 15 seconds)",
|
|
||||||
"enableRemote": "enable remote control server",
|
|
||||||
"enableRemote_description": "enables the remote control server to allow other devices to control the application",
|
|
||||||
"exitToTray": "exit to tray",
|
|
||||||
"exitToTray_description": "exit the application to the system tray",
|
|
||||||
"floatingQueueArea": "show floating queue hover area",
|
|
||||||
"floatingQueueArea_description": "display a hover icon on the right side of the screen to view the play queue",
|
|
||||||
"followLyric": "follow current lyric",
|
|
||||||
"followLyric_description": "scroll the lyric to the current playing position",
|
|
||||||
"font": "font",
|
|
||||||
"font_description": "sets the font to use for the application",
|
|
||||||
"fontType": "font type",
|
|
||||||
"fontType_description": "built-in font selects one of the fonts provided by Feishin. system font allows you to select any font provided by your operating system. custom allows you to provide your own font",
|
|
||||||
"fontType_optionBuiltIn": "built-in font",
|
|
||||||
"fontType_optionCustom": "custom font",
|
|
||||||
"fontType_optionSystem": "system font",
|
|
||||||
"gaplessAudio": "gapless audio",
|
|
||||||
"gaplessAudio_description": "sets the gapless audio setting for mpv",
|
|
||||||
"gaplessAudio_optionWeak": "weak (recommended)",
|
|
||||||
"globalMediaHotkeys": "global media hotkeys",
|
|
||||||
"globalMediaHotkeys_description": "enable or disable the usage of your system media hotkeys to control playback",
|
|
||||||
"hotkey_browserBack": "browser back",
|
|
||||||
"hotkey_browserForward": "browser forward",
|
|
||||||
"hotkey_favoriteCurrentSong": "favorite $t(common.currentSong)",
|
|
||||||
"hotkey_favoritePreviousSong": "favorite $t(common.previousSong)",
|
|
||||||
"hotkey_globalSearch": "global search",
|
|
||||||
"hotkey_localSearch": "in-page search",
|
|
||||||
"hotkey_playbackNext": "next track",
|
|
||||||
"hotkey_playbackPause": "pause",
|
|
||||||
"hotkey_playbackPlay": "play",
|
|
||||||
"hotkey_playbackPlayPause": "play / pause",
|
|
||||||
"hotkey_playbackPrevious": "previous track",
|
|
||||||
"hotkey_playbackStop": "stop",
|
|
||||||
"hotkey_rate0": "rating clear",
|
|
||||||
"hotkey_rate1": "rating 1 star",
|
|
||||||
"hotkey_rate2": "rating 2 stars",
|
|
||||||
"hotkey_rate3": "rating 3 stars",
|
|
||||||
"hotkey_rate4": "rating 4 stars",
|
|
||||||
"hotkey_rate5": "rating 5 stars",
|
|
||||||
"hotkey_skipBackward": "skip backward",
|
|
||||||
"hotkey_skipForward": "skip forward",
|
|
||||||
"hotkey_toggleCurrentSongFavorite": "toggle $t(common.currentSong) favorite",
|
|
||||||
"hotkey_toggleFullScreenPlayer": "toggle full screen player",
|
|
||||||
"hotkey_togglePreviousSongFavorite": "toggle $t(common.previousSong) favorite",
|
|
||||||
"hotkey_toggleQueue": "toggle queue",
|
|
||||||
"hotkey_toggleRepeat": "toggle repeat",
|
|
||||||
"hotkey_toggleShuffle": "toggle shuffle",
|
|
||||||
"hotkey_unfavoriteCurrentSong": "unfavorite $t(common.currentSong)",
|
|
||||||
"hotkey_unfavoritePreviousSong": "unfavorite $t(common.previousSong)",
|
|
||||||
"hotkey_volumeDown": "volume down",
|
|
||||||
"hotkey_volumeMute": "volume mute",
|
|
||||||
"hotkey_volumeUp": "volume up",
|
|
||||||
"hotkey_zoomIn": "zoom in",
|
|
||||||
"hotkey_zoomOut": "zoom out",
|
|
||||||
"language": "language",
|
|
||||||
"language_description": "sets the language for the application ($t(common.restartRequired))",
|
|
||||||
"lyricFetch": "fetch lyrics from the internet",
|
|
||||||
"lyricFetch_description": "fetch lyrics from various internet sources",
|
|
||||||
"lyricFetchProvider": "providers to fetch lyrics from",
|
|
||||||
"lyricFetchProvider_description": "select the providers to fetch lyrics from. the order of the providers is the order in which they will be queried",
|
|
||||||
"lyricOffset": "lyric offset (ms)",
|
|
||||||
"lyricOffset_description": "offset the lyric by the specified amount of milliseconds",
|
|
||||||
"minimizeToTray": "minimize to tray",
|
|
||||||
"minimizeToTray_description": "minimize the application to the system tray",
|
|
||||||
"minimumScrobblePercentage": "minimum scrobble duration (percentage)",
|
|
||||||
"minimumScrobblePercentage_description": "the minimum percentage of the song that must be played before it is scrobbled",
|
|
||||||
"minimumScrobbleSeconds": "minimum scrobble (seconds)",
|
|
||||||
"minimumScrobbleSeconds_description": "the minimum duration in seconds of the song that must be played before it is scrobbled",
|
|
||||||
"mpvExecutablePath": "mpv executable path",
|
|
||||||
"mpvExecutablePath_description": "sets the path to the mpv executable",
|
|
||||||
"mpvExecutablePath_help": "one per line",
|
|
||||||
"mpvExtraParameters": "mpv parameters",
|
|
||||||
"playbackStyle": "playback style",
|
|
||||||
"playbackStyle_description": "select the playback style to use for the audio player",
|
|
||||||
"playbackStyle_optionCrossFade": "crossfade",
|
|
||||||
"playbackStyle_optionNormal": "normal",
|
|
||||||
"playButtonBehavior": "play button behavior",
|
|
||||||
"playButtonBehavior_description": "sets the default behavior of the play button when adding songs to the queue",
|
|
||||||
"playButtonBehavior_optionAddLast": "$t(player.addLast)",
|
|
||||||
"playButtonBehavior_optionAddNext": "$t(player.addNext)",
|
|
||||||
"playButtonBehavior_optionPlay": "$t(player.play)",
|
|
||||||
"remotePassword": "remote control server password",
|
|
||||||
"remotePassword_description": "sets the password for the remote control server. These credentials are by default transferred insecurely, so you should use a unique password that you do not care about",
|
|
||||||
"remotePort": "remote control server port",
|
|
||||||
"remotePort_description": "sets the port for the remote control server",
|
|
||||||
"remoteUsername": "remote control server username",
|
|
||||||
"remoteUsername_description": "sets the username for the remote control server. if both username and password are empty, authentication will be disabled",
|
|
||||||
"replayGainClipping": "{{ReplayGain}} clipping",
|
|
||||||
"replayGainClipping_description": "Prevent clipping caused by {{ReplayGain}} by automatically lowering the gain",
|
|
||||||
"replayGainFallback": "{{ReplayGain}} fallback",
|
|
||||||
"replayGainFallback_description": "gain in db to apply if the file has no {{ReplayGain}} tags",
|
|
||||||
"replayGainMode": "{{ReplayGain}} mode",
|
|
||||||
"replayGainMode_description": "adjust volume gain according to {{ReplayGain}} values stored in the file metadata",
|
|
||||||
"replayGainMode_optionAlbum": "$t(entity.album_one)",
|
|
||||||
"replayGainMode_optionNone": "$t(common.none)",
|
|
||||||
"replayGainMode_optionTrack": "$t(entity.track_one)",
|
|
||||||
"replayGainPreamp": "{{ReplayGain}} preamp (dB)",
|
|
||||||
"replayGainPreamp_description": "adjust the preamp gain applied to the {{ReplayGain}} values",
|
|
||||||
"sampleRate": "sample rate",
|
|
||||||
"sampleRate_description": "select the output sample rate to be used if the sample frequency selected is different from that of the current media",
|
|
||||||
"savePlayQueue": "save play queue",
|
|
||||||
"savePlayQueue_description": "save the play queue when the application is closed and restore it when the application is opened",
|
|
||||||
"scrobble": "scrobble",
|
|
||||||
"scrobble_description": "scrobble plays to your media server",
|
|
||||||
"showSkipButton": "show skip buttons",
|
|
||||||
"showSkipButton_description": "show or hide the skip buttons on the player bar",
|
|
||||||
"showSkipButtons": "show skip buttons",
|
|
||||||
"showSkipButtons_description": "show or hide the skip buttons on the player bar",
|
|
||||||
"sidebarCollapsedNavigation": "sidebar (collapsed) navigation",
|
|
||||||
"sidebarCollapsedNavigation_description": "show or hide the navigation in the collapsed sidebar",
|
|
||||||
"sidebarConfiguration": "sidebar configuration",
|
|
||||||
"sidebarConfiguration_description": "select the items and order in which they appear in the sidebar",
|
|
||||||
"sidebarPlaylistList": "sidebar playlist list",
|
|
||||||
"sidebarPlaylistList_description": "show or hide the playlist list in the sidebar",
|
|
||||||
"sidePlayQueueStyle": "side play queue style",
|
|
||||||
"sidePlayQueueStyle_description": "sets the style of the side play queue",
|
|
||||||
"sidePlayQueueStyle_optionAttached": "attached",
|
|
||||||
"sidePlayQueueStyle_optionDetached": "detached",
|
|
||||||
"skipDuration": "skip duration",
|
|
||||||
"skipDuration_description": "sets the duration to skip when using the skip buttons on the player bar",
|
|
||||||
"skipPlaylistPage": "skip playlist page",
|
|
||||||
"skipPlaylistPage_description": "when navigating to a playlist, go to the playlist song list page instead of the default page",
|
|
||||||
"theme": "theme",
|
|
||||||
"theme_description": "sets the theme to use for the application",
|
|
||||||
"themeDark": "theme (dark)",
|
|
||||||
"themeDark_description": "sets the dark theme to use for the application",
|
|
||||||
"themeLight": "theme (light)",
|
|
||||||
"themeLight_description": "sets the light theme to use for the application",
|
|
||||||
"useSystemTheme": "use system theme",
|
|
||||||
"useSystemTheme_description": "follow the system-defined light or dark preference",
|
|
||||||
"volumeWheelStep": "volume wheel step",
|
|
||||||
"volumeWheelStep_description": "the amount of volume to change when scrolling the mouse wheel on the volume slider",
|
|
||||||
"windowBarStyle": "window bar style",
|
|
||||||
"windowBarStyle_description": "select the style of the window bar",
|
|
||||||
"zoom": "zoom percentage",
|
|
||||||
"zoom_description": "sets the zoom percentage for the application"
|
|
||||||
},
|
|
||||||
"table": {
|
|
||||||
"column": {
|
|
||||||
"album": "album",
|
|
||||||
"albumArtist": "album artist",
|
|
||||||
"albumCount": "$t(entity.album_other)",
|
|
||||||
"artist": "$t(entity.artist_one)",
|
|
||||||
"biography": "biography",
|
|
||||||
"bitrate": "bitrate",
|
|
||||||
"bpm": "bpm",
|
|
||||||
"channels": "$t(common.channel_other)",
|
|
||||||
"comment": "comment",
|
|
||||||
"dateAdded": "date added",
|
|
||||||
"discNumber": "disc",
|
|
||||||
"favorite": "favorite",
|
|
||||||
"genre": "$t(entity.genre_one)",
|
|
||||||
"lastPlayed": "last played",
|
|
||||||
"path": "path",
|
|
||||||
"playCount": "plays",
|
|
||||||
"rating": "rating",
|
|
||||||
"releaseDate": "release date",
|
|
||||||
"releaseYear": "year",
|
|
||||||
"songCount": "$t(entity.track_other)",
|
|
||||||
"title": "title",
|
|
||||||
"trackNumber": "track"
|
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"general": {
|
|
||||||
"autoFitColumns": "auto fit columns",
|
|
||||||
"displayType": "display type",
|
|
||||||
"gap": "$t(common.gap)",
|
|
||||||
"size": "$t(common.size)",
|
|
||||||
"tableColumns": "table columns"
|
|
||||||
},
|
|
||||||
"label": {
|
|
||||||
"actions": "$t(common.action_other)",
|
|
||||||
"album": "$t(entity.album_one)",
|
|
||||||
"albumArtist": "$t(entity.albumArtist_one)",
|
|
||||||
"artist": "$t(entity.artist_one)",
|
|
||||||
"biography": "$t(common.biography)",
|
|
||||||
"bitrate": "$t(common.bitrate)",
|
|
||||||
"bpm": "$t(common.bpm)",
|
|
||||||
"channels": "$t(common.channel_other)",
|
|
||||||
"dateAdded": "date added",
|
|
||||||
"discNumber": "disc number",
|
|
||||||
"duration": "$t(common.duration)",
|
|
||||||
"favorite": "$t(common.favorite)",
|
|
||||||
"genre": "$t(entity.genre_one)",
|
|
||||||
"lastPlayed": "last played",
|
|
||||||
"note": "$t(common.note)",
|
|
||||||
"owner": "$t(common.owner)",
|
|
||||||
"path": "$t(common.path)",
|
|
||||||
"playCount": "play count",
|
|
||||||
"rating": "$t(common.rating)",
|
|
||||||
"releaseDate": "release date",
|
|
||||||
"rowIndex": "row index",
|
|
||||||
"size": "$t(common.size)",
|
|
||||||
"title": "$t(common.title)",
|
|
||||||
"titleCombined": "$t(common.title) (combined)",
|
|
||||||
"trackNumber": "track number",
|
|
||||||
"year": "$t(common.year)"
|
|
||||||
},
|
|
||||||
"view": {
|
|
||||||
"card": "card",
|
|
||||||
"poster": "poster",
|
|
||||||
"table": "table"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
import { Client, SetActivity } from '@xhayper/discord-rpc';
|
|
||||||
import { ipcMain } from 'electron';
|
|
||||||
|
|
||||||
const FEISHIN_DISCORD_APPLICATION_ID = '1165957668758900787';
|
|
||||||
|
|
||||||
let client: Client | null = null;
|
|
||||||
|
|
||||||
const createClient = (clientId?: string) => {
|
|
||||||
client = new Client({
|
|
||||||
clientId: clientId || FEISHIN_DISCORD_APPLICATION_ID,
|
|
||||||
});
|
|
||||||
|
|
||||||
client.login();
|
|
||||||
|
|
||||||
return client;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setActivity = (activity: SetActivity) => {
|
|
||||||
if (client) {
|
|
||||||
client.user?.setActivity({
|
|
||||||
...activity,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const clearActivity = () => {
|
|
||||||
if (client) {
|
|
||||||
client.user?.clearActivity();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const quit = () => {
|
|
||||||
if (client) {
|
|
||||||
client?.destroy();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ipcMain.handle('discord-rpc-initialize', (_event, clientId?: string) => {
|
|
||||||
createClient(clientId);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('discord-rpc-set-activity', (_event, activity: SetActivity) => {
|
|
||||||
if (client) {
|
|
||||||
setActivity(activity);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('discord-rpc-clear-activity', () => {
|
|
||||||
if (client) {
|
|
||||||
clearActivity();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('discord-rpc-quit', () => {
|
|
||||||
quit();
|
|
||||||
});
|
|
||||||
|
|
||||||
export const discordRpc = {
|
|
||||||
clearActivity,
|
|
||||||
createClient,
|
|
||||||
quit,
|
|
||||||
setActivity,
|
|
||||||
};
|
|
||||||
@@ -1,5 +1 @@
|
|||||||
import './lyrics';
|
|
||||||
import './player';
|
import './player';
|
||||||
import './remote';
|
|
||||||
import './settings';
|
|
||||||
import './discord-rpc';
|
|
||||||
|
|||||||
@@ -1,209 +0,0 @@
|
|||||||
import axios, { AxiosResponse } from 'axios';
|
|
||||||
import { load } from 'cheerio';
|
|
||||||
import { orderSearchResults } from './shared';
|
|
||||||
import {
|
|
||||||
LyricSource,
|
|
||||||
InternetProviderLyricResponse,
|
|
||||||
InternetProviderLyricSearchResponse,
|
|
||||||
LyricSearchQuery,
|
|
||||||
} from '../../../../renderer/api/types';
|
|
||||||
|
|
||||||
const SEARCH_URL = 'https://genius.com/api/search/song';
|
|
||||||
|
|
||||||
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/genius.ts
|
|
||||||
|
|
||||||
export interface GeniusResponse {
|
|
||||||
meta: Meta;
|
|
||||||
response: Response;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Meta {
|
|
||||||
status: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Response {
|
|
||||||
next_page: number;
|
|
||||||
sections: Section[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Section {
|
|
||||||
hits: Hit[];
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Hit {
|
|
||||||
highlights: any[];
|
|
||||||
index: string;
|
|
||||||
result: Result;
|
|
||||||
type: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Result {
|
|
||||||
_type: string;
|
|
||||||
annotation_count: number;
|
|
||||||
api_path: string;
|
|
||||||
artist_names: string;
|
|
||||||
featured_artists: any[];
|
|
||||||
full_title: string;
|
|
||||||
header_image_thumbnail_url: string;
|
|
||||||
header_image_url: string;
|
|
||||||
id: number;
|
|
||||||
instrumental: boolean;
|
|
||||||
language: string;
|
|
||||||
lyrics_owner_id: number;
|
|
||||||
lyrics_state: string;
|
|
||||||
lyrics_updated_at: number;
|
|
||||||
path: string;
|
|
||||||
primary_artist: PrimaryArtist;
|
|
||||||
pyongs_count: null;
|
|
||||||
relationships_index_url: string;
|
|
||||||
release_date_components: ReleaseDateComponents;
|
|
||||||
release_date_for_display: string;
|
|
||||||
release_date_with_abbreviated_month_for_display: string;
|
|
||||||
song_art_image_thumbnail_url: string;
|
|
||||||
song_art_image_url: string;
|
|
||||||
stats: Stats;
|
|
||||||
title: string;
|
|
||||||
title_with_featured: string;
|
|
||||||
updated_by_human_at: number;
|
|
||||||
url: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PrimaryArtist {
|
|
||||||
_type: string;
|
|
||||||
api_path: string;
|
|
||||||
header_image_url: string;
|
|
||||||
id: number;
|
|
||||||
image_url: string;
|
|
||||||
index_character: string;
|
|
||||||
is_meme_verified: boolean;
|
|
||||||
is_verified: boolean;
|
|
||||||
name: string;
|
|
||||||
slug: string;
|
|
||||||
url: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReleaseDateComponents {
|
|
||||||
day: number;
|
|
||||||
month: number;
|
|
||||||
year: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Stats {
|
|
||||||
hot: boolean;
|
|
||||||
unreviewed_annotations: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getSearchResults(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<InternetProviderLyricSearchResponse[] | null> {
|
|
||||||
let result: AxiosResponse<GeniusResponse>;
|
|
||||||
|
|
||||||
const searchQuery = [params.artist, params.name].join(' ');
|
|
||||||
|
|
||||||
if (!searchQuery) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = await axios.get(SEARCH_URL, {
|
|
||||||
params: {
|
|
||||||
per_page: '5',
|
|
||||||
q: searchQuery,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Genius search request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rawSongsResult = result.data.response?.sections?.[0]?.hits?.map((hit) => hit.result);
|
|
||||||
|
|
||||||
if (!rawSongsResult) return null;
|
|
||||||
|
|
||||||
const songResults: InternetProviderLyricSearchResponse[] = rawSongsResult.map((song) => {
|
|
||||||
return {
|
|
||||||
artist: song.artist_names,
|
|
||||||
id: song.url,
|
|
||||||
name: song.full_title,
|
|
||||||
source: LyricSource.GENIUS,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return orderSearchResults({ params, results: songResults });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getSongId(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<Omit<InternetProviderLyricResponse, 'lyrics'> | null> {
|
|
||||||
let result: AxiosResponse<GeniusResponse>;
|
|
||||||
try {
|
|
||||||
result = await axios.get(SEARCH_URL, {
|
|
||||||
params: {
|
|
||||||
per_page: '1',
|
|
||||||
q: `${params.artist} ${params.name}`,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Genius search request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hit = result.data.response?.sections?.[0]?.hits?.[0]?.result;
|
|
||||||
|
|
||||||
if (!hit) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
artist: hit.artist_names,
|
|
||||||
id: hit.url,
|
|
||||||
name: hit.full_title,
|
|
||||||
source: LyricSource.GENIUS,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getLyricsBySongId(url: string): Promise<string | null> {
|
|
||||||
let result: AxiosResponse<string, any>;
|
|
||||||
try {
|
|
||||||
result = await axios.get<string>(url, { responseType: 'text' });
|
|
||||||
} catch (e) {
|
|
||||||
console.error('Genius lyrics request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const $ = load(result.data.split('<br/>').join('\n'));
|
|
||||||
const lyricsDiv = $('div.lyrics');
|
|
||||||
|
|
||||||
if (lyricsDiv.length > 0) return lyricsDiv.text().trim();
|
|
||||||
|
|
||||||
const lyricSections = $('div[class^=Lyrics__Container]')
|
|
||||||
.map((_, e) => $(e).text())
|
|
||||||
.toArray()
|
|
||||||
.join('\n');
|
|
||||||
return lyricSections;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function query(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<InternetProviderLyricResponse | null> {
|
|
||||||
const response = await getSongId(params);
|
|
||||||
if (!response) {
|
|
||||||
console.error('Could not find the song on Genius!');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lyrics = await getLyricsBySongId(response.id);
|
|
||||||
if (!lyrics) {
|
|
||||||
console.error('Could not get lyrics on Genius!');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
artist: response.artist,
|
|
||||||
id: response.id,
|
|
||||||
lyrics,
|
|
||||||
name: response.name,
|
|
||||||
source: LyricSource.GENIUS,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,149 +0,0 @@
|
|||||||
import { ipcMain } from 'electron';
|
|
||||||
import {
|
|
||||||
query as queryGenius,
|
|
||||||
getSearchResults as searchGenius,
|
|
||||||
getLyricsBySongId as getGenius,
|
|
||||||
} from './genius';
|
|
||||||
import {
|
|
||||||
query as queryLrclib,
|
|
||||||
getSearchResults as searchLrcLib,
|
|
||||||
getLyricsBySongId as getLrcLib,
|
|
||||||
} from './lrclib';
|
|
||||||
import {
|
|
||||||
query as queryNetease,
|
|
||||||
getSearchResults as searchNetease,
|
|
||||||
getLyricsBySongId as getNetease,
|
|
||||||
} from './netease';
|
|
||||||
import {
|
|
||||||
InternetProviderLyricResponse,
|
|
||||||
InternetProviderLyricSearchResponse,
|
|
||||||
LyricSearchQuery,
|
|
||||||
QueueSong,
|
|
||||||
LyricGetQuery,
|
|
||||||
LyricSource,
|
|
||||||
} from '../../../../renderer/api/types';
|
|
||||||
import { store } from '../settings/index';
|
|
||||||
|
|
||||||
type SongFetcher = (params: LyricSearchQuery) => Promise<InternetProviderLyricResponse | null>;
|
|
||||||
type SearchFetcher = (
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
) => Promise<InternetProviderLyricSearchResponse[] | null>;
|
|
||||||
type GetFetcher = (id: string) => Promise<string | null>;
|
|
||||||
|
|
||||||
type CachedLyrics = Record<LyricSource, InternetProviderLyricResponse>;
|
|
||||||
|
|
||||||
const FETCHERS: Record<LyricSource, SongFetcher> = {
|
|
||||||
[LyricSource.GENIUS]: queryGenius,
|
|
||||||
[LyricSource.LRCLIB]: queryLrclib,
|
|
||||||
[LyricSource.NETEASE]: queryNetease,
|
|
||||||
};
|
|
||||||
|
|
||||||
const SEARCH_FETCHERS: Record<LyricSource, SearchFetcher> = {
|
|
||||||
[LyricSource.GENIUS]: searchGenius,
|
|
||||||
[LyricSource.LRCLIB]: searchLrcLib,
|
|
||||||
[LyricSource.NETEASE]: searchNetease,
|
|
||||||
};
|
|
||||||
|
|
||||||
const GET_FETCHERS: Record<LyricSource, GetFetcher> = {
|
|
||||||
[LyricSource.GENIUS]: getGenius,
|
|
||||||
[LyricSource.LRCLIB]: getLrcLib,
|
|
||||||
[LyricSource.NETEASE]: getNetease,
|
|
||||||
};
|
|
||||||
|
|
||||||
const MAX_CACHED_ITEMS = 10;
|
|
||||||
|
|
||||||
const lyricCache = new Map<string, CachedLyrics>();
|
|
||||||
|
|
||||||
const getRemoteLyrics = async (song: QueueSong) => {
|
|
||||||
const sources = store.get('lyrics', []) as LyricSource[];
|
|
||||||
|
|
||||||
const cached = lyricCache.get(song.id);
|
|
||||||
|
|
||||||
if (cached) {
|
|
||||||
for (const source of sources) {
|
|
||||||
const data = cached[source];
|
|
||||||
if (data) return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let lyricsFromSource = null;
|
|
||||||
|
|
||||||
for (const source of sources) {
|
|
||||||
const params = {
|
|
||||||
album: song.album || song.name,
|
|
||||||
artist: song.artistName,
|
|
||||||
duration: song.duration,
|
|
||||||
name: song.name,
|
|
||||||
};
|
|
||||||
const response = await FETCHERS[source](params);
|
|
||||||
|
|
||||||
if (response) {
|
|
||||||
const newResult = cached
|
|
||||||
? {
|
|
||||||
...cached,
|
|
||||||
[source]: response,
|
|
||||||
}
|
|
||||||
: ({ [source]: response } as CachedLyrics);
|
|
||||||
|
|
||||||
if (lyricCache.size === MAX_CACHED_ITEMS && cached === undefined) {
|
|
||||||
const toRemove = lyricCache.keys().next().value;
|
|
||||||
lyricCache.delete(toRemove);
|
|
||||||
}
|
|
||||||
|
|
||||||
lyricCache.set(song.id, newResult);
|
|
||||||
|
|
||||||
lyricsFromSource = response;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return lyricsFromSource;
|
|
||||||
};
|
|
||||||
|
|
||||||
const searchRemoteLyrics = async (params: LyricSearchQuery) => {
|
|
||||||
const sources = store.get('lyrics', []) as LyricSource[];
|
|
||||||
|
|
||||||
const results: Record<LyricSource, InternetProviderLyricSearchResponse[]> = {
|
|
||||||
[LyricSource.GENIUS]: [],
|
|
||||||
[LyricSource.LRCLIB]: [],
|
|
||||||
[LyricSource.NETEASE]: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const source of sources) {
|
|
||||||
const response = await SEARCH_FETCHERS[source](params);
|
|
||||||
|
|
||||||
if (response) {
|
|
||||||
response.forEach((result) => {
|
|
||||||
results[source].push(result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getRemoteLyricsById = async (params: LyricGetQuery): Promise<string | null> => {
|
|
||||||
const { remoteSongId, remoteSource } = params;
|
|
||||||
const response = await GET_FETCHERS[remoteSource](remoteSongId);
|
|
||||||
|
|
||||||
if (!response) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
};
|
|
||||||
|
|
||||||
ipcMain.handle('lyric-by-song', async (_event, song: QueueSong) => {
|
|
||||||
const lyric = await getRemoteLyrics(song);
|
|
||||||
return lyric;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('lyric-search', async (_event, params: LyricSearchQuery) => {
|
|
||||||
const lyricResults = await searchRemoteLyrics(params);
|
|
||||||
return lyricResults;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('lyric-by-remote-id', async (_event, params: LyricGetQuery) => {
|
|
||||||
const lyricResults = await getRemoteLyricsById(params);
|
|
||||||
return lyricResults;
|
|
||||||
});
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
// Credits to https://github.com/tranxuanthang/lrcget for API implementation
|
|
||||||
import axios, { AxiosResponse } from 'axios';
|
|
||||||
import { orderSearchResults } from './shared';
|
|
||||||
import {
|
|
||||||
InternetProviderLyricResponse,
|
|
||||||
InternetProviderLyricSearchResponse,
|
|
||||||
LyricSearchQuery,
|
|
||||||
LyricSource,
|
|
||||||
} from '../../../../renderer/api/types';
|
|
||||||
|
|
||||||
const FETCH_URL = 'https://lrclib.net/api/get';
|
|
||||||
const SEEARCH_URL = 'https://lrclib.net/api/search';
|
|
||||||
|
|
||||||
const TIMEOUT_MS = 5000;
|
|
||||||
|
|
||||||
export interface LrcLibSearchResponse {
|
|
||||||
albumName: string;
|
|
||||||
artistName: string;
|
|
||||||
id: number;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LrcLibTrackResponse {
|
|
||||||
albumName: string;
|
|
||||||
artistName: string;
|
|
||||||
duration: number;
|
|
||||||
id: number;
|
|
||||||
instrumental: boolean;
|
|
||||||
isrc: string;
|
|
||||||
lang: string;
|
|
||||||
name: string;
|
|
||||||
plainLyrics: string | null;
|
|
||||||
releaseDate: string;
|
|
||||||
spotifyId: string;
|
|
||||||
syncedLyrics: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getSearchResults(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<InternetProviderLyricSearchResponse[] | null> {
|
|
||||||
let result: AxiosResponse<LrcLibSearchResponse[]>;
|
|
||||||
|
|
||||||
if (!params.name) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = await axios.get<LrcLibSearchResponse[]>(SEEARCH_URL, {
|
|
||||||
params: {
|
|
||||||
q: params.name,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('LrcLib search request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result.data) return null;
|
|
||||||
|
|
||||||
const songResults: InternetProviderLyricSearchResponse[] = result.data.map((song) => {
|
|
||||||
return {
|
|
||||||
artist: song.artistName,
|
|
||||||
id: String(song.id),
|
|
||||||
name: song.name,
|
|
||||||
source: LyricSource.LRCLIB,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return orderSearchResults({ params, results: songResults });
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getLyricsBySongId(songId: string): Promise<string | null> {
|
|
||||||
let result: AxiosResponse<LrcLibTrackResponse, any>;
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = await axios.get<LrcLibTrackResponse>(`${FETCH_URL}/${songId}`);
|
|
||||||
} catch (e) {
|
|
||||||
console.error('LrcLib lyrics request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.data.syncedLyrics || result.data.plainLyrics || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function query(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<InternetProviderLyricResponse | null> {
|
|
||||||
let result: AxiosResponse<LrcLibTrackResponse, any>;
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = await axios.get<LrcLibTrackResponse>(FETCH_URL, {
|
|
||||||
params: {
|
|
||||||
album_name: params.album,
|
|
||||||
artist_name: params.artist,
|
|
||||||
duration: params.duration,
|
|
||||||
track_name: params.name,
|
|
||||||
},
|
|
||||||
timeout: TIMEOUT_MS,
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('LrcLib search request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lyrics = result.data.syncedLyrics || result.data.plainLyrics || null;
|
|
||||||
|
|
||||||
if (!lyrics) {
|
|
||||||
console.error(`Could not get lyrics on LrcLib!`);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
artist: result.data.artistName,
|
|
||||||
id: String(result.data.id),
|
|
||||||
lyrics,
|
|
||||||
name: result.data.name,
|
|
||||||
source: LyricSource.LRCLIB,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,167 +0,0 @@
|
|||||||
import axios, { AxiosResponse } from 'axios';
|
|
||||||
import { LyricSource } from '../../../../renderer/api/types';
|
|
||||||
import { orderSearchResults } from './shared';
|
|
||||||
import type {
|
|
||||||
InternetProviderLyricResponse,
|
|
||||||
InternetProviderLyricSearchResponse,
|
|
||||||
LyricSearchQuery,
|
|
||||||
} from '/@/renderer/api/types';
|
|
||||||
|
|
||||||
const SEARCH_URL = 'https://music.163.com/api/search/get';
|
|
||||||
const LYRICS_URL = 'https://music.163.com/api/song/lyric';
|
|
||||||
|
|
||||||
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/netease.ts
|
|
||||||
|
|
||||||
export interface NetEaseResponse {
|
|
||||||
code: number;
|
|
||||||
result: Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Result {
|
|
||||||
hasMore: boolean;
|
|
||||||
songCount: number;
|
|
||||||
songs: Song[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Song {
|
|
||||||
album: Album;
|
|
||||||
alias: string[];
|
|
||||||
artists: Artist[];
|
|
||||||
copyrightId: number;
|
|
||||||
duration: number;
|
|
||||||
fee: number;
|
|
||||||
ftype: number;
|
|
||||||
id: number;
|
|
||||||
mark: number;
|
|
||||||
mvid: number;
|
|
||||||
name: string;
|
|
||||||
rUrl: null;
|
|
||||||
rtype: number;
|
|
||||||
status: number;
|
|
||||||
transNames?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Album {
|
|
||||||
artist: Artist;
|
|
||||||
copyrightId: number;
|
|
||||||
id: number;
|
|
||||||
mark: number;
|
|
||||||
name: string;
|
|
||||||
picId: number;
|
|
||||||
publishTime: number;
|
|
||||||
size: number;
|
|
||||||
status: number;
|
|
||||||
transNames?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Artist {
|
|
||||||
albumSize: number;
|
|
||||||
alias: any[];
|
|
||||||
fansGroup: null;
|
|
||||||
id: number;
|
|
||||||
img1v1: number;
|
|
||||||
img1v1Url: string;
|
|
||||||
name: string;
|
|
||||||
picId: number;
|
|
||||||
picUrl: null;
|
|
||||||
trans: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getSearchResults(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<InternetProviderLyricSearchResponse[] | null> {
|
|
||||||
let result: AxiosResponse<NetEaseResponse>;
|
|
||||||
|
|
||||||
const searchQuery = [params.artist, params.name].join(' ');
|
|
||||||
|
|
||||||
if (!searchQuery) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
result = await axios.get(SEARCH_URL, {
|
|
||||||
params: {
|
|
||||||
limit: 5,
|
|
||||||
offset: 0,
|
|
||||||
s: searchQuery,
|
|
||||||
type: '1',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('NetEase search request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const rawSongsResult = result?.data.result?.songs;
|
|
||||||
|
|
||||||
if (!rawSongsResult) return null;
|
|
||||||
|
|
||||||
const songResults: InternetProviderLyricSearchResponse[] = rawSongsResult.map((song) => {
|
|
||||||
const artist = song.artists ? song.artists.map((artist) => artist.name).join(', ') : '';
|
|
||||||
|
|
||||||
return {
|
|
||||||
artist,
|
|
||||||
id: String(song.id),
|
|
||||||
name: song.name,
|
|
||||||
source: LyricSource.NETEASE,
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
return orderSearchResults({ params, results: songResults });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getMatchedLyrics(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<Omit<InternetProviderLyricResponse, 'lyrics'> | null> {
|
|
||||||
const results = await getSearchResults(params);
|
|
||||||
|
|
||||||
const firstMatch = results?.[0];
|
|
||||||
|
|
||||||
if (!firstMatch || (firstMatch?.score && firstMatch.score > 0.5)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return firstMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getLyricsBySongId(songId: string): Promise<string | null> {
|
|
||||||
let result: AxiosResponse<any, any>;
|
|
||||||
try {
|
|
||||||
result = await axios.get(LYRICS_URL, {
|
|
||||||
params: {
|
|
||||||
id: songId,
|
|
||||||
kv: '-1',
|
|
||||||
lv: '-1',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.error('NetEase lyrics request got an error!', e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.data.klyric?.lyric || result.data.lrc?.lyric;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function query(
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<InternetProviderLyricResponse | null> {
|
|
||||||
const lyricsMatch = await getMatchedLyrics(params);
|
|
||||||
if (!lyricsMatch) {
|
|
||||||
console.error('Could not find the song on NetEase!');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const lyrics = await getLyricsBySongId(lyricsMatch.id);
|
|
||||||
if (!lyrics) {
|
|
||||||
console.error('Could not get lyrics on NetEase!');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
artist: lyricsMatch.artist,
|
|
||||||
id: lyricsMatch.id,
|
|
||||||
lyrics,
|
|
||||||
name: lyricsMatch.name,
|
|
||||||
source: LyricSource.NETEASE,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import Fuse from 'fuse.js';
|
|
||||||
import {
|
|
||||||
InternetProviderLyricSearchResponse,
|
|
||||||
LyricSearchQuery,
|
|
||||||
} from '../../../../renderer/api/types';
|
|
||||||
|
|
||||||
export const orderSearchResults = (args: {
|
|
||||||
params: LyricSearchQuery;
|
|
||||||
results: InternetProviderLyricSearchResponse[];
|
|
||||||
}) => {
|
|
||||||
const { params, results } = args;
|
|
||||||
|
|
||||||
const options: Fuse.IFuseOptions<InternetProviderLyricSearchResponse> = {
|
|
||||||
fieldNormWeight: 1,
|
|
||||||
includeScore: true,
|
|
||||||
keys: [
|
|
||||||
{ getFn: (song) => song.name, name: 'name', weight: 3 },
|
|
||||||
{ getFn: (song) => song.artist, name: 'artist' },
|
|
||||||
],
|
|
||||||
threshold: 1.0,
|
|
||||||
};
|
|
||||||
|
|
||||||
const fuse = new Fuse(results, options);
|
|
||||||
|
|
||||||
const searchResults = fuse.search<InternetProviderLyricSearchResponse>({
|
|
||||||
...(params.artist && { artist: params.artist }),
|
|
||||||
...(params.name && { name: params.name }),
|
|
||||||
});
|
|
||||||
|
|
||||||
return searchResults.map((result) => ({
|
|
||||||
...result.item,
|
|
||||||
score: result.score,
|
|
||||||
}));
|
|
||||||
};
|
|
||||||
@@ -1,205 +1,117 @@
|
|||||||
import console from 'console';
|
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
import { getMpvInstance } from '../../../main';
|
import MpvAPI from 'node-mpv';
|
||||||
import { PlayerData } from '/@/renderer/store';
|
import { PlayerData } from '../../../../renderer/store';
|
||||||
|
import { getMainWindow } from '../../../main';
|
||||||
|
|
||||||
declare module 'node-mpv';
|
const mpv = new MpvAPI(
|
||||||
|
{
|
||||||
|
audio_only: true,
|
||||||
|
auto_restart: true,
|
||||||
|
binary: 'C:/ProgramData/chocolatey/lib/mpv.install/tools/mpv.exe',
|
||||||
|
time_update: 1,
|
||||||
|
},
|
||||||
|
['--gapless-audio=yes', '--prefetch-playlist']
|
||||||
|
);
|
||||||
|
|
||||||
// function wait(timeout: number) {
|
mpv.start().catch((error: any) => {
|
||||||
// return new Promise((resolve) => {
|
console.log('error', error);
|
||||||
// setTimeout(() => {
|
|
||||||
// resolve('resolved');
|
|
||||||
// }, timeout);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
ipcMain.handle('player-is-running', async () => {
|
|
||||||
return getMpvInstance()?.isRunning();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle('player-clean-up', async () => {
|
mpv.on('status', (status: any) => {
|
||||||
getMpvInstance()?.stop();
|
if (status.property === 'playlist-pos') {
|
||||||
getMpvInstance()?.clearPlaylist();
|
if (status.value !== 0) {
|
||||||
|
getMainWindow()?.webContents.send('renderer-player-set-queue-next');
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('player-start', async () => {
|
// Automatically updates the play button when the player is playing
|
||||||
await getMpvInstance()
|
mpv.on('started', () => {
|
||||||
?.play()
|
getMainWindow()?.webContents.send('renderer-player-play');
|
||||||
.catch((err) => {
|
});
|
||||||
console.log('MPV failed to play', err);
|
|
||||||
});
|
// Automatically updates the play button when the player is stopped
|
||||||
|
mpv.on('stopped', () => {
|
||||||
|
getMainWindow()?.webContents.send('renderer-player-stop');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Automatically updates the play button when the player is paused
|
||||||
|
mpv.on('paused', () => {
|
||||||
|
getMainWindow()?.webContents.send('renderer-player-pause');
|
||||||
|
});
|
||||||
|
|
||||||
|
mpv.on('quit', () => {
|
||||||
|
console.log('mpv quit');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Event output every interval set by time_update, used to update the current time
|
||||||
|
mpv.on('timeposition', (time: number) => {
|
||||||
|
getMainWindow()?.webContents.send('renderer-player-current-time', time);
|
||||||
|
});
|
||||||
|
|
||||||
|
mpv.on('seek', () => {
|
||||||
|
console.log('mpv seek');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Starts the player
|
// Starts the player
|
||||||
ipcMain.on('player-play', async () => {
|
ipcMain.on('player-play', async () => {
|
||||||
await getMpvInstance()
|
await mpv.play();
|
||||||
?.play()
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to play', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pauses the player
|
// Pauses the player
|
||||||
ipcMain.on('player-pause', async () => {
|
ipcMain.on('player-pause', async () => {
|
||||||
await getMpvInstance()
|
await mpv.pause();
|
||||||
?.pause()
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to pause', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Stops the player
|
// Stops the player
|
||||||
ipcMain.on('player-stop', async () => {
|
ipcMain.on('player-stop', async () => {
|
||||||
await getMpvInstance()
|
await mpv.stop();
|
||||||
?.stop()
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to stop', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Goes to the next track in the playlist
|
// Stops the player
|
||||||
ipcMain.on('player-next', async () => {
|
ipcMain.on('player-next', async () => {
|
||||||
await getMpvInstance()
|
await mpv.next();
|
||||||
?.next()
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to go to next', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Goes to the previous track in the playlist
|
// Stops the player
|
||||||
ipcMain.on('player-previous', async () => {
|
ipcMain.on('player-previous', async () => {
|
||||||
await getMpvInstance()
|
await mpv.previous();
|
||||||
?.prev()
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to go to previous', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Seeks forward or backward by the given amount of seconds
|
// Seeks forward or backward by the given amount of seconds
|
||||||
ipcMain.on('player-seek', async (_event, time: number) => {
|
ipcMain.on('player-seek', async (_event, time: number) => {
|
||||||
await getMpvInstance()
|
await mpv.seek(time);
|
||||||
?.seek(time)
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to seek', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Seeks to the given time in seconds
|
// Seeks to the given time in seconds
|
||||||
ipcMain.on('player-seek-to', async (_event, time: number) => {
|
ipcMain.on('player-seek-to', async (_event, time: number) => {
|
||||||
await getMpvInstance()
|
await mpv.goToPosition(time);
|
||||||
?.goToPosition(time)
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(`MPV failed to seek to ${time}`, err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sets the queue in position 0 and 1 to the given data. Used when manually starting a song or using the next/prev buttons
|
// Sets the queue to the given data. Used when manually starting a song or using the next/prev buttons
|
||||||
ipcMain.on('player-set-queue', async (_event, data: PlayerData, pause?: boolean) => {
|
ipcMain.on('player-set-queue', async (_event, data: PlayerData) => {
|
||||||
if (!data.queue.current && !data.queue.next) {
|
if (data.queue.current) {
|
||||||
await getMpvInstance()
|
await mpv.load(data.queue.current.streamUrl, 'replace');
|
||||||
?.clearPlaylist()
|
}
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to clear playlist', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
await getMpvInstance()
|
if (data.queue.next) {
|
||||||
?.pause()
|
await mpv.load(data.queue.next.streamUrl, 'append');
|
||||||
.catch((err) => {
|
}
|
||||||
console.log('MPV failed to pause', err);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (data.queue.current) {
|
|
||||||
await getMpvInstance()
|
|
||||||
?.load(data.queue.current.streamUrl, 'replace')
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to load song', err);
|
|
||||||
getMpvInstance()?.play();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (data.queue.next) {
|
|
||||||
await getMpvInstance()?.load(data.queue.next.streamUrl, 'append');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pause) {
|
|
||||||
getMpvInstance()?.pause();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Replaces the queue in position 1 to the given data
|
|
||||||
ipcMain.on('player-set-queue-next', async (_event, data: PlayerData) => {
|
|
||||||
const size = await getMpvInstance()
|
|
||||||
?.getPlaylistSize()
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to get playlist size', err);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size > 1) {
|
|
||||||
await getMpvInstance()
|
|
||||||
?.playlistRemove(1)
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to remove song from playlist', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.queue.next) {
|
|
||||||
await getMpvInstance()
|
|
||||||
?.load(data.queue.next.streamUrl, 'append')
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to load next song', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sets the next song in the queue when reaching the end of the queue
|
// Sets the next song in the queue when reaching the end of the queue
|
||||||
ipcMain.on('player-auto-next', async (_event, data: PlayerData) => {
|
ipcMain.on('player-set-queue-next', async (_event, data: PlayerData) => {
|
||||||
// Always keep the current song as position 0 in the mpv queue
|
if (data.queue.next) {
|
||||||
// This allows us to easily set update the next song in the queue without
|
await mpv.load(data.queue.next.streamUrl, 'append');
|
||||||
// disturbing the currently playing song
|
}
|
||||||
await getMpvInstance()
|
|
||||||
?.playlistRemove(0)
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to remove song from playlist', err);
|
|
||||||
getMpvInstance()?.pause();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (data.queue.next) {
|
|
||||||
await getMpvInstance()
|
|
||||||
?.load(data.queue.next.streamUrl, 'append')
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to load next song', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Sets the volume to the given value (0-100)
|
// Sets the volume to the given value (0-100)
|
||||||
ipcMain.on('player-volume', async (_event, value: number) => {
|
ipcMain.on('player-volume', async (_event, value: number) => {
|
||||||
await getMpvInstance()
|
mpv.volume(value);
|
||||||
?.volume(value)
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to set volume', err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Toggles the mute status
|
// Toggles the mute status
|
||||||
ipcMain.on('player-mute', async (_event, mute: boolean) => {
|
ipcMain.on('player-mute', async () => {
|
||||||
await getMpvInstance()
|
mpv.mute();
|
||||||
?.mute(mute)
|
|
||||||
.catch((err) => {
|
|
||||||
console.log('MPV failed to toggle mute', err);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('player-get-time', async (): Promise<number | undefined> => {
|
|
||||||
return getMpvInstance()?.getTimePosition();
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
/* eslint-disable promise/always-return */
|
|
||||||
import { BrowserWindow, globalShortcut } from 'electron';
|
|
||||||
|
|
||||||
export const enableMediaKeys = (window: BrowserWindow | null) => {
|
|
||||||
globalShortcut.register('MediaStop', () => {
|
|
||||||
window?.webContents.send('renderer-player-stop');
|
|
||||||
});
|
|
||||||
|
|
||||||
globalShortcut.register('MediaPlayPause', () => {
|
|
||||||
window?.webContents.send('renderer-player-play-pause');
|
|
||||||
});
|
|
||||||
|
|
||||||
globalShortcut.register('MediaNextTrack', () => {
|
|
||||||
window?.webContents.send('renderer-player-next');
|
|
||||||
});
|
|
||||||
|
|
||||||
globalShortcut.register('MediaPreviousTrack', () => {
|
|
||||||
window?.webContents.send('renderer-player-previous');
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const disableMediaKeys = () => {
|
|
||||||
globalShortcut.unregister('MediaStop');
|
|
||||||
globalShortcut.unregister('MediaPlayPause');
|
|
||||||
globalShortcut.unregister('MediaNextTrack');
|
|
||||||
globalShortcut.unregister('MediaPreviousTrack');
|
|
||||||
};
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
declare module 'node-mpv';
|
||||||
@@ -1,662 +0,0 @@
|
|||||||
import { Stats, promises } from 'fs';
|
|
||||||
import { readFile } from 'fs/promises';
|
|
||||||
import { IncomingMessage, Server, ServerResponse, createServer } from 'http';
|
|
||||||
import { join } from 'path';
|
|
||||||
import { deflate, gzip } from 'zlib';
|
|
||||||
import axios from 'axios';
|
|
||||||
import { app, ipcMain } from 'electron';
|
|
||||||
import { Server as WsServer, WebSocketServer, WebSocket } from 'ws';
|
|
||||||
import manifest from './manifest.json';
|
|
||||||
import { ClientEvent, ServerEvent } from '../../../../remote/types';
|
|
||||||
import { PlayerRepeat, SongUpdate } from '../../../../renderer/types';
|
|
||||||
import { getMainWindow } from '../../../main';
|
|
||||||
import { isLinux } from '../../../utils';
|
|
||||||
|
|
||||||
let mprisPlayer: any | undefined;
|
|
||||||
|
|
||||||
if (isLinux()) {
|
|
||||||
// eslint-disable-next-line global-require
|
|
||||||
mprisPlayer = require('../../linux/mpris').mprisPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RemoteConfig {
|
|
||||||
enabled: boolean;
|
|
||||||
password: string;
|
|
||||||
port: number;
|
|
||||||
username: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MimeType {
|
|
||||||
css: string;
|
|
||||||
html: string;
|
|
||||||
ico: string;
|
|
||||||
js: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface StatefulWebSocket extends WebSocket {
|
|
||||||
alive: boolean;
|
|
||||||
auth: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
let server: Server | undefined;
|
|
||||||
let wsServer: WsServer<StatefulWebSocket> | undefined;
|
|
||||||
|
|
||||||
const settings: RemoteConfig = {
|
|
||||||
enabled: false,
|
|
||||||
password: '',
|
|
||||||
port: 4333,
|
|
||||||
username: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
type SendData = ServerEvent & {
|
|
||||||
client: StatefulWebSocket;
|
|
||||||
};
|
|
||||||
|
|
||||||
function send({ client, event, data }: SendData): void {
|
|
||||||
if (client.readyState === WebSocket.OPEN) {
|
|
||||||
if (client.alive && client.auth) {
|
|
||||||
client.send(JSON.stringify({ data, event }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function broadcast(message: ServerEvent): void {
|
|
||||||
if (wsServer) {
|
|
||||||
for (const client of wsServer.clients) {
|
|
||||||
send({ client, ...message });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const shutdownServer = () => {
|
|
||||||
if (wsServer) {
|
|
||||||
wsServer.clients.forEach((client) => client.close(4000));
|
|
||||||
wsServer.close();
|
|
||||||
wsServer = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (server) {
|
|
||||||
server.close();
|
|
||||||
server = undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const MIME_TYPES: MimeType = {
|
|
||||||
css: 'text/css',
|
|
||||||
html: 'text/html; charset=UTF-8',
|
|
||||||
ico: 'image/x-icon',
|
|
||||||
js: 'application/javascript',
|
|
||||||
};
|
|
||||||
|
|
||||||
const PING_TIMEOUT_MS = 10000;
|
|
||||||
const UP_TIMEOUT_MS = 5000;
|
|
||||||
|
|
||||||
enum Encoding {
|
|
||||||
GZIP = 'gzip',
|
|
||||||
NONE = 'none',
|
|
||||||
ZLIB = 'deflate',
|
|
||||||
}
|
|
||||||
|
|
||||||
const GZIP_REGEX = /\bgzip\b/;
|
|
||||||
const ZLIB_REGEX = /bdeflate\b/;
|
|
||||||
|
|
||||||
let currentSong: SongUpdate = {
|
|
||||||
currentTime: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
const getEncoding = (encoding: string | string[]): Encoding => {
|
|
||||||
const encodingArray = Array.isArray(encoding) ? encoding : [encoding];
|
|
||||||
|
|
||||||
for (const code of encodingArray) {
|
|
||||||
if (code.match(GZIP_REGEX)) {
|
|
||||||
return Encoding.GZIP;
|
|
||||||
}
|
|
||||||
if (code.match(ZLIB_REGEX)) {
|
|
||||||
return Encoding.ZLIB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Encoding.NONE;
|
|
||||||
};
|
|
||||||
|
|
||||||
const cache = new Map<string, Map<Encoding, [number, Buffer]>>();
|
|
||||||
|
|
||||||
function setOk(
|
|
||||||
res: ServerResponse,
|
|
||||||
mtimeMs: number,
|
|
||||||
extension: keyof MimeType,
|
|
||||||
encoding: Encoding,
|
|
||||||
data?: Buffer,
|
|
||||||
) {
|
|
||||||
res.statusCode = data ? 200 : 304;
|
|
||||||
|
|
||||||
res.setHeader('Content-Type', MIME_TYPES[extension]);
|
|
||||||
res.setHeader('ETag', `"${mtimeMs}"`);
|
|
||||||
res.setHeader('Cache-Control', 'public');
|
|
||||||
|
|
||||||
if (encoding !== 'none') res.setHeader('Content-Encoding', encoding);
|
|
||||||
res.end(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function serveFile(
|
|
||||||
req: IncomingMessage,
|
|
||||||
file: string,
|
|
||||||
extension: keyof MimeType,
|
|
||||||
res: ServerResponse,
|
|
||||||
): Promise<void> {
|
|
||||||
const fileName = `${file}.${extension}`;
|
|
||||||
const path = app.isPackaged
|
|
||||||
? join(__dirname, '../remote', fileName)
|
|
||||||
: join(__dirname, '../../../../../.erb/dll', fileName);
|
|
||||||
|
|
||||||
let stats: Stats;
|
|
||||||
|
|
||||||
try {
|
|
||||||
stats = await promises.stat(path);
|
|
||||||
} catch (error) {
|
|
||||||
res.statusCode = 404;
|
|
||||||
res.setHeader('Content-Type', 'text/plain');
|
|
||||||
res.end((error as Error).message);
|
|
||||||
// This is a resolve, even though it is an error, because we want specific (non 500) status
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
const encodings = req.headers['accept-encoding'] ?? '';
|
|
||||||
const selectedEncoding = getEncoding(encodings);
|
|
||||||
|
|
||||||
const ifMatch = req.headers['if-none-match'];
|
|
||||||
|
|
||||||
const fileInfo = cache.get(fileName);
|
|
||||||
let cached = fileInfo?.get(selectedEncoding);
|
|
||||||
|
|
||||||
if (cached && cached[0] !== stats.mtimeMs) {
|
|
||||||
cache.get(fileName)!.delete(selectedEncoding);
|
|
||||||
cached = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ifMatch && cached) {
|
|
||||||
const options = ifMatch.split(',');
|
|
||||||
|
|
||||||
for (const option of options) {
|
|
||||||
const mTime = Number(option.replaceAll('"', '').trim());
|
|
||||||
|
|
||||||
if (cached[0] === mTime) {
|
|
||||||
setOk(res, cached[0], extension, selectedEncoding);
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cached || cached[0] !== stats.mtimeMs) {
|
|
||||||
const content = await readFile(path);
|
|
||||||
|
|
||||||
switch (selectedEncoding) {
|
|
||||||
case Encoding.GZIP:
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
gzip(content, (error, result) => {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newEntry: [number, Buffer] = [stats.mtimeMs, result];
|
|
||||||
|
|
||||||
if (fileInfo) {
|
|
||||||
fileInfo.set(selectedEncoding, newEntry);
|
|
||||||
} else {
|
|
||||||
cache.set(fileName, new Map([[selectedEncoding, newEntry]]));
|
|
||||||
}
|
|
||||||
|
|
||||||
setOk(res, stats.mtimeMs, extension, selectedEncoding, result);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
case Encoding.ZLIB:
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
deflate(content, (error, result) => {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newEntry: [number, Buffer] = [stats.mtimeMs, result];
|
|
||||||
|
|
||||||
if (fileInfo) {
|
|
||||||
fileInfo.set(selectedEncoding, newEntry);
|
|
||||||
} else {
|
|
||||||
cache.set(fileName, new Map([[selectedEncoding, newEntry]]));
|
|
||||||
}
|
|
||||||
|
|
||||||
setOk(res, stats.mtimeMs, extension, selectedEncoding, result);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
default: {
|
|
||||||
const newEntry: [number, Buffer] = [stats.mtimeMs, content];
|
|
||||||
|
|
||||||
if (fileInfo) {
|
|
||||||
fileInfo.set(selectedEncoding, newEntry);
|
|
||||||
} else {
|
|
||||||
cache.set(fileName, new Map([[selectedEncoding, newEntry]]));
|
|
||||||
}
|
|
||||||
|
|
||||||
setOk(res, stats.mtimeMs, extension, selectedEncoding, content);
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setOk(res, cached[0], extension, selectedEncoding, cached[1]);
|
|
||||||
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
function authorize(req: IncomingMessage): boolean {
|
|
||||||
if (settings.username || settings.password) {
|
|
||||||
// https://stackoverflow.com/questions/23616371/basic-http-authentication-with-node-and-express-4
|
|
||||||
|
|
||||||
const authorization = req.headers.authorization?.split(' ')[1] || '';
|
|
||||||
const [login, password] = Buffer.from(authorization, 'base64').toString().split(':');
|
|
||||||
|
|
||||||
return login === settings.username && password === settings.password;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const enableServer = (config: RemoteConfig): Promise<void> => {
|
|
||||||
return new Promise<void>((resolve, reject) => {
|
|
||||||
try {
|
|
||||||
if (server) {
|
|
||||||
server.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
server = createServer({}, async (req, res) => {
|
|
||||||
if (!authorize(req)) {
|
|
||||||
res.statusCode = 401;
|
|
||||||
res.setHeader('WWW-Authenticate', 'Basic realm="401"');
|
|
||||||
res.end('Authorization required');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch (req.url) {
|
|
||||||
case '/': {
|
|
||||||
await serveFile(req, 'index', 'html', res);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '/favicon.ico': {
|
|
||||||
await serveFile(req, 'favicon', 'ico', res);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '/remote.css': {
|
|
||||||
await serveFile(req, 'remote', 'css', res);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '/remote.js': {
|
|
||||||
await serveFile(req, 'remote', 'js', res);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '/manifest.json': {
|
|
||||||
res.statusCode = 200;
|
|
||||||
res.setHeader('Content-Type', 'application/json');
|
|
||||||
res.end(JSON.stringify(manifest));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case '/credentials': {
|
|
||||||
res.statusCode = 200;
|
|
||||||
res.setHeader('Content-Type', 'text/plain');
|
|
||||||
res.end(req.headers.authorization);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
if (req.url?.startsWith('/worker.js')) {
|
|
||||||
await serveFile(req, 'worker', 'js', res);
|
|
||||||
} else {
|
|
||||||
res.statusCode = 404;
|
|
||||||
res.setHeader('Content-Type', 'text/plain');
|
|
||||||
res.end('Not Found');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
res.statusCode = 500;
|
|
||||||
res.setHeader('Content-Type', 'text/plain');
|
|
||||||
res.end((error as Error).message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
server.listen(config.port, resolve);
|
|
||||||
wsServer = new WebSocketServer({ server });
|
|
||||||
|
|
||||||
wsServer.on('connection', (ws) => {
|
|
||||||
let authFail: number | undefined;
|
|
||||||
ws.alive = true;
|
|
||||||
|
|
||||||
if (!settings.username && !settings.password) {
|
|
||||||
ws.auth = true;
|
|
||||||
} else {
|
|
||||||
authFail = setTimeout(() => {
|
|
||||||
if (!ws.auth) {
|
|
||||||
ws.close();
|
|
||||||
}
|
|
||||||
}, 10000) as unknown as number;
|
|
||||||
}
|
|
||||||
|
|
||||||
ws.on('error', console.error);
|
|
||||||
|
|
||||||
ws.on('message', (data) => {
|
|
||||||
try {
|
|
||||||
const json = JSON.parse(data.toString()) as ClientEvent;
|
|
||||||
const event = json.event;
|
|
||||||
|
|
||||||
if (!ws.auth) {
|
|
||||||
if (event === 'authenticate') {
|
|
||||||
const auth = json.header.split(' ')[1];
|
|
||||||
const [login, password] = Buffer.from(auth, 'base64')
|
|
||||||
.toString()
|
|
||||||
.split(':');
|
|
||||||
|
|
||||||
if (login === settings.username && password === settings.password) {
|
|
||||||
ws.auth = true;
|
|
||||||
} else {
|
|
||||||
ws.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
clearTimeout(authFail);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event) {
|
|
||||||
case 'pause': {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-pause');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'play': {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-play');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'next': {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-next');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'previous': {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-previous');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'proxy': {
|
|
||||||
const toFetch = currentSong.song?.imageUrl?.replaceAll(
|
|
||||||
/&(size|width|height=\d+)/g,
|
|
||||||
'',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!toFetch) return;
|
|
||||||
|
|
||||||
axios
|
|
||||||
.get(toFetch, { responseType: 'arraybuffer' })
|
|
||||||
.then((resp) => {
|
|
||||||
if (ws.readyState === WebSocket.OPEN) {
|
|
||||||
send({
|
|
||||||
client: ws,
|
|
||||||
data: Buffer.from(resp.data, 'binary').toString(
|
|
||||||
'base64',
|
|
||||||
),
|
|
||||||
event: 'proxy',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
if (ws.readyState === WebSocket.OPEN) {
|
|
||||||
send({
|
|
||||||
client: ws,
|
|
||||||
data: error.message,
|
|
||||||
event: 'error',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'repeat': {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-toggle-repeat');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'shuffle': {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-toggle-shuffle');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'volume': {
|
|
||||||
let volume = Number(json.volume);
|
|
||||||
|
|
||||||
if (volume > 100) {
|
|
||||||
volume = 100;
|
|
||||||
} else if (volume < 0) {
|
|
||||||
volume = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentSong.volume = volume;
|
|
||||||
|
|
||||||
broadcast({ data: { volume }, event: 'song' });
|
|
||||||
getMainWindow()?.webContents.send('request-volume', {
|
|
||||||
volume,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mprisPlayer) {
|
|
||||||
mprisPlayer.volume = volume / 100;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'favorite': {
|
|
||||||
const { favorite, id } = json;
|
|
||||||
if (id && id === currentSong.song?.id) {
|
|
||||||
getMainWindow()?.webContents.send('request-favorite', {
|
|
||||||
favorite,
|
|
||||||
id,
|
|
||||||
serverId: currentSong.song.serverId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'rating': {
|
|
||||||
const { rating, id } = json;
|
|
||||||
if (id && id === currentSong.song?.id) {
|
|
||||||
getMainWindow()?.webContents.send('request-rating', {
|
|
||||||
id,
|
|
||||||
rating,
|
|
||||||
serverId: currentSong.song.serverId,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ws.on('pong', () => {
|
|
||||||
ws.alive = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
ws.send(JSON.stringify({ data: currentSong, event: 'song' }));
|
|
||||||
});
|
|
||||||
|
|
||||||
const heartBeat = setInterval(() => {
|
|
||||||
wsServer?.clients.forEach((ws) => {
|
|
||||||
if (!ws.alive) {
|
|
||||||
ws.terminate();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ws.alive = false;
|
|
||||||
ws.ping();
|
|
||||||
});
|
|
||||||
}, PING_TIMEOUT_MS);
|
|
||||||
|
|
||||||
wsServer.on('close', () => {
|
|
||||||
clearInterval(heartBeat);
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
reject(new Error('Server did not come up'));
|
|
||||||
}, UP_TIMEOUT_MS);
|
|
||||||
} catch (error) {
|
|
||||||
reject(error);
|
|
||||||
shutdownServer();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
ipcMain.handle('remote-enable', async (_event, enabled: boolean) => {
|
|
||||||
settings.enabled = enabled;
|
|
||||||
|
|
||||||
if (enabled) {
|
|
||||||
try {
|
|
||||||
await enableServer(settings);
|
|
||||||
} catch (error) {
|
|
||||||
return (error as Error).message;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
shutdownServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('remote-port', async (_event, port: number) => {
|
|
||||||
settings.port = port;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('remote-password', (_event, password: string) => {
|
|
||||||
settings.password = password;
|
|
||||||
wsServer?.clients.forEach((client) => client.close(4002));
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle(
|
|
||||||
'remote-settings',
|
|
||||||
async (_event, enabled: boolean, port: number, username: string, password: string) => {
|
|
||||||
settings.enabled = enabled;
|
|
||||||
settings.password = password;
|
|
||||||
settings.port = port;
|
|
||||||
settings.username = username;
|
|
||||||
|
|
||||||
if (enabled) {
|
|
||||||
try {
|
|
||||||
await enableServer(settings);
|
|
||||||
} catch (error) {
|
|
||||||
return (error as Error).message;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
shutdownServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
ipcMain.on('remote-username', (_event, username: string) => {
|
|
||||||
settings.username = username;
|
|
||||||
wsServer?.clients.forEach((client) => client.close(4002));
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-favorite', (_event, favorite: boolean, serverId: string, ids: string[]) => {
|
|
||||||
if (currentSong.song?.serverId !== serverId) return;
|
|
||||||
|
|
||||||
const id = currentSong.song.id;
|
|
||||||
|
|
||||||
for (const songId of ids) {
|
|
||||||
if (songId === id) {
|
|
||||||
currentSong.song.userFavorite = favorite;
|
|
||||||
broadcast({ data: { favorite, id: songId }, event: 'favorite' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-rating', (_event, rating: number, serverId: string, ids: string[]) => {
|
|
||||||
if (currentSong.song?.serverId !== serverId) return;
|
|
||||||
|
|
||||||
const id = currentSong.song.id;
|
|
||||||
|
|
||||||
for (const songId of ids) {
|
|
||||||
if (songId === id) {
|
|
||||||
currentSong.song.userRating = rating;
|
|
||||||
broadcast({ data: { id: songId, rating }, event: 'rating' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-repeat', (_event, repeat: PlayerRepeat) => {
|
|
||||||
currentSong.repeat = repeat;
|
|
||||||
broadcast({ data: { repeat }, event: 'song' });
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-shuffle', (_event, shuffle: boolean) => {
|
|
||||||
currentSong.shuffle = shuffle;
|
|
||||||
broadcast({ data: { shuffle }, event: 'song' });
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-song', (_event, data: SongUpdate) => {
|
|
||||||
const { song, ...rest } = data;
|
|
||||||
const songChanged = song?.id !== currentSong.song?.id;
|
|
||||||
|
|
||||||
if (!song?.id) {
|
|
||||||
currentSong = {
|
|
||||||
...currentSong,
|
|
||||||
...data,
|
|
||||||
song: undefined,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
currentSong = {
|
|
||||||
...currentSong,
|
|
||||||
...data,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (songChanged) {
|
|
||||||
broadcast({ data: { ...rest, song: song || null }, event: 'song' });
|
|
||||||
} else {
|
|
||||||
broadcast({ data: rest, event: 'song' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-volume', (_event, volume: number) => {
|
|
||||||
currentSong.volume = volume;
|
|
||||||
broadcast({ data: { volume }, event: 'song' });
|
|
||||||
});
|
|
||||||
|
|
||||||
if (mprisPlayer) {
|
|
||||||
mprisPlayer.on('loopStatus', (event: string) => {
|
|
||||||
const repeat =
|
|
||||||
event === 'Playlist'
|
|
||||||
? PlayerRepeat.ALL
|
|
||||||
: event === 'Track'
|
|
||||||
? PlayerRepeat.ONE
|
|
||||||
: PlayerRepeat.NONE;
|
|
||||||
|
|
||||||
currentSong.repeat = repeat;
|
|
||||||
broadcast({ data: { repeat }, event: 'song' });
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('shuffle', (shuffle: boolean) => {
|
|
||||||
currentSong.shuffle = shuffle;
|
|
||||||
broadcast({ data: { shuffle }, event: 'song' });
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('volume', (vol: number) => {
|
|
||||||
let volume = Math.round(vol * 100);
|
|
||||||
|
|
||||||
if (volume > 100) {
|
|
||||||
volume = 100;
|
|
||||||
} else if (volume < 0) {
|
|
||||||
volume = 0;
|
|
||||||
}
|
|
||||||
currentSong.volume = volume;
|
|
||||||
broadcast({ data: { volume }, event: 'song' });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Feishin Remote",
|
|
||||||
"short_name": "Feishin Remote",
|
|
||||||
"start_url": "/",
|
|
||||||
"background_color": "#000100",
|
|
||||||
"theme_color": "#E7E7E7",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "favicon.ico",
|
|
||||||
"sizes": "32x32",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "maskable any"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"display": "standalone",
|
|
||||||
"orientation": "portrait"
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
import { ipcMain, safeStorage } from 'electron';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
|
|
||||||
export const store = new Store();
|
|
||||||
|
|
||||||
ipcMain.handle('settings-get', (_event, data: { property: string }) => {
|
|
||||||
return store.get(`${data.property}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('settings-set', (__event, data: { property: string; value: any }) => {
|
|
||||||
store.set(`${data.property}`, data.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('password-get', (_event, server: string): string | null => {
|
|
||||||
if (safeStorage.isEncryptionAvailable()) {
|
|
||||||
const servers = store.get('server') as Record<string, string> | undefined;
|
|
||||||
|
|
||||||
if (!servers) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const encrypted = servers[server];
|
|
||||||
if (!encrypted) return null;
|
|
||||||
|
|
||||||
const decrypted = safeStorage.decryptString(Buffer.from(encrypted, 'hex'));
|
|
||||||
return decrypted;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('password-remove', (_event, server: string) => {
|
|
||||||
const passwords = store.get('server', {}) as Record<string, string>;
|
|
||||||
if (server in passwords) {
|
|
||||||
delete passwords[server];
|
|
||||||
}
|
|
||||||
store.set({ server: passwords });
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.handle('password-set', (_event, password: string, server: string) => {
|
|
||||||
if (safeStorage.isEncryptionAvailable()) {
|
|
||||||
const encrypted = safeStorage.encryptString(password);
|
|
||||||
const passwords = store.get('server', {}) as Record<string, string>;
|
|
||||||
passwords[server] = encrypted.toString('hex');
|
|
||||||
store.set({ server: passwords });
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
import './mpris';
|
|
||||||
|
|||||||
@@ -1,169 +0,0 @@
|
|||||||
import { ipcMain } from 'electron';
|
|
||||||
import Player from 'mpris-service';
|
|
||||||
import { PlayerRepeat, PlayerStatus, SongUpdate } from '../../../renderer/types';
|
|
||||||
import { getMainWindow } from '../../main';
|
|
||||||
|
|
||||||
const mprisPlayer = Player({
|
|
||||||
identity: 'Feishin',
|
|
||||||
maximumRate: 1.0,
|
|
||||||
minimumRate: 1.0,
|
|
||||||
name: 'Feishin',
|
|
||||||
rate: 1.0,
|
|
||||||
supportedInterfaces: ['player'],
|
|
||||||
supportedMimeTypes: ['audio/mpeg', 'application/ogg'],
|
|
||||||
supportedUriSchemes: ['file'],
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('quit', () => {
|
|
||||||
process.exit();
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('stop', () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-stop');
|
|
||||||
mprisPlayer.playbackStatus = 'Paused';
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('pause', () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-pause');
|
|
||||||
mprisPlayer.playbackStatus = 'Paused';
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('play', () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-play');
|
|
||||||
mprisPlayer.playbackStatus = 'Playing';
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('playpause', () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-play-pause');
|
|
||||||
if (mprisPlayer.playbackStatus !== 'Playing') {
|
|
||||||
mprisPlayer.playbackStatus = 'Playing';
|
|
||||||
} else {
|
|
||||||
mprisPlayer.playbackStatus = 'Paused';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('next', () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-next');
|
|
||||||
|
|
||||||
if (mprisPlayer.playbackStatus !== 'Playing') {
|
|
||||||
mprisPlayer.playbackStatus = 'Playing';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('previous', () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-previous');
|
|
||||||
|
|
||||||
if (mprisPlayer.playbackStatus !== 'Playing') {
|
|
||||||
mprisPlayer.playbackStatus = Player.PLAYBACK_STATUS_PLAYING;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('volume', (vol: number) => {
|
|
||||||
let volume = Math.round(vol * 100);
|
|
||||||
|
|
||||||
if (volume > 100) {
|
|
||||||
volume = 100;
|
|
||||||
} else if (volume < 0) {
|
|
||||||
volume = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMainWindow()?.webContents.send('request-volume', {
|
|
||||||
volume,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('shuffle', (event: boolean) => {
|
|
||||||
getMainWindow()?.webContents.send('mpris-request-toggle-shuffle', { shuffle: event });
|
|
||||||
mprisPlayer.shuffle = event;
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('loopStatus', (event: string) => {
|
|
||||||
getMainWindow()?.webContents.send('mpris-request-toggle-repeat', { repeat: event });
|
|
||||||
mprisPlayer.loopStatus = event;
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('position', (event: any) => {
|
|
||||||
getMainWindow()?.webContents.send('request-position', {
|
|
||||||
position: event.position / 1e6,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
mprisPlayer.on('seek', (event: number) => {
|
|
||||||
getMainWindow()?.webContents.send('request-seek', {
|
|
||||||
offset: event / 1e6,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('mpris-update-position', (_event, arg) => {
|
|
||||||
mprisPlayer.getPosition = () => arg * 1e6;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('mpris-update-seek', (_event, arg) => {
|
|
||||||
mprisPlayer.seeked(arg * 1e6);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-volume', (_event, volume) => {
|
|
||||||
mprisPlayer.volume = Number(volume) / 100;
|
|
||||||
});
|
|
||||||
|
|
||||||
const REPEAT_TO_MPRIS: Record<PlayerRepeat, string> = {
|
|
||||||
[PlayerRepeat.ALL]: 'Playlist',
|
|
||||||
[PlayerRepeat.ONE]: 'Track',
|
|
||||||
[PlayerRepeat.NONE]: 'None',
|
|
||||||
};
|
|
||||||
|
|
||||||
ipcMain.on('update-repeat', (_event, arg: PlayerRepeat) => {
|
|
||||||
mprisPlayer.loopStatus = REPEAT_TO_MPRIS[arg];
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-shuffle', (_event, shuffle: boolean) => {
|
|
||||||
mprisPlayer.shuffle = shuffle;
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('update-song', (_event, args: SongUpdate) => {
|
|
||||||
const { song, status, repeat, shuffle } = args || {};
|
|
||||||
|
|
||||||
try {
|
|
||||||
mprisPlayer.playbackStatus = status === PlayerStatus.PLAYING ? 'Playing' : 'Paused';
|
|
||||||
|
|
||||||
if (repeat) {
|
|
||||||
mprisPlayer.loopStatus = REPEAT_TO_MPRIS[repeat];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shuffle) {
|
|
||||||
mprisPlayer.shuffle = shuffle;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!song) return;
|
|
||||||
|
|
||||||
const upsizedImageUrl = song.imageUrl
|
|
||||||
? song.imageUrl
|
|
||||||
?.replace(/&size=\d+/, '&size=300')
|
|
||||||
.replace(/\?width=\d+/, '?width=300')
|
|
||||||
.replace(/&height=\d+/, '&height=300')
|
|
||||||
: null;
|
|
||||||
|
|
||||||
mprisPlayer.metadata = {
|
|
||||||
'mpris:artUrl': upsizedImageUrl,
|
|
||||||
'mpris:length': song.duration ? Math.round((song.duration || 0) * 1e3) : null,
|
|
||||||
'mpris:trackid': song.id
|
|
||||||
? mprisPlayer.objectPath(`track/${song.id?.replace('-', '')}`)
|
|
||||||
: '',
|
|
||||||
'xesam:album': song.album || null,
|
|
||||||
'xesam:albumArtist': song.albumArtists?.length
|
|
||||||
? song.albumArtists.map((artist) => artist.name)
|
|
||||||
: null,
|
|
||||||
'xesam:artist': song.artists?.length ? song.artists.map((artist) => artist.name) : null,
|
|
||||||
'xesam:discNumber': song.discNumber ? song.discNumber : null,
|
|
||||||
'xesam:genre': song.genres?.length ? song.genres.map((genre: any) => genre.name) : null,
|
|
||||||
'xesam:title': song.name || null,
|
|
||||||
'xesam:trackNumber': song.trackNumber ? song.trackNumber : null,
|
|
||||||
'xesam:useCount':
|
|
||||||
song.playCount !== null && song.playCount !== undefined ? song.playCount : null,
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export { mprisPlayer };
|
|
||||||
@@ -8,689 +8,158 @@
|
|||||||
* When running `npm run build` or `npm run build:main`, this file is compiled to
|
* When running `npm run build` or `npm run build:main`, this file is compiled to
|
||||||
* `./src/main.js` using webpack. This gives us some performance wins.
|
* `./src/main.js` using webpack. This gives us some performance wins.
|
||||||
*/
|
*/
|
||||||
import { access, constants, readFile, writeFile } from 'fs';
|
import path from 'path';
|
||||||
import path, { join } from 'path';
|
import { app, BrowserWindow, shell, ipcMain } from 'electron';
|
||||||
import { deflate, inflate } from 'zlib';
|
|
||||||
import {
|
|
||||||
app,
|
|
||||||
BrowserWindow,
|
|
||||||
shell,
|
|
||||||
ipcMain,
|
|
||||||
globalShortcut,
|
|
||||||
Tray,
|
|
||||||
Menu,
|
|
||||||
nativeImage,
|
|
||||||
BrowserWindowConstructorOptions,
|
|
||||||
protocol,
|
|
||||||
net,
|
|
||||||
} from 'electron';
|
|
||||||
import electronLocalShortcut from 'electron-localshortcut';
|
|
||||||
import log from 'electron-log';
|
import log from 'electron-log';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
import uniq from 'lodash/uniq';
|
|
||||||
import MpvAPI from 'node-mpv';
|
|
||||||
import { disableMediaKeys, enableMediaKeys } from './features/core/player/media-keys';
|
|
||||||
import { store } from './features/core/settings/index';
|
|
||||||
import MenuBuilder from './menu';
|
import MenuBuilder from './menu';
|
||||||
import { hotkeyToElectronAccelerator, isLinux, isMacOS, isWindows, resolveHtmlPath } from './utils';
|
import { resolveHtmlPath } from './utils';
|
||||||
import './features';
|
import './features';
|
||||||
|
|
||||||
declare module 'node-mpv';
|
|
||||||
|
|
||||||
export default class AppUpdater {
|
export default class AppUpdater {
|
||||||
constructor() {
|
constructor() {
|
||||||
log.transports.file.level = 'info';
|
log.transports.file.level = 'info';
|
||||||
autoUpdater.logger = log;
|
autoUpdater.logger = log;
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protocol.registerSchemesAsPrivileged([{ privileges: { bypassCSP: true }, scheme: 'feishin' }]);
|
|
||||||
|
|
||||||
process.on('uncaughtException', (error: any) => {
|
|
||||||
console.log('Error in main process', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (store.get('ignore_ssl')) {
|
|
||||||
app.commandLine.appendSwitch('ignore-certificate-errors');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | null = null;
|
let mainWindow: BrowserWindow | null = null;
|
||||||
let tray: Tray | null = null;
|
|
||||||
let exitFromTray = false;
|
|
||||||
let forceQuit = false;
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
const sourceMapSupport = require('source-map-support');
|
const sourceMapSupport = require('source-map-support');
|
||||||
sourceMapSupport.install();
|
sourceMapSupport.install();
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDevelopment = process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
|
const isDevelopment =
|
||||||
|
process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true';
|
||||||
|
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
require('electron-debug')();
|
require('electron-debug')();
|
||||||
}
|
}
|
||||||
|
|
||||||
const installExtensions = async () => {
|
const installExtensions = async () => {
|
||||||
const installer = require('electron-devtools-installer');
|
const installer = require('electron-devtools-installer');
|
||||||
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
|
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
|
||||||
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
|
const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
|
||||||
|
|
||||||
return installer
|
return installer
|
||||||
.default(
|
.default(
|
||||||
extensions.map((name) => installer[name]),
|
extensions.map((name) => installer[name]),
|
||||||
forceDownload,
|
forceDownload
|
||||||
)
|
)
|
||||||
.catch(console.log);
|
.catch(console.log);
|
||||||
};
|
|
||||||
|
|
||||||
const singleInstance = app.requestSingleInstanceLock();
|
|
||||||
|
|
||||||
if (!singleInstance) {
|
|
||||||
app.quit();
|
|
||||||
} else {
|
|
||||||
app.on('second-instance', () => {
|
|
||||||
mainWindow?.show();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const RESOURCES_PATH = app.isPackaged
|
|
||||||
? path.join(process.resourcesPath, 'assets')
|
|
||||||
: path.join(__dirname, '../../assets');
|
|
||||||
|
|
||||||
const getAssetPath = (...paths: string[]): string => {
|
|
||||||
return path.join(RESOURCES_PATH, ...paths);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getMainWindow = () => {
|
|
||||||
return mainWindow;
|
|
||||||
};
|
|
||||||
|
|
||||||
const createWinThumbarButtons = () => {
|
|
||||||
if (isWindows()) {
|
|
||||||
getMainWindow()?.setThumbarButtons([
|
|
||||||
{
|
|
||||||
click: () => getMainWindow()?.webContents.send('renderer-player-previous'),
|
|
||||||
icon: nativeImage.createFromPath(getAssetPath('skip-previous.png')),
|
|
||||||
tooltip: 'Previous Track',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => getMainWindow()?.webContents.send('renderer-player-play-pause'),
|
|
||||||
icon: nativeImage.createFromPath(getAssetPath('play-circle.png')),
|
|
||||||
tooltip: 'Play/Pause',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => getMainWindow()?.webContents.send('renderer-player-next'),
|
|
||||||
icon: nativeImage.createFromPath(getAssetPath('skip-next.png')),
|
|
||||||
tooltip: 'Next Track',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const createTray = () => {
|
|
||||||
if (isMacOS()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tray = isLinux()
|
|
||||||
? new Tray(getAssetPath('icons/icon.png'))
|
|
||||||
: new Tray(getAssetPath('icons/icon.ico'));
|
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
|
||||||
{
|
|
||||||
click: () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-play-pause');
|
|
||||||
},
|
|
||||||
label: 'Play/Pause',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-next');
|
|
||||||
},
|
|
||||||
label: 'Next Track',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-previous');
|
|
||||||
},
|
|
||||||
label: 'Previous Track',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-stop');
|
|
||||||
},
|
|
||||||
label: 'Stop',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'separator',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => {
|
|
||||||
mainWindow?.show();
|
|
||||||
createWinThumbarButtons();
|
|
||||||
},
|
|
||||||
label: 'Open main window',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click: () => {
|
|
||||||
exitFromTray = true;
|
|
||||||
app.quit();
|
|
||||||
},
|
|
||||||
label: 'Quit',
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
tray.on('double-click', () => {
|
|
||||||
mainWindow?.show();
|
|
||||||
createWinThumbarButtons();
|
|
||||||
});
|
|
||||||
|
|
||||||
tray.setToolTip('Feishin');
|
|
||||||
tray.setContextMenu(contextMenu);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const createWindow = async () => {
|
const createWindow = async () => {
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
await installExtensions();
|
await installExtensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
const RESOURCES_PATH = app.isPackaged
|
||||||
|
? path.join(process.resourcesPath, 'assets')
|
||||||
|
: path.join(__dirname, '../../assets');
|
||||||
|
|
||||||
|
const getAssetPath = (...paths: string[]): string => {
|
||||||
|
return path.join(RESOURCES_PATH, ...paths);
|
||||||
|
};
|
||||||
|
|
||||||
|
mainWindow = new BrowserWindow({
|
||||||
|
frame: false,
|
||||||
|
height: 728,
|
||||||
|
icon: getAssetPath('icon.png'),
|
||||||
|
minHeight: 600,
|
||||||
|
minWidth: 640,
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
backgroundThrottling: false,
|
||||||
|
|
||||||
|
contextIsolation: true,
|
||||||
|
devTools: true,
|
||||||
|
nodeIntegration: true,
|
||||||
|
preload: app.isPackaged
|
||||||
|
? path.join(__dirname, 'preload.js')
|
||||||
|
: path.join(__dirname, '../../.erb/dll/preload.js'),
|
||||||
|
},
|
||||||
|
width: 1024,
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('window-maximize', () => {
|
||||||
|
mainWindow?.maximize();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('window-unmaximize', () => {
|
||||||
|
mainWindow?.unmaximize();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('window-minimize', () => {
|
||||||
|
mainWindow?.minimize();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.on('window-close', () => {
|
||||||
|
mainWindow?.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.loadURL(resolveHtmlPath('index.html'));
|
||||||
|
|
||||||
|
mainWindow.on('ready-to-show', () => {
|
||||||
|
if (!mainWindow) {
|
||||||
|
throw new Error('"mainWindow" is not defined');
|
||||||
}
|
}
|
||||||
|
if (process.env.START_MINIMIZED) {
|
||||||
const nativeFrame = store.get('window_window_bar_style') === 'linux';
|
mainWindow.minimize();
|
||||||
store.set('window_has_frame', nativeFrame);
|
|
||||||
|
|
||||||
const nativeFrameConfig: Record<string, BrowserWindowConstructorOptions> = {
|
|
||||||
linux: {
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
frame: true,
|
|
||||||
},
|
|
||||||
macOS: {
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
frame: false,
|
|
||||||
titleBarStyle: 'hidden',
|
|
||||||
trafficLightPosition: { x: 10, y: 10 },
|
|
||||||
},
|
|
||||||
windows: {
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
frame: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
mainWindow = new BrowserWindow({
|
|
||||||
autoHideMenuBar: true,
|
|
||||||
frame: false,
|
|
||||||
height: 900,
|
|
||||||
icon: getAssetPath('icons/icon.png'),
|
|
||||||
minHeight: 640,
|
|
||||||
minWidth: 480,
|
|
||||||
show: false,
|
|
||||||
webPreferences: {
|
|
||||||
allowRunningInsecureContent: !!store.get('ignore_ssl'),
|
|
||||||
backgroundThrottling: false,
|
|
||||||
contextIsolation: true,
|
|
||||||
devTools: true,
|
|
||||||
nodeIntegration: true,
|
|
||||||
preload: app.isPackaged
|
|
||||||
? path.join(__dirname, 'preload.js')
|
|
||||||
: path.join(__dirname, '../../.erb/dll/preload.js'),
|
|
||||||
webSecurity: !store.get('ignore_cors'),
|
|
||||||
},
|
|
||||||
width: 1440,
|
|
||||||
...(nativeFrame && isLinux() && nativeFrameConfig.linux),
|
|
||||||
...(nativeFrame && isMacOS() && nativeFrameConfig.macOS),
|
|
||||||
...(nativeFrame && isWindows() && nativeFrameConfig.windows),
|
|
||||||
});
|
|
||||||
|
|
||||||
electronLocalShortcut.register(mainWindow, 'Ctrl+Shift+I', () => {
|
|
||||||
mainWindow?.webContents.openDevTools();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('window-dev-tools', () => {
|
|
||||||
mainWindow?.webContents.openDevTools();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('window-maximize', () => {
|
|
||||||
mainWindow?.maximize();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('window-unmaximize', () => {
|
|
||||||
mainWindow?.unmaximize();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('window-minimize', () => {
|
|
||||||
mainWindow?.minimize();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('window-close', () => {
|
|
||||||
mainWindow?.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('window-quit', () => {
|
|
||||||
mainWindow?.close();
|
|
||||||
app.exit();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('app-restart', () => {
|
|
||||||
// Fix for .AppImage
|
|
||||||
if (process.env.APPIMAGE) {
|
|
||||||
app.exit();
|
|
||||||
app.relaunch({
|
|
||||||
args: process.argv.slice(1).concat(['--appimage-extract-and-run']),
|
|
||||||
execPath: process.env.APPIMAGE,
|
|
||||||
});
|
|
||||||
app.exit(0);
|
|
||||||
} else {
|
|
||||||
app.relaunch();
|
|
||||||
app.exit(0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('global-media-keys-enable', () => {
|
|
||||||
enableMediaKeys(mainWindow);
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('global-media-keys-disable', () => {
|
|
||||||
disableMediaKeys();
|
|
||||||
});
|
|
||||||
|
|
||||||
ipcMain.on('player-restore-queue', () => {
|
|
||||||
if (store.get('resume')) {
|
|
||||||
const queueLocation = join(app.getPath('userData'), 'queue');
|
|
||||||
|
|
||||||
access(queueLocation, constants.F_OK, (accessError) => {
|
|
||||||
if (accessError) {
|
|
||||||
console.error('unable to access saved queue: ', accessError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
readFile(queueLocation, (readError, buffer) => {
|
|
||||||
if (readError) {
|
|
||||||
console.error('failed to read saved queue: ', readError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
inflate(buffer, (decompressError, data) => {
|
|
||||||
if (decompressError) {
|
|
||||||
console.error('failed to decompress queue: ', decompressError);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const queue = JSON.parse(data.toString());
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-restore-queue', queue);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const globalMediaKeysEnabled = store.get('global_media_hotkeys') as boolean;
|
|
||||||
|
|
||||||
if (globalMediaKeysEnabled !== false) {
|
|
||||||
enableMediaKeys(mainWindow);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainWindow.loadURL(resolveHtmlPath('index.html'));
|
|
||||||
|
|
||||||
mainWindow.on('ready-to-show', () => {
|
|
||||||
if (!mainWindow) {
|
|
||||||
throw new Error('"mainWindow" is not defined');
|
|
||||||
}
|
|
||||||
if (process.env.START_MINIMIZED) {
|
|
||||||
mainWindow.minimize();
|
|
||||||
} else {
|
|
||||||
mainWindow.show();
|
|
||||||
createWinThumbarButtons();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
|
||||||
mainWindow = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
let saved = false;
|
|
||||||
|
|
||||||
mainWindow.on('close', (event) => {
|
|
||||||
if (!exitFromTray && store.get('window_exit_to_tray')) {
|
|
||||||
if (isMacOS() && !forceQuit) {
|
|
||||||
exitFromTray = true;
|
|
||||||
}
|
|
||||||
event.preventDefault();
|
|
||||||
mainWindow?.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!saved && store.get('resume')) {
|
|
||||||
event.preventDefault();
|
|
||||||
saved = true;
|
|
||||||
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-save-queue');
|
|
||||||
|
|
||||||
ipcMain.once('player-save-queue', async (_event, data: Record<string, any>) => {
|
|
||||||
const queueLocation = join(app.getPath('userData'), 'queue');
|
|
||||||
const serialized = JSON.stringify(data);
|
|
||||||
|
|
||||||
try {
|
|
||||||
await new Promise<void>((resolve, reject) => {
|
|
||||||
deflate(serialized, { level: 1 }, (error, deflated) => {
|
|
||||||
if (error) {
|
|
||||||
reject(error);
|
|
||||||
} else {
|
|
||||||
writeFile(queueLocation, deflated, (writeError) => {
|
|
||||||
if (writeError) {
|
|
||||||
reject(writeError);
|
|
||||||
} else {
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error('error saving queue state: ', error);
|
|
||||||
} finally {
|
|
||||||
mainWindow?.close();
|
|
||||||
if (forceQuit) {
|
|
||||||
app.exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mainWindow.on('minimize', (event: any) => {
|
|
||||||
if (store.get('window_minimize_to_tray') === true) {
|
|
||||||
event.preventDefault();
|
|
||||||
mainWindow?.hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isWindows()) {
|
|
||||||
app.setAppUserModelId(process.execPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMacOS()) {
|
|
||||||
app.on('before-quit', () => {
|
|
||||||
forceQuit = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const menuBuilder = new MenuBuilder(mainWindow);
|
|
||||||
menuBuilder.buildMenu();
|
|
||||||
|
|
||||||
// Open urls in the user's browser
|
|
||||||
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
|
||||||
shell.openExternal(edata.url);
|
|
||||||
return { action: 'deny' };
|
|
||||||
});
|
|
||||||
|
|
||||||
if (store.get('disable_auto_updates') !== true) {
|
|
||||||
// eslint-disable-next-line
|
|
||||||
new AppUpdater();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
app.commandLine.appendSwitch('disable-features', 'HardwareMediaKeyHandling,MediaSessionService');
|
|
||||||
|
|
||||||
const MPV_BINARY_PATH = store.get('mpv_path') as string | undefined;
|
|
||||||
|
|
||||||
const prefetchPlaylistParams = [
|
|
||||||
'--prefetch-playlist=no',
|
|
||||||
'--prefetch-playlist=yes',
|
|
||||||
'--prefetch-playlist',
|
|
||||||
];
|
|
||||||
|
|
||||||
const DEFAULT_MPV_PARAMETERS = (extraParameters?: string[]) => {
|
|
||||||
const parameters = ['--idle=yes', '--no-config', '--load-scripts=no'];
|
|
||||||
|
|
||||||
if (!extraParameters?.some((param) => prefetchPlaylistParams.includes(param))) {
|
|
||||||
parameters.push('--prefetch-playlist=yes');
|
|
||||||
}
|
|
||||||
|
|
||||||
return parameters;
|
|
||||||
};
|
|
||||||
|
|
||||||
let mpvInstance: MpvAPI | null = null;
|
|
||||||
|
|
||||||
const createMpv = (data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
|
||||||
const { extraParameters, properties } = data;
|
|
||||||
|
|
||||||
const params = uniq([...DEFAULT_MPV_PARAMETERS(extraParameters), ...(extraParameters || [])]);
|
|
||||||
console.log('Setting mpv params: ', params);
|
|
||||||
|
|
||||||
const extra = isDevelopment ? '-dev' : '';
|
|
||||||
|
|
||||||
const mpv = new MpvAPI(
|
|
||||||
{
|
|
||||||
audio_only: true,
|
|
||||||
auto_restart: false,
|
|
||||||
binary: MPV_BINARY_PATH || '',
|
|
||||||
socket: isWindows() ? `\\\\.\\pipe\\mpvserver${extra}` : `/tmp/node-mpv${extra}.sock`,
|
|
||||||
time_update: 1,
|
|
||||||
},
|
|
||||||
params,
|
|
||||||
);
|
|
||||||
|
|
||||||
// eslint-disable-next-line promise/catch-or-return
|
|
||||||
mpv.start()
|
|
||||||
.catch((error) => {
|
|
||||||
console.log('MPV failed to start', error);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
console.log('Setting MPV properties: ', properties);
|
|
||||||
mpv.setMultipleProperties(properties || {});
|
|
||||||
});
|
|
||||||
|
|
||||||
mpv.on('status', (status, ...rest) => {
|
|
||||||
console.log('MPV Event: status', status.property, status.value, rest);
|
|
||||||
if (status.property === 'playlist-pos') {
|
|
||||||
if (status.value === -1) {
|
|
||||||
mpv?.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status.value !== 0) {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-auto-next');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Automatically updates the play button when the player is playing
|
|
||||||
mpv.on('resumed', () => {
|
|
||||||
console.log('MPV Event: resumed');
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-play');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Automatically updates the play button when the player is stopped
|
|
||||||
mpv.on('stopped', () => {
|
|
||||||
console.log('MPV Event: stopped');
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-stop');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Automatically updates the play button when the player is paused
|
|
||||||
mpv.on('paused', () => {
|
|
||||||
console.log('MPV Event: paused');
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-pause');
|
|
||||||
});
|
|
||||||
|
|
||||||
// Event output every interval set by time_update, used to update the current time
|
|
||||||
mpv.on('timeposition', (time: number) => {
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-current-time', time);
|
|
||||||
});
|
|
||||||
|
|
||||||
mpv.on('quit', () => {
|
|
||||||
console.log('MPV Event: quit');
|
|
||||||
});
|
|
||||||
|
|
||||||
return mpv;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getMpvInstance = () => {
|
|
||||||
return mpvInstance;
|
|
||||||
};
|
|
||||||
|
|
||||||
ipcMain.on('player-set-properties', async (_event, data: Record<string, any>) => {
|
|
||||||
if (data.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.length === 1) {
|
|
||||||
getMpvInstance()?.setProperty(Object.keys(data)[0], Object.values(data)[0]);
|
|
||||||
} else {
|
} else {
|
||||||
getMpvInstance()?.setMultipleProperties(data);
|
mainWindow.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on(
|
mainWindow.on('closed', () => {
|
||||||
'player-restart',
|
mainWindow = null;
|
||||||
async (_event, data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
});
|
||||||
mpvInstance?.quit();
|
|
||||||
mpvInstance = createMpv(data);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
ipcMain.on(
|
const menuBuilder = new MenuBuilder(mainWindow);
|
||||||
'player-initialize',
|
menuBuilder.buildMenu();
|
||||||
async (_event, data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
|
||||||
console.log('Initializing MPV with data: ', data);
|
|
||||||
mpvInstance = createMpv(data);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
ipcMain.on('player-quit', async () => {
|
// Open urls in the user's browser
|
||||||
mpvInstance?.stop();
|
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
||||||
mpvInstance?.quit();
|
shell.openExternal(edata.url);
|
||||||
mpvInstance = null;
|
return { action: 'deny' };
|
||||||
});
|
});
|
||||||
|
|
||||||
// Must duplicate with the one in renderer process settings.store.ts
|
// Remove this if your app does not use auto updates
|
||||||
enum BindingActions {
|
// eslint-disable-next-line
|
||||||
GLOBAL_SEARCH = 'globalSearch',
|
new AppUpdater();
|
||||||
LOCAL_SEARCH = 'localSearch',
|
|
||||||
MUTE = 'volumeMute',
|
|
||||||
NEXT = 'next',
|
|
||||||
PAUSE = 'pause',
|
|
||||||
PLAY = 'play',
|
|
||||||
PLAY_PAUSE = 'playPause',
|
|
||||||
PREVIOUS = 'previous',
|
|
||||||
SHUFFLE = 'toggleShuffle',
|
|
||||||
SKIP_BACKWARD = 'skipBackward',
|
|
||||||
SKIP_FORWARD = 'skipForward',
|
|
||||||
STOP = 'stop',
|
|
||||||
TOGGLE_FULLSCREEN_PLAYER = 'toggleFullscreenPlayer',
|
|
||||||
TOGGLE_QUEUE = 'toggleQueue',
|
|
||||||
TOGGLE_REPEAT = 'toggleRepeat',
|
|
||||||
VOLUME_DOWN = 'volumeDown',
|
|
||||||
VOLUME_UP = 'volumeUp',
|
|
||||||
}
|
|
||||||
|
|
||||||
const HOTKEY_ACTIONS: Record<BindingActions, () => void> = {
|
|
||||||
[BindingActions.MUTE]: () => getMainWindow()?.webContents.send('renderer-player-volume-mute'),
|
|
||||||
[BindingActions.NEXT]: () => getMainWindow()?.webContents.send('renderer-player-next'),
|
|
||||||
[BindingActions.PAUSE]: () => getMainWindow()?.webContents.send('renderer-player-pause'),
|
|
||||||
[BindingActions.PLAY]: () => getMainWindow()?.webContents.send('renderer-player-play'),
|
|
||||||
[BindingActions.PLAY_PAUSE]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-play-pause'),
|
|
||||||
[BindingActions.PREVIOUS]: () => getMainWindow()?.webContents.send('renderer-player-previous'),
|
|
||||||
[BindingActions.SHUFFLE]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-toggle-shuffle'),
|
|
||||||
[BindingActions.SKIP_BACKWARD]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-skip-backward'),
|
|
||||||
[BindingActions.SKIP_FORWARD]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-skip-forward'),
|
|
||||||
[BindingActions.STOP]: () => getMainWindow()?.webContents.send('renderer-player-stop'),
|
|
||||||
[BindingActions.TOGGLE_REPEAT]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-toggle-repeat'),
|
|
||||||
[BindingActions.VOLUME_UP]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-volume-up'),
|
|
||||||
[BindingActions.VOLUME_DOWN]: () =>
|
|
||||||
getMainWindow()?.webContents.send('renderer-player-volume-down'),
|
|
||||||
[BindingActions.GLOBAL_SEARCH]: () => {},
|
|
||||||
[BindingActions.LOCAL_SEARCH]: () => {},
|
|
||||||
[BindingActions.TOGGLE_QUEUE]: () => {},
|
|
||||||
[BindingActions.TOGGLE_FULLSCREEN_PLAYER]: () => {},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ipcMain.on(
|
/**
|
||||||
'set-global-shortcuts',
|
* Add event listeners...
|
||||||
(
|
*/
|
||||||
_event,
|
|
||||||
data: Record<BindingActions, { allowGlobal: boolean; hotkey: string; isGlobal: boolean }>,
|
|
||||||
) => {
|
|
||||||
// Since we're not tracking the previous shortcuts, we need to unregister all of them
|
|
||||||
globalShortcut.unregisterAll();
|
|
||||||
|
|
||||||
for (const shortcut of Object.keys(data)) {
|
app.commandLine.appendSwitch(
|
||||||
const isGlobalHotkey = data[shortcut as BindingActions].isGlobal;
|
'disable-features',
|
||||||
const isValidHotkey =
|
'HardwareMediaKeyHandling,MediaSessionService'
|
||||||
data[shortcut as BindingActions].hotkey &&
|
|
||||||
data[shortcut as BindingActions].hotkey !== '';
|
|
||||||
|
|
||||||
if (isGlobalHotkey && isValidHotkey) {
|
|
||||||
const accelerator = hotkeyToElectronAccelerator(
|
|
||||||
data[shortcut as BindingActions].hotkey,
|
|
||||||
);
|
|
||||||
|
|
||||||
globalShortcut.register(accelerator, () => {
|
|
||||||
HOTKEY_ACTIONS[shortcut as BindingActions]();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const globalMediaKeysEnabled = store.get('global_media_hotkeys') as boolean;
|
|
||||||
|
|
||||||
if (globalMediaKeysEnabled) {
|
|
||||||
enableMediaKeys(mainWindow);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
app.on('before-quit', () => {
|
export const getMainWindow = () => {
|
||||||
getMpvInstance()?.stop();
|
return mainWindow;
|
||||||
getMpvInstance()?.quit();
|
};
|
||||||
});
|
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
globalShortcut.unregisterAll();
|
// Respect the OSX convention of having the application in memory even
|
||||||
getMpvInstance()?.quit();
|
// after all windows have been closed
|
||||||
// Respect the OSX convention of having the application in memory even
|
if (process.platform !== 'darwin') {
|
||||||
// after all windows have been closed
|
app.quit();
|
||||||
if (isMacOS()) {
|
}
|
||||||
mainWindow = null;
|
|
||||||
} else {
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const FONT_HEADERS = [
|
app
|
||||||
'font/collection',
|
.whenReady()
|
||||||
'font/otf',
|
.then(() => {
|
||||||
'font/sfnt',
|
createWindow();
|
||||||
'font/ttf',
|
app.on('activate', () => {
|
||||||
'font/woff',
|
// On macOS it's common to re-create a window in the app when the
|
||||||
'font/woff2',
|
// dock icon is clicked and there are no other windows open.
|
||||||
];
|
if (mainWindow === null) createWindow();
|
||||||
|
});
|
||||||
app.whenReady()
|
})
|
||||||
.then(() => {
|
.catch(console.log);
|
||||||
protocol.handle('feishin', async (request) => {
|
|
||||||
const filePath = `file://${request.url.slice('feishin://'.length)}`;
|
|
||||||
const response = await net.fetch(filePath);
|
|
||||||
const contentType = response.headers.get('content-type');
|
|
||||||
|
|
||||||
if (!contentType || !FONT_HEADERS.includes(contentType)) {
|
|
||||||
getMainWindow()?.webContents.send('custom-font-error', filePath);
|
|
||||||
|
|
||||||
return new Response(null, {
|
|
||||||
status: 403,
|
|
||||||
statusText: 'Forbidden',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
|
|
||||||
createWindow();
|
|
||||||
createTray();
|
|
||||||
app.on('activate', () => {
|
|
||||||
// On macOS it's common to re-create a window in the app when the
|
|
||||||
// dock icon is clicked and there are no other windows open.
|
|
||||||
if (mainWindow === null) createWindow();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(console.log);
|
|
||||||
|
|||||||
@@ -1,279 +1,290 @@
|
|||||||
import { app, Menu, shell, BrowserWindow, MenuItemConstructorOptions } from 'electron';
|
import {
|
||||||
|
app,
|
||||||
|
Menu,
|
||||||
|
shell,
|
||||||
|
BrowserWindow,
|
||||||
|
MenuItemConstructorOptions,
|
||||||
|
} from 'electron';
|
||||||
|
|
||||||
interface DarwinMenuItemConstructorOptions extends MenuItemConstructorOptions {
|
interface DarwinMenuItemConstructorOptions extends MenuItemConstructorOptions {
|
||||||
selector?: string;
|
selector?: string;
|
||||||
submenu?: DarwinMenuItemConstructorOptions[] | Menu;
|
submenu?: DarwinMenuItemConstructorOptions[] | Menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class MenuBuilder {
|
export default class MenuBuilder {
|
||||||
mainWindow: BrowserWindow;
|
mainWindow: BrowserWindow;
|
||||||
|
|
||||||
constructor(mainWindow: BrowserWindow) {
|
constructor(mainWindow: BrowserWindow) {
|
||||||
this.mainWindow = mainWindow;
|
this.mainWindow = mainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
buildMenu(): Menu {
|
||||||
|
if (
|
||||||
|
process.env.NODE_ENV === 'development' ||
|
||||||
|
process.env.DEBUG_PROD === 'true'
|
||||||
|
) {
|
||||||
|
this.setupDevelopmentEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
buildMenu(): Menu {
|
const template =
|
||||||
if (process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true') {
|
process.platform === 'darwin'
|
||||||
this.setupDevelopmentEnvironment();
|
? this.buildDarwinTemplate()
|
||||||
}
|
: this.buildDefaultTemplate();
|
||||||
|
|
||||||
const template =
|
const menu = Menu.buildFromTemplate(template);
|
||||||
process.platform === 'darwin'
|
Menu.setApplicationMenu(menu);
|
||||||
? this.buildDarwinTemplate()
|
|
||||||
: this.buildDefaultTemplate();
|
|
||||||
|
|
||||||
const menu = Menu.buildFromTemplate(template);
|
return menu;
|
||||||
Menu.setApplicationMenu(menu);
|
}
|
||||||
|
|
||||||
return menu;
|
setupDevelopmentEnvironment(): void {
|
||||||
}
|
this.mainWindow.webContents.on('context-menu', (_, props) => {
|
||||||
|
const { x, y } = props;
|
||||||
|
|
||||||
setupDevelopmentEnvironment(): void {
|
Menu.buildFromTemplate([
|
||||||
this.mainWindow.webContents.on('context-menu', (_, props) => {
|
{
|
||||||
const { x, y } = props;
|
label: 'Inspect element',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.webContents.inspectElement(x, y);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]).popup({ window: this.mainWindow });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Menu.buildFromTemplate([
|
buildDarwinTemplate(): MenuItemConstructorOptions[] {
|
||||||
{
|
const subMenuAbout: DarwinMenuItemConstructorOptions = {
|
||||||
click: () => {
|
label: 'Electron',
|
||||||
this.mainWindow.webContents.inspectElement(x, y);
|
submenu: [
|
||||||
},
|
{
|
||||||
label: 'Inspect element',
|
label: 'About ElectronReact',
|
||||||
},
|
selector: 'orderFrontStandardAboutPanel:',
|
||||||
]).popup({ window: this.mainWindow });
|
},
|
||||||
});
|
{ type: 'separator' },
|
||||||
}
|
{ label: 'Services', submenu: [] },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Hide ElectronReact',
|
||||||
|
accelerator: 'Command+H',
|
||||||
|
selector: 'hide:',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Hide Others',
|
||||||
|
accelerator: 'Command+Shift+H',
|
||||||
|
selector: 'hideOtherApplications:',
|
||||||
|
},
|
||||||
|
{ label: 'Show All', selector: 'unhideAllApplications:' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Quit',
|
||||||
|
accelerator: 'Command+Q',
|
||||||
|
click: () => {
|
||||||
|
app.quit();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const subMenuEdit: DarwinMenuItemConstructorOptions = {
|
||||||
|
label: 'Edit',
|
||||||
|
submenu: [
|
||||||
|
{ label: 'Undo', accelerator: 'Command+Z', selector: 'undo:' },
|
||||||
|
{ label: 'Redo', accelerator: 'Shift+Command+Z', selector: 'redo:' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Cut', accelerator: 'Command+X', selector: 'cut:' },
|
||||||
|
{ label: 'Copy', accelerator: 'Command+C', selector: 'copy:' },
|
||||||
|
{ label: 'Paste', accelerator: 'Command+V', selector: 'paste:' },
|
||||||
|
{
|
||||||
|
label: 'Select All',
|
||||||
|
accelerator: 'Command+A',
|
||||||
|
selector: 'selectAll:',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const subMenuViewDev: MenuItemConstructorOptions = {
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Reload',
|
||||||
|
accelerator: 'Command+R',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.webContents.reload();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle Full Screen',
|
||||||
|
accelerator: 'Ctrl+Command+F',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Toggle Developer Tools',
|
||||||
|
accelerator: 'Alt+Command+I',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.webContents.toggleDevTools();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const subMenuViewProd: MenuItemConstructorOptions = {
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Toggle Full Screen',
|
||||||
|
accelerator: 'Ctrl+Command+F',
|
||||||
|
click: () => {
|
||||||
|
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const subMenuWindow: DarwinMenuItemConstructorOptions = {
|
||||||
|
label: 'Window',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Minimize',
|
||||||
|
accelerator: 'Command+M',
|
||||||
|
selector: 'performMiniaturize:',
|
||||||
|
},
|
||||||
|
{ label: 'Close', accelerator: 'Command+W', selector: 'performClose:' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ label: 'Bring All to Front', selector: 'arrangeInFront:' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const subMenuHelp: MenuItemConstructorOptions = {
|
||||||
|
label: 'Help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Learn More',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://electronjs.org');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Documentation',
|
||||||
|
click() {
|
||||||
|
shell.openExternal(
|
||||||
|
'https://github.com/electron/electron/tree/main/docs#readme'
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Community Discussions',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://www.electronjs.org/community');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Search Issues',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://github.com/electron/electron/issues');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
buildDarwinTemplate(): MenuItemConstructorOptions[] {
|
const subMenuView =
|
||||||
const subMenuAbout: DarwinMenuItemConstructorOptions = {
|
process.env.NODE_ENV === 'development' ||
|
||||||
label: 'Electron',
|
process.env.DEBUG_PROD === 'true'
|
||||||
submenu: [
|
? subMenuViewDev
|
||||||
{
|
: subMenuViewProd;
|
||||||
label: 'About ElectronReact',
|
|
||||||
selector: 'orderFrontStandardAboutPanel:',
|
|
||||||
},
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ label: 'Services', submenu: [] },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{
|
|
||||||
accelerator: 'Command+H',
|
|
||||||
label: 'Hide ElectronReact',
|
|
||||||
selector: 'hide:',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accelerator: 'Command+Shift+H',
|
|
||||||
label: 'Hide Others',
|
|
||||||
selector: 'hideOtherApplications:',
|
|
||||||
},
|
|
||||||
{ label: 'Show All', selector: 'unhideAllApplications:' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{
|
|
||||||
accelerator: 'Command+Q',
|
|
||||||
click: () => {
|
|
||||||
app.quit();
|
|
||||||
},
|
|
||||||
label: 'Quit',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuEdit: DarwinMenuItemConstructorOptions = {
|
|
||||||
label: 'Edit',
|
|
||||||
submenu: [
|
|
||||||
{ accelerator: 'Command+Z', label: 'Undo', selector: 'undo:' },
|
|
||||||
{ accelerator: 'Shift+Command+Z', label: 'Redo', selector: 'redo:' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ accelerator: 'Command+X', label: 'Cut', selector: 'cut:' },
|
|
||||||
{ accelerator: 'Command+C', label: 'Copy', selector: 'copy:' },
|
|
||||||
{ accelerator: 'Command+V', label: 'Paste', selector: 'paste:' },
|
|
||||||
{
|
|
||||||
accelerator: 'Command+A',
|
|
||||||
label: 'Select All',
|
|
||||||
selector: 'selectAll:',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuViewDev: MenuItemConstructorOptions = {
|
|
||||||
label: 'View',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
accelerator: 'Command+R',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.reload();
|
|
||||||
},
|
|
||||||
label: 'Reload',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accelerator: 'Ctrl+Command+F',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
|
||||||
},
|
|
||||||
label: 'Toggle Full Screen',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
accelerator: 'Alt+Command+I',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.webContents.toggleDevTools();
|
|
||||||
},
|
|
||||||
label: 'Toggle Developer Tools',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuViewProd: MenuItemConstructorOptions = {
|
|
||||||
label: 'View',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
accelerator: 'Ctrl+Command+F',
|
|
||||||
click: () => {
|
|
||||||
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
|
|
||||||
},
|
|
||||||
label: 'Toggle Full Screen',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuWindow: DarwinMenuItemConstructorOptions = {
|
|
||||||
label: 'Window',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
accelerator: 'Command+M',
|
|
||||||
label: 'Minimize',
|
|
||||||
selector: 'performMiniaturize:',
|
|
||||||
},
|
|
||||||
{ accelerator: 'Command+W', label: 'Close', selector: 'performClose:' },
|
|
||||||
{ type: 'separator' },
|
|
||||||
{ label: 'Bring All to Front', selector: 'arrangeInFront:' },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
const subMenuHelp: MenuItemConstructorOptions = {
|
|
||||||
label: 'Help',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://electronjs.org');
|
|
||||||
},
|
|
||||||
label: 'Learn More',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal(
|
|
||||||
'https://github.com/electron/electron/tree/main/docs#readme',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
label: 'Documentation',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://www.electronjs.org/community');
|
|
||||||
},
|
|
||||||
label: 'Community Discussions',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://github.com/electron/electron/issues');
|
|
||||||
},
|
|
||||||
label: 'Search Issues',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
const subMenuView =
|
return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp];
|
||||||
process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true'
|
}
|
||||||
? subMenuViewDev
|
|
||||||
: subMenuViewProd;
|
|
||||||
|
|
||||||
return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp];
|
buildDefaultTemplate() {
|
||||||
}
|
const templateDefault = [
|
||||||
|
{
|
||||||
buildDefaultTemplate() {
|
label: '&File',
|
||||||
const templateDefault = [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: '&File',
|
label: '&Open',
|
||||||
submenu: [
|
accelerator: 'Ctrl+O',
|
||||||
{
|
},
|
||||||
accelerator: 'Ctrl+O',
|
{
|
||||||
label: '&Open',
|
label: '&Close',
|
||||||
},
|
accelerator: 'Ctrl+W',
|
||||||
{
|
click: () => {
|
||||||
accelerator: 'Ctrl+W',
|
this.mainWindow.close();
|
||||||
click: () => {
|
|
||||||
this.mainWindow.close();
|
|
||||||
},
|
|
||||||
label: '&Close',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
label: '&View',
|
],
|
||||||
submenu:
|
},
|
||||||
process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true'
|
{
|
||||||
? [
|
label: '&View',
|
||||||
{
|
submenu:
|
||||||
accelerator: 'Ctrl+R',
|
process.env.NODE_ENV === 'development' ||
|
||||||
click: () => {
|
process.env.DEBUG_PROD === 'true'
|
||||||
this.mainWindow.webContents.reload();
|
? [
|
||||||
},
|
{
|
||||||
label: '&Reload',
|
label: '&Reload',
|
||||||
},
|
accelerator: 'Ctrl+R',
|
||||||
{
|
click: () => {
|
||||||
accelerator: 'F11',
|
this.mainWindow.webContents.reload();
|
||||||
click: () => {
|
},
|
||||||
this.mainWindow.setFullScreen(
|
},
|
||||||
!this.mainWindow.isFullScreen(),
|
{
|
||||||
);
|
label: 'Toggle &Full Screen',
|
||||||
},
|
accelerator: 'F11',
|
||||||
label: 'Toggle &Full Screen',
|
click: () => {
|
||||||
},
|
this.mainWindow.setFullScreen(
|
||||||
{
|
!this.mainWindow.isFullScreen()
|
||||||
accelerator: 'Alt+Ctrl+I',
|
);
|
||||||
click: () => {
|
},
|
||||||
this.mainWindow.webContents.toggleDevTools();
|
},
|
||||||
},
|
{
|
||||||
label: 'Toggle &Developer Tools',
|
label: 'Toggle &Developer Tools',
|
||||||
},
|
accelerator: 'Alt+Ctrl+I',
|
||||||
]
|
click: () => {
|
||||||
: [
|
this.mainWindow.webContents.toggleDevTools();
|
||||||
{
|
},
|
||||||
accelerator: 'F11',
|
},
|
||||||
click: () => {
|
]
|
||||||
this.mainWindow.setFullScreen(
|
: [
|
||||||
!this.mainWindow.isFullScreen(),
|
{
|
||||||
);
|
label: 'Toggle &Full Screen',
|
||||||
},
|
accelerator: 'F11',
|
||||||
label: 'Toggle &Full Screen',
|
click: () => {
|
||||||
},
|
this.mainWindow.setFullScreen(
|
||||||
],
|
!this.mainWindow.isFullScreen()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Learn More',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://electronjs.org');
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
label: 'Help',
|
{
|
||||||
submenu: [
|
label: 'Documentation',
|
||||||
{
|
click() {
|
||||||
click() {
|
shell.openExternal(
|
||||||
shell.openExternal('https://electronjs.org');
|
'https://github.com/electron/electron/tree/main/docs#readme'
|
||||||
},
|
);
|
||||||
label: 'Learn More',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal(
|
|
||||||
'https://github.com/electron/electron/tree/main/docs#readme',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
label: 'Documentation',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://www.electronjs.org/community');
|
|
||||||
},
|
|
||||||
label: 'Community Discussions',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
click() {
|
|
||||||
shell.openExternal('https://github.com/electron/electron/issues');
|
|
||||||
},
|
|
||||||
label: 'Search Issues',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
];
|
},
|
||||||
|
{
|
||||||
|
label: 'Community Discussions',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://www.electronjs.org/community');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Search Issues',
|
||||||
|
click() {
|
||||||
|
shell.openExternal('https://github.com/electron/electron/issues');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
return templateDefault;
|
return templateDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,74 @@
|
|||||||
import { contextBridge } from 'electron';
|
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
||||||
import { browser } from './preload/browser';
|
import { PlayerData } from 'renderer/store';
|
||||||
import { discordRpc } from './preload/discord-rpc';
|
|
||||||
import { ipc } from './preload/ipc';
|
|
||||||
import { localSettings } from './preload/local-settings';
|
|
||||||
import { lyrics } from './preload/lyrics';
|
|
||||||
import { mpris } from './preload/mpris';
|
|
||||||
import { mpvPlayer, mpvPlayerListener } from './preload/mpv-player';
|
|
||||||
import { remote } from './preload/remote';
|
|
||||||
import { utils } from './preload/utils';
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('electron', {
|
contextBridge.exposeInMainWorld('electron', {
|
||||||
browser,
|
ipcRenderer: {
|
||||||
discordRpc,
|
PLAYER_CURRENT_TIME() {
|
||||||
ipc,
|
ipcRenderer.send('player-current-time');
|
||||||
localSettings,
|
},
|
||||||
lyrics,
|
PLAYER_MUTE() {
|
||||||
mpris,
|
ipcRenderer.send('player-mute');
|
||||||
mpvPlayer,
|
},
|
||||||
mpvPlayerListener,
|
PLAYER_NEXT() {
|
||||||
remote,
|
ipcRenderer.send('player-next');
|
||||||
utils,
|
},
|
||||||
|
PLAYER_PAUSE() {
|
||||||
|
ipcRenderer.send('player-pause');
|
||||||
|
},
|
||||||
|
PLAYER_PLAY() {
|
||||||
|
ipcRenderer.send('player-play');
|
||||||
|
},
|
||||||
|
PLAYER_PREVIOUS() {
|
||||||
|
ipcRenderer.send('player-previous');
|
||||||
|
},
|
||||||
|
PLAYER_SEEK(seconds: number) {
|
||||||
|
ipcRenderer.send('player-seek', seconds);
|
||||||
|
},
|
||||||
|
PLAYER_SEEK_TO(seconds: number) {
|
||||||
|
ipcRenderer.send('player-seek-to', seconds);
|
||||||
|
},
|
||||||
|
PLAYER_SET_QUEUE(data: PlayerData) {
|
||||||
|
ipcRenderer.send('player-set-queue', data);
|
||||||
|
},
|
||||||
|
PLAYER_SET_QUEUE_NEXT(data: PlayerData) {
|
||||||
|
ipcRenderer.send('player-set-queue-next', data);
|
||||||
|
},
|
||||||
|
PLAYER_STOP() {
|
||||||
|
ipcRenderer.send('player-stop');
|
||||||
|
},
|
||||||
|
PLAYER_VOLUME(value: number) {
|
||||||
|
ipcRenderer.send('player-volume', value);
|
||||||
|
},
|
||||||
|
RENDERER_PLAYER_CURRENT_TIME(
|
||||||
|
cb: (event: IpcRendererEvent, data: any) => void
|
||||||
|
) {
|
||||||
|
ipcRenderer.on('renderer-player-current-time', cb);
|
||||||
|
},
|
||||||
|
RENDERER_PLAYER_PAUSE(cb: (event: IpcRendererEvent, data: any) => void) {
|
||||||
|
ipcRenderer.on('renderer-player-pause', cb);
|
||||||
|
},
|
||||||
|
RENDERER_PLAYER_PLAY(cb: (event: IpcRendererEvent, data: any) => void) {
|
||||||
|
ipcRenderer.on('renderer-player-play', cb);
|
||||||
|
},
|
||||||
|
RENDERER_PLAYER_SET_QUEUE_NEXT(
|
||||||
|
cb: (event: IpcRendererEvent, data: any) => void
|
||||||
|
) {
|
||||||
|
ipcRenderer.on('renderer-player-set-queue-next', cb);
|
||||||
|
},
|
||||||
|
RENDERER_PLAYER_STOP(cb: (event: IpcRendererEvent, data: any) => void) {
|
||||||
|
ipcRenderer.on('renderer-player-stop', cb);
|
||||||
|
},
|
||||||
|
windowClose() {
|
||||||
|
ipcRenderer.send('window-close');
|
||||||
|
},
|
||||||
|
windowMaximize() {
|
||||||
|
ipcRenderer.send('window-maximize');
|
||||||
|
},
|
||||||
|
windowMinimize() {
|
||||||
|
ipcRenderer.send('window-minimize');
|
||||||
|
},
|
||||||
|
windowUnmaximize() {
|
||||||
|
ipcRenderer.send('window-unmaximize');
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
|
||||||
|
|
||||||
const exit = () => {
|
|
||||||
ipcRenderer.send('window-close');
|
|
||||||
};
|
|
||||||
|
|
||||||
const maximize = () => {
|
|
||||||
ipcRenderer.send('window-maximize');
|
|
||||||
};
|
|
||||||
|
|
||||||
const minimize = () => {
|
|
||||||
ipcRenderer.send('window-minimize');
|
|
||||||
};
|
|
||||||
|
|
||||||
const unmaximize = () => {
|
|
||||||
ipcRenderer.send('window-unmaximize');
|
|
||||||
};
|
|
||||||
|
|
||||||
const quit = () => {
|
|
||||||
ipcRenderer.send('window-quit');
|
|
||||||
};
|
|
||||||
|
|
||||||
const devtools = () => {
|
|
||||||
ipcRenderer.send('window-dev-tools');
|
|
||||||
};
|
|
||||||
|
|
||||||
export const browser = {
|
|
||||||
devtools,
|
|
||||||
exit,
|
|
||||||
maximize,
|
|
||||||
minimize,
|
|
||||||
quit,
|
|
||||||
unmaximize,
|
|
||||||
};
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
import { SetActivity } from '@xhayper/discord-rpc';
|
|
||||||
import { ipcRenderer } from 'electron';
|
|
||||||
|
|
||||||
const initialize = (clientId: string) => {
|
|
||||||
const client = ipcRenderer.invoke('discord-rpc-initialize', clientId);
|
|
||||||
return client;
|
|
||||||
};
|
|
||||||
|
|
||||||
const clearActivity = () => {
|
|
||||||
ipcRenderer.invoke('discord-rpc-clear-activity');
|
|
||||||
};
|
|
||||||
|
|
||||||
const setActivity = (activity: SetActivity) => {
|
|
||||||
ipcRenderer.invoke('discord-rpc-set-activity', activity);
|
|
||||||
};
|
|
||||||
|
|
||||||
const quit = () => {
|
|
||||||
ipcRenderer.invoke('discord-rpc-quit');
|
|
||||||
};
|
|
||||||
|
|
||||||
export const discordRpc = {
|
|
||||||
clearActivity,
|
|
||||||
initialize,
|
|
||||||
quit,
|
|
||||||
setActivity,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DiscordRpc = typeof discordRpc;
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
|
||||||
|
|
||||||
const removeAllListeners = (channel: string) => {
|
|
||||||
ipcRenderer.removeAllListeners(channel);
|
|
||||||
};
|
|
||||||
|
|
||||||
const send = (channel: string, ...args: any[]) => {
|
|
||||||
ipcRenderer.send(channel, ...args);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ipc = {
|
|
||||||
removeAllListeners,
|
|
||||||
send,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Ipc = typeof ipc;
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
import { IpcRendererEvent, ipcRenderer, webFrame } from 'electron';
|
|
||||||
import Store from 'electron-store';
|
|
||||||
|
|
||||||
const store = new Store();
|
|
||||||
|
|
||||||
const set = (property: string, value: string | Record<string, unknown> | boolean | string[]) => {
|
|
||||||
store.set(`${property}`, value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const get = (property: string) => {
|
|
||||||
return store.get(`${property}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const restart = () => {
|
|
||||||
ipcRenderer.send('app-restart');
|
|
||||||
};
|
|
||||||
|
|
||||||
const enableMediaKeys = () => {
|
|
||||||
ipcRenderer.send('global-media-keys-enable');
|
|
||||||
};
|
|
||||||
|
|
||||||
const disableMediaKeys = () => {
|
|
||||||
ipcRenderer.send('global-media-keys-disable');
|
|
||||||
};
|
|
||||||
|
|
||||||
const passwordGet = async (server: string): Promise<string | null> => {
|
|
||||||
return ipcRenderer.invoke('password-get', server);
|
|
||||||
};
|
|
||||||
|
|
||||||
const passwordRemove = (server: string) => {
|
|
||||||
ipcRenderer.send('password-remove', server);
|
|
||||||
};
|
|
||||||
|
|
||||||
const passwordSet = async (password: string, server: string): Promise<boolean> => {
|
|
||||||
return ipcRenderer.invoke('password-set', password, server);
|
|
||||||
};
|
|
||||||
|
|
||||||
const setZoomFactor = (zoomFactor: number) => {
|
|
||||||
webFrame.setZoomFactor(zoomFactor / 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fontError = (cb: (event: IpcRendererEvent, file: string) => void) => {
|
|
||||||
ipcRenderer.on('custom-font-error', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const localSettings = {
|
|
||||||
disableMediaKeys,
|
|
||||||
enableMediaKeys,
|
|
||||||
fontError,
|
|
||||||
get,
|
|
||||||
passwordGet,
|
|
||||||
passwordRemove,
|
|
||||||
passwordSet,
|
|
||||||
restart,
|
|
||||||
set,
|
|
||||||
setZoomFactor,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type LocalSettings = typeof localSettings;
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
import { ipcRenderer } from 'electron';
|
|
||||||
import {
|
|
||||||
InternetProviderLyricSearchResponse,
|
|
||||||
LyricGetQuery,
|
|
||||||
LyricSearchQuery,
|
|
||||||
LyricSource,
|
|
||||||
QueueSong,
|
|
||||||
} from '/@/renderer/api/types';
|
|
||||||
|
|
||||||
const getRemoteLyricsBySong = (song: QueueSong) => {
|
|
||||||
const result = ipcRenderer.invoke('lyric-by-song', song);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
const searchRemoteLyrics = (
|
|
||||||
params: LyricSearchQuery,
|
|
||||||
): Promise<Record<LyricSource, InternetProviderLyricSearchResponse[]>> => {
|
|
||||||
const result = ipcRenderer.invoke('lyric-search', params);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getRemoteLyricsByRemoteId = (id: LyricGetQuery) => {
|
|
||||||
const result = ipcRenderer.invoke('lyric-by-remote-id', id);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const lyrics = {
|
|
||||||
getRemoteLyricsByRemoteId,
|
|
||||||
getRemoteLyricsBySong,
|
|
||||||
searchRemoteLyrics,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Lyrics = typeof lyrics;
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
import { IpcRendererEvent, ipcRenderer } from 'electron';
|
|
||||||
import type { PlayerRepeat } from '/@/renderer/types';
|
|
||||||
|
|
||||||
const updatePosition = (timeSec: number) => {
|
|
||||||
ipcRenderer.send('mpris-update-position', timeSec);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateSeek = (timeSec: number) => {
|
|
||||||
ipcRenderer.send('mpris-update-seek', timeSec);
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleRepeat = () => {
|
|
||||||
ipcRenderer.send('mpris-toggle-repeat');
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleShuffle = () => {
|
|
||||||
ipcRenderer.send('mpris-toggle-shuffle');
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestToggleRepeat = (
|
|
||||||
cb: (event: IpcRendererEvent, data: { repeat: PlayerRepeat }) => void,
|
|
||||||
) => {
|
|
||||||
ipcRenderer.on('mpris-request-toggle-repeat', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestToggleShuffle = (
|
|
||||||
cb: (event: IpcRendererEvent, data: { shuffle: boolean }) => void,
|
|
||||||
) => {
|
|
||||||
ipcRenderer.on('mpris-request-toggle-shuffle', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mpris = {
|
|
||||||
requestToggleRepeat,
|
|
||||||
requestToggleShuffle,
|
|
||||||
toggleRepeat,
|
|
||||||
toggleShuffle,
|
|
||||||
updatePosition,
|
|
||||||
updateSeek,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Mpris = typeof mpris;
|
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
import { ipcRenderer, IpcRendererEvent } from 'electron';
|
|
||||||
import { PlayerData, PlayerState } from '/@/renderer/store';
|
|
||||||
|
|
||||||
const initialize = (data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
|
||||||
ipcRenderer.send('player-initialize', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const restart = (data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
|
|
||||||
ipcRenderer.send('player-restart', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const isRunning = () => {
|
|
||||||
return ipcRenderer.invoke('player-is-running');
|
|
||||||
};
|
|
||||||
|
|
||||||
const cleanup = () => {
|
|
||||||
return ipcRenderer.invoke('player-clean-up');
|
|
||||||
};
|
|
||||||
|
|
||||||
const setProperties = (data: Record<string, any>) => {
|
|
||||||
console.log('Setting property :>>', data);
|
|
||||||
ipcRenderer.send('player-set-properties', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const autoNext = (data: PlayerData) => {
|
|
||||||
ipcRenderer.send('player-auto-next', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const currentTime = () => {
|
|
||||||
ipcRenderer.send('player-current-time');
|
|
||||||
};
|
|
||||||
|
|
||||||
const mute = (mute: boolean) => {
|
|
||||||
ipcRenderer.send('player-mute', mute);
|
|
||||||
};
|
|
||||||
|
|
||||||
const next = () => {
|
|
||||||
ipcRenderer.send('player-next');
|
|
||||||
};
|
|
||||||
|
|
||||||
const pause = () => {
|
|
||||||
ipcRenderer.send('player-pause');
|
|
||||||
};
|
|
||||||
|
|
||||||
const play = () => {
|
|
||||||
ipcRenderer.send('player-play');
|
|
||||||
};
|
|
||||||
|
|
||||||
const previous = () => {
|
|
||||||
ipcRenderer.send('player-previous');
|
|
||||||
};
|
|
||||||
|
|
||||||
const restoreQueue = () => {
|
|
||||||
ipcRenderer.send('player-restore-queue');
|
|
||||||
};
|
|
||||||
|
|
||||||
const saveQueue = (data: Record<string, any>) => {
|
|
||||||
ipcRenderer.send('player-save-queue', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const seek = (seconds: number) => {
|
|
||||||
ipcRenderer.send('player-seek', seconds);
|
|
||||||
};
|
|
||||||
|
|
||||||
const seekTo = (seconds: number) => {
|
|
||||||
ipcRenderer.send('player-seek-to', seconds);
|
|
||||||
};
|
|
||||||
|
|
||||||
const setQueue = (data: PlayerData, pause?: boolean) => {
|
|
||||||
ipcRenderer.send('player-set-queue', data, pause);
|
|
||||||
};
|
|
||||||
|
|
||||||
const setQueueNext = (data: PlayerData) => {
|
|
||||||
ipcRenderer.send('player-set-queue-next', data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const stop = () => {
|
|
||||||
ipcRenderer.send('player-stop');
|
|
||||||
};
|
|
||||||
|
|
||||||
const volume = (value: number) => {
|
|
||||||
ipcRenderer.send('player-volume', value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const quit = () => {
|
|
||||||
ipcRenderer.send('player-quit');
|
|
||||||
};
|
|
||||||
|
|
||||||
const getCurrentTime = async () => {
|
|
||||||
return ipcRenderer.invoke('player-get-time');
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererAutoNext = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-auto-next', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererCurrentTime = (cb: (event: IpcRendererEvent, data: number) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-current-time', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererNext = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-next', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererPause = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-pause', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererPlay = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-play', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererPlayPause = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-play-pause', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererPrevious = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-previous', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererStop = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-stop', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererSkipForward = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-skip-forward', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererSkipBackward = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-skip-backward', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererVolumeUp = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-volume-up', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererVolumeDown = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-volume-down', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererVolumeMute = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-volume-mute', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererToggleRepeat = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-toggle-repeat', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererToggleShuffle = (cb: (event: IpcRendererEvent, data: PlayerData) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-toggle-shuffle', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererQuit = (cb: (event: IpcRendererEvent) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-quit', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererSaveQueue = (cb: (event: IpcRendererEvent) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-save-queue', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererRestoreQueue = (
|
|
||||||
cb: (event: IpcRendererEvent, data: Partial<PlayerState>) => void,
|
|
||||||
) => {
|
|
||||||
ipcRenderer.on('renderer-player-restore-queue', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const rendererError = (cb: (event: IpcRendererEvent, data: string) => void) => {
|
|
||||||
ipcRenderer.on('renderer-player-error', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mpvPlayer = {
|
|
||||||
autoNext,
|
|
||||||
cleanup,
|
|
||||||
currentTime,
|
|
||||||
getCurrentTime,
|
|
||||||
initialize,
|
|
||||||
isRunning,
|
|
||||||
mute,
|
|
||||||
next,
|
|
||||||
pause,
|
|
||||||
play,
|
|
||||||
previous,
|
|
||||||
quit,
|
|
||||||
restart,
|
|
||||||
restoreQueue,
|
|
||||||
saveQueue,
|
|
||||||
seek,
|
|
||||||
seekTo,
|
|
||||||
setProperties,
|
|
||||||
setQueue,
|
|
||||||
setQueueNext,
|
|
||||||
stop,
|
|
||||||
volume,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const mpvPlayerListener = {
|
|
||||||
rendererAutoNext,
|
|
||||||
rendererCurrentTime,
|
|
||||||
rendererError,
|
|
||||||
rendererNext,
|
|
||||||
rendererPause,
|
|
||||||
rendererPlay,
|
|
||||||
rendererPlayPause,
|
|
||||||
rendererPrevious,
|
|
||||||
rendererQuit,
|
|
||||||
rendererRestoreQueue,
|
|
||||||
rendererSaveQueue,
|
|
||||||
rendererSkipBackward,
|
|
||||||
rendererSkipForward,
|
|
||||||
rendererStop,
|
|
||||||
rendererToggleRepeat,
|
|
||||||
rendererToggleShuffle,
|
|
||||||
rendererVolumeDown,
|
|
||||||
rendererVolumeMute,
|
|
||||||
rendererVolumeUp,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type MpvPLayer = typeof mpvPlayer;
|
|
||||||
export type MpvPlayerListener = typeof mpvPlayerListener;
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
import { IpcRendererEvent, ipcRenderer } from 'electron';
|
|
||||||
import { SongUpdate } from '/@/renderer/types';
|
|
||||||
|
|
||||||
const requestFavorite = (
|
|
||||||
cb: (
|
|
||||||
event: IpcRendererEvent,
|
|
||||||
data: { favorite: boolean; id: string; serverId: string },
|
|
||||||
) => void,
|
|
||||||
) => {
|
|
||||||
ipcRenderer.on('request-favorite', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestPosition = (cb: (event: IpcRendererEvent, data: { position: number }) => void) => {
|
|
||||||
ipcRenderer.on('request-position', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestRating = (
|
|
||||||
cb: (event: IpcRendererEvent, data: { id: string; rating: number; serverId: string }) => void,
|
|
||||||
) => {
|
|
||||||
ipcRenderer.on('request-rating', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestSeek = (cb: (event: IpcRendererEvent, data: { offset: number }) => void) => {
|
|
||||||
ipcRenderer.on('request-seek', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const requestVolume = (cb: (event: IpcRendererEvent, data: { volume: number }) => void) => {
|
|
||||||
ipcRenderer.on('request-volume', cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
const setRemoteEnabled = (enabled: boolean): Promise<string | null> => {
|
|
||||||
const result = ipcRenderer.invoke('remote-enable', enabled);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setRemotePort = (port: number): Promise<string | null> => {
|
|
||||||
const result = ipcRenderer.invoke('remote-port', port);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateFavorite = (favorite: boolean, serverId: string, ids: string[]) => {
|
|
||||||
ipcRenderer.send('update-favorite', favorite, serverId, ids);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updatePassword = (password: string) => {
|
|
||||||
ipcRenderer.send('remote-password', password);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateSetting = (
|
|
||||||
enabled: boolean,
|
|
||||||
port: number,
|
|
||||||
username: string,
|
|
||||||
password: string,
|
|
||||||
): Promise<string | null> => {
|
|
||||||
return ipcRenderer.invoke('remote-settings', enabled, port, username, password);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateRating = (rating: number, serverId: string, ids: string[]) => {
|
|
||||||
ipcRenderer.send('update-rating', rating, serverId, ids);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateRepeat = (repeat: string) => {
|
|
||||||
ipcRenderer.send('update-repeat', repeat);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateShuffle = (shuffle: boolean) => {
|
|
||||||
ipcRenderer.send('update-shuffle', shuffle);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateSong = (args: SongUpdate) => {
|
|
||||||
ipcRenderer.send('update-song', args);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateUsername = (username: string) => {
|
|
||||||
ipcRenderer.send('remote-username', username);
|
|
||||||
};
|
|
||||||
|
|
||||||
const updateVolume = (volume: number) => {
|
|
||||||
ipcRenderer.send('update-volume', volume);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const remote = {
|
|
||||||
requestFavorite,
|
|
||||||
requestPosition,
|
|
||||||
requestRating,
|
|
||||||
requestSeek,
|
|
||||||
requestVolume,
|
|
||||||
setRemoteEnabled,
|
|
||||||
setRemotePort,
|
|
||||||
updateFavorite,
|
|
||||||
updatePassword,
|
|
||||||
updateRating,
|
|
||||||
updateRepeat,
|
|
||||||
updateSetting,
|
|
||||||
updateShuffle,
|
|
||||||
updateSong,
|
|
||||||
updateUsername,
|
|
||||||
updateVolume,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Remote = typeof remote;
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { isMacOS, isWindows, isLinux } from '../utils';
|
|
||||||
|
|
||||||
export const utils = {
|
|
||||||
isLinux,
|
|
||||||
isMacOS,
|
|
||||||
isWindows,
|
|
||||||
};
|
|
||||||
|
|
||||||
export type Utils = typeof utils;
|
|
||||||