Skip to content

Commit

Permalink
Or condition in news (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox authored Nov 23, 2024
1 parent f74e038 commit 682487b
Show file tree
Hide file tree
Showing 19 changed files with 643 additions and 421 deletions.
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,33 +86,38 @@ The icons may not be reused in other projects without the proper flaticon licens

<!--
### **WORK IN PROGRESS**
-->
-->
### **WORK IN PROGRESS**

- (@GermanBluefox) Made improvement for JSONConfig components
- (@GermanBluefox) Added clear button to text area JSON config component

### 7.4.1 (2024-11-19)

- (@GermanBluefox) Made improvement for JSONConfig components

### 7.4.0 (2024-11-17)

- (@GermanBluefox) Added new JsonConfig control: staticInfo

- (@GermanBluefox) Added new JsonConfig control: staticInfo

### 7.3.2 (2024-11-15)

- (@GermanBluefox) Some GUI packages were updated.
- (@GermanBluefox) Improved file viewer. Added icons viewer

- (@GermanBluefox) Improved file viewer. Added icons viewer

### 7.3.1 (2024-11-14)

- (@GermanBluefox) Corrected cloud icon for admin
- (@GermanBluefox) Added old dialog names to adapter-react-v5 again
- (@GermanBluefox) Corrected the password field in JSON-Config

- (@GermanBluefox) Corrected the password field in JSON-Config

### 7.2.6 (2024-10-11)

- (@GermanBluefox) Trying to fix a GUI build process
- (@GermanBluefox) Changed license icon

- (@GermanBluefox) Changed license icon

## License

The MIT License (MIT)

Copyright (c) 2014-2024 bluefox <[email protected]>
Copyright (c) 2014-2024 bluefox <[email protected]>
18 changes: 9 additions & 9 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions packages/adapter-react-v5/src/Components/IconDeviceType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ export function getDeviceIcon(type: DeviceType, props?: IconProps): React.JSX.El
if (SvgComponent) {
return (
<SvgComponent
style={props.style || undefined}
className={Utils.clsx(props.className, 'iconOwn')}
style={props?.style || undefined}
className={Utils.clsx(props?.className, 'iconOwn')}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-react-v5/src/assets/devices.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/adapter-react-v5/src/assets/rooms.json

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions packages/admin/io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,31 +415,31 @@
{
"category": "wellKnownPassword",
"name": {
"en": "Well known password",
"de": "Bekanntes Passwort",
"ru": "Известный пароль",
"pt": "Senha bem conhecida",
"nl": "Bekend wachtwoord",
"fr": "Mot de passe bien connu",
"it": "Password ben nota",
"es": "Contraseña bien conocida",
"pl": "Znane hasło",
"uk": "Відомий пароль",
"zh-cn": "众所周知的密码"
"en": "Unchanged default password",
"de": "Unverändertes Standardpasswort",
"ru": "Неизмененный пароль по умолчанию",
"pt": "Senha padrão inalterada",
"nl": "Onveranderd standaardwachtwoord",
"fr": "Mot de passe par défaut inchangé",
"it": "Password predefinita non modificata",
"es": "Contraseña predeterminada sin cambios",
"pl": "Niezmienione domyślne hasło",
"uk": "Незмінений пароль за замовчуванням",
"zh-cn": "未更改的默认密码"
},
"severity": "alert",
"description": {
"en": "Your Linux system uses a user with a well-known password. This can lead to the system being hacked from the outside. It is strongly recommended to change the password.",
"de": "Ihr Linux-System verwendet einen Benutzer mit einem bekannten Passwort. Dies kann dazu führen, dass das System von außen gehackt wird. Es wird dringend empfohlen, das Passwort zu ändern.",
"ru": "Ваша Linux система использует пользователя с хорошо известным паролем. Это может стать причиной взлома системы извне. Настоятельно рекомендуется сменить пароль.",
"pt": "Seu sistema Linux usa um usuário com uma senha bem conhecida. Isso pode levar ao hackeamento do sistema de fora. É altamente recomendável mudar a senha.",
"nl": "Uw Linux-systeem gebruikt een gebruiker met een bekend wachtwoord. Dit kan ertoe leiden dat het systeem van buitenaf wordt gehackt. Het wordt sterk aanbevolen om het wachtwoord te wijzigen.",
"fr": "Votre système Linux utilise un utilisateur avec un mot de passe bien connu. Cela peut entraîner le piratage du système de l'extérieur. Il est fortement recommandé de changer le mot de passe.",
"it": "Il tuo sistema Linux utilizza un utente con una password ben nota. Questo può portare a un attacco al sistema dall'esterno. Si consiglia vivamente di cambiare la password.",
"es": "Su sistema Linux utiliza un usuario con una contraseña bien conocida. Esto puede llevar a que el sistema sea hackeado desde el exterior. Se recomienda encarecidamente cambiar la contraseña.",
"pl": "Twój system Linux używa użytkownika ze znanym hasłem. Może to prowadzić do włamania do systemu z zewnątrz. Zaleca się zmianę hasła.",
"uk": "Ваша Linux система використовує користувача з добре відомим паролем. Це може призвести до злому системи ззовні. Настійно рекомендується змінити пароль.",
"zh-cn": "您的 Linux 系统使用众所周知的密码。 这可能导致系统被外部黑客攻击。 强烈建议更改密码。"
"en": "Your Linux system uses a user with the unchanged default password. This can lead to the system being hacked from the outside. It is strongly recommended to change the password.",
"de": "Ihr Linux-System verwendet einen Benutzer mit unverändertem Standardpasswort. Dies kann dazu führen, dass das System von außen gehackt wird. Es wird dringend empfohlen, das Passwort zu ändern.",
"ru": "Ваша система Linux использует пользователя с неизмененным паролем по умолчанию. Это может привести к взлому системы извне. Настоятельно рекомендуется изменить пароль.",
"pt": "Seu sistema Linux usa um usuário com a senha padrão inalterada. Isso pode levar ao sistema ser hackeado de fora. É altamente recomendável alterar a senha.",
"nl": "Uw Linux-systeem gebruikt een gebruiker met het ongewijzigde standaardwachtwoord. Dit kan ertoe leiden dat het systeem van buitenaf wordt gehackt. Het wordt sterk aanbevolen om het wachtwoord te wijzigen.",
"fr": "Votre système Linux utilise un utilisateur avec le mot de passe par défaut inchangé. Cela peut entraîner le piratage du système depuis l'extérieur. Il est fortement recommandé de changer le mot de passe.",
"it": "Il tuo sistema Linux utilizza un utente con la password predefinita non modificata. Questo può portare al sistema che viene hackerato dall'esterno. Si consiglia vivamente di cambiare la password.",
"es": "Su sistema Linux utiliza un usuario con la contraseña predeterminada sin cambios. Esto puede llevar a que el sistema sea hackeado desde el exterior. Se recomienda encarecidamente cambiar la contraseña.",
"pl": "Twój system Linux używa użytkownika z niezmienionym domyślnym hasłem. Może to prowadzić do włamania do systemu z zewnątrz. Zaleca się zmianę hasła.",
"uk": "Ваша система Linux використовує користувача з незміненим паролем за замовчуванням. Це може призвести до взлому системи ззовні. Настійно рекомендується змінити пароль.",
"zh-cn": "您的 Linux 系统使用具有未更改的默认密码的用户。 这可能导致系统被从外部黑客攻击。 强烈建议更改密码。"
},
"regex": [],
"limit": 1
Expand Down
6 changes: 3 additions & 3 deletions packages/admin/src-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"homepage": ".",
"scripts": {
"start": "set DANGEROUSLY_DISABLE_HOST_CHECK=true && craco start",
"start": "set DANGEROUSLY_DISABLE_HOST_CHECK=true && npm run patch-webpack && craco start",
"lint": "eslint -c eslint.config.mjs src",
"patch-webpack": "node ../tasks --patch-webpack",
"build": "npm run patch-webpack && craco build",
Expand Down Expand Up @@ -36,7 +36,7 @@
"@foxriver76/iob-component-lib": "^0.1.6",
"@honkhonk/vite-plugin-svgr": "^1.1.0",
"@iobroker/admin-component-easy-access": "^1.0.8",
"@iobroker/dm-utils": "^0.6.6",
"@iobroker/dm-utils": "^0.6.8",
"@iobroker/socket-client": "^3.1.2",
"@originjs/vite-plugin-commonjs": "^1.0.3",
"@react-leaflet/core": "^2.1.0",
Expand Down Expand Up @@ -104,4 +104,4 @@
]
],
"version": "7.4.0"
}
}
1 change: 1 addition & 0 deletions packages/admin/src-admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ const styles: Record<string, any> = {
display: 'flex',
marginRight: 'auto',
overflowY: 'auto',
alignItems: 'center',
},

flexGrow: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1542,11 +1542,16 @@ class ObjectBrowserEditObject extends Component<ObjectBrowserEditObjectProps, Ob
const withAlias = obj._id.startsWith('alias.0') && obj.type === 'state';
const fullWidth = obj.type !== 'state' || (obj.common.type !== 'number' && obj.common.type !== 'boolean');

let dialogStyle = styles.dialog;
if (window.innerWidth > 1920) {
dialogStyle = { ...dialogStyle, maxWidth: 'calc(100% - 150px)' };
}

return (
<Dialog
sx={{ '& .MuiPaper-root': styles.dialog }}
sx={{ '& .MuiPaper-root': dialogStyle }}
open={!0}
maxWidth="lg"
maxWidth="xl"
fullWidth={fullWidth}
fullScreen={false}
onClose={() => this.props.onClose()}
Expand Down
41 changes: 25 additions & 16 deletions packages/admin/src-admin/src/dialogs/NewsAdminDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,13 @@ interface Message {
os?: string;
repo: string;
conditions: {
[adapter: string]: '!installed' | 'active' | '!active';
// bigger(x.x.x), smaller(x.x.x), equals(x.x.x), between(x.x.x, x.x.x)
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
[adapter: string]: '!installed' | 'active' | '!active' | string;
};
title: Record<ioBroker.Languages, string>;
content: Record<ioBroker.Languages, string>;
class: 'info' | 'warning' | 'danger';
/** Name of the FA-icon */
icon: string;
created: string;
/** Link destination */
link?: string;
Expand All @@ -213,7 +213,6 @@ export interface ShowMessage {
title: string;
content: string;
class: 'info' | 'warning' | 'danger';
icon: string;
created: string;
link?: string;
linkTitle: string;
Expand All @@ -240,24 +239,35 @@ export const checkMessages = (messages: Message[], lastMessageId: string, contex
} else if (showIt && message['date-end'] && new Date(message['date-end']).getTime() < today) {
showIt = false;
} else if (showIt && message.conditions && Object.keys(message.conditions).length > 0) {
Object.keys(message.conditions).forEach(key => {
if (showIt) {
const adapter = context.adapters[key];
const condition = message.conditions[key];

let andConditions = true;
if (message.conditions.or === 'true') {
andConditions = false;
}
const adapters = Object.keys(message.conditions).filter(key => key !== 'or');
let conditionResult = true;
for (let a = 0; a < adapters.length; a++) {
const adapter = context.adapters[adapters[a]];
const condition = message.conditions[adapters[a]];
if (condition) {
if (!adapter && condition !== '!installed') {
showIt = false;
conditionResult = false;
} else if (adapter && condition === '!installed') {
showIt = false;
conditionResult = false;
} else if (adapter && condition === 'active') {
showIt = checkActive(key, context.instances);
conditionResult = checkActive(adapters[a], context.instances);
} else if (adapter && condition === '!active') {
showIt = !checkActive(key, context.instances);
conditionResult = !checkActive(adapters[a], context.instances);
} else if (adapter) {
showIt = checkConditions(condition, adapter.v);
conditionResult = checkConditions(condition, adapter.v);
}
}
});
if (andConditions && !conditionResult) {
break;
} else if (!andConditions && conditionResult) {
break;
}
}
showIt = conditionResult;
}

if (showIt && message['node-version'] && context.nodeVersion) {
Expand Down Expand Up @@ -302,7 +312,6 @@ export const checkMessages = (messages: Message[], lastMessageId: string, contex
title: message.title[context.lang] || message.title.en,
content: message.content[context.lang] || message.content.en,
class: message.class,
icon: message.icon,
created: message.created,
link: message.link,
linkTitle:
Expand Down
Loading

0 comments on commit 682487b

Please sign in to comment.