Skip to content

Commit

Permalink
Merge pull request #1329 from shlinkio/develop
Browse files Browse the repository at this point in the history
Release 4.2.1
  • Loading branch information
acelaya authored Oct 9, 2024
2 parents 9e1a803 + 45a9783 commit 9a798c2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 13 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org).

## [4.2.1] - 2024-10-09
### Added
* *Nothing*

### Changed
* *Nothing*

### Deprecated
* *Nothing*

### Removed
* *Nothing*

### Fixed
* [#1325](https://github.com/shlinkio/shlink-web-client/issues/1325) Get dependency on `uuid` package back, as `crypto.randomUUID()` can only be used in [secure contexts](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
* [shlink-web-component#461](https://github.com/shlinkio/shlink-web-component/issues/461) Ensure `shortUrlsList.confirmDeletion` setting is `true` in any case, except when explicitly set to `false`.
* [shlink-web-component#237](https://github.com/shlinkio/shlink-web-component/issues/237) Set darker color for previous period in charts, when light theme is enabled.
* [shlink-web-component#246](https://github.com/shlinkio/shlink-web-component/issues/246) Fix selected date range not reflected in visits comparison date range selector, when selecting it in the line chart via drag'n'drop.


## [4.2.0] - 2024-10-07
### Added
* [shlink-web-component#411](https://github.com/shlinkio/shlink-web-component/issues/411) Add support for `ip-address` redirect conditions when Shlink server is >=4.2
Expand Down
33 changes: 26 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@shlinkio/data-manipulation": "^1.0.3",
"@shlinkio/shlink-frontend-kit": "^0.5.2",
"@shlinkio/shlink-js-sdk": "^1.2.0",
"@shlinkio/shlink-web-component": "^0.8.0",
"@shlinkio/shlink-web-component": "^0.8.1",
"bootstrap": "5.2.3",
"bottlejs": "^2.0.1",
"clsx": "^2.1.1",
Expand All @@ -49,6 +49,7 @@
"react-router-dom": "^6.26.2",
"reactstrap": "^9.2.3",
"redux-localstorage-simple": "^2.5.1",
"uuid": "^10.0.0",
"workbox-core": "^7.1.0",
"workbox-expiration": "^7.1.0",
"workbox-precaching": "^7.1.0",
Expand Down
3 changes: 2 additions & 1 deletion src/servers/CreateServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { NoMenuLayout } from '../common/NoMenuLayout';
import type { FCWithDeps } from '../container/utils';
import { componentFactory, useDependencies } from '../container/utils';
import { useGoBack } from '../utils/helpers/hooks';
import { randomUUID } from '../utils/utils';
import type { ServerData, ServersMap, ServerWithId } from './data';
import { DuplicatedServersModal } from './helpers/DuplicatedServersModal';
import type { ImportServersBtnProps } from './helpers/ImportServersBtn';
Expand Down Expand Up @@ -44,7 +45,7 @@ const CreateServer: FCWithDeps<CreateServerProps, CreateServerDeps> = ({ servers
const [isConfirmModalOpen, toggleConfirmModal] = useToggle();
const [serverData, setServerData] = useState<ServerData>();
const saveNewServer = useCallback((theServerData: ServerData) => {
const id = crypto.randomUUID();
const id = randomUUID();

createServers([{ ...theServerData, id }]);
navigate(`/server/${id}`);
Expand Down
3 changes: 2 additions & 1 deletion src/servers/reducers/servers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { PayloadAction } from '@reduxjs/toolkit';
import { createSlice } from '@reduxjs/toolkit';
import { randomUUID } from '../../utils/utils';
import type { ServerData, ServersMap, ServerWithId } from '../data';

interface EditServer {
Expand All @@ -19,7 +20,7 @@ const serverWithId = (server: ServerWithId | ServerData): ServerWithId => {
return server;
}

return { ...server, id: crypto.randomUUID() };
return { ...server, id: randomUUID() };
};

const serversListToMap = (servers: ServerWithId[]): ServersMap => servers.reduce<ServersMap>(
Expand Down
3 changes: 3 additions & 0 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import type { SyntheticEvent } from 'react';
import { v4 } from 'uuid';

export const handleEventPreventingDefault = <T>(handler: () => T) => (e: SyntheticEvent) => {
e.preventDefault();
handler();
};

export const randomUUID = () => v4();
7 changes: 4 additions & 3 deletions test/servers/reducers/selectedServer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
selectedServerReducerCreator,
selectServer as selectServerCreator,
} from '../../../src/servers/reducers/selectedServer';
import { randomUUID } from '../../../src/utils/utils';

describe('selectedServerReducer', () => {
const dispatch = vi.fn();
Expand Down Expand Up @@ -40,7 +41,7 @@ describe('selectedServerReducer', () => {
['latest', MAX_FALLBACK_VERSION, 'latest'],
['%invalid_semver%', MIN_FALLBACK_VERSION, '%invalid_semver%'],
])('dispatches proper actions', async (serverVersion, expectedVersion, expectedPrintableVersion) => {
const id = crypto.randomUUID();
const id = randomUUID();
const getState = createGetStateMock(id);
const expectedSelectedServer = {
id,
Expand All @@ -59,7 +60,7 @@ describe('selectedServerReducer', () => {
});

it('dispatches error when health endpoint fails', async () => {
const id = crypto.randomUUID();
const id = randomUUID();
const getState = createGetStateMock(id);
const expectedSelectedServer = fromPartial<NonReachableServer>({ id, serverNotReachable: true });

Expand All @@ -72,7 +73,7 @@ describe('selectedServerReducer', () => {
});

it('dispatches error when server is not found', async () => {
const id = crypto.randomUUID();
const id = randomUUID();
const getState = vi.fn(() => fromPartial<ShlinkState>({ servers: {} }));
const expectedSelectedServer: NotFoundServer = { serverNotFound: true };

Expand Down

0 comments on commit 9a798c2

Please sign in to comment.