Skip to content

Commit

Permalink
Updated packages
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Feb 25, 2025
1 parent 9baf90e commit 822ff8e
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 70 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ It is suggested to use [socket class](https://github.com/ioBroker/socket-client)
-->

## Changelog
### 3.0.9 (2025-02-24)
### **WORK IN PROGRESS**
* (@GermanBluefox) Added OAuth2 authentication

### 3.0.5 (2025-02-11)
Expand Down
4 changes: 2 additions & 2 deletions dist/lib/socketWS.js

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

2 changes: 1 addition & 1 deletion dist/lib/socketWS.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/main.js

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

2 changes: 1 addition & 1 deletion dist/main.js.map

Large diffs are not rendered by default.

52 changes: 0 additions & 52 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,58 +29,6 @@
"zh-cn": "该适配器允许与ioBroker通信不同的Web应用程序"
},
"news": {
"3.0.9": {
"en": "Added OAuth2 authentication",
"de": "OAuth2 Authentifizierung hinzugefügt",
"ru": "Проверка подлинности OAuth2",
"pt": "Autenticação de OAuth2 adicionada",
"nl": "OAuth2-authenticatie toegevoegd",
"fr": "Ajout de l'authentification OAuth2",
"it": "Aggiunta autenticazione OAuth2",
"es": "Autenticación OAuth2",
"pl": "Dodano uwierzytelnianie OAuth2",
"uk": "Додано автентифікацію OAuth2",
"zh-cn": "添加 OAuth2 认证"
},
"3.0.8": {
"en": "Added OAuth2 authentication",
"de": "OAuth2 Authentifizierung hinzugefügt",
"ru": "Проверка подлинности OAuth2",
"pt": "Autenticação de OAuth2 adicionada",
"nl": "OAuth2-authenticatie toegevoegd",
"fr": "Ajout de l'authentification OAuth2",
"it": "Aggiunta autenticazione OAuth2",
"es": "Autenticación OAuth2",
"pl": "Dodano uwierzytelnianie OAuth2",
"uk": "Додано автентифікацію OAuth2",
"zh-cn": "添加 OAuth2 认证"
},
"3.0.7": {
"en": "Added OAuth2 authentication",
"de": "OAuth2 Authentifizierung hinzugefügt",
"ru": "Проверка подлинности OAuth2",
"pt": "Autenticação de OAuth2 adicionada",
"nl": "OAuth2-authenticatie toegevoegd",
"fr": "Ajout de l'authentification OAuth2",
"it": "Aggiunta autenticazione OAuth2",
"es": "Autenticación OAuth2",
"pl": "Dodano uwierzytelnianie OAuth2",
"uk": "Додано автентифікацію OAuth2",
"zh-cn": "添加 OAuth2 认证"
},
"3.0.6": {
"en": "Added OAuth2 authentication",
"de": "OAuth2 Authentifizierung hinzugefügt",
"ru": "Проверка подлинности OAuth2",
"pt": "Autenticação de OAuth2 adicionada",
"nl": "OAuth2-authenticatie toegevoegd",
"fr": "Ajout de l'authentification OAuth2",
"it": "Aggiunta autenticazione OAuth2",
"es": "Autenticación OAuth2",
"pl": "Dodano uwierzytelnianie OAuth2",
"uk": "Додано автентифікацію OAuth2",
"zh-cn": "添加 OAuth2 认证"
},
"3.0.5": {
"en": "Corrected address detection\nCorrected language settings",
"de": "Korrigierte Adresserkennung\nKorrigierte Spracheinstellungen",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"dependencies": {
"@iobroker/adapter-core": "^3.2.3",
"@iobroker/socket-classes": "^2.1.9",
"@iobroker/webserver": "^1.1.3",
"@iobroker/socket-classes": "^2.1.10",
"@iobroker/webserver": "^1.1.6",
"@iobroker/ws-server": "^4.2.9",
"body-parser": "^1.20.3",
"cookie-parser": "^1.4.7",
Expand Down
11 changes: 3 additions & 8 deletions src/lib/socketWS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ import {
type PassportHttpRequest,
type Store,
type SocketSubscribeTypes,
type InternalStorageToken,
} from '@iobroker/socket-classes';
import type { Socket as WebSocketClient } from '@iobroker/ws-server';
import passport from 'passport';
import cookieParser from 'cookie-parser';
import type { AddressInfo } from 'node:net';
import type { WsAdapterConfig } from '../types';

interface InternalStorageToken {
token: string;
exp: number;
user: string;
}

// From settings used only secure, auth and crossDomain
export class SocketWS extends SocketCommon {
__getIsNoDisconnect(): boolean {
Expand Down Expand Up @@ -161,7 +156,7 @@ export class SocketWS extends SocketCommon {
socket.emit(SocketCommon.COMMAND_RE_AUTHENTICATE);
callback('Cannot detect user');
} else {
callback(null, obj.user ? `system.user.${obj.user}` : '', obj.exp);
callback(null, obj.user ? `system.user.${obj.user}` : '', obj.aExp);
}
});
wait = true;
Expand Down Expand Up @@ -301,7 +296,7 @@ export class SocketWS extends SocketCommon {
} else if (!tokenData?.user) {
this.adapter.log.error('No session found');
} else {
socket._sessionExpiresAt = tokenData.exp;
socket._sessionExpiresAt = tokenData.aExp;
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Server as HttpsServer } from 'node:https';
import { readFileSync } from 'node:fs';

import * as session from 'express-session';
import express, {type Express, NextFunction, type Request, type Response} from 'express';
import express, { type Express, type NextFunction, type Request, type Response } from 'express';
import * as bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';

Expand Down Expand Up @@ -184,7 +184,7 @@ export class WsAdapter extends Adapter {
this.server.app.use((req: Request, res: Response, next: NextFunction): void => {
const url = req.url.split('?')[0];
if (url === '/auth') {
// User can asc server if authentication enabled
// User can ask server if authentication enabled
res.setHeader('Content-Type', 'application/json');
res.json({ auth: this.config.auth });
} else if (
Expand Down

0 comments on commit 822ff8e

Please sign in to comment.