diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2022-05-25 20:15:08 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2022-05-25 20:15:08 -0500 |
| commit | a14bcc2d735a55fb0fae20845a169c0a72228042 (patch) | |
| tree | 1947b12bb89d0b482da3e846785eb7c6a36d357f /src | |
| parent | 362f404b50503e5c6764ad281a2fe45e053548a8 (diff) | |
| download | slskd-a14bcc2d735a55fb0fae20845a169c0a72228042.tar.gz | |
use semicolons consistently
Diffstat (limited to 'src')
47 files changed, 276 insertions, 276 deletions
diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 8c879480..09039442 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -59,8 +59,8 @@ class App extends Component { const securityEnabled = await session.getSecurityEnabled(); if (!securityEnabled) { - console.debug('application security is not enabled, per api call') - session.enablePassthrough() + console.debug('application security is not enabled, per api call'); + session.enablePassthrough(); } if (await session.check()) { @@ -71,8 +71,8 @@ class App extends Component { }); appHub.on('options', (options) => { - this.setState({ applicationOptions: options }) - }) + this.setState({ applicationOptions: options }); + }); appHub.onreconnecting(() => this.setState({ error: true, retriesExhausted: false })); appHub.onclose(() => this.setState({ error: true, retriesExhausted: true })); @@ -85,13 +85,13 @@ class App extends Component { error: false, }); } catch (err) { - console.error(err) - this.setState({ error: true, retriesExhausted: true }) + console.error(err); + this.setState({ error: true, retriesExhausted: true }); } finally { this.setState({ initialized: true }); } - }) - } + }); + }; login = (username, password, rememberMe) => { this.setState({ login: { ...this.state.login, pending: true, error: undefined }}, async () => { @@ -303,7 +303,7 @@ class App extends Component { pauseOnHover /> </> - ) + ); }; } diff --git a/src/web/src/components/Browse/Browse.js b/src/web/src/components/Browse/Browse.js index 5b845b7b..e1a3c7f0 100644 --- a/src/web/src/components/Browse/Browse.js +++ b/src/web/src/components/Browse/Browse.js @@ -66,22 +66,22 @@ class Browse extends Component { .then(() => this.setState({ browseState: 'complete', browseError: undefined }, () => { this.saveState(); })) - .catch(err => this.setState({ browseState: 'error', browseError: err })) + .catch(err => this.setState({ browseState: 'error', browseError: err })); }); - } + }; clear = () => { this.setState(initialState, () => { this.saveState(); this.inputtext.focus(); }); - } + }; keyUp = (event) => event.key === 'Escape' ? this.clear() : ''; onUsernameChange = (event, data) => { this.setState({ username: data.value }); - } + }; saveState = () => { this.inputtext.inputRef.current.value = this.state.username; @@ -92,12 +92,12 @@ class Browse extends Component { } catch (error) { console.log(error); } - } + }; loadState = () => { this.setState( JSON.parse(lzString.decompress(localStorage.getItem('soulseek-example-browse-state') || '')) || initialState); - } + }; componentDidMount = () => { this.fetchStatus(); @@ -107,13 +107,13 @@ class Browse extends Component { }, () => this.saveState()); document.addEventListener('keyup', this.keyUp, false); - } + }; componentWillUnmount = () => { clearInterval(this.state.interval); this.setState({ interval: undefined }); document.removeEventListener('keyup', this.keyUp, false); - } + }; fetchStatus = () => { const { browseState, username } = this.state; @@ -123,7 +123,7 @@ class Browse extends Component { browseStatus: response.data, })); } - } + }; getDirectoryTree = (directories) => { if (directories.length === 0 || directories[0].name === undefined) { @@ -137,7 +137,7 @@ class Browse extends Component { .filter(d => d.name.split(separator).length === depth); return topLevelDirs.map(directory => this.getChildDirectories(directories, directory, separator, depth)); - } + }; getChildDirectories = (directories, root, separator, depth) => { const children = directories @@ -146,15 +146,15 @@ class Browse extends Component { .filter(d => d.name.startsWith(root.name)); return { ...root, children: children.map(c => this.getChildDirectories(directories, c, separator, depth + 1)) }; - } + }; selectDirectory = (directory) => { this.setState({ selectedDirectory: { ...directory, children: [] }}, () => this.saveState()); - } + }; deselectDirectory = () => { this.setState({ selectedDirectory: initialState.selectedDirectory }, () => this.saveState()); - } + }; sep = (name) => name.includes('\\') ? '\\' : '/'; @@ -234,8 +234,8 @@ class Browse extends Component { } </div>} </div> - ) - } + ); + }; } export default Browse; diff --git a/src/web/src/components/Browse/Directory.js b/src/web/src/components/Browse/Directory.js index 2ba53b3e..ed179e87 100644 --- a/src/web/src/components/Browse/Directory.js +++ b/src/web/src/components/Browse/Directory.js @@ -3,7 +3,7 @@ import * as transfers from '../../lib/transfers'; import { formatBytes } from '../../lib/util'; -import FileList from '../Shared/FileList' +import FileList from '../Shared/FileList'; import { Button, @@ -15,37 +15,37 @@ import { const initialState = { downloadRequest: undefined, downloadError: '', -} +}; class Directory extends Component { state = { ...initialState, files: this.props.files.map(f => ({ selected: false, ...f })), - } + }; onFileSelectionChange = (file, state) => { file.selected = state; - this.setState({ tree: this.state.tree, downloadRequest: undefined, downloadError: '' }) - } + this.setState({ tree: this.state.tree, downloadRequest: undefined, downloadError: '' }); + }; download = (username, files) => { this.setState({ downloadRequest: 'inProgress' }, async () => { try { - const requests = (files || []).map(({ filename, size }) => ({ filename, size })) - await transfers.download({ username, files: requests }) + const requests = (files || []).map(({ filename, size }) => ({ filename, size })); + await transfers.download({ username, files: requests }); - this.setState({ downloadRequest: 'complete' }) + this.setState({ downloadRequest: 'complete' }); } catch (err) { - this.setState({ downloadRequest: 'error', downloadError: err.response }) + this.setState({ downloadRequest: 'error', downloadError: err.response }); } }); - } + }; componentDidUpdate = (prevProps) => { if (this.props.name !== prevProps.name) { this.setState({ files: this.props.files.map(f => ({ selected: false, ...f }))}); } - } + }; render = () => { let { username, name, locked, marginTop, onClose } = this.props; @@ -94,8 +94,8 @@ class Directory extends Component { </span> </Card.Content>} </Card> - ) - } + ); + }; } export default Directory; diff --git a/src/web/src/components/Browse/DirectoryTree.js b/src/web/src/components/Browse/DirectoryTree.js index 0e9843b6..765c1bac 100644 --- a/src/web/src/components/Browse/DirectoryTree.js +++ b/src/web/src/components/Browse/DirectoryTree.js @@ -31,9 +31,9 @@ const subtree = (root, selectedDirectoryName, onSelect) => { </List.List> </List.Content> </List.Item> - </List>) - }) -} + </List>); + }); +}; const DirectoryTree = ({ tree, selectedDirectoryName, onSelect }) => subtree(tree, selectedDirectoryName, onSelect); diff --git a/src/web/src/components/Chat/Chat.js b/src/web/src/components/Chat/Chat.js index 47c1dba0..12840e4a 100644 --- a/src/web/src/components/Chat/Chat.js +++ b/src/web/src/components/Chat/Chat.js @@ -30,17 +30,17 @@ class Chat extends Component { await this.fetchConversations(); this.selectConversation(this.state.active || this.getFirstConversation()); }); - } + }; componentWillUnmount = () => { clearInterval(this.state.interval); this.setState({ interval: undefined }); - } + }; getFirstConversation = () => { const names = [...Object.keys(this.state.conversations)]; return names.length > 0 ? names[0] : ''; - } + }; fetchConversations = async () => { const { active } = this.state; @@ -64,7 +64,7 @@ class Chat extends Component { this.acknowledgeMessages(this.state.active); } }); - } + }; acknowledgeMessages = async (username, { force = false } = {}) => { if (!username) return; @@ -75,11 +75,11 @@ class Chat extends Component { if (!force && unAckedMessages.length === 0) return; await chat.acknowledge({ username }); - } + }; sendMessage = async (username, message) => { await chat.send({ username, message }); - } + }; sendReply = async () => { const { active } = this.state; @@ -91,7 +91,7 @@ class Chat extends Component { await this.sendMessage(active, message); this.messageRef.current.value = ''; - } + }; validInput = () => (this.state.active || '').length > 0 @@ -99,7 +99,7 @@ class Chat extends Component { focusInput = () => { this.messageRef.current.focus(); - } + }; formatTimestamp = (timestamp) => { const date = new Date(timestamp); @@ -111,7 +111,7 @@ class Chat extends Component { }); return dtfUS.format(date); - } + }; selectConversation = (username) => { this.setState({ @@ -130,19 +130,19 @@ class Chat extends Component { } }); }); - } + }; initiateConversation = async (username, message) => { await this.sendMessage(username, message); await this.fetchConversations(); this.selectConversation(username); - } + }; deleteConversation = async (username) => { await chat.remove({ username }); await this.fetchConversations(); this.selectConversation(this.getFirstConversation()); - } + }; render = () => { const { conversations = [], active, loading } = this.state; @@ -214,8 +214,8 @@ class Chat extends Component { </Card.Content> </Card>} </div> - ) - } + ); + }; } export default Chat;
\ No newline at end of file diff --git a/src/web/src/components/Chat/ChatMenu.js b/src/web/src/components/Chat/ChatMenu.js index 75580ec0..971646f4 100644 --- a/src/web/src/components/Chat/ChatMenu.js +++ b/src/web/src/components/Chat/ChatMenu.js @@ -10,7 +10,7 @@ const ChatMenu = ({ conversations, active, onConversationChange, ...rest }) => { const names = Object.keys(conversations); const unread = Object.entries(conversations).reduce((acc, [name, messages]) => { - acc[name] = messages.filter(message => !message.acknowledged) + acc[name] = messages.filter(message => !message.acknowledged); return acc; }, {}); @@ -44,7 +44,7 @@ const ChatMenu = ({ conversations, active, onConversationChange, ...rest }) => { /> </Menu.Menu> </Menu> - ) -} + ); +}; export default ChatMenu;
\ No newline at end of file diff --git a/src/web/src/components/Chat/SendMessageModal.js b/src/web/src/components/Chat/SendMessageModal.js index 6c817ae7..45b85d23 100644 --- a/src/web/src/components/Chat/SendMessageModal.js +++ b/src/web/src/components/Chat/SendMessageModal.js @@ -26,11 +26,11 @@ const SendMessageModal = ({ initiateConversation, ...rest }) => { await initiateConversation(username, message); setOpen(false); - } + }; const validInput = () => { - return username.length > 0 && message.length > 0 - } + return username.length > 0 && message.length > 0; + }; return ( <Modal @@ -69,7 +69,7 @@ const SendMessageModal = ({ initiateConversation, ...rest }) => { >Send</Button> </Modal.Actions> </Modal> - ) -} + ); +}; export default SendMessageModal;
\ No newline at end of file diff --git a/src/web/src/components/LoginForm.js b/src/web/src/components/LoginForm.js index fea82175..1be639fd 100644 --- a/src/web/src/components/LoginForm.js +++ b/src/web/src/components/LoginForm.js @@ -1,5 +1,5 @@ -import React, { useState, useEffect, useMemo } from 'react' -import { Button, Form, Grid, Header, Icon, Segment, Checkbox, Message } from 'semantic-ui-react' +import React, { useState, useEffect, useMemo } from 'react'; +import { Button, Form, Grid, Header, Icon, Segment, Checkbox, Message } from 'semantic-ui-react'; import Logos from './Shared/Logo'; @@ -7,7 +7,7 @@ const initialState = { username: '', password: '', rememberMe: true, -} +}; const LoginForm = ({ onLoginAttempt, loading, error }) => { const [state, setState] = useState(initialState); @@ -20,14 +20,14 @@ const LoginForm = ({ onLoginAttempt, loading, error }) => { } else { setReady(false); } - }, [state]) + }, [state]); const handleChange = (field, value) => { setState({ ...state, [field]: value, }); - } + }; const { username, password, rememberMe } = state; @@ -89,7 +89,7 @@ const LoginForm = ({ onLoginAttempt, loading, error }) => { </Grid.Column> </Grid> </> - ) -} + ); +}; -export default LoginForm
\ No newline at end of file +export default LoginForm;
\ No newline at end of file diff --git a/src/web/src/components/Rooms/RoomJoinModal.js b/src/web/src/components/Rooms/RoomJoinModal.js index 134d9339..f1c8aad4 100644 --- a/src/web/src/components/Rooms/RoomJoinModal.js +++ b/src/web/src/components/Rooms/RoomJoinModal.js @@ -21,7 +21,7 @@ const RoomJoinModal = ({ joinRoom: parentJoinRoom, ...modalOptions }) => { const available = await rooms.getAvailable(); setAvailable(available); setLoading(false); - } + }; if (open) getAvailableRooms(); }, [open]); @@ -42,7 +42,7 @@ const RoomJoinModal = ({ joinRoom: parentJoinRoom, ...modalOptions }) => { return a[sortBy].localeCompare(b[sortBy]); } - return b[sortBy] - a[sortBy] + return b[sortBy] - a[sortBy]; }); return sorted; @@ -51,7 +51,7 @@ const RoomJoinModal = ({ joinRoom: parentJoinRoom, ...modalOptions }) => { const joinRoom = async () => { await parentJoinRoom(selected); close(); - } + }; const isSelected = (room) => selected === room.name; @@ -62,7 +62,7 @@ const RoomJoinModal = ({ joinRoom: parentJoinRoom, ...modalOptions }) => { setSortOrder('desc'); setFilter(''); setOpen(false); - } + }; return ( <Modal @@ -136,7 +136,7 @@ const RoomJoinModal = ({ joinRoom: parentJoinRoom, ...modalOptions }) => { >Join</Button> </Modal.Actions> </Modal> - ) -} + ); +}; export default RoomJoinModal;
\ No newline at end of file diff --git a/src/web/src/components/Rooms/RoomMenu.js b/src/web/src/components/Rooms/RoomMenu.js index 485646d6..b785c66c 100644 --- a/src/web/src/components/Rooms/RoomMenu.js +++ b/src/web/src/components/Rooms/RoomMenu.js @@ -35,7 +35,7 @@ const RoomMenu = ({ joined, active, onRoomChange, ...rest }) => { /> </Menu.Menu> </Menu> - ) -} + ); +}; export default RoomMenu;
\ No newline at end of file diff --git a/src/web/src/components/Rooms/RoomUserList.js b/src/web/src/components/Rooms/RoomUserList.js index 0a891e88..663961e8 100644 --- a/src/web/src/components/Rooms/RoomUserList.js +++ b/src/web/src/components/Rooms/RoomUserList.js @@ -10,11 +10,11 @@ const RoomUserList = ({ users }) => { if (!(user || {}).countryCode) return <Icon className='unknown-user-flag' name='question'/>; return <Flag name={user.countryCode.toLowerCase()}/>; - } + }; const getDetails = (user) => { return user.countryCode || '?'; - } + }; const sortedUsers = useMemo(() => { const filtered = [...users] @@ -38,7 +38,7 @@ const RoomUserList = ({ users }) => { </List.Item> )} </List> - ) -} + ); +}; export default RoomUserList;
\ No newline at end of file diff --git a/src/web/src/components/Rooms/Rooms.js b/src/web/src/components/Rooms/Rooms.js index 822cdaf4..066c0ab1 100644 --- a/src/web/src/components/Rooms/Rooms.js +++ b/src/web/src/components/Rooms/Rooms.js @@ -20,7 +20,7 @@ const initialState = { messages: undefined, }, loading: false, -} +}; class Rooms extends Component { state = initialState; @@ -36,7 +36,7 @@ class Rooms extends Component { active: sessionStorage.getItem(activeRoomKey) || '', }, async () => { await this.fetchJoinedRooms(); - this.selectRoom(this.state.active || this.getFirstRoom()) + this.selectRoom(this.state.active || this.getFirstRoom()); }); }; @@ -47,11 +47,11 @@ class Rooms extends Component { clearInterval(messages); this.setState({ intervals: initialState.intervals }); - } + }; getFirstRoom = () => { return this.state.joined.length > 0 ? this.state.joined[0] : ''; - } + }; fetchJoinedRooms = async () => { const joined = await rooms.getJoined(); @@ -218,7 +218,7 @@ class Rooms extends Component { </Card.Content> </Card>} </div> - ) + ); }; } diff --git a/src/web/src/components/Search/Detail/SearchDetail.js b/src/web/src/components/Search/Detail/SearchDetail.js index be64aabd..4de3cc0e 100644 --- a/src/web/src/components/Search/Detail/SearchDetail.js +++ b/src/web/src/components/Search/Detail/SearchDetail.js @@ -56,12 +56,12 @@ const SearchDetail = ({ search, creating, stopping, removing, disabled, onCreate setError(error); setLoading(false); } - } + }; if (isComplete) { get(); } - }, [id, isComplete]) + }, [id, isComplete]); // apply sorting and filters. this can take a while for larger result // sets, so memoize it. @@ -69,7 +69,7 @@ const SearchDetail = ({ search, creating, stopping, removing, disabled, onCreate const sortOptions = { uploadSpeed: { field: 'uploadSpeed', order: 'desc' }, queueLength: { field: 'queueLength', order: 'asc' }, - } + }; const { field, order } = sortOptions[resultSort]; @@ -79,7 +79,7 @@ const SearchDetail = ({ search, creating, stopping, removing, disabled, onCreate .filter(r => !hiddenResults.includes(r.username)) .map(r => { if (hideLocked) { - return { ...r, lockedFileCount: 0, lockedFiles: [] } + return { ...r, lockedFileCount: 0, lockedFiles: [] }; } return r; }) @@ -94,7 +94,7 @@ const SearchDetail = ({ search, creating, stopping, removing, disabled, onCreate return b[field] - a[field]; }); - }, [results, hideLocked, hideNoFreeSlots, resultFilters, resultSort, hiddenResults]) + }, [results, hideLocked, hideNoFreeSlots, resultFilters, resultSort, hiddenResults]); // when a user uses the action buttons, we will *probably* re-use this component, // but with a new search ID. clear everything to prepare for the transition @@ -104,24 +104,24 @@ const SearchDetail = ({ search, creating, stopping, removing, disabled, onCreate setResults([]); setHiddenResults([]); setDisplayCount(5); - } + }; const create = async ({ search, navigate }) => { reset(); - onCreate({ search, navigate }) - } + onCreate({ search, navigate }); + }; const remove = async () => { reset(); onRemove(search); - } + }; const filteredCount = results?.length - sortedAndFilteredResults.length; const remainingCount = sortedAndFilteredResults.length - displayCount; - const loaded = (!removing && !creating && !loading && results && results.length > 0) + const loaded = (!removing && !creating && !loading && results && results.length > 0); if (error) { - return (<ErrorSegment caption={error?.message ?? error}/>) + return (<ErrorSegment caption={error?.message ?? error}/>); } return ( @@ -220,7 +220,7 @@ const SearchDetail = ({ search, creating, stopping, removing, disabled, onCreate }</Button> : '')} </Switch> </> - ) -} + ); +}; export default SearchDetail;
\ No newline at end of file diff --git a/src/web/src/components/Search/Detail/SearchDetailHeader.js b/src/web/src/components/Search/Detail/SearchDetailHeader.js index 9e04ba6d..ac613249 100644 --- a/src/web/src/components/Search/Detail/SearchDetailHeader.js +++ b/src/web/src/components/Search/Detail/SearchDetailHeader.js @@ -33,7 +33,7 @@ const SearchDetailHeader = ({ } else { onStop(search); } - } + }; const RefreshButton = () => loaded && <Button @@ -43,7 +43,7 @@ const SearchDetailHeader = ({ loading={creating} > <Icon name='refresh'/>{(!isSmallScreen || isTinyScreen) && 'Search Again'} - </Button> + </Button>; const StopOrDeleteButton = () => <Button @@ -56,7 +56,7 @@ const SearchDetailHeader = ({ > <Icon name={isComplete ? 'trash alternate' : 'stop circle'}/> {(!isSmallScreen || isTinyScreen) && ((loaded && isComplete) ? 'Delete' : 'Stop')} - </Button> + </Button>; // if the screen is full width, display the header and action buttons in the same segment, with full // button text. if the screen is between 684 and 899 pixels, display the buttons with no text. @@ -77,7 +77,7 @@ const SearchDetailHeader = ({ <StopOrDeleteButton/> </Segment>} </> - ) + ); }; export default SearchDetailHeader;
\ No newline at end of file diff --git a/src/web/src/components/Search/List/SearchActionIcon.js b/src/web/src/components/Search/List/SearchActionIcon.js index 98455241..baec2ccc 100644 --- a/src/web/src/components/Search/List/SearchActionIcon.js +++ b/src/web/src/components/Search/List/SearchActionIcon.js @@ -4,7 +4,7 @@ import { Icon } from 'semantic-ui-react'; const SearchActionIcon = ({ search, loading, onRemove, onStop,...props }) => { if (loading) { - return (<Icon name='spinner' loading {...props}/>) + return (<Icon name='spinner' loading {...props}/>); } if (search.state.includes('Completed')) { @@ -13,7 +13,7 @@ const SearchActionIcon = ({ search, loading, onRemove, onStop,...props }) => { color='red' onClick={() => onRemove()} style={{ cursor: 'pointer' }} - />) + />); } return (<Icon @@ -21,7 +21,7 @@ const SearchActionIcon = ({ search, loading, onRemove, onStop,...props }) => { color="red" onClick={() => onStop()} style={{ cursor: 'pointer' }} - />) + />); }; export default SearchActionIcon;
\ No newline at end of file diff --git a/src/web/src/components/Search/List/SearchList.js b/src/web/src/components/Search/List/SearchList.js index 9826bdc5..db16fa71 100644 --- a/src/web/src/components/Search/List/SearchList.js +++ b/src/web/src/components/Search/List/SearchList.js @@ -58,7 +58,7 @@ const SearchList = ({ </div> </Card.Content> </Card> - ) + ); }; export default SearchList;
\ No newline at end of file diff --git a/src/web/src/components/Search/List/SearchListRow.js b/src/web/src/components/Search/List/SearchListRow.js index fd762069..feffdcea 100644 --- a/src/web/src/components/Search/List/SearchListRow.js +++ b/src/web/src/components/Search/List/SearchListRow.js @@ -27,7 +27,7 @@ const SearchListRow = ({ search, onRemove, onStop }) => { } finally { setWorking(false); } - } + }; return ( <Table.Row @@ -54,7 +54,7 @@ const SearchListRow = ({ search, onRemove, onStop }) => { /> </Table.Cell> </Table.Row> - ) -} + ); +}; export default SearchListRow;
\ No newline at end of file diff --git a/src/web/src/components/Search/Response.js b/src/web/src/components/Search/Response.js index 05d5544c..6bc8feb0 100644 --- a/src/web/src/components/Search/Response.js +++ b/src/web/src/components/Search/Response.js @@ -3,7 +3,7 @@ import * as transfers from '../../lib/transfers'; import { formatBytes, getDirectoryName } from '../../lib/util'; -import FileList from '../Shared/FileList' +import FileList from '../Shared/FileList'; import { Button, @@ -22,7 +22,7 @@ const buildTree = (response) => { dict[dir] = dict[dir] === undefined ? [ selectable ] : dict[dir].concat(selectable); return dict; }, {}); -} +}; class Response extends Component { state = { @@ -30,7 +30,7 @@ class Response extends Component { downloadRequest: undefined, downloadError: '', isFolded: this.props.isInitiallyFolded, - } + }; componentDidUpdate = (prevProps) => { if (JSON.stringify(this.props.response) !== JSON.stringify(prevProps.response)) { @@ -39,29 +39,29 @@ class Response extends Component { if (this.props.isInitiallyFolded !== prevProps.isInitiallyFolded) { this.setState({ isFolded: this.props.isInitiallyFolded }); } - } + }; onFileSelectionChange = (file, state) => { file.selected = state; - this.setState({ tree: this.state.tree, downloadRequest: undefined, downloadError: '' }) - } + this.setState({ tree: this.state.tree, downloadRequest: undefined, downloadError: '' }); + }; download = (username, files) => { this.setState({ downloadRequest: 'inProgress' }, async () => { try { - const requests = (files || []).map(({ filename, size }) => ({ filename, size })) - await transfers.download({ username, files: requests }) + const requests = (files || []).map(({ filename, size }) => ({ filename, size })); + await transfers.download({ username, files: requests }); - this.setState({ downloadRequest: 'complete' }) + this.setState({ downloadRequest: 'complete' }); } catch (err) { - this.setState({ downloadRequest: 'error', downloadError: err.response }) + this.setState({ downloadRequest: 'error', downloadError: err.response }); } }); - } + }; toggleFolded = () => { this.setState({ isFolded: !this.state.isFolded }); - } + }; render = () => { let {response} = this.props; @@ -134,8 +134,8 @@ class Response extends Component { </span> </Card.Content>} </Card> - ) - } + ); + }; } export default Response; diff --git a/src/web/src/components/Search/SearchStatusIcon.js b/src/web/src/components/Search/SearchStatusIcon.js index 8160d994..0b1bfb16 100644 --- a/src/web/src/components/Search/SearchStatusIcon.js +++ b/src/web/src/components/Search/SearchStatusIcon.js @@ -13,23 +13,23 @@ const getIcon = ({ state, ...props }) => { switch (state) { case 'None': case 'Requested': - return <Icon name='time' {...props}/> + return <Icon name='time' {...props}/>; case 'InProgress': - return <Icon name='circle notch' loading color='green' {...props}/> + return <Icon name='circle notch' loading color='green' {...props}/>; case 'Completed, TimedOut': case 'Completed, ResponseLimitReached': case 'Completed, FileLimitReached': - return <Icon name='check' color='green' {...props}/> + return <Icon name='check' color='green' {...props}/>; case 'Completed, Cancelled': - return <Icon name='stop circle' color='green' {...props}/> + return <Icon name='stop circle' color='green' {...props}/>; case 'Completed, Errored': - return <Icon name='x' color='red' {...props}/> + return <Icon name='x' color='red' {...props}/>; default: - return <Icon name='question circle' color='yellow' {...props}/> + return <Icon name='question circle' color='yellow' {...props}/>; } -} +}; const SearchStatusIcon = ({ state, ...props }) => - <Popup content={state} trigger={getIcon({ state, ...props })}/> + <Popup content={state} trigger={getIcon({ state, ...props })}/>; export default SearchStatusIcon;
\ No newline at end of file diff --git a/src/web/src/components/Search/Searches.js b/src/web/src/components/Search/Searches.js index 76644cc2..fdcda3ac 100644 --- a/src/web/src/components/Search/Searches.js +++ b/src/web/src/components/Search/Searches.js @@ -37,14 +37,14 @@ const Searches = ({ server }) => { const history = useHistory(); const match = useRouteMatch(); - const onConnecting = () => { setConnecting(true); } - const onConnected = () => { setConnecting(false); setError(undefined); } - const onConnectionError = (error) => { setConnecting(false); setError(error); } + const onConnecting = () => { setConnecting(true); }; + const onConnected = () => { setConnecting(false); setError(undefined); }; + const onConnectionError = (error) => { setConnecting(false); setError(error); }; const onUpdate = (update) => { onConnected(); setSearches(update); - } + }; useEffect(() => { onConnecting(); @@ -57,7 +57,7 @@ const Searches = ({ server }) => { return acc; }, {})); onConnected(); - }) + }); searchHub.on('update', search => { onUpdate(old => ({ ...old, [search.id]: search })); @@ -66,7 +66,7 @@ const Searches = ({ server }) => { searchHub.on('delete', search => { onUpdate(old => { delete old[search.id]; - return { ...old } + return { ...old }; }); }); @@ -82,15 +82,15 @@ const Searches = ({ server }) => { await searchHub.start(); } catch (error) { toast.error(error?.message ?? 'Failed to connect'); - onConnectionError(error?.message ?? 'Failed to connect') + onConnectionError(error?.message ?? 'Failed to connect'); } - } + }; connect(); return () => { searchHub.stop(); - } + }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); @@ -102,8 +102,8 @@ const Searches = ({ server }) => { const id = uuidv4(); try { - setCreating(true) - await lib.create({ id, searchText }) + setCreating(true); + await lib.create({ id, searchText }); try { ref.value = ''; @@ -111,27 +111,27 @@ const Searches = ({ server }) => { // we are probably repeating an existing search; the input isn't mounted. no-op. } - setCreating(false) + setCreating(false); if (navigate) { history.push(`${match.url.replace(`/${searchId}`, '')}/${id}`); } } catch (error) { - console.error(error) + console.error(error); toast.error(error?.response?.data ?? error?.message ?? error); - setCreating(false) + setCreating(false); } - } + }; // delete a search const remove = async (search) => { try { setRemoving(true); - await lib.remove({ id: search.id }) + await lib.remove({ id: search.id }); setSearches(old => { delete old[search.id]; - return { ...old } + return { ...old }; }); setRemoving(false); @@ -146,17 +146,17 @@ const Searches = ({ server }) => { const stop = async (search) => { try { setStopping(true); - await lib.stop({ id: search.id }) + await lib.stop({ id: search.id }); setStopping(false); } catch (error) { console.error(error); toast.error(error?.response?.data ?? error?.message ?? error); setStopping(false); } - } + }; if (connecting) { - return <LoaderSegment/> + return <LoaderSegment/>; } if (error) { @@ -225,7 +225,7 @@ const Searches = ({ server }) => { /> } </> - ) + ); }; export default Searches;
\ No newline at end of file diff --git a/src/web/src/components/Shared/CodeEditor.js b/src/web/src/components/Shared/CodeEditor.js index 77867a12..cfac1f2f 100644 --- a/src/web/src/components/Shared/CodeEditor.js +++ b/src/web/src/components/Shared/CodeEditor.js @@ -14,6 +14,6 @@ const CodeEditor = ({ value, onChange = () => {}, ...rest}) => { { ...rest} /> ); -} +}; export default CodeEditor;
\ No newline at end of file diff --git a/src/web/src/components/Shared/Div.js b/src/web/src/components/Shared/Div.js index e9bf999a..c26a40fd 100644 --- a/src/web/src/components/Shared/Div.js +++ b/src/web/src/components/Shared/Div.js @@ -6,6 +6,6 @@ const Div = ({ hidden, children, ...rest }) => { } return (<div {...rest}>{children}</div>); -} +}; export default Div;
\ No newline at end of file diff --git a/src/web/src/components/Shared/Nbsp.js b/src/web/src/components/Shared/Nbsp.js index 1c8bbfa2..24f725fa 100644 --- a/src/web/src/components/Shared/Nbsp.js +++ b/src/web/src/components/Shared/Nbsp.js @@ -1,5 +1,5 @@ const Nbsp = () => { return ' '; -} +}; export default Nbsp;
\ No newline at end of file diff --git a/src/web/src/components/Shared/ShrinkableButton.js b/src/web/src/components/Shared/ShrinkableButton.js index 77981953..2f736ade 100644 --- a/src/web/src/components/Shared/ShrinkableButton.js +++ b/src/web/src/components/Shared/ShrinkableButton.js @@ -4,7 +4,7 @@ import { useMediaQuery } from 'react-responsive'; import { Button, Icon, Popup } from 'semantic-ui-react'; const ShrinkableButton = ({ icon, mediaQuery, children, ...rest }) => { - const shouldShrink = useMediaQuery({ query: mediaQuery }) + const shouldShrink = useMediaQuery({ query: mediaQuery }); if (!shouldShrink) { return ( @@ -12,7 +12,7 @@ const ShrinkableButton = ({ icon, mediaQuery, children, ...rest }) => { <Icon name={icon}/> {children} </Button> - ) + ); } return ( @@ -24,7 +24,7 @@ const ShrinkableButton = ({ icon, mediaQuery, children, ...rest }) => { </Button> } /> - ) -} + ); +}; export default ShrinkableButton;
\ No newline at end of file diff --git a/src/web/src/components/Shared/ShrinkableDropdownButton.js b/src/web/src/components/Shared/ShrinkableDropdownButton.js index 2f4db781..bdf6b3a1 100644 --- a/src/web/src/components/Shared/ShrinkableDropdownButton.js +++ b/src/web/src/components/Shared/ShrinkableDropdownButton.js @@ -41,6 +41,6 @@ const ShrinkableDropdownButton = ({ /> </Button.Group> ); -} +}; export default ShrinkableDropdownButton;
\ No newline at end of file diff --git a/src/web/src/components/Shared/Switch.js b/src/web/src/components/Shared/Switch.js index 9b8e4beb..7dad342f 100644 --- a/src/web/src/components/Shared/Switch.js +++ b/src/web/src/components/Shared/Switch.js @@ -6,6 +6,6 @@ const Switch = ({ children, ...rest }) => { } return children; -} +}; export default Switch;
\ No newline at end of file diff --git a/src/web/src/components/System/Info.js b/src/web/src/components/System/Info.js index 8991777b..d9ce8813 100644 --- a/src/web/src/components/System/Info.js +++ b/src/web/src/components/System/Info.js @@ -8,7 +8,7 @@ import CodeEditor from '../Shared/CodeEditor'; import ShrinkableButton from '../Shared/ShrinkableButton'; const Info = ({ state }) => { - const stateAsYaml = YAML.stringify(state, { simpleKeys: true, sortMapEntries: true }) + const stateAsYaml = YAML.stringify(state, { simpleKeys: true, sortMapEntries: true }); return ( <> @@ -65,6 +65,6 @@ const Info = ({ state }) => { </div> </> ); -} +}; export default Info;
\ No newline at end of file diff --git a/src/web/src/components/System/Logs.js b/src/web/src/components/System/Logs.js index 945fd5e2..4a118414 100644 --- a/src/web/src/components/System/Logs.js +++ b/src/web/src/components/System/Logs.js @@ -8,14 +8,14 @@ import './System.css'; const initialState = { logs: [], connected: false, -} +}; const levels = { 'Debug': 'DBG', 'Warning': 'WRN', 'Error': 'ERR', 'Information': 'INF', -} +}; const maxLogs = 500; @@ -27,23 +27,23 @@ class Logs extends Component { logsHub.on('buffer', (buffer) => { this.setState({ connected: true, logs: buffer.reverse().slice(0, maxLogs) }); - }) + }); logsHub.on('log', (log) => { this.setState({ connected: true, logs: [log].concat(this.state.logs).slice(0, maxLogs) }); - }) + }); logsHub.onreconnecting(() => this.setState({ connected: false })); logsHub.onclose(() => this.setState({ connected: false })); logsHub.onreconnected(() => this.setState({ connected: true })); logsHub.start(); - } + }; formatTimestamp = (timestamp) => { const date = new Date(timestamp); return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}:${date.getSeconds().toString().padStart(2, '0')}`; // eslint-disable-line max-len - } + }; render = () => { const { connected, logs } = this.state; @@ -77,7 +77,7 @@ class Logs extends Component { } </div> ); - } + }; } export default Logs;
\ No newline at end of file diff --git a/src/web/src/components/System/Options/Edit.js b/src/web/src/components/System/Options/Edit.js index 825dd900..f9657022 100644 --- a/src/web/src/components/System/Options/Edit.js +++ b/src/web/src/components/System/Options/Edit.js @@ -14,7 +14,7 @@ const Edit = ({ cancelAction }) => { useEffect(() => { get(); - }, []) + }, []); const get = async () => { setLoading({ loading: true, error: false }); @@ -22,22 +22,22 @@ const Edit = ({ cancelAction }) => { try { const [location, yaml] = await Promise.all([getYamlLocation(), getYaml()]); - setYaml({ location, yaml, isDirty: false }) - setLoading({ loading: false, error: false }) + setYaml({ location, yaml, isDirty: false }); + setLoading({ loading: false, error: false }); } catch (error) { - setLoading({ loading: false, error: error.message }) + setLoading({ loading: false, error: error.message }); } - } + }; const update = async (yaml) => { setYaml({ location, yaml, isDirty: true }); validate(yaml); - } + }; const validate = async (yaml) => { const response = await validateYaml({ yaml }); setYamlError(response); - } + }; const save = async (yaml) => { await validate(yaml); @@ -51,14 +51,14 @@ const Edit = ({ cancelAction }) => { setUpdateError(error.response.data); } } - } + }; if (loading) { - return <PlaceholderSegment loading={true}/> + return <PlaceholderSegment loading={true}/>; } if (error) { - return <PlaceholderSegment icon='close'/> + return <PlaceholderSegment icon='close'/>; } return ( @@ -82,6 +82,6 @@ const Edit = ({ cancelAction }) => { </div> </> ); -} +}; export default Edit;
\ No newline at end of file diff --git a/src/web/src/components/System/Options/View.js b/src/web/src/components/System/Options/View.js index 83b24a88..9d4d7635 100644 --- a/src/web/src/components/System/Options/View.js +++ b/src/web/src/components/System/Options/View.js @@ -7,7 +7,7 @@ import CodeEditor from '../../Shared/CodeEditor'; const View = ({ options, editAction }) => { const { remoteConfiguration } = options; - const optionsAsYaml = YAML.stringify(options, { simpleKeys: true, sortMapEntries: true }) + const optionsAsYaml = YAML.stringify(options, { simpleKeys: true, sortMapEntries: true }); return ( <> @@ -25,6 +25,6 @@ const View = ({ options, editAction }) => { </div> </> ); -} +}; export default View;
\ No newline at end of file diff --git a/src/web/src/components/System/Options/index.js b/src/web/src/components/System/Options/index.js index 9e92b423..92535b95 100644 --- a/src/web/src/components/System/Options/index.js +++ b/src/web/src/components/System/Options/index.js @@ -7,10 +7,10 @@ const Index = ({ options }) => { const [mode, setMode] = useState('view'); if (mode === 'edit') { - return <Edit cancelAction={() => setMode('view')}/> + return <Edit cancelAction={() => setMode('view')}/>; } - return <View options={options} editAction={() => setMode('edit')}/> -} + return <View options={options} editAction={() => setMode('edit')}/>; +}; export default Index;
\ No newline at end of file diff --git a/src/web/src/components/System/System.js b/src/web/src/components/System/System.js index a4c79e12..9310777f 100644 --- a/src/web/src/components/System/System.js +++ b/src/web/src/components/System/System.js @@ -20,16 +20,16 @@ const System = ({ state = {}, options = {} }) => { <Tab.Pane className='full-height'><Options options={options} /></Tab.Pane>, }, { route: 'logs', menuItem: 'Logs', render: () => <Tab.Pane><Logs/></Tab.Pane> }, - ] + ]; - const activeIndex = panes.findIndex(pane => pane.route === tab) + const activeIndex = panes.findIndex(pane => pane.route === tab); const onTabChange = (e, { activeIndex }) => { - history.push(panes[activeIndex].route) - } + history.push(panes[activeIndex].route); + }; if (tab === undefined) { - return <Redirect to={`${route.url}/${panes[0].route}`}/> + return <Redirect to={`${route.url}/${panes[0].route}`}/>; } return ( diff --git a/src/web/src/components/Transfers/TransferGroup.js b/src/web/src/components/Transfers/TransferGroup.js index a8a2f627..023c18a0 100644 --- a/src/web/src/components/Transfers/TransferGroup.js +++ b/src/web/src/components/Transfers/TransferGroup.js @@ -13,7 +13,7 @@ class TransferGroup extends Component { state = { selections: new Set(), isFolded: false, - } + }; onSelectionChange = (directoryName, file, selected) => { const {selections} = this.state; @@ -21,7 +21,7 @@ class TransferGroup extends Component { selected ? selections.add(obj) : selections.delete(obj); this.setState({ selections }); - } + }; isSelected = (directoryName, file) => this.state.selections.has(JSON.stringify({ directory: directoryName, filename: file.filename })); @@ -35,7 +35,7 @@ class TransferGroup extends Component { .find(d => d.directory === s.directory) .files.find(f => f.filename === s.filename) ).filter(s => s !== undefined); - } + }; removeFileSelection = (file) => { const {selections} = this.state; @@ -48,21 +48,21 @@ class TransferGroup extends Component { selections.delete(JSON.stringify(match)); this.setState({ selections }); } - } + }; retryAll = async (selected) => { await Promise.all(selected.map(file => this.retry(file))); - } + }; cancelAll = async (direction, username, selected) => { await Promise.all(selected.map(file => transfers.cancel({ direction, username, id: file.id}))); - } + }; removeAll = async (direction, username, selected) => { await Promise.all(selected.map(file => transfers.cancel({ direction, username, id: file.id, remove: true }) .then(() => this.removeFileSelection(file)))); - } + }; retry = async (file) => { const { username, filename, size } = file; @@ -72,7 +72,7 @@ class TransferGroup extends Component { } catch (error) { console.log(error); } - } + }; fetchPlaceInQueue = async (file) => { const { username, id } = file; @@ -82,11 +82,11 @@ class TransferGroup extends Component { } catch (error) { console.log(error); } - } + }; toggleFolded = () => { this.setState({'isFolded': !this.state.isFolded}); - } + }; render = () => { const { user, direction } = this.props; @@ -153,7 +153,7 @@ class TransferGroup extends Component { </Card.Content>} </Card> ); - } + }; } export default TransferGroup; diff --git a/src/web/src/components/Transfers/TransferList.js b/src/web/src/components/Transfers/TransferList.js index 5908c9cb..d477fe44 100644 --- a/src/web/src/components/Transfers/TransferList.js +++ b/src/web/src/components/Transfers/TransferList.js @@ -31,30 +31,30 @@ const getColor = (state) => { default: return { color: 'red' }; } -} +}; const isRetryableState = (state) => getColor(state).color === 'red'; const isQueuedState = (state) => state.includes('Queued'); const formatBytesTransferred = ({ transferred, size }) => { - const [t, tExt] = formatBytes(transferred).split(' ') - const [s, sExt] = formatBytes(size).split(' ') + const [t, tExt] = formatBytes(transferred).split(' '); + const [s, sExt] = formatBytes(size).split(' '); const fmt = (n) => parseFloat(n).toFixed(2); // if less than 1 MB has been transferred, don't include decimals if (tExt === 'KB') { - return `${t} KB/${fmt(s)} ${sExt}` + return `${t} KB/${fmt(s)} ${sExt}`; } // if the suffix for size and transferred doesn't match, include // the suffix for each if (tExt !== sExt) { - return `${fmt(t)} ${tExt}/${fmt(s)} ${sExt}` + return `${fmt(t)} ${tExt}/${fmt(s)} ${sExt}`; } - return `${fmt(t)}/${fmt(s)} ${sExt}` -} + return `${fmt(t)}/${fmt(s)} ${sExt}`; +}; class TransferList extends Component { handleClick = (file) => { @@ -69,7 +69,7 @@ class TransferList extends Component { return this.props.onPlaceInQueueRequested(file); } } - } + }; render = () => { const { directoryName, onSelectionChange, files } = this.props; @@ -143,8 +143,8 @@ class TransferList extends Component { </List.Item> </List> </div> - ) - } + ); + }; } export default TransferList; diff --git a/src/web/src/components/Transfers/Transfers.js b/src/web/src/components/Transfers/Transfers.js index 30905f74..638c0d67 100644 --- a/src/web/src/components/Transfers/Transfers.js +++ b/src/web/src/components/Transfers/Transfers.js @@ -26,14 +26,14 @@ const Transfers = ({ direction, server }) => { const init = async () => { await fetch(); setConnecting(false); - } + }; init(); const interval = window.setInterval(fetch, 1000); return () => { clearInterval(interval); - } + }; }, [direction]); // eslint-disable-line react-hooks/exhaustive-deps useMemo(() => { @@ -54,7 +54,7 @@ const Transfers = ({ direction, server }) => { console.error(error); toast.error(error?.response?.data ?? error?.message ?? error); } - } + }; const retry = async ({ file, suppressStateChange = false }) => { const { username, filename, size } = file; @@ -68,13 +68,13 @@ const Transfers = ({ direction, server }) => { toast.error(error?.response?.data ?? error?.message ?? error); if (!suppressStateChange) setRetrying(false); } - } + }; const retryAll = async (transfers) => { setRetrying(true); - await Promise.all(transfers.map(file => retry({ file, suppressStateChange: true }))) + await Promise.all(transfers.map(file => retry({ file, suppressStateChange: true }))); setRetrying(false); - } + }; const cancel = async ({ file, suppressStateChange = false }) => { const { username, id } = file; @@ -88,13 +88,13 @@ const Transfers = ({ direction, server }) => { toast.error(error?.response?.data ?? error?.message ?? error); if (!suppressStateChange) setCancelling(false); } - } + }; const cancelAll = async (transfers) => { setCancelling(true); await Promise.all(transfers.map(file => cancel({ file, suppressStateChange: true }))); setCancelling(false); - } + }; const remove = async ({ file, suppressStateChange = false }) => { const { username, id } = file; @@ -108,16 +108,16 @@ const Transfers = ({ direction, server }) => { toast.error(error?.response?.data ?? error?.message ?? error); if (!suppressStateChange) setRemoving(false); } - } + }; const removeAll = async (transfers) => { setRemoving(true); await Promise.all(transfers.map(file => remove({ file, suppressStateChange: true }))); setRemoving(false); - } + }; if (connecting) { - return <LoaderSegment/> + return <LoaderSegment/>; } return ( @@ -150,6 +150,6 @@ const Transfers = ({ direction, server }) => { )} </> ); -} +}; export default Transfers;
\ No newline at end of file diff --git a/src/web/src/components/Transfers/TransfersHeader.js b/src/web/src/components/Transfers/TransfersHeader.js index d3ef383b..bb130d11 100644 --- a/src/web/src/components/Transfers/TransfersHeader.js +++ b/src/web/src/components/Transfers/TransfersHeader.js @@ -27,7 +27,7 @@ const getRetryableFiles = ({ files, retryOption }) => { default: return []; } -} +}; const getCancellableFiles = ({ files, cancelOption }) => { switch (cancelOption) { @@ -36,11 +36,11 @@ const getCancellableFiles = ({ files, cancelOption }) => { case 'Queued': return files.filter(file => ['Queued, Locally', 'Queued, Remotely'].includes(file.state)); case 'In Progress': - return files.filter(file => file.state === 'InProgress') + return files.filter(file => file.state === 'InProgress'); default: return []; } -} +}; const getRemovableFiles = ({ files, removeOption }) => { switch (removeOption) { @@ -58,7 +58,7 @@ const getRemovableFiles = ({ files, removeOption }) => { default: return []; } -} +}; const TransfersHeader = ({ direction, @@ -82,7 +82,7 @@ const TransfersHeader = ({ return acc; }, []); - acc = acc.concat(allUserFiles) + acc = acc.concat(allUserFiles); return acc; }, []); @@ -149,7 +149,7 @@ const TransfersHeader = ({ </ShrinkableDropdownButton> </Div> </Segment> - ) + ); }; export default TransfersHeader;
\ No newline at end of file diff --git a/src/web/src/components/Users/User.js b/src/web/src/components/Users/User.js index 38d11a22..d4da80ee 100644 --- a/src/web/src/components/Users/User.js +++ b/src/web/src/components/Users/User.js @@ -10,9 +10,9 @@ const Presence = ({ presence }) => { const colors = { Away: 'yellow', Online: 'green', - } + }; - return <Icon name='circle' color={colors[presence] || 'grey'}/> + return <Icon name='circle' color={colors[presence] || 'grey'}/>; }; const FreeUploadSlot = ({ hasFreeUploadSlot }) => ( diff --git a/src/web/src/components/Users/Users.js b/src/web/src/components/Users/Users.js index 6478f2be..b887d962 100644 --- a/src/web/src/components/Users/Users.js +++ b/src/web/src/components/Users/Users.js @@ -57,7 +57,7 @@ const Users = (props) => { } catch (error) { setStatus({ fetching: false, error: error }); } - } + }; fetchUser(); }, [selectedUsername]); @@ -68,15 +68,15 @@ const Users = (props) => { setUser(undefined); setInputText(''); setInputFocus(); - } + }; const setInputText = (text) => { inputRef.current.inputRef.current.value = text; - } + }; const setInputFocus = () => { inputRef.current.focus(); - } + }; const keyUp = (e) => e.key === 'Escape' ? clear() : ''; diff --git a/src/web/src/lib/api.js b/src/web/src/lib/api.js index 85c72d82..0de23c11 100644 --- a/src/web/src/lib/api.js +++ b/src/web/src/lib/api.js @@ -24,7 +24,7 @@ api.interceptors.response.use(response => { return response; }, error => { if (error.response.status === 401 && !['/session', '/server', '/application'].includes(error.response.config.url)) { - console.debug('received 401 from api route, logging out') + console.debug('received 401 from api route, logging out'); session.logout(); window.location.reload(true); diff --git a/src/web/src/lib/application.js b/src/web/src/lib/application.js index 0c8b8319..20260d9b 100644 --- a/src/web/src/lib/application.js +++ b/src/web/src/lib/application.js @@ -10,8 +10,8 @@ export const restart = async () => { export const shutdown = async () => { return api.delete('/application'); -} +}; export const getVersion = async ({ forceCheck = false }) => { return (await api.get(`/application/version/latest?forceCheck=${forceCheck}`)).data; -}
\ No newline at end of file +};
\ No newline at end of file diff --git a/src/web/src/lib/hubFactory.js b/src/web/src/lib/hubFactory.js index effe3be0..7d84864e 100644 --- a/src/web/src/lib/hubFactory.js +++ b/src/web/src/lib/hubFactory.js @@ -2,7 +2,7 @@ import { JsonHubProtocol, HubConnectionBuilder, LogLevel, -} from '@microsoft/signalr' +} from '@microsoft/signalr'; import { hubBaseUrl } from '../config'; import * as session from '../lib/session'; @@ -22,4 +22,4 @@ export const createApplicationHubConnection = () => createHubConnection({ url: ` export const createLogsHubConnection = () => createHubConnection({ url: `${hubBaseUrl}/logs` }); -export const createSearchHubConnection = () => createHubConnection({ url: `${hubBaseUrl}/search`}) +export const createSearchHubConnection = () => createHubConnection({ url: `${hubBaseUrl}/search`}); diff --git a/src/web/src/lib/options.js b/src/web/src/lib/options.js index da198bd8..20f8dd0a 100644 --- a/src/web/src/lib/options.js +++ b/src/web/src/lib/options.js @@ -10,7 +10,7 @@ export const getYaml = async () => { export const getYamlLocation = async () => { return (await api.get('/options/yaml/location')).data; -} +}; export const validateYaml = async ({ yaml }) => { return (await api.post('/options/yaml/validate', yaml)).data; diff --git a/src/web/src/lib/rooms.js b/src/web/src/lib/rooms.js index c30a7a15..96b01446 100644 --- a/src/web/src/lib/rooms.js +++ b/src/web/src/lib/rooms.js @@ -4,7 +4,7 @@ export const getAvailable = async () => { const response = (await api.get('/rooms/available')).data; if (!Array.isArray(response)) { - console.warn('got non-array response from rooms API', response) + console.warn('got non-array response from rooms API', response); return undefined; } @@ -15,7 +15,7 @@ export const getJoined = async () => { const response = (await api.get('/rooms/joined')).data; if (!Array.isArray(response)) { - console.warn('got non-array response from rooms API', response) + console.warn('got non-array response from rooms API', response); return undefined; } @@ -26,7 +26,7 @@ export const getMessages = async ({ roomName }) => { const response = (await api.get(`/rooms/joined/${encodeURIComponent(roomName)}/messages`)).data; if (!Array.isArray(response)) { - console.warn('got non-array response from rooms API', response) + console.warn('got non-array response from rooms API', response); return undefined; } @@ -37,7 +37,7 @@ export const getUsers = async ({ roomName }) => { const response = (await api.get(`/rooms/joined/${encodeURIComponent(roomName)}/users`)).data; if (!Array.isArray(response)) { - console.warn('got non-array response from rooms API', response) + console.warn('got non-array response from rooms API', response); return undefined; } diff --git a/src/web/src/lib/searches.js b/src/web/src/lib/searches.js index 46e506cb..c7312bf5 100644 --- a/src/web/src/lib/searches.js +++ b/src/web/src/lib/searches.js @@ -2,15 +2,15 @@ import api from './api'; export const getAll = async () => { return (await api.get('/searches')).data; -} +}; export const stop = ({ id }) => { - return api.put(`/searches/${encodeURIComponent(id)}`) -} + return api.put(`/searches/${encodeURIComponent(id)}`); +}; export const remove = ({ id }) => { - return api.delete(`/searches/${encodeURIComponent(id)}`) -} + return api.delete(`/searches/${encodeURIComponent(id)}`); +}; export const create = ({ id, searchText }) => { return api.post('/searches', { id, searchText }); @@ -24,7 +24,7 @@ export const getResponses = async ({ id }) => { const response = (await api.get(`/searches/${encodeURIComponent(id)}/responses`)).data; if (!Array.isArray(response)) { - console.warn('got non-array response from searches API', response) + console.warn('got non-array response from searches API', response); return undefined; } @@ -51,7 +51,7 @@ export const parseFiltersFromString = (string) => { if (match) { return parseInt(match[n], 10); } - } + }; filters.minBitRate = getNthMatch(string, /(minbr|minbitrate):([0-9]+)/i, 2) || filters.minBitRate; filters.minFileSize = getNthMatch(string, /(minfs|minfilesize):([0-9]+)/i, 2) || filters.minFileSize; @@ -93,7 +93,7 @@ export const filterResponse = ({ let { files = [], lockedFiles = [] } = response; if (response.fileCount + response.lockedFileCount < filters.minFilesInFolder) { - return { ...response, files: [] } + return { ...response, files: [] }; } const filterFiles = (files) => files.filter(file => { diff --git a/src/web/src/lib/session.js b/src/web/src/lib/session.js index 822a28a9..c46c5eb7 100644 --- a/src/web/src/lib/session.js +++ b/src/web/src/lib/session.js @@ -9,16 +9,16 @@ export const getSecurityEnabled = async () => { }; export const enablePassthrough = () => { - console.debug('enabling token passthrough. api calls will not be authenticated') - setToken(sessionStorage, tokenPassthroughValue) -} + console.debug('enabling token passthrough. api calls will not be authenticated'); + setToken(sessionStorage, tokenPassthroughValue); +}; export const isPassthroughEnabled = () => getToken() === tokenPassthroughValue; export const isLoggedIn = () => { const token = getToken(); return token !== undefined && token !== null && token !== tokenPassthroughValue; -} +}; export const login = async ({ username, password, rememberMe = false }) => { const { token } = (await api.post('/session', { username, password })).data; @@ -27,10 +27,10 @@ export const login = async ({ username, password, rememberMe = false }) => { }; export const logout = () => { - console.debug('removing token from local and session storage') - localStorage.removeItem(tokenKey) - sessionStorage.removeItem(tokenKey) -} + console.debug('removing token from local and session storage'); + localStorage.removeItem(tokenKey); + sessionStorage.removeItem(tokenKey); +}; export const check = async () => { try { @@ -38,7 +38,7 @@ export const check = async () => { return true; } catch (error) { if (error.response.status === 401) { - console.error('session error; not logged in or session has expired') + console.error('session error; not logged in or session has expired'); logout(); return false; } else { diff --git a/src/web/src/lib/transfers.js b/src/web/src/lib/transfers.js index 4a6eec5e..e9d021e0 100644 --- a/src/web/src/lib/transfers.js +++ b/src/web/src/lib/transfers.js @@ -4,7 +4,7 @@ export const getAll = async ({ direction }) => { const response = (await api.get(`/transfers/${direction}s`)).data; if (!Array.isArray(response)) { - console.warn('got non-array response from transfers API', response) + console.warn('got non-array response from transfers API', response); return undefined; } diff --git a/src/web/src/lib/util.js b/src/web/src/lib/util.js index f00b0683..94095efa 100644 --- a/src/web/src/lib/util.js +++ b/src/web/src/lib/util.js @@ -4,7 +4,7 @@ export const formatSeconds = (seconds) => var date = new Date(1970,0,1); date.setSeconds(seconds); return date.toTimeString().replace(/.*(\d{2}:\d{2}).*/, '$1'); -} +}; export const formatBytes = (bytes, decimals = 2) => { if (bytes === 0) return '0 Bytes'; @@ -16,11 +16,11 @@ export const formatBytes = (bytes, decimals = 2) => { const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; -} +}; export const getFileName = (fullPath) => { return fullPath.split('\\').pop().split('/').pop(); -} +}; export const getDirectoryName = (fullPath) => { let path = fullPath; @@ -32,7 +32,7 @@ export const getDirectoryName = (fullPath) => { {path = path.substring(0, path.lastIndexOf('/'));} return path; -} +}; export const formatAttributes = ({ bitRate, isVariableBitRate, bitDepth, sampleRate }) => { const isLossless = !!sampleRate && !!bitDepth; @@ -42,15 +42,15 @@ export const formatAttributes = ({ bitRate, isVariableBitRate, bitDepth, sampleR } if (isVariableBitRate) { - return `${bitRate} Kbps, VBR` + return `${bitRate} Kbps, VBR`; } - return bitRate ? `${bitRate} Kbps` : '' -} + return bitRate ? `${bitRate} Kbps` : ''; +}; export const sleep = (milliseconds) => { - return new Promise(resolve => setTimeout(resolve, milliseconds)) -} + return new Promise(resolve => setTimeout(resolve, milliseconds)); +}; /* https://www.npmjs.com/package/js-file-download * @@ -99,4 +99,4 @@ export const downloadFile = (data, filename, mime) => { document.body.removeChild(tempLink); window.URL.revokeObjectURL(blobURL); } -}
\ No newline at end of file +};
\ No newline at end of file |
