Move server directory outside of frontend src

This commit is contained in:
jeffvli 2022-10-25 16:52:45 -07:00
parent 863dce88b7
commit 0438f2d5f2
105 changed files with 16946 additions and 6901 deletions

58
server/.eslintrc.js Normal file
View File

@ -0,0 +1,58 @@
module.exports = {
extends: ['plugin:typescript-sort-keys/recommended'],
ignorePatterns: [],
parser: '@typescript-eslint/parser',
parserOptions: {
createDefaultProgram: true,
ecmaVersion: 2020,
project: './tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'import', 'sort-keys-fix'],
root: true,
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-shadow': ['off'],
'import/no-cycle': 'error',
'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',
},
],
},
],
'import/prefer-default-export': 'off',
'no-await-in-loop': 'off',
'no-console': 'off',
'no-nested-ternary': 'off',
'no-restricted-syntax': 'off',
'sort-keys-fix/sort-keys-fix': 'warn',
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
'import/resolver': {
// See https://github.com/benmosher/eslint-plugin-import/issues/1396#issuecomment-575727774 for line below
node: {
extensions: ['.js', '.ts'],
paths: ['node_modules/', 'node_modules/@types'],
},
typescript: {},
},
},
};

View File

@ -33,7 +33,7 @@ const getSubsonicStreamUrl = (
`?id=${remoteId}` +
`&${token}` +
`&v=1.13.0` +
`&c=sonixd_${deviceId}`
`&c=Feishin_${deviceId}`
);
};
@ -52,7 +52,7 @@ const getJellyfinStreamUrl = (
`&container=opus,mp3,aac,m4a,m4b,flac,wav,ogg` +
`&transcodingContainer=ts` +
`&transcodingProtocol=hls` +
`&deviceId=sonixd_${deviceId}` +
`&deviceId=Feishin_${deviceId}` +
`&playSessionId=${deviceId}` +
`&api_key=${token}`
);
@ -108,7 +108,7 @@ const imageUrl = (
`?id=${imageId}` +
`&size=250` +
`&v=1.13.0` +
`&c=sonixd` +
`&c=Feishin` +
`&${token}`
);
}

16856
server/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
{
"name": "sonixd-server",
"name": "feishin-server",
"version": "1.0.0-alpha1",
"description": "A full-featured Subsonic/Jellyfin compatible music player",
"main": "server.js",
@ -24,10 +24,11 @@
"prisma": {
"seed": "ts-node prisma/seed.ts"
},
"license": "ISC",
"license": "GPL-3.0",
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/bcryptjs": "^2.4.2",
"@types/better-queue": "^3.8.3",
"@types/cookie-parser": "^1.4.3",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.14",
@ -37,7 +38,17 @@
"@types/passport-jwt": "^3.0.7",
"@types/passport-local": "^1.0.34",
"@typescript-eslint/parser": "^5.40.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-erb": "^4.0.3",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-compat": "^4.0.2",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-n": "^15.3.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-typescript-sort-keys": "^2.1.0",
"nodemon": "^2.0.20",
"prisma": "^4.5.0",
"ts-node": "^10.9.1",
@ -47,7 +58,6 @@
},
"dependencies": {
"@prisma/client": "^4.5.0",
"@types/better-queue": "^3.8.3",
"axios": "^0.27.2",
"bcryptjs": "^2.4.3",
"better-queue": "^3.8.12",

View File

@ -28,7 +28,7 @@ export const authenticate = async (options: {
{ pw: password, username },
{
headers: {
'X-Emby-Authorization': `MediaBrowser Client="Sonixd", Device="PC", DeviceId="Sonixd", Version="1.0.0-alpha1"`,
'X-Emby-Authorization': `MediaBrowser Client="Feishin", Device="PC", DeviceId="Feishin", Version="1.0.0-alpha1"`,
},
}
);

View File

@ -1,3 +1,4 @@
import { prisma } from '@lib/prisma';
import {
ExternalSource,
ExternalType,
@ -7,7 +8,6 @@ import {
ServerFolder,
} from '@prisma/client';
import uniqBy from 'lodash/uniqBy';
import { prisma } from '@lib/prisma';
import { uniqueArray } from '../../utils/unique-array';
import {
JFAlbum,

View File

@ -1,7 +1,7 @@
import { Server } from '@prisma/client';
import { randomString } from '@utils/index';
import axios from 'axios';
import md5 from 'md5';
import { randomString } from '@utils/index';
import {
SSAlbumListEntry,
SSAlbumListResponse,
@ -47,7 +47,7 @@ const authenticate = async (options: {
}
const { data } = await api.get(
`${cleanServerUrl}/rest/ping.view?v=1.13.0&c=sonixd&f=json&${token}`
`${cleanServerUrl}/rest/ping.view?v=1.13.0&c=Feishin&f=json&${token}`
);
return { token, ...data };
@ -55,7 +55,7 @@ const authenticate = async (options: {
const getMusicFolders = async (server: Partial<Server>) => {
const { data } = await api.get<SSMusicFoldersResponse>(
`${server.url}/rest/getMusicFolders.view?v=1.13.0&c=sonixd&f=json&${server.token}`
`${server.url}/rest/getMusicFolders.view?v=1.13.0&c=Feishin&f=json&${server.token}`
);
return data.musicFolders.musicFolder;
@ -63,7 +63,7 @@ const getMusicFolders = async (server: Partial<Server>) => {
const getArtists = async (server: Server, musicFolderId: string) => {
const { data } = await api.get<SSArtistsResponse>(
`${server.url}/rest/getArtists.view?v=1.13.0&c=sonixd&f=json&${server.token}`,
`${server.url}/rest/getArtists.view?v=1.13.0&c=Feishin&f=json&${server.token}`,
{ params: { musicFolderId } }
);
@ -76,7 +76,7 @@ const getArtists = async (server: Server, musicFolderId: string) => {
const getGenres = async (server: Server) => {
const { data: genres } = await api.get<SSGenresResponse>(
`${server.url}/rest/getGenres.view?v=1.13.0&c=sonixd&f=json&${server.token}`
`${server.url}/rest/getGenres.view?v=1.13.0&c=Feishin&f=json&${server.token}`
);
return genres;
@ -84,7 +84,7 @@ const getGenres = async (server: Server) => {
const getAlbum = async (server: Server, id: string) => {
const { data: album } = await api.get<SSAlbumResponse>(
`${server.url}/rest/getAlbum.view?v=1.13.0&c=sonixd&f=json&${server.token}`,
`${server.url}/rest/getAlbum.view?v=1.13.0&c=Feishin&f=json&${server.token}`,
{ params: { id } }
);
@ -98,7 +98,7 @@ const getAlbums = async (
) => {
const albums: any = api
.get<SSAlbumListResponse>(
`${server.url}/rest/getAlbumList2.view?v=1.13.0&c=sonixd&f=json&${server.token}`,
`${server.url}/rest/getAlbumList2.view?v=1.13.0&c=Feishin&f=json&${server.token}`,
{ params }
)
.then((res) => {
@ -131,7 +131,7 @@ const getAlbums = async (
const getArtistInfo = async (server: Server, id: string) => {
const { data: artistInfo } = await api.get<SSArtistInfoResponse>(
`${server.url}/rest/getArtistInfo2.view?v=1.13.0&c=sonixd&f=json&${server.token}`,
`${server.url}/rest/getArtistInfo2.view?v=1.13.0&c=Feishin&f=json&${server.token}`,
{ params: { id } }
);

View File

@ -1,8 +1,11 @@
import express, { Router } from 'express';
import { controller } from '@controllers/index';
import { validation, validateRequest } from '@validations/index';
import { validateRequest, validation } from '@validations/index';
export const router: Router = express.Router({ mergeParams: true });
export const router: Router = express.Router({
mergeParams: true,
strict: true,
});
router.get('/', controller.albumArtists.getList);

View File

@ -12,7 +12,7 @@ require('./lib/passport');
const PORT = 9321;
const app = express();
const staticPath = path.join(__dirname, '../sonixd-client/');
const staticPath = path.join(__dirname, '../feishin-client/');
app.use(express.static(staticPath));
app.use(

View File

@ -31,7 +31,6 @@
"resolveJsonModule": true,
"allowJs": true,
"outDir": "./dist",
"rootDir": ".",
"typeRoots": ["./types"]
},
"exclude": ["dist"]

Some files were not shown because too many files have changed in this diff Show More