From 2f0afe27cc952dca2a53bc22b174a3c48c5e4998 Mon Sep 17 00:00:00 2001 From: marcobaobao Date: Fri, 7 Jun 2024 10:08:32 +0200 Subject: [PATCH] removed --no-mtime and -x switches in settings Custom templates are powerful: --no-mtime has been set as default behavior (template named default), -x is another template named "audio only" --- frontend/src/atoms/settings.ts | 5 +- frontend/src/atoms/status.ts | 10 --- frontend/src/components/AppBar.tsx | 8 +-- frontend/src/components/DownloadDialog.tsx | 24 +------ .../src/components/ExtraDownloadOptions.tsx | 6 ++ frontend/src/components/HomeSpeedDial.tsx | 2 +- frontend/src/components/Logout.tsx | 3 - frontend/src/lib/argsParser.ts | 66 ------------------- frontend/src/views/Settings.tsx | 25 ------- server/dbutil/migrate.go | 12 ++++ 10 files changed, 27 insertions(+), 134 deletions(-) delete mode 100644 frontend/src/lib/argsParser.ts diff --git a/frontend/src/atoms/settings.ts b/frontend/src/atoms/settings.ts index 452230a..aea61e2 100644 --- a/frontend/src/atoms/settings.ts +++ b/frontend/src/atoms/settings.ts @@ -64,8 +64,7 @@ export const serverAddressState = atom({ export const serverPortState = atom({ key: 'serverPortState', - default: Number(localStorage.getItem('server-port')) || - Number(window.location.port), + default: Number(localStorage.getItem('server-port')) || Number(window.location.port), effects: [ ({ onSet }) => onSet(a => localStorage.setItem('server-port', a.toString())) @@ -197,7 +196,7 @@ export const cookiesState = atom({ ] }) -export const themeSelector = selector({ +const themeSelector = selector({ key: 'themeSelector', get: ({ get }) => { const theme = get(themeState) diff --git a/frontend/src/atoms/status.ts b/frontend/src/atoms/status.ts index f4f04e6..5d24fef 100644 --- a/frontend/src/atoms/status.ts +++ b/frontend/src/atoms/status.ts @@ -6,16 +6,6 @@ export const connectedState = atom({ default: false }) -export const updatedBinaryState = atom({ - key: 'updatedBinaryState', - default: false -}) - -export const isDownloadingState = atom({ - key: 'isDownloadingState', - default: false -}) - export const freeSpaceBytesState = selector({ key: 'freeSpaceBytesState', get: async ({ get }) => { diff --git a/frontend/src/components/AppBar.tsx b/frontend/src/components/AppBar.tsx index eea617d..ce066f5 100644 --- a/frontend/src/components/AppBar.tsx +++ b/frontend/src/components/AppBar.tsx @@ -1,11 +1,11 @@ -import { styled } from '@mui/material'; -import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar'; +import { styled } from '@mui/material' +import MuiAppBar, { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar' interface AppBarProps extends MuiAppBarProps { open?: boolean } -const drawerWidth = 240; +const drawerWidth = 240 const AppBar = styled(MuiAppBar, { shouldForwardProp: (prop) => prop !== 'open', @@ -23,6 +23,6 @@ const AppBar = styled(MuiAppBar, { duration: theme.transitions.duration.enteringScreen, }), }), -})); +})) export default AppBar \ No newline at end of file diff --git a/frontend/src/components/DownloadDialog.tsx b/frontend/src/components/DownloadDialog.tsx index 106f37a..c371b07 100644 --- a/frontend/src/components/DownloadDialog.tsx +++ b/frontend/src/components/DownloadDialog.tsx @@ -26,19 +26,17 @@ import { Suspense, forwardRef, useEffect, - useMemo, useRef, useState, useTransition } from 'react' import { useRecoilState, useRecoilValue } from 'recoil' import { customArgsState, downloadTemplateState, filenameTemplateState, savedTemplatesState } from '../atoms/downloadTemplate' -import { latestCliArgumentsState, settingsState } from '../atoms/settings' +import { settingsState } from '../atoms/settings' import { availableDownloadPathsState, connectedState } from '../atoms/status' import FormatsGrid from '../components/FormatsGrid' import { useI18n } from '../hooks/useI18n' import { useRPC } from '../hooks/useRPC' -import { CliArguments } from '../lib/argsParser' import type { DLMetadata } from '../types' import { toFormatArgs } from '../utils' import ExtraDownloadOptions from './ExtraDownloadOptions' @@ -71,7 +69,6 @@ const DownloadDialog: FC = ({ open, onClose, onDownloadStart }) => { const [pickedBestFormat, setPickedBestFormat] = useState('') const [customArgs, setCustomArgs] = useRecoilState(customArgsState) - const [, setCliArgs] = useRecoilState(latestCliArgumentsState) const [downloadPath, setDownloadPath] = useState('') @@ -83,10 +80,6 @@ const DownloadDialog: FC = ({ open, onClose, onDownloadStart }) => { const [isPlaylist, setIsPlaylist] = useState(false) - const argsBuilder = useMemo(() => - new CliArguments().fromString(settings.cliArgs), [settings.cliArgs] - ) - const { i18n } = useI18n() const { client } = useRPC() @@ -112,7 +105,7 @@ const DownloadDialog: FC = ({ open, onClose, onDownloadStart }) => { await new Promise(r => setTimeout(r, 10)) await client.download({ url: immediate || line, - args: `${argsBuilder.toString()} ${toFormatArgs(codes)} ${downloadTemplate}`, + args: `${toFormatArgs(codes)} ${downloadTemplate}`, pathOverride: downloadPath ?? '', renameTo: settings.fileRenaming ? filenameTemplate : '', playlist: isPlaylist, @@ -327,19 +320,6 @@ const DownloadDialog: FC = ({ open, onClose, onDownloadStart }) => { label={i18n.t('playlistCheckbox')} /> - - setCliArgs(argsBuilder.toggleExtractAudio().toString())} - /> - } - checked={argsBuilder.extractAudio} - onChange={() => setCliArgs(argsBuilder.toggleExtractAudio().toString())} - disabled={settings.formatSelection} - label={i18n.t('extractAudioCheckbox')} - /> -