🔧 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 CURRENT_VERSION = 'v0.10.3';
export const CURRENT_VERSION = 'v0.10.4';

View File

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

View File

@@ -308,7 +308,9 @@ export function AddAppShelfItemForm(props: AddAppShelfItemFormProps) {
target="_blank"
weight="bold"
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')}
</Anchor>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -136,12 +136,12 @@ export default function CalendarComponent(props: any) {
date.getDay() === today.getDay() && date.getDate() === today.getDate()
? {
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,
}
}
styles={{
calendarHeader: {

View File

@@ -98,7 +98,7 @@ const useJson = (targetUrl: string, url: string) => {
const doRequest = async () => {
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);
// eslint-disable-next-line no-empty

View File

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

View File

@@ -158,16 +158,24 @@ export default function SearchBar(props: any) {
form.setValues({ query: '' });
switch (query.substring(0, 3)) {
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;
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;
case '!os':
break;
default:
window.open(
`${queryUrl.includes('%s') ? queryUrl.replace('%s', query) : `${queryUrl}${query}`}`,
`${
queryUrl.includes('%s') ? queryUrl.replace('%s', query) : `${queryUrl}${query}`
}`,
open_in
);
break;

View File

@@ -48,7 +48,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
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[]) => {
if (!err) {
resolve(result);

View File

@@ -47,7 +47,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
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) => {
if (!err) {
resolve(result);

View File

@@ -2,21 +2,21 @@ import NZBGet from 'nzbget-api';
import { NzbgetClientOptions } from './types';
export function NzbgetClient(options: NzbgetClientOptions) {
if (!options?.host) {
throw new Error('Cannot connect to NZBGet. Missing host in service config.');
}
if (!options?.host) {
throw new Error('Cannot connect to NZBGet. Missing host in service config.');
}
if (!options?.port) {
throw new Error('Cannot connect to NZBGet. Missing port in service config.');
}
if (!options?.port) {
throw new Error('Cannot connect to NZBGet. Missing port in service config.');
}
if (!options?.login) {
throw new Error('Cannot connect to NZBGet. Missing username in service config.');
}
if (!options?.login) {
throw new Error('Cannot connect to NZBGet. Missing username in service config.');
}
if (!options?.hash) {
throw new Error('Cannot connect to NZBGet. Missing password in service config.');
}
if (!options?.hash) {
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;
PostTotalTimeSec: number;
ParTimeSec: number;
RepairTimeSec: number
RepairTimeSec: number;
UnpackTimeSec: number;
MessageCount:number;
MessageCount: number;
DupeKey: string;
DupeScore: number;
DupeMode: 'SCORE' | 'ALL' | 'FORCE';
@@ -71,7 +71,21 @@ export interface NzbgetQueueItem {
MaxPostTime: number;
MaxPriority: 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;
SuccessArticles: number;
FailedArticles: number;
@@ -128,8 +142,8 @@ export interface NzbgetStatus {
}
export interface NzbgetClientOptions {
host: string,
port: string,
login: string | undefined,
hash: string | undefined,
host: string;
port: string;
login: string | undefined;
hash: string | undefined;
}

View File

@@ -48,7 +48,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
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[]) => {
if (!err) {
resolve(result);
@@ -62,7 +62,7 @@ async function Get(req: NextApiRequest, res: NextApiResponse) {
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) => {
if (!err) {
resolve(result);
@@ -139,7 +139,7 @@ function getNzbgetState(status: string) {
case 'QUEUED':
return 'queued';
case 'PAUSED ':
return 'paused';
return 'paused';
default:
return 'downloading';
}

View File

@@ -1,11 +1,11 @@
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 { showNotification, updateNotification } from '@mantine/notifications';
import axios from 'axios';
import { IconCheck, IconX } from '@tabler/icons';
import { useRouter } from 'next/router';
import { Trans, useTranslation } from 'next-i18next';
import { useTranslation } from 'next-i18next';
import { useForm } from '@mantine/form';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { loginNamespaces } from '../tools/translation-namespaces';

View File

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

View File

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