🔧 fix lint errors and bumb version

This commit is contained in:
Thomas Camlong
2022-11-12 08:12:54 +09:00
parent 7414f02667
commit dfdb8678b7
21 changed files with 82 additions and 87 deletions

View File

@@ -1,2 +1,2 @@
export const REPO_URL = 'ajnart/homarr'; export const REPO_URL = 'ajnart/homarr';
export const CURRENT_VERSION = 'v0.10.3'; export const CURRENT_VERSION = 'v0.10.4';

View File

@@ -1,6 +1,6 @@
{ {
"name": "homarr", "name": "homarr",
"version": "0.10.3", "version": "0.10.4",
"description": "Homarr - A homepage for your server.", "description": "Homarr - A homepage for your server.",
"license": "MIT", "license": "MIT",
"repository": { "repository": {

View File

@@ -308,7 +308,9 @@ export function AddAppShelfItemForm(props: AddAppShelfItemFormProps) {
target="_blank" target="_blank"
weight="bold" weight="bold"
style={{ fontStyle: 'inherit', fontSize: 'inherit' }} style={{ fontStyle: 'inherit', fontSize: 'inherit' }}
href={`${hostname}/${apiKeyPaths[form.values.type as keyof typeof apiKeyPaths]}`} href={`${hostname}/${
apiKeyPaths[form.values.type as keyof typeof apiKeyPaths]
}`}
> >
{t('modal.tabs.options.form.integrations.apiKey.tip.link')} {t('modal.tabs.options.form.integrations.apiKey.tip.link')}
</Anchor> </Anchor>

View File

@@ -1,14 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { import { Accordion, Grid, Paper, Stack, Text, useMantineColorScheme } from '@mantine/core';
Accordion,
Divider,
Grid,
Paper,
Stack,
Text,
Title,
useMantineColorScheme,
} from '@mantine/core';
import { import {
closestCenter, closestCenter,
DndContext, DndContext,
@@ -202,7 +193,7 @@ const AppShelf = (props: any) => {
<Accordion.Control>{t('accordions.downloads.text')}</Accordion.Control> <Accordion.Control>{t('accordions.downloads.text')}</Accordion.Control>
<Accordion.Panel> <Accordion.Panel>
<Paper radius="lg" style={{ position: 'relative' }}> <Paper radius="lg" style={{ position: 'relative' }}>
{torrentEnabled && ( {torrentEnabled && (
<> <>
<Text>{t('accordions.downloads.torrents')}</Text> <Text>{t('accordions.downloads.torrents')}</Text>
<ModuleMenu module={TorrentsModule} hovered /> <ModuleMenu module={TorrentsModule} hovered />

View File

@@ -49,11 +49,7 @@ export function SearchNewTabSwitch() {
return ( return (
<Group> <Group>
<div className={classes.root}> <div className={classes.root}>
<Switch <Switch checked={openInNewTab} onChange={() => toggleOpenInNewTab()} size="md" />
checked={openInNewTab}
onChange={() => toggleOpenInNewTab()}
size="md"
/>
</div> </div>
{t('searchNewTab.label')} {t('searchNewTab.label')}
</Group> </Group>

View File

@@ -47,22 +47,22 @@ export default function TitleChanger() {
<Stack> <Stack>
<TextInput <TextInput
label={t('pageTitle.label')} label={t('pageTitle.label')}
placeholder={'Homarr 🦞'} placeholder="Homarr 🦞"
{...form.getInputProps('title')} {...form.getInputProps('title')}
/> />
<TextInput <TextInput
label={t('logo.label')} label={t('logo.label')}
placeholder={'/imgs/logo.png} placeholder="/imgs/logo.png"
{...form.getInputProps('logo')} {...form.getInputProps('logo')}
/> />
<TextInput <TextInput
label={t('favicon.label')} label={t('favicon.label')}
placeholder={'/imgs/favicon/favicon.png'} placeholder="/imgs/favicon/favicon.png"
{...form.getInputProps('favicon')} {...form.getInputProps('favicon')}
/> />
<TextInput <TextInput
label={t('background.label')} label={t('background.label')}
placeholder={'/img/background.png'} placeholder="/img/background.png"
{...form.getInputProps('background')} {...form.getInputProps('background')}
/> />
<Textarea <Textarea

View File

@@ -42,9 +42,7 @@ export default function Layout({ children, style }: any) {
> >
{children} {children}
</main> </main>
<style> <style>{cx(config.settings.customCSS)}</style>
{cx(config.settings.customCSS)}
</style>
</AppShell> </AppShell>
); );
} }

View File

@@ -4,19 +4,15 @@ import { NextFetchEvent, NextRequest, NextResponse } from 'next/server';
export function middleware(req: NextRequest, ev: NextFetchEvent) { export function middleware(req: NextRequest, ev: NextFetchEvent) {
const isCorrectPassword = req.cookies.get('password') === process.env.PASSWORD; const isCorrectPassword = req.cookies.get('password') === process.env.PASSWORD;
const url = req.nextUrl.clone(); const url = req.nextUrl.clone();
const skipURL = url.pathname && ( const skipURL =
url.pathname.includes('login') || url.pathname === ('/api/configs/tryPassword') || ( url.pathname &&
url.pathname.includes('/_next/') && !url.pathname.includes('/pages/') (url.pathname.includes('login') ||
) || url.pathname === '/api/configs/tryPassword' ||
(url.pathname.includes('/_next/') && !url.pathname.includes('/pages/')) ||
url.pathname === '/favicon.ico' || url.pathname === '/favicon.ico' ||
url.pathname === '/404' || url.pathname === '/404' ||
url.pathname.includes('pages/_app') url.pathname.includes('pages/_app'));
); if (!skipURL && !isCorrectPassword && process.env.PASSWORD) {
if (
!skipURL &&
!isCorrectPassword &&
process.env.PASSWORD
) {
url.pathname = '/login'; url.pathname = '/login';
return NextResponse.rewrite(url); return NextResponse.rewrite(url);
} }

View File

@@ -14,7 +14,7 @@ export interface IModule {
padding?: PaddingOptions = { padding?: PaddingOptions = {
right: 15, right: 15,
top: 15, top: 15,
}, };
} }
interface PaddingOptions { interface PaddingOptions {

View File

@@ -136,12 +136,12 @@ export default function CalendarComponent(props: any) {
date.getDay() === today.getDay() && date.getDate() === today.getDate() date.getDay() === today.getDay() && date.getDate() === today.getDate()
? { ? {
backgroundColor: backgroundColor:
theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[0], theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[0],
margin: 1, margin: 1,
} }
: { : {
margin: 1, margin: 1,
} }
} }
styles={{ styles={{
calendarHeader: { calendarHeader: {

View File

@@ -98,7 +98,7 @@ const useJson = (targetUrl: string, url: string) => {
const doRequest = async () => { const doRequest = async () => {
try { try {
const resp = await axios.get('/api/modules/dashdot',{ params: { url, base: targetUrl } }); const resp = await axios.get('/api/modules/dashdot', { params: { url, base: targetUrl } });
setData(resp.data); setData(resp.data);
// eslint-disable-next-line no-empty // eslint-disable-next-line no-empty

View File

@@ -1,12 +1,4 @@
import { import { Table, Checkbox, Group, Badge, createStyles, ScrollArea, TextInput } from '@mantine/core';
Table,
Checkbox,
Group,
Badge,
createStyles,
ScrollArea,
TextInput,
} from '@mantine/core';
import { IconSearch } from '@tabler/icons'; import { IconSearch } from '@tabler/icons';
import Dockerode from 'dockerode'; import Dockerode from 'dockerode';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';

View File

@@ -158,16 +158,24 @@ export default function SearchBar(props: any) {
form.setValues({ query: '' }); form.setValues({ query: '' });
switch (query.substring(0, 3)) { switch (query.substring(0, 3)) {
case '!yt': case '!yt':
window.open(`https://www.youtube.com/results?search_query=${query.substring(3)}`, open_in); window.open(
`https://www.youtube.com/results?search_query=${query.substring(3)}`,
open_in
);
break; break;
case '!t ': case '!t ':
window.open(`https://www.torrentdownloads.me/search/?search=${query.substring(3)}`, open_in); window.open(
`https://www.torrentdownloads.me/search/?search=${query.substring(3)}`,
open_in
);
break; break;
case '!os': case '!os':
break; break;
default: default:
window.open( window.open(
`${queryUrl.includes('%s') ? queryUrl.replace('%s', query) : `${queryUrl}${query}`}`, `${
queryUrl.includes('%s') ? queryUrl.replace('%s', query) : `${queryUrl}${query}`
}`,
open_in open_in
); );
break; break;

View File

@@ -48,7 +48,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const nzbGet = NzbgetClient(options); const nzbGet = NzbgetClient(options);
const nzbgetHistory:NzbgetHistoryItem[] = await new Promise((resolve, reject) => { const nzbgetHistory: NzbgetHistoryItem[] = await new Promise((resolve, reject) => {
nzbGet.history(false, (err: any, result: NzbgetHistoryItem[]) => { nzbGet.history(false, (err: any, result: NzbgetHistoryItem[]) => {
if (!err) { if (!err) {
resolve(result); resolve(result);

View File

@@ -47,7 +47,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const nzbGet = NzbgetClient(options); const nzbGet = NzbgetClient(options);
const nzbgetStatus:NzbgetStatus = await new Promise((resolve, reject) => { const nzbgetStatus: NzbgetStatus = await new Promise((resolve, reject) => {
nzbGet.status((err: any, result: NzbgetStatus) => { nzbGet.status((err: any, result: NzbgetStatus) => {
if (!err) { if (!err) {
resolve(result); resolve(result);

View File

@@ -2,21 +2,21 @@ import NZBGet from 'nzbget-api';
import { NzbgetClientOptions } from './types'; import { NzbgetClientOptions } from './types';
export function NzbgetClient(options: NzbgetClientOptions) { export function NzbgetClient(options: NzbgetClientOptions) {
if (!options?.host) { if (!options?.host) {
throw new Error('Cannot connect to NZBGet. Missing host in service config.'); throw new Error('Cannot connect to NZBGet. Missing host in service config.');
} }
if (!options?.port) { if (!options?.port) {
throw new Error('Cannot connect to NZBGet. Missing port in service config.'); throw new Error('Cannot connect to NZBGet. Missing port in service config.');
} }
if (!options?.login) { if (!options?.login) {
throw new Error('Cannot connect to NZBGet. Missing username in service config.'); throw new Error('Cannot connect to NZBGet. Missing username in service config.');
} }
if (!options?.hash) { if (!options?.hash) {
throw new Error('Cannot connect to NZBGet. Missing password in service config.'); throw new Error('Cannot connect to NZBGet. Missing password in service config.');
} }
return new NZBGet(options); return new NZBGet(options);
} }

View File

@@ -25,9 +25,9 @@ export interface NzbgetHistoryItem {
DownloadTimeSec: number; DownloadTimeSec: number;
PostTotalTimeSec: number; PostTotalTimeSec: number;
ParTimeSec: number; ParTimeSec: number;
RepairTimeSec: number RepairTimeSec: number;
UnpackTimeSec: number; UnpackTimeSec: number;
MessageCount:number; MessageCount: number;
DupeKey: string; DupeKey: string;
DupeScore: number; DupeScore: number;
DupeMode: 'SCORE' | 'ALL' | 'FORCE'; DupeMode: 'SCORE' | 'ALL' | 'FORCE';
@@ -71,7 +71,21 @@ export interface NzbgetQueueItem {
MaxPostTime: number; MaxPostTime: number;
MaxPriority: number; MaxPriority: number;
ActiveDownloads: number; ActiveDownloads: number;
Status: 'QUEUED' | 'PAUSED' | 'DOWNLOADING' | 'FETCHING' | 'PP_QUEUED' | 'LOADING_PARS' | 'VERIFYING_SOURCES' | 'REPAIRING' | 'VERIFYING_REPAIRED' | 'RENAMING' | 'UNPACKING' | 'MOVING' | 'EXECUTING_SCRIPT' | 'PP_FINISHED'; Status:
| 'QUEUED'
| 'PAUSED'
| 'DOWNLOADING'
| 'FETCHING'
| 'PP_QUEUED'
| 'LOADING_PARS'
| 'VERIFYING_SOURCES'
| 'REPAIRING'
| 'VERIFYING_REPAIRED'
| 'RENAMING'
| 'UNPACKING'
| 'MOVING'
| 'EXECUTING_SCRIPT'
| 'PP_FINISHED';
TotalArticles: number; TotalArticles: number;
SuccessArticles: number; SuccessArticles: number;
FailedArticles: number; FailedArticles: number;
@@ -128,8 +142,8 @@ export interface NzbgetStatus {
} }
export interface NzbgetClientOptions { export interface NzbgetClientOptions {
host: string, host: string;
port: string, port: string;
login: string | undefined, login: string | undefined;
hash: string | undefined, hash: string | undefined;
} }

View File

@@ -48,7 +48,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
const nzbGet = NzbgetClient(options); const nzbGet = NzbgetClient(options);
const nzbgetQueue:NzbgetQueueItem[] = await new Promise((resolve, reject) => { const nzbgetQueue: NzbgetQueueItem[] = await new Promise((resolve, reject) => {
nzbGet.listGroups((err: any, result: NzbgetQueueItem[]) => { nzbGet.listGroups((err: any, result: NzbgetQueueItem[]) => {
if (!err) { if (!err) {
resolve(result); resolve(result);
@@ -62,7 +62,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
throw new Error('Error while getting NZBGet queue'); throw new Error('Error while getting NZBGet queue');
} }
const nzbgetStatus:NzbgetStatus = await new Promise((resolve, reject) => { const nzbgetStatus: NzbgetStatus = await new Promise((resolve, reject) => {
nzbGet.status((err: any, result: NzbgetStatus) => { nzbGet.status((err: any, result: NzbgetStatus) => {
if (!err) { if (!err) {
resolve(result); resolve(result);
@@ -139,7 +139,7 @@ function getNzbgetState(status: string) {
case 'QUEUED': case 'QUEUED':
return 'queued'; return 'queued';
case 'PAUSED ': case 'PAUSED ':
return 'paused'; return 'paused';
default: default:
return 'downloading'; return 'downloading';
} }

View File

@@ -1,11 +1,11 @@
import React from 'react'; import React from 'react';
import { PasswordInput, Anchor, Paper, Title, Text, Container, Group, Button } from '@mantine/core'; import { PasswordInput, Paper, Title, Text, Container, Group, Button } from '@mantine/core';
import { setCookie } from 'cookies-next'; import { setCookie } from 'cookies-next';
import { showNotification, updateNotification } from '@mantine/notifications'; import { showNotification, updateNotification } from '@mantine/notifications';
import axios from 'axios'; import axios from 'axios';
import { IconCheck, IconX } from '@tabler/icons'; import { IconCheck, IconX } from '@tabler/icons';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { Trans, useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { useForm } from '@mantine/form'; import { useForm } from '@mantine/form';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { loginNamespaces } from '../tools/translation-namespaces'; import { loginNamespaces } from '../tools/translation-namespaces';

View File

@@ -30,6 +30,4 @@ export const dashboardNamespaces = [
'modules/common-media-cards', 'modules/common-media-cards',
]; ];
export const loginNamespaces = [ export const loginNamespaces = ['authentication/login'];
'authentication/login',
];

View File

@@ -11,7 +11,7 @@ export interface Settings {
secondaryColor?: MantineTheme['primaryColor']; secondaryColor?: MantineTheme['primaryColor'];
primaryShade?: MantineTheme['primaryShade']; primaryShade?: MantineTheme['primaryShade'];
background?: string; background?: string;
customCSS?: string, customCSS?: string;
appOpacity?: number; appOpacity?: number;
widgetPosition?: string; widgetPosition?: string;
appCardWidth?: number; appCardWidth?: number;
@@ -76,7 +76,7 @@ export const ServiceTypeList = [
'Overseerr', 'Overseerr',
'Jellyseerr', 'Jellyseerr',
'Sabnzbd', 'Sabnzbd',
'NZBGet' 'NZBGet',
]; ];
export type ServiceType = export type ServiceType =
| 'Other' | 'Other'
@@ -120,7 +120,7 @@ export const portmap = [
{ name: 'overseerr', value: '5055' }, { name: 'overseerr', value: '5055' },
{ name: 'dash.', value: '3001' }, { name: 'dash.', value: '3001' },
{ name: 'sabnzbd', value: '8080' }, { name: 'sabnzbd', value: '8080' },
{ name: 'nzbget', value: '6789' } { name: 'nzbget', value: '6789' },
]; ];
export const MatchingImages: { export const MatchingImages: {