Skip to content

Commit

Permalink
Update release-script
Browse files Browse the repository at this point in the history
Remove request lib
  • Loading branch information
GermanBluefox committed Oct 22, 2021
1 parent 4b30ec3 commit 7e15b5f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 68 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/[email protected].4
uses: actions/[email protected].5

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
Expand Down
26 changes: 14 additions & 12 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
gruntfile.js
example
tasks
test
.travis.yml
appveyor.yml
admin/i18n
package-lock.json
iob_npm.done
.idea
.github
node_modules
/**/*
/gulpfile.js
gulpfile.js
!/lib/**/*
!/lib/*
!/admin/**/*
!/admin/*
!/example/*
!/example/**/*
!/io-package.json
!/package.json
!/LICENSE
!/main.js
!/README.md
3 changes: 3 additions & 0 deletions .releaseconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["iobroker", "license"]
}
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ You can set option *Force Web-Sockets* to force using only web-sockets transport

### __WORK IN PROGRESS__
* (foxriver76) make error logging on failed authentication more specific
* (foxriver76) "request" was repalced by "axios"

### 3.1.4 (2021-01-13)
* (Apollon77) Define instanceObject "connected" to prevent warning with js-controller 3.2
Expand Down
22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

18 changes: 10 additions & 8 deletions lib/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const fs = require('fs');
const cookieParser = require('cookie-parser');
const EventEmitter = require('events');
const util = require('util');
let request = null;
let axios = null;

// From settings used only secure, auth and crossDomain
function IOSocket(server, settings, adapter) {
Expand Down Expand Up @@ -810,17 +810,17 @@ function IOSocket(server, settings, adapter) {

function socketEvents(socket, address) {
if (socket.conn) {
that.adapter.log.info('==>Connected ' + socket._acl.user + ' from ' + address);
that.adapter.log.info(`==>Connected ${socket._acl.user} from ${address}`);
} else {
that.adapter.log.info('Trying to connect as ' + socket._acl.user + ' from ' + address);
that.adapter.log.info(`Trying to connect as ${socket._acl.user} from ${address}`);
}

if (!that.infoTimeout) {
that.infoTimeout = setTimeout(updateConnectedInfo, 1000);
}

socket.on('authenticate', function (user, pass, callback) {
that.adapter.log.debug((new Date()).toISOString() + ' Request authenticate [' + socket._acl.user + ']');
that.adapter.log.debug(`${(new Date()).toISOString()} Request authenticate [${socket._acl.user}]`);
if (typeof user === 'function') {
callback = user;
user = undefined;
Expand All @@ -830,7 +830,7 @@ function IOSocket(server, settings, adapter) {
callback(true, socket._secure);
}
} else {
that.adapter.log.debug((new Date()).toISOString() + ' Request authenticate [' + socket._acl.user + ']');
that.adapter.log.debug(`${(new Date()).toISOString()} Request authenticate [${socket._acl.user}]`);
socket._authPending = callback;
}
});
Expand All @@ -844,7 +844,7 @@ function IOSocket(server, settings, adapter) {
that.infoTimeout = setTimeout(updateConnectedInfo, 1000);
}
} else if (this._name !== name) {
that.adapter.log.warn('socket ' + this.id + ' changed socket name from ' + this._name + ' to ' + name);
that.adapter.log.warn(`socket ${this.id} changed socket name from ${this._name} to ${name}`);
this._name = name;
}
if (typeof cb === 'function') {
Expand Down Expand Up @@ -1280,10 +1280,12 @@ function IOSocket(server, settings, adapter) {
// HTTP
socket.on('httpGet', function (url, callback) {
if (updateSession(socket) && checkPermissions(socket, 'httpGet', callback, url)) {
if (!request) request = require('request');
axios = axios || require('axios');
that.adapter.log.debug('httpGet: ' + url);
try {
request(url, callback);
axios(url, {responseType: 'arraybuffer'})
.then(result => callback(null, {status: result.status, statusText: result.statusText}, result.data))
.catch(error => callback(error));
} catch (err) {
callback(err);
}
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
},
"dependencies": {
"socket.io": "^2.4.1",
"request": "^2.88.2",
"axios": "^0.23.0",
"cookie-parser": "^1.4.5",
"express-session": "^1.17.2",
"@iobroker/adapter-core": "^2.5.1"
},
"devDependencies": {
"@alcalzone/release-script": "^2.2.1",
"@alcalzone/release-script": "^3.4.0",
"@alcalzone/release-script-plugin-iobroker": "^3.3.0",
"@alcalzone/release-script-plugin-license": "^3.3.0",
"gulp": "^4.0.2",
"mocha": "^9.1.2",
"mocha": "^9.1.3",
"chai": "^4.3.4"
},
"bugs": {
Expand All @@ -34,7 +36,8 @@
"main": "main.js",
"scripts": {
"test": "node node_modules/mocha/bin/mocha --exit",
"release": "release-script"
"release": "release-script patch --yes",
"release-minor": "release-script minor --yes"
},
"license": "MIT",
"readmeFilename": "README.md"
Expand Down

0 comments on commit 7e15b5f

Please sign in to comment.