Skip to content

Commit

Permalink
ported to iob webserver
Browse files Browse the repository at this point in the history
  • Loading branch information
foxriver76 committed May 23, 2024
1 parent 66f7eba commit cf8a305
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 45 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

strategy:
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [18.x, 20.x, 22.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]

steps:
- name: Checkout code
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ If no data source was specified or the noHistory parameter is passed, then only
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) ported to `@iobroker/webserver`

### 2.7.2 (2022-10-08)
* (Apollon77) Prepare for future js-controller versions

Expand Down
37 changes: 4 additions & 33 deletions admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"leTab": {
"type": "panel",
"label": "Let's Encrypt SSL",
"disabled": "!data.secure || !!data.webInstance",
"disabled": "!data.secure",
"items": {
"_image": {
"type": "staticImage",
Expand All @@ -141,38 +141,9 @@
"height": 59
}
},
"_link": {
"newLine": true,
"type": "staticLink",
"href": "https://github.com/ioBroker/ioBroker.admin/blob/master/README.md#lets-encrypt-certificates",
"text": "Read about Let's Encrypt certificates",
"style": {
"fontSize": 16,
"marginBottom": 20
}
},
"leEnabled": {
"newLine": true,
"type": "checkbox",
"label": "Use Lets Encrypt certificates"
},
"leUpdate": {
"newLine": true,
"type": "checkbox",
"hidden": "!data.leEnabled",
"label": "Use this instance for automatic update"
},
"lePort": {
"newLine": true,
"sm": 12,
"lg": 6,
"type": "number",
"hidden": "!data.leEnabled || !data.leUpdate",
"label": "Port to check the domain",
"style": {
"marginTop": 15,
"maxWidth": 300
}
"_staticText": {
"type": "staticText",
"text": "ra_Use iobroker.acme adapter for letsencrypt certificates"
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
"Apollon77 <[email protected]>",
"Marco.K <[email protected]>"
],
"license": "MIT",
"platform": "Javascript/Node.js",
"mode": "daemon",
"loglevel": "info",
Expand Down Expand Up @@ -153,7 +152,11 @@
},
"connectionType": "none",
"dataSource": "none",
"tier": 3
"tier": 3,
"licenseInformation": {
"type": "free",
"license": "MIT"
}
},
"native": {
"port": 8087,
Expand Down
14 changes: 8 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

const utils = require('@iobroker/adapter-core'); // Get common adapter utils
const SimpleAPI = require('./lib/simpleapi.js');
const LE = utils.commonTools.letsEncrypt;
const { WebServer } = require('@iobroker/webserver');
const adapterName = require('./package.json').name.split('.').pop();

let webServer = null;
Expand Down Expand Up @@ -112,11 +112,13 @@ async function initWebServer(settings) {
}

try {
if (typeof LE.createServerAsync === 'function') {
server.server = await LE.createServerAsync(requestProcessor, settings, adapter.config.certificates, adapter.config.leConfig, adapter.log, adapter);
} else {
server.server = LE.createServer(requestProcessor, settings, adapter.config.certificates, adapter.config.leConfig, adapter.log);
}
const webserver = new WebServer({
app: server.app,
adapter,
secure: adapter.config.secure
});

server.server = await webserver.init();
} catch (err) {
adapter.log.error(`Cannot create webserver: ${err}`);
adapter.terminate ? adapter.terminate(utils.EXIT_CODES.ADAPTER_REQUESTED_TERMINATION) : process.exit(utils.EXIT_CODES.ADAPTER_REQUESTED_TERMINATION);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"url": "https://github.com/ioBroker/ioBroker.simple-api"
},
"dependencies": {
"@iobroker/adapter-core": "^2.6.7"
"@iobroker/adapter-core": "^3.1.4",
"@iobroker/webserver": "^1.0.3"
},
"devDependencies": {
"@alcalzone/release-script": "^3.6.0",
Expand Down

0 comments on commit cf8a305

Please sign in to comment.