1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-06-16 13:46:16 +02:00

Compare commits

..

8 Commits

Author SHA1 Message Date
a1e9f23620 Merge branch 'bump-520' into 'dev'
Bump v5.2.0

See merge request turris/reforis/foris-js!176
2021-12-15 17:09:05 +01:00
579ed5ea8c Bump v5.2.0
* Remove login page
* NPM audit fix
2021-12-15 19:05:53 +03:00
c2eda33998 NPM audit fix 2021-12-15 19:05:26 +03:00
f49529018c Merge branch 'remove-login' into 'dev'
Remove reForis login page

Closes reforis#355

See merge request turris/reforis/foris-js!167
2021-12-15 16:59:46 +01:00
a66a2f4708 Remove reForis login page 2021-12-13 15:51:56 +01:00
43cb5bff50 Bump v5.1.16
* NPM audit fix
2021-11-18 17:49:13 +01:00
c67ea089fd NPM audit fix 2021-11-18 17:49:12 +01:00
4b25f6eafc Revert "NPM audit fix"
This reverts commit 6e6c349866.
2021-11-18 17:49:12 +01:00
6 changed files with 41894 additions and 31223 deletions

73081
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "5.1.15",
"version": "5.2.0",
"description": "Set of components and utils for Foris and its plugins.",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
@ -53,14 +53,11 @@
"react": "16.9.0",
"react-dom": "16.9.0",
"react-router-dom": "^5.1.2",
"react-styleguidist": "^11.1.7",
"react-styleguidist": "^7.3.11",
"snapshot-diff": "^0.7.0",
"style-loader": "^1.2.1",
"webpack": "^5.15.0"
},
"resolutions": {
"immer": "9.0.6"
},
"scripts": {
"lint": "eslint src",
"lint:fix": "eslint --fix src",
@ -68,7 +65,6 @@
"test:watch": "jest --watch",
"test:coverage": "jest --coverage --colors",
"docs": "npx styleguidist build ",
"docs:watch": "styleguidist server",
"preinstall": "npx npm-force-resolutions"
"docs:watch": "styleguidist server"
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
@ -7,7 +7,6 @@
import { useCallback, useEffect, useReducer, useState } from "react";
import { ForisURLs } from "../utils/forisUrls";
import {
API_ACTIONS,
API_METHODS,
@ -84,8 +83,8 @@ function APIReducer(state, action) {
data: action.payload,
};
case API_ACTIONS.FAILURE:
if (action.status === 403) {
window.location.assign(ForisURLs.login);
if (action.status === 401) {
window.location.reload();
}
// Not an API error - should be rethrown.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
@ -11,6 +11,7 @@ export const HEADERS = {
Accept: "application/json",
"Content-Type": "application/json",
"X-CSRFToken": getCookie("_csrf_token"),
"X-Requested-With": "json",
};
export const TIMEOUT = 30500;
@ -56,7 +57,7 @@ function getCookie(name) {
export function getErrorPayload(error) {
if (error.response) {
if (error.response.status === 403) {
if (error.response.status === 401) {
return _("The session is expired. Please log in again.");
}
return getJSONErrorMessage(error);

View File

@ -9,8 +9,8 @@ export const REFORIS_URL_PREFIX = "/reforis";
export const REFORIS_API_URL_PREFIX = `${REFORIS_URL_PREFIX}/api`;
export const ForisURLs = {
login: `${REFORIS_URL_PREFIX}/login`,
logout: `${REFORIS_URL_PREFIX}/logout`,
login: `/login?${REFORIS_URL_PREFIX}/`,
logout: `/logout`,
static: `${REFORIS_URL_PREFIX}/static/reforis`,
wifi: `${REFORIS_URL_PREFIX}/network-settings/wifi`,

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2020-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
@ -7,8 +7,6 @@
/* eslint no-console: "off" */
import { ForisURLs } from "../utils/forisUrls";
const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss";
const URL = process.env.LIGHTTPD
@ -21,12 +19,6 @@ export class WebSockets {
constructor() {
this.ws = new WebSocket(URL);
this.ws.onerror = (e) => {
if (!window.initialData.logged) {
console.error(
"WS: Error observed, you aren't logged probably."
);
window.location.replace(ForisURLs.login);
}
console.error("WS: Error:", e);
};
this.ws.onmessage = (e) => {