Skip to content

Commit

Permalink
Merge pull request #312 from pawelmalak/feature
Browse files Browse the repository at this point in the history
Version 2.2.2
  • Loading branch information
pawelmalak authored Mar 21, 2022
2 parents 750891c + c2e8183 commit baac780
Show file tree
Hide file tree
Showing 24 changed files with 221 additions and 192 deletions.
2 changes: 2 additions & 0 deletions .dev/build_latest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build -t pawelmalak/flame -t "pawelmalak/flame:$1" -f .docker/Dockerfile "$2" \
&& docker push pawelmalak/flame && docker push "pawelmalak/flame:$1"
6 changes: 6 additions & 0 deletions .dev/build_multiarch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker buildx build \
--platform linux/arm/v7,linux/arm64,linux/amd64 \
-f .docker/Dockerfile.multiarch \
-t pawelmalak/flame:multiarch \
-t "pawelmalak/flame:multiarch$1" \
--push "$2"
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ EXPOSE 5005
ENV NODE_ENV=production
ENV PASSWORD=flame_password

CMD ["node", "server.js"]
CMD ["sh", "-c", "chown -R node /app/data && node server.js"]
2 changes: 1 addition & 1 deletion .docker/Dockerfile.multiarch
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ EXPOSE 5005
ENV NODE_ENV=production
ENV PASSWORD=flame_password

CMD ["node", "server.js"]
CMD ["sh", "-c", "chown -R node /app/data && node server.js"]
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PORT=5005
NODE_ENV=development
VERSION=2.2.1
VERSION=2.2.2
PASSWORD=flame_password
SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_modules
data
public
!client/public
build.sh
!client/public
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### v2.2.2 (2022-03-21)
- Added option to get user location directly from the app ([#287](https://github.com/pawelmalak/flame/issues/287))
- Fixed bug with local search not working when using prefix ([#289](https://github.com/pawelmalak/flame/issues/289))
- Fixed bug with app description not updating when using custom icon ([#310](https://github.com/pawelmalak/flame/issues/310))
- Changed permissions to some files and directories created by Flame
- Changed some of the settings tabs

### v2.2.1 (2022-01-08)
- Local search will now include app descriptions ([#266](https://github.com/pawelmalak/flame/issues/266))
- Fixed bug with unsupported characters in local search [#279](https://github.com/pawelmalak/flame/issues/279))
Expand Down
2 changes: 1 addition & 1 deletion client/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_VERSION=2.2.1
REACT_APP_VERSION=2.2.2
2 changes: 2 additions & 0 deletions client/src/components/Apps/AppForm/AppForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const AppForm = ({ modalHandler }: Props): JSX.Element => {
if (customIcon) {
data.append('icon', customIcon);
}

data.append('name', formData.name);
data.append('description', formData.description);
data.append('url', formData.url);
data.append('isPublic', `${formData.isPublic ? 1 : 0}`);

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Apps/AppTable/AppTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const AppTable = (props: Props): JSX.Element => {
) : (
<p>
Custom order is disabled. You can change it in the{' '}
<Link to="/settings/interface">settings</Link>
<Link to="/settings/general">settings</Link>
</p>
)}
</Message>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Bookmarks/Table/CategoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const CategoryTable = ({ openFormForUpdating }: Props): JSX.Element => {
) : (
<p>
Custom order is disabled. You can change it in the{' '}
<Link to="/settings/interface">settings</Link>
<Link to="/settings/general">settings</Link>
</p>
)}
</Message>
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export const SearchBar = (props: Props): JSX.Element => {
);

if (isLocal) {
// no additional encoding required for local search
setLocalSearch(inputRef.current.value);
setLocalSearch(search);
}

if (e.code === 'Enter' || e.code === 'NumpadEnter') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState, useEffect, FormEvent, ChangeEvent, Fragment } from 'react';
import { useDispatch, useSelector } from 'react-redux';

// Typescript
import { Query, SearchForm } from '../../../interfaces';
import { Query, GeneralForm } from '../../../interfaces';

// Components
import { CustomQueries } from './CustomQueries/CustomQueries';
Expand All @@ -12,7 +12,7 @@ import { CustomQueries } from './CustomQueries/CustomQueries';
import { Button, SettingsHeadline, InputGroup } from '../../UI';

// Utils
import { inputHandler, searchSettingsTemplate } from '../../../utility';
import { inputHandler, generalSettingsTemplate } from '../../../utility';

// Data
import { queries } from '../../../utility/searchQueries.json';
Expand All @@ -22,16 +22,20 @@ import { State } from '../../../store/reducers';
import { bindActionCreators } from 'redux';
import { actionCreators } from '../../../store';

export const SearchSettings = (): JSX.Element => {
const { loading, customQueries, config } = useSelector(
(state: State) => state.config
);
export const GeneralSettings = (): JSX.Element => {
const {
config: { loading, customQueries, config },
bookmarks: { categories },
} = useSelector((state: State) => state);

const dispatch = useDispatch();
const { updateConfig } = bindActionCreators(actionCreators, dispatch);
const { updateConfig, sortApps, sortCategories, sortBookmarks } =
bindActionCreators(actionCreators, dispatch);

// Initial state
const [formData, setFormData] = useState<SearchForm>(searchSettingsTemplate);
const [formData, setFormData] = useState<GeneralForm>(
generalSettingsTemplate
);

// Get config
useEffect(() => {
Expand All @@ -46,14 +50,24 @@ export const SearchSettings = (): JSX.Element => {

// Save settings
await updateConfig(formData);

// Sort entities with new settings
if (formData.useOrdering !== config.useOrdering) {
sortApps();
sortCategories();

for (let { id } of categories) {
sortBookmarks(id);
}
}
};

// Input handler
const inputChangeHandler = (
e: ChangeEvent<HTMLInputElement | HTMLSelectElement>,
options?: { isNumber?: boolean; isBool?: boolean }
) => {
inputHandler<SearchForm>({
inputHandler<GeneralForm>({
e,
options,
setStateHandler: setFormData,
Expand All @@ -63,66 +77,123 @@ export const SearchSettings = (): JSX.Element => {

return (
<Fragment>
{/* GENERAL SETTINGS */}
<form
onSubmit={(e) => formSubmitHandler(e)}
style={{ marginBottom: '30px' }}
>
{/* === GENERAL OPTIONS === */}
<SettingsHeadline text="General" />
{/* SORT TYPE */}
<InputGroup>
<label htmlFor="defaultSearchProvider">Default search provider</label>
<label htmlFor="useOrdering">Sorting type</label>
<select
id="defaultSearchProvider"
name="defaultSearchProvider"
value={formData.defaultSearchProvider}
id="useOrdering"
name="useOrdering"
value={formData.useOrdering}
onChange={(e) => inputChangeHandler(e)}
>
{[...queries, ...customQueries].map((query: Query, idx) => {
const isCustom = idx >= queries.length;
<option value="createdAt">By creation date</option>
<option value="name">Alphabetical order</option>
<option value="orderId">Custom order</option>
</select>
</InputGroup>

return (
<option key={idx} value={query.prefix}>
{isCustom && '+'} {query.name}
</option>
);
})}
{/* === APPS OPTIONS === */}
<SettingsHeadline text="Apps" />
{/* PIN APPS */}
<InputGroup>
<label htmlFor="pinAppsByDefault">
Pin new applications by default
</label>
<select
id="pinAppsByDefault"
name="pinAppsByDefault"
value={formData.pinAppsByDefault ? 1 : 0}
onChange={(e) => inputChangeHandler(e, { isBool: true })}
>
<option value={1}>True</option>
<option value={0}>False</option>
</select>
</InputGroup>

{/* APPS OPPENING */}
<InputGroup>
<label htmlFor="searchSameTab">
Open search results in the same tab
<label htmlFor="appsSameTab">Open applications in the same tab</label>
<select
id="appsSameTab"
name="appsSameTab"
value={formData.appsSameTab ? 1 : 0}
onChange={(e) => inputChangeHandler(e, { isBool: true })}
>
<option value={1}>True</option>
<option value={0}>False</option>
</select>
</InputGroup>

{/* === BOOKMARKS OPTIONS === */}
<SettingsHeadline text="Bookmarks" />
{/* PIN CATEGORIES */}
<InputGroup>
<label htmlFor="pinCategoriesByDefault">
Pin new categories by default
</label>
<select
id="searchSameTab"
name="searchSameTab"
value={formData.searchSameTab ? 1 : 0}
id="pinCategoriesByDefault"
name="pinCategoriesByDefault"
value={formData.pinCategoriesByDefault ? 1 : 0}
onChange={(e) => inputChangeHandler(e, { isBool: true })}
>
<option value={1}>True</option>
<option value={0}>False</option>
</select>
</InputGroup>

{/* BOOKMARKS OPPENING */}
<InputGroup>
<label htmlFor="hideSearch">Hide search bar</label>
<label htmlFor="bookmarksSameTab">
Open bookmarks in the same tab
</label>
<select
id="hideSearch"
name="hideSearch"
value={formData.hideSearch ? 1 : 0}
id="bookmarksSameTab"
name="bookmarksSameTab"
value={formData.bookmarksSameTab ? 1 : 0}
onChange={(e) => inputChangeHandler(e, { isBool: true })}
>
<option value={1}>True</option>
<option value={0}>False</option>
</select>
</InputGroup>

{/* SEARCH SETTINGS */}
<SettingsHeadline text="Search" />
<InputGroup>
<label htmlFor="disableAutofocus">Disable search bar autofocus</label>
<label htmlFor="defaultSearchProvider">Default search provider</label>
<select
id="disableAutofocus"
name="disableAutofocus"
value={formData.disableAutofocus ? 1 : 0}
id="defaultSearchProvider"
name="defaultSearchProvider"
value={formData.defaultSearchProvider}
onChange={(e) => inputChangeHandler(e)}
>
{[...queries, ...customQueries].map((query: Query, idx) => {
const isCustom = idx >= queries.length;

return (
<option key={idx} value={query.prefix}>
{isCustom && '+'} {query.name}
</option>
);
})}
</select>
</InputGroup>

<InputGroup>
<label htmlFor="searchSameTab">
Open search results in the same tab
</label>
<select
id="searchSameTab"
name="searchSameTab"
value={formData.searchSameTab ? 1 : 0}
onChange={(e) => inputChangeHandler(e, { isBool: true })}
>
<option value={1}>True</option>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { WeatherSettings } from './WeatherSettings/WeatherSettings';
import { UISettings } from './UISettings/UISettings';
import { AppDetails } from './AppDetails/AppDetails';
import { StyleSettings } from './StyleSettings/StyleSettings';
import { SearchSettings } from './SearchSettings/SearchSettings';
import { GeneralSettings } from './GeneralSettings/GeneralSettings';
import { DockerSettings } from './DockerSettings/DockerSettings';
import { ProtectedRoute } from '../Routing/ProtectedRoute';

Expand Down Expand Up @@ -59,8 +59,8 @@ export const Settings = (): JSX.Element => {
component={WeatherSettings}
/>
<ProtectedRoute
path="/settings/search"
component={SearchSettings}
path="/settings/general"
component={GeneralSettings}
/>
<ProtectedRoute path="/settings/interface" component={UISettings} />
<ProtectedRoute
Expand Down
Loading

0 comments on commit baac780

Please sign in to comment.