From 662c5f9627ca206b985e3ee73f0bf0d1aaf63304 Mon Sep 17 00:00:00 2001 From: Chrystian Huot Date: Thu, 3 Mar 2022 08:11:45 -0500 Subject: [PATCH] Version 6.1.15 --- CHANGELOG.md | 7 ++ COMPILING.md | 18 +-- Makefile | 4 +- client/package-lock.json | 82 ++++++------ client/package.json | 4 +- .../rdio-scanner/main/main.component.ts | 17 ++- .../rdio-scanner/rdio-scanner.component.ts | 2 +- .../rdio-scanner/rdio-scanner.service.ts | 5 +- .../components/rdio-scanner/rdio-scanner.ts | 1 - docs/faq.md | 20 ++- docs/platforms/darwin.md | 78 ++++++------ docs/platforms/freebsd.md | 80 ++++++------ docs/platforms/linux.md | 78 ++++++------ docs/platforms/windows.md | 76 +++++------- server/access.go | 4 + server/admin.go | 6 +- server/certificates.go | 117 ------------------ server/config.go | 12 -- server/controller.go | 25 ++-- server/database.go | 2 +- server/downstream.go | 24 ++-- server/go.mod | 4 +- server/go.sum | 17 +-- server/version.go | 2 +- 24 files changed, 272 insertions(+), 413 deletions(-) delete mode 100644 server/certificates.go diff --git a/CHANGELOG.md b/CHANGELOG.md index c4cfedd..586e2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,13 @@ _v6.1.14_ - Bump delay before killing unauthenticated clients from 10 seconds to 60 seconds. - Remove the gitter.im support forum from the documentation and prefer github discussions. +_v6.1.15_ + +- Fix access and downstreams order not retained. +- Remove the self-signed certificate generator (-ssl create) as it was causing more problems than solutions. +- Client handling and call ingestion now run on 2 different threads (Issue #135). +- Fix downstream talkgroup select keeps reverting to all talkgroups (issue #136). + ## Version 6.0 - Backend server rewritten in Go for better performance and ease of installation. diff --git a/COMPILING.md b/COMPILING.md index 2b12749..b94393d 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -1,5 +1,7 @@ # How to compile +> RDIO SCANNER REPRESENTS A LOT OF INVESTMENT IN TIME, SUPPORT, TESTS AND MATERIALS. BY INTENTIONALLY MODIFYING ITS CODE TO REMOVE ITS IDENTITY, YOU HARM THE OPEN SOURCE PROJECT AND ITS AUTHOR. PLEASE BE RESPECTFUL, SPONSOR THIS PROJECT IF YOU CAN, USE NATIVE APPS IF POSSIBLE. + The official version of [Rdio Scanner](https://github.com/chuot/rdio-scanner) is compiled on a PC using the current version of Fedora Workstation. You should have no problem building on another platform as long as the prerequisites are available and installed. ## Install the prerequisites @@ -24,13 +26,13 @@ Clone the official repository on your computer and start the build process. When finished, you will find the precompiled versions for various platforms in the `dist` folder. - rdio-scanner-darwin-amd64-v6.1.14.zip - rdio-scanner-darwin-arm64-v6.1.14.zip - rdio-scanner-freebsd-amd64-v6.1.14.zip - rdio-scanner-linux-386-v6.1.14.zip - rdio-scanner-linux-amd64-v6.1.14.zip - rdio-scanner-linux-arm64-v6.1.14.zip - rdio-scanner-linux-arm-v6.1.14.zip - rdio-scanner-windows-amd64-v6.1.14.zip + rdio-scanner-darwin-amd64-v6.1.15.zip + rdio-scanner-darwin-arm64-v6.1.15.zip + rdio-scanner-freebsd-amd64-v6.1.15.zip + rdio-scanner-linux-386-v6.1.15.zip + rdio-scanner-linux-amd64-v6.1.15.zip + rdio-scanner-linux-arm64-v6.1.15.zip + rdio-scanner-linux-arm-v6.1.15.zip + rdio-scanner-windows-amd64-v6.1.15.zip **Happy Rdio scanning !** \ No newline at end of file diff --git a/Makefile b/Makefile index 316c50f..bc694fb 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ ################################################################################ app := rdio-scanner -date := 2022/02/24 -ver := 6.1.14 +date := 2022/03/03 +ver := 6.1.15 client := $(wildcard client/*.json client/*.ts) server := $(wildcard server/*.go) diff --git a/client/package-lock.json b/client/package-lock.json index b4a4347..acaee8e 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "rdio-scanner", - "version": "6.1.14", + "version": "6.1.15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "rdio-scanner", - "version": "6.1.14", + "version": "6.1.15", "license": "LICENSE", "dependencies": { "@angular/animations": "^13.2.4", @@ -32,7 +32,7 @@ "@typescript-eslint/eslint-plugin": "^5.12.1", "@typescript-eslint/parser": "^5.12.1", "ajv-keywords": "^5.1.0", - "eslint": "^8.9.0", + "eslint": "^8.10.0", "ts-node": "~10.5.0", "typescript": "~4.4.4" }, @@ -2306,9 +2306,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", - "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz", + "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -2810,9 +2810,9 @@ } }, "node_modules/@types/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-mTClfhq5cuGyW4jthaFuig6Q8OVfB3IRyZfN/9SCyJtiM5H0SubwM89cHoT9UngO6HyUFic88HvT1zSNLNyxWA==", + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.1.tgz", + "integrity": "sha512-UxlLOfkuQnT2YSBCNq0x86SGOUxas6gAySFeDe2DcnEnA8655UIPoCDorWZCugcvKIL8IUI4oueUfJ1hhZSE2A==", "dev": true, "dependencies": { "@types/node": "*" @@ -4933,9 +4933,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.72", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.72.tgz", - "integrity": "sha512-9LkRQwjW6/wnSfevR21a3k8sOJ+XWSH7kkzs9/EUenKmuDkndP3W9y1yCZpOxufwGbX3JV8glZZSDb4o95zwXQ==", + "version": "1.4.73", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.73.tgz", + "integrity": "sha512-RlCffXkE/LliqfA5m29+dVDPB2r72y2D2egMMfIy3Le8ODrxjuZNVo4NIC2yPL01N4xb4nZQLwzi6Z5tGIGLnA==", "dev": true }, "node_modules/emoji-regex": { @@ -4986,9 +4986,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz", - "integrity": "sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA==", + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.1.tgz", + "integrity": "sha512-jdyZMwCQ5Oj4c5+BTnkxPgDZO/BJzh/ADDmKebayyzNwjVX1AFCeGkOfxNx0mHi2+8BKC5VxUYiw3TIvoT7vhw==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -5426,12 +5426,12 @@ } }, "node_modules/eslint": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", - "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz", + "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.1.0", + "@eslint/eslintrc": "^1.2.0", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -11580,9 +11580,9 @@ } }, "node_modules/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==", + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==", "dev": true, "engines": { "node": ">=12" @@ -13175,9 +13175,9 @@ "dev": true }, "@eslint/eslintrc": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz", - "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz", + "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -13609,9 +13609,9 @@ } }, "@types/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-mTClfhq5cuGyW4jthaFuig6Q8OVfB3IRyZfN/9SCyJtiM5H0SubwM89cHoT9UngO6HyUFic88HvT1zSNLNyxWA==", + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.1.tgz", + "integrity": "sha512-UxlLOfkuQnT2YSBCNq0x86SGOUxas6gAySFeDe2DcnEnA8655UIPoCDorWZCugcvKIL8IUI4oueUfJ1hhZSE2A==", "dev": true, "requires": { "@types/node": "*" @@ -15191,9 +15191,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.72", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.72.tgz", - "integrity": "sha512-9LkRQwjW6/wnSfevR21a3k8sOJ+XWSH7kkzs9/EUenKmuDkndP3W9y1yCZpOxufwGbX3JV8glZZSDb4o95zwXQ==", + "version": "1.4.73", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.73.tgz", + "integrity": "sha512-RlCffXkE/LliqfA5m29+dVDPB2r72y2D2egMMfIy3Le8ODrxjuZNVo4NIC2yPL01N4xb4nZQLwzi6Z5tGIGLnA==", "dev": true }, "emoji-regex": { @@ -15237,9 +15237,9 @@ } }, "enhanced-resolve": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.0.tgz", - "integrity": "sha512-weDYmzbBygL7HzGGS26M3hGQx68vehdEg6VUmqSOaFzXExFqlnKuSvsEJCVGQHScS8CQMbrAqftT+AzzHNt/YA==", + "version": "5.9.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.9.1.tgz", + "integrity": "sha512-jdyZMwCQ5Oj4c5+BTnkxPgDZO/BJzh/ADDmKebayyzNwjVX1AFCeGkOfxNx0mHi2+8BKC5VxUYiw3TIvoT7vhw==", "dev": true, "requires": { "graceful-fs": "^4.2.4", @@ -15475,12 +15475,12 @@ "dev": true }, "eslint": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz", - "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz", + "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.1.0", + "@eslint/eslintrc": "^1.2.0", "@humanwhocodes/config-array": "^0.9.2", "ajv": "^6.10.0", "chalk": "^4.0.0", @@ -20018,9 +20018,9 @@ } }, "yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==", + "version": "21.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz", + "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==", "dev": true }, "yn": { diff --git a/client/package.json b/client/package.json index a2c631c..cdf0431 100644 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,7 @@ "@typescript-eslint/eslint-plugin": "^5.12.1", "@typescript-eslint/parser": "^5.12.1", "ajv-keywords": "^5.1.0", - "eslint": "^8.9.0", + "eslint": "^8.10.0", "ts-node": "~10.5.0", "typescript": "~4.4.4" }, @@ -38,5 +38,5 @@ "build": "ng build --base-href ./ --configuration production", "start": "ng serve" }, - "version": "6.1.14" + "version": "6.1.15" } diff --git a/client/src/app/components/rdio-scanner/main/main.component.ts b/client/src/app/components/rdio-scanner/main/main.component.ts index dec025f..2ff6b32 100644 --- a/client/src/app/components/rdio-scanner/main/main.component.ts +++ b/client/src/app/components/rdio-scanner/main/main.component.ts @@ -60,7 +60,20 @@ export class RdioScannerMainComponent implements OnDestroy, OnInit { callTag = 'Tag'; callTalkgroup = 'Talkgroup'; callTalkgroupId = '0'; - callTalkgroupName = `Rdio Scanner ${packageInfo.name === 'rdio-scanner' ? 'v'.concat(packageInfo.version) : ''}`; + /* + * BEGIN OF RED TAPE: + * + * By modifying, deleting or disabling the following lines, you harm + * the open source project and its author. Rdio Scanner represents a lot of + * investment in time, support, testing and hardware. + * + * Be respectful, sponsor the project if you can, use native apps when possible. + * + */ + callTalkgroupName = `Rdio Scanner v${packageInfo.version}`; + /** + * END OF RED TAPE. + */ callTime = 0; callUnit = '0'; @@ -509,7 +522,7 @@ export class RdioScannerMainComponent implements OnDestroy, OnInit { const call = this.call || this.callPrevious; if (call) { - if (call.patched) { + if (this.rdioScannerService.isPatched(call)) { this.avoided = false; this.patched = true; } else { diff --git a/client/src/app/components/rdio-scanner/rdio-scanner.component.ts b/client/src/app/components/rdio-scanner/rdio-scanner.component.ts index f510ec8..378dfbb 100644 --- a/client/src/app/components/rdio-scanner/rdio-scanner.component.ts +++ b/client/src/app/components/rdio-scanner/rdio-scanner.component.ts @@ -72,7 +72,7 @@ export class RdioScannerComponent implements OnDestroy, OnInit { /* * BEGIN OF RED TAPE: * - * By modifying, deleting or disabling the following lines, you are harming + * By modifying, deleting or disabling the following lines, you harm * the open source project and its author. Rdio Scanner represents a lot of * investment in time, support, testing and hardware. * diff --git a/client/src/app/components/rdio-scanner/rdio-scanner.service.ts b/client/src/app/components/rdio-scanner/rdio-scanner.service.ts index bb7cf82..4fc7400 100644 --- a/client/src/app/components/rdio-scanner/rdio-scanner.service.ts +++ b/client/src/app/components/rdio-scanner/rdio-scanner.service.ts @@ -727,7 +727,7 @@ export class RdioScannerService implements OnDestroy { const file = call.audio.data.reduce((str, val) => str += String.fromCharCode(val), ''); const fileName = call.audioName || 'unknown.dat'; const fileType = call.audioType || 'audio/*'; - const fileUri = `data:${fileType};base64,${btoa(file)}`; + const fileUri = `data:${fileType};base64,${window.btoa(file)}`; const el = this.document.createElement('a'); @@ -815,9 +815,6 @@ export class RdioScannerService implements OnDestroy { this.queue(this.transformCall(call), { priority: true }); } else { - if (this.isPatched(call)) { - call.patched = true; - } this.queue(this.transformCall(call)); } } diff --git a/client/src/app/components/rdio-scanner/rdio-scanner.ts b/client/src/app/components/rdio-scanner/rdio-scanner.ts index 6eaa25f..a25b8a4 100644 --- a/client/src/app/components/rdio-scanner/rdio-scanner.ts +++ b/client/src/app/components/rdio-scanner/rdio-scanner.ts @@ -49,7 +49,6 @@ export interface RdioScannerCall { frequencies?: RdioScannerCallFrequency[]; frequency?: number; id: number; - patched?: boolean; patches: number[]; source?: number; sources?: RdioScannerCallSource[]; diff --git a/docs/faq.md b/docs/faq.md index 2992380..dc18d69 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,23 +1,19 @@ # FAQ -**Q: I created a self-signed certificate but I cannot get the web app to work on my Apple device** - -A: This is an Apple restriction where Websocket connections to a self-signed certificate are not allowed. Use the native app or have a real certificate. - -**Q: I tried the autocert function but I get strange error messages** - -A: Due to the ACME protocol used by Let's Encrypt, ports 80 and 443 must be open to the world for autocert to work. - -**Q: I did not find an answer to my question in this FAQ** - -A: No problem, just drop us a line at **[rdio-scanner@saubeo.solutions](mailto:rdio-scanner@saubeo.solutions)** and we'll make sure to add the relevant information in this document in the next release. In the meantime, You can ask your questions on the [Rdio Scanner Discussions](https://github.com/chuot/rdio-scanner/discussions) at **[https://github.com/chuot/rdio-scanner/discussions](https://github.com/chuot/rdio-scanner/discussions)**. - **Q: How do I update from version 5 to version 6** A: First, don't use the update.js script, it won't work since the server portion of version 6 as been completely rewritten in GO. Simply unzip the archive that contains the Rdio Scanner executable and its PDF document to a new folder, then copy the database.sqlite from version 5 to the new folder that contains version 6 and make sure to rename it to _rdio-scanner.db_. +**Q: I tried the autocert function but I get strange error messages** + +A: Due to the ACME protocol used by Let's Encrypt, ports 80 and 443 must be open to the world for the autocert to work. The domain specified via the `-ssl_auto_cert` argument must also match the IP address of your Rdio Scanner instance. + **Q: The web app keeps displaying a dialog telling me that a new version is available** A: Force a refresh of the web application from the browser (usually with ctrl-shift-r) to resolve the issue. Alternatively, you can click on the icon just to the left of the URL address and select website settings, then clear all website data. +**Q: I did not find an answer to my question in this FAQ** + +A: No problem, just drop us a line at **[rdio-scanner@saubeo.solutions](mailto:rdio-scanner@saubeo.solutions)** and we'll make sure to add the relevant information in this document in the next release. In the meantime, You can ask your questions on the [Rdio Scanner Discussions](https://github.com/chuot/rdio-scanner/discussions) at **[https://github.com/chuot/rdio-scanner/discussions](https://github.com/chuot/rdio-scanner/discussions)**. + \pagebreak{} \ No newline at end of file diff --git a/docs/platforms/darwin.md b/docs/platforms/darwin.md index 00615b0..6f7ccbe 100644 --- a/docs/platforms/darwin.md +++ b/docs/platforms/darwin.md @@ -42,8 +42,8 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd rdio@macos ~ % mkdir rdio-scanner rdio@macos ~ % cd rdio-scanner rdio@macos rdio-scanner % unzip \ - > ~/Downloads/rdio-scanner-darwin-arm64-v6.1.14.zip - Archive: /Users/rdio/Downloads/rdio-scanner-darwin-arm64-v6.1.14.zip + > ~/Downloads/rdio-scanner-darwin-arm64-v6.1.15.zip + Archive: /Users/rdio/Downloads/rdio-scanner-darwin-arm64-v6.1.15.zip inflating: rdio-scanner inflating: rdio-scanner.pdf @@ -51,11 +51,11 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd rdio@macos rdio-scanner % ./rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 08:38:06 server started - 2022/02/24 08:38:06 main interface at http://macos.local:3000 - 2022/02/24 08:38:06 admin interface at http://macos.local:3000/admin + 2022/03/03 08:38:06 server started + 2022/03/03 08:38:06 main interface at http://macos.local:3000 + 2022/03/03 08:38:06 admin interface at http://macos.local:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -77,43 +77,37 @@ Here we want our [Rdio Scanner](https://guthub.com/chuot/rdio-scanner) instance rdio@macos rdio-scanner % ./rdio-scanner --listen :80 - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 08:48:03 server started - 2022/02/24 08:48:03 main interface at http://macos.local - 2022/02/24 08:48:03 admin interface at http://macos.local/admin + 2022/03/03 08:48:03 server started + 2022/03/03 08:48:03 main interface at http://macos.local + 2022/03/03 08:48:03 admin interface at http://macos.local/admin -## Listening with SSL with self-signed certificates +## Listening on a SSL port -It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the Internet by listening to a SSL port. +It is recommended to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the internet by listening to an SSL port. -We can create such self-signed certificates by running [Rdio Scanner](https://github.com/chuot/rdio-scanner) with the **-ssl_create** argument. - - rdio@macos rdio-scanner % ./rdio-scanner -ssl_create - 2022/02/24 08:49:16 generating ssl certificate files - 2022/02/24 08:49:17 ssl files created - -This has generated these files in the same folder as your [Rdio Scanner](https://github.com/chuot/rdio-scanner) executable. - -- **ca.crt** - self-signed certificate authority. -- **ca.key** - certificate authority private key. -- **server.crt** - self-signed server certificate. -- **server.key** - server private key. - -Now we use the self-signed server certificate to run our instance. +You can use your own SSL certificates that match your domain name with `-ssl_cert_file` and `-ssl_key_file`. If your certificate comes with an intermediate CA certificate, simply add its contents to the standard certificate file. rdio@macos rdio-scanner % ./rdio-scanner \ > -listen :80 \ - > -ssl_cert_file server.crt \ - > -ssl_key_file server.key \ + > -ssl_cert_file mycert.crt \ + > -ssl_key_file mykey.key \ > -ssl_listen :443 - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 08:50:58 server started - 2022/02/24 08:50:58 main interface at http://macos.local - 2022/02/24 08:50:58 main interface at https://macos.local - 2022/02/24 08:50:58 admin interface at https://macos.local/admin + 2022/03/03 08:50:58 server started + 2022/03/03 08:50:58 main interface at http://macos.local + 2022/03/03 08:50:58 main interface at https://macos.local + 2022/03/03 08:50:58 admin interface at https://macos.local/admin + +If you don't want to worry about SSL certificates, you can use the built-in Let's Encrypt auto-cert feature. This requires that you have both port 80 (HTTP) and port 443 (HTTPS) open to the world. Also, your domain name should point to your IP address where [Rdio Scanner](https://github.com/chuot/rdio-scanner/) is running. The advantage of this approach is that everything is done automatically, no certificate request, no certificate renewal. + + rdio@macos rdio-scanner % ./rdio-scanner \ + > -listen :80 \ + > -ssl_auto_cert mydomain.com \ + > -ssl_listen :443 ## Save your advanced configuration to a config file @@ -121,31 +115,29 @@ You don't want to have to type everytime a long list of arguments. No problem, y rdio@macos rdio-scanner % ./rdio-scanner \ > -listen :80 \ - > -ssl_cert_file server.crt \ - > -ssl_key_file server.key \ + > -ssl_auto_cert mydomain.com \ > -ssl_listen :443 \ > -config_save - 2022/02/24 08:52:24 rdio-scanner.ini file created + 2022/03/03 08:52:24 rdio-scanner.ini file created All of your parameters passed as arguments to [Rdio Scanner](https://github.com/chuot/rdio-scanner) have been saved to an INI file which has the same arguments/values list. db_file = rdio-scanner.db db_type = sqlite listen = :80 - ssl_cert_file = server.crt - ssl_key_file = server.key + ssl_auto_cert = mydomain.com ssl_listen = :443 Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without any arguments. rdio@macos rdio-scanner % ./rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 08:54:08 server started - 2022/02/24 08:54:08 main interface at http://macos.local - 2022/02/24 08:54:08 main interface at https://macos.local - 2022/02/24 08:54:08 admin interface at https://macos.local/admin + 2022/03/03 08:54:08 server started + 2022/03/03 08:54:08 main interface at http://macos.local + 2022/03/03 08:54:08 main interface at https://macos.local + 2022/03/03 08:54:08 admin interface at https://macos.local/admin ## Install Rdio Scanner as a service diff --git a/docs/platforms/freebsd.md b/docs/platforms/freebsd.md index 3bc06a9..f5fda64 100644 --- a/docs/platforms/freebsd.md +++ b/docs/platforms/freebsd.md @@ -42,8 +42,8 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd rdio@pc-freebsd:~ $ mkdir rdio-scanner rdio@pc-freebsd:~ $ cd rdio-scanner rdio@pc-freebsd:~/rdio-scanner $ unzip \ - > ~/rdio-scanner-freebsd-amd64-v6.1.14.zip - Archive: ../rdio-scanner-freebsd-amd64-v6.1.14.zip + > ~/rdio-scanner-freebsd-amd64-v6.1.15.zip + Archive: ../rdio-scanner-freebsd-amd64-v6.1.15.zip extracting: rdio-scanner extracting: rdio-scanner.pdf @@ -51,11 +51,11 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd rdio@pc-freebsd:~/rdio-scanner $ ./rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 08:16:36 server started - 2022/02/24 08:16:36 main interface at http://pc-freebsd:3000 - 2022/02/24 08:16:36 admin interface at http://pc-freebsd:3000/admin + 2022/03/03 08:16:36 server started + 2022/03/03 08:16:36 main interface at http://pc-freebsd:3000 + 2022/03/03 08:16:36 admin interface at http://pc-freebsd:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -81,45 +81,41 @@ Here we want our [Rdio Scanner](https://guthub.com/chuot/rdio-scanner) instance Password: root@pc-freebsd:/home/rdio/rdio-scanner # ./rdio-scanner -listen :80 - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 08:19:38 server started - 2022/02/24 08:19:38 main interface at http://pc-freebsd - 2022/02/24 08:19:38 admin interface at http://pc-freebsd/admin + 2022/03/03 08:19:38 server started + 2022/03/03 08:19:38 main interface at http://pc-freebsd + 2022/03/03 08:19:38 admin interface at http://pc-freebsd/admin -## Listening with SSL with self-signed certificates +## Listening on a SSL port -It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the Internet by listening to a SSL port. +It is recommended to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the internet by listening to an SSL port. -We can create such self-signed certificates by running [Rdio Scanner](https://github.com/chuot/rdio-scanner) with the **-ssl_create** argument. - - rdio@pc-freebsd:~/rdio-scanner $ ./rdio-scanner -ssl_create - 2022/02/24 10:32:17 generating ssl certificate files - 2022/02/24 10:32:19 ssl files created - -This has generated these files in the same folder as your [Rdio Scanner](https://github.com/chuot/rdio-scanner) executable. - -- **ca.crt** - self-signed certificate authority. -- **ca.key** - certificate authority private key. -- **server.crt** - self-signed server certificate. -- **server.key** - server private key. - -Now we use the self-signed server certificate to run our instance. +You can use your own SSL certificates that match your domain name with `-ssl_cert_file` and `-ssl_key_file`. If your certificate comes with an intermediate CA certificate, simply add its contents to the standard certificate file. rdio@pc-freebsd:~/rdio-scanner $ su root Password: root@pc-freebsd:/home/rdio/rdio-scanner # ./rdio-scanner \ > -listen :80 \ - > -ssl_cert_file server.crt \ - > -ssl_key_file server.key \ + > -ssl_cert_file mycert.crt \ + > -ssl_key_file mykey.key \ > -ssl_listen :443 - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 10:34:29 server started - 2022/02/24 10:34:29 main interface at http://pc-freebsd - 2022/02/24 10:34:29 main interface at https://pc-freebsd - 2022/02/24 10:34:29 admin interface at https://pc-freebsd/admin + 2022/03/03 10:34:29 server started + 2022/03/03 10:34:29 main interface at http://pc-freebsd + 2022/03/03 10:34:29 main interface at https://pc-freebsd + 2022/03/03 10:34:29 admin interface at https://pc-freebsd/admin + +If you don't want to worry about SSL certificates, you can use the built-in Let's Encrypt auto-cert feature. This requires that you have both port 80 (HTTP) and port 443 (HTTPS) open to the world. Also, your domain name should point to your IP address where [Rdio Scanner](https://github.com/chuot/rdio-scanner/) is running. The advantage of this approach is that everything is done automatically, no certificate request, no certificate renewal. + + rdio@pc-freebsd:~/rdio-scanner $ su root + Password: + root@pc-freebsd:/home/rdio/rdio-scanner # ./rdio-scanner \ + > -listen :80 \ + > -ssl_auto_cert mydomain.com \ + > -ssl_listen :443 ## Save your advanced configuration to a config file @@ -127,19 +123,17 @@ You don't want to have to type everytime a long list of arguments. No problem, y rdio@pc-freebsd:~/rdio-scanner $ ./rdio-scanner \ > -listen :80 \ - > -ssl_cert_file server.crt \ - > -ssl_key_file server.key \ + > -ssl_auto_cert mydomain.com \ > -ssl_listen :443 \ > -config_save - 2022/02/24 10:37:00 rdio-scanner.ini file created + 2022/03/03 10:37:00 rdio-scanner.ini file created All of your parameters passed as arguments to [Rdio Scanner](https://github.com/chuot/rdio-scanner) have been saved to an INI file which has the same arguments/values list. db_file = rdio-scanner.db db_type = sqlite listen = :80 - ssl_cert_file = server.crt - ssl_key_file = server.key + ssl_auto_cert = mydomain.com ssl_listen = :443 Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without any arguments. @@ -148,12 +142,12 @@ Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without an Password: root@pc-freebsd:/home/rdio/rdio-scanner # ./rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 10:38:28 server started - 2022/02/24 10:38:29 main interface at http://pc-freebsd - 2022/02/24 10:38:29 main interface at https://pc-freebsd - 2022/02/24 10:38:29 admin interface at https://pc-freebsd/admin + 2022/03/03 10:38:28 server started + 2022/03/03 10:38:29 main interface at http://pc-freebsd + 2022/03/03 10:38:29 main interface at https://pc-freebsd + 2022/03/03 10:38:29 admin interface at https://pc-freebsd/admin ## Install Rdio Scanner as a service diff --git a/docs/platforms/linux.md b/docs/platforms/linux.md index 0e79132..aa1cdae 100644 --- a/docs/platforms/linux.md +++ b/docs/platforms/linux.md @@ -42,8 +42,8 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd [rdio@pc-linux ~]$ mkdir rdio-scanner [rdio@pc-linux ~]$ cd rdio-scanner [rdio@pc-linux rdio-scanner]$ unzip \ - > ~/Downloads/rdio-scanner-linux-amd64-v6.1.14.zip - Archive: /home/rdio/Downloads/rdio-scanner-linux-amd64-v6.1.14.zip + > ~/Downloads/rdio-scanner-linux-amd64-v6.1.15.zip + Archive: /home/rdio/Downloads/rdio-scanner-linux-amd64-v6.1.15.zip inflating: rdio-scanner inflating: rdio-scanner.pdf @@ -51,11 +51,11 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd [rdio@pc-linux rdio-scanner]$ ./rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 09:11:48 server started - 2022/02/24 09:11:48 main interface at http://pc-linux:3000 - 2022/02/24 09:11:48 admin interface at http://pc-linux:3000/admin + 2022/03/03 09:11:48 server started + 2022/03/03 09:11:48 main interface at http://pc-linux:3000 + 2022/03/03 09:11:48 admin interface at http://pc-linux:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -78,44 +78,38 @@ Here we want our [Rdio Scanner](https://guthub.com/chuot/rdio-scanner) instance [rdio@pc-linux rdio-scanner]$ sudo ./rdio-scanner -listen :80 [sudo] password for rdio: - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 09:14:00 server started - 2022/02/24 09:14:00 main interface at http://pc-linux - 2022/02/24 09:14:00 admin interface at http://pc-linux/admin + 2022/03/03 09:14:00 server started + 2022/03/03 09:14:00 main interface at http://pc-linux + 2022/03/03 09:14:00 admin interface at http://pc-linux/admin -## Listening with SSL with self-signed certificates +## Listening on a SSL port -It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the Internet by listening to a SSL port. +It is recommended to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the internet by listening to an SSL port. -We can create such self-signed certificates by running [Rdio Scanner](https://github.com/chuot/rdio-scanner) with the **-ssl_create** argument. - - [rdio@pc-linux rdio-scanner]$ ./rdio-scanner -ssl_create - 2022/02/24 09:15:03 generating ssl certificate files - 2022/02/24 09:15:05 ssl files created - -This has generated these files in the same folder as your [Rdio Scanner](https://github.com/chuot/rdio-scanner) executable. - -- **ca.crt** - self-signed certificate authority. -- **ca.key** - certificate authority private key. -- **server.crt** - self-signed server certificate. -- **server.key** - server private key. - -Now we use the self-signed server certificate to run our instance. +You can use your own SSL certificates that match your domain name with `-ssl_cert_file` and `-ssl_key_file`. If your certificate comes with an intermediate CA certificate, simply add its contents to the standard certificate file. [rdio@pc-linux rdio-scanner]$ sudo ./rdio-scanner \ > -listen :80 \ - > -ssl_cert_file server.crt \ - > -ssl_key_file server.key \ + > -ssl_cert_file mycert.crt \ + > -ssl_key_file mykey.key \ > -ssl_listen :443 [sudo] password for rdio: - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 09:16:47 server started - 2022/02/24 09:16:47 main interface at http://pc-linux - 2022/02/24 09:16:47 main interface at https://pc-linux - 2022/02/24 09:16:47 admin interface at https://pc-linux/admin + 2022/03/03 09:16:47 server started + 2022/03/03 09:16:47 main interface at http://pc-linux + 2022/03/03 09:16:47 main interface at https://pc-linux + 2022/03/03 09:16:47 admin interface at https://pc-linux/admin + +If you don't want to worry about SSL certificates, you can use the built-in Let's Encrypt auto-cert feature. This requires that you have both port 80 (HTTP) and port 443 (HTTPS) open to the world. Also, your domain name should point to your IP address where [Rdio Scanner](https://github.com/chuot/rdio-scanner/) is running. The advantage of this approach is that everything is done automatically, no certificate request, no certificate renewal. + + [rdio@pc-linux rdio-scanner]$ sudo ./rdio-scanner \ + > -listen :80 \ + > -ssl_auto_cert mydomain.com \ + > -ssl_listen :443 ## Save your advanced configuration to a config file @@ -123,19 +117,17 @@ You don't want to have to type everytime a long list of arguments. No problem, y [rdio@pc-linux rdio-scanner]$ ./rdio-scanner \ > -listen :80 \ - > -ssl_cert_file server.crt \ - > -ssl_key_file server.key \ + > -ssl_auto_cert mydomain.com \ > -ssl_listen :443 \ > -config_save - 2022/02/24 09:19:29 rdio-scanner.ini file created + 2022/03/03 09:19:29 rdio-scanner.ini file created All of your parameters passed as arguments to [Rdio Scanner](https://github.com/chuot/rdio-scanner) have been saved to an INI file which has the same arguments/values list. db_file = rdio-scanner.db db_type = sqlite listen = :80 - ssl_cert_file = server.crt - ssl_key_file = server.key + ssl_auto_cert = mydomain.com ssl_listen = :443 Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without any arguments. @@ -143,12 +135,12 @@ Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without an [rdio@pc-linux rdio-scanner]$ sudo ./rdio-scanner [sudo] Mot de passe de rdio : - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 09:20:40 server started - 2022/02/24 09:20:40 main interface at http://pc-linux - 2022/02/24 09:20:40 main interface at https://pc-linux - 2022/02/24 09:20:40 admin interface at https://pc-linux/admin + 2022/03/03 09:20:40 server started + 2022/03/03 09:20:40 main interface at http://pc-linux + 2022/03/03 09:20:40 main interface at https://pc-linux + 2022/03/03 09:20:40 admin interface at https://pc-linux/admin ## Install Rdio Scanner as a service diff --git a/docs/platforms/windows.md b/docs/platforms/windows.md index eff2c08..dfb204f 100644 --- a/docs/platforms/windows.md +++ b/docs/platforms/windows.md @@ -44,7 +44,7 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd C:\Users\rdio> cd rdio-scanner C:\Users\rdio\rdio-scanner> tar -xvf ^ - ..\downloads\rdio-scanner-windows-amd64-v6.1.14.zip + ..\downloads\rdio-scanner-windows-amd64-v6.1.15.zip x rdio-scanner.exe x rdio-scanner.pdf @@ -52,11 +52,11 @@ ALWAYS DOWNLOAD THE LATEST VERSION OF [RDIO SCANNER](https://github.com/chuot/rd C:\Users\rdio\rdio-scanner>rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 13:48:48 server started - 2022/02/24 13:48:48 main interface at http://pc-windows:3000 - 2022/02/24 13:48:48 admin interface at http://pc-windows:3000/admin + 2022/03/03 13:48:48 server started + 2022/03/03 13:48:48 main interface at http://pc-windows:3000 + 2022/03/03 13:48:48 admin interface at http://pc-windows:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -78,43 +78,37 @@ Here we want our [Rdio Scanner](https://guthub.com/chuot/rdio-scanner) instance C:\Users\rdio\rdio-scanner>rdio-scanner -listen :80 - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 10:53:31 server started - 2022/02/24 10:53:31 main interface at http://pc-windows - 2022/02/24 10:53:31 admin interface at http://pc-windows/admin + 2022/03/03 10:53:31 server started + 2022/03/03 10:53:31 main interface at http://pc-windows + 2022/03/03 10:53:31 admin interface at http://pc-windows/admin -## Listening with SSL with self-signed certificates +## Listening on a SSL port -It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the Internet by listening to a SSL port. +It is recommended to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner) instance over the internet by listening to an SSL port. -We can create such self-signed certificates by running [Rdio Scanner](https://github.com/chuot/rdio-scanner) with the **-ssl_create** argument. - - C:\Users\rdio\rdio-scanner>rdio-scanner -ssl_create - 2022/02/24 10:58:51 generating ssl certificate files - 2022/02/24 10:58:54 ssl files created - -This has generated these files in the same folder as your [Rdio Scanner](https://github.com/chuot/rdio-scanner) executable. - -- **ca.crt** - self-signed certificate authority. -- **ca.key** - certificate authority private key. -- **server.crt** - self-signed server certificate. -- **server.key** - server private key. - -Now we use the self-signed server certificate to run our instance. +You can use your own SSL certificates that match your domain name with `-ssl_cert_file` and `-ssl_key_file`. If your certificate comes with an intermediate CA certificate, simply add its contents to the standard certificate file. C:\Users\rdio\rdio-scanner>rdio-scanner ^ -listen :80 ^ - -ssl_cert_file server.crt ^ - -ssl_key_file server.key ^ + -ssl_cert_file mycert.crt ^ + -ssl_key_file meykey.key ^ -ssl_listen :443 - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 11:05:43 server started - 2022/02/24 11:05:43 main interface at http://pc-windows - 2022/02/24 11:05:43 main interface at https://pc-windows - 2022/02/24 11:05:43 admin interface at https://pc-windows/admin + 2022/03/03 11:05:43 server started + 2022/03/03 11:05:43 main interface at http://pc-windows + 2022/03/03 11:05:43 main interface at https://pc-windows + 2022/03/03 11:05:43 admin interface at https://pc-windows/admin + +If you don't want to worry about SSL certificates, you can use the built-in Let's Encrypt auto-cert feature. This requires that you have both port 80 (HTTP) and port 443 (HTTPS) open to the world. Also, your domain name should point to your IP address where [Rdio Scanner](https://github.com/chuot/rdio-scanner/) is running. The advantage of this approach is that everything is done automatically, no certificate request, no certificate renewal. + + C:\Users\rdio\rdio-scanner>rdio-scanner ^ + -listen :80 ^ + -ssl_auto_cert mydomain.com ^ + -ssl_listen :443 ## Save your advanced configuration to a config file @@ -122,31 +116,29 @@ You don't want to have to type everytime a long list of arguments. No problem, y C:\Users\rdio\rdio-scanner>rdio-scanner ^ -listen :80 ^ - -ssl_cert_file server.crt ^ - -ssl_key_file server.key ^ + -ssl_auto_cert mydomain.com ^ -ssl_listen :443 ^ -config_save - 2022/02/24 11:08:28 rdio-scanner.ini file created + 2022/03/03 11:08:28 rdio-scanner.ini file created All of your parameters passed as arguments to [Rdio Scanner](https://github.com/chuot/rdio-scanner) have been saved to an INI file which has the same arguments/values list. db_file = rdio-scanner.db db_type = sqlite listen = :80 - ssl_cert_file = server.crt - ssl_key_file = server.key + ssl_auto_cert = mydomain.com ssl_listen = :443 Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without any arguments. C:\Users\rdio\rdio-scanner>rdio-scanner - Rdio Scanner v6.1.14 + Rdio Scanner v6.1.15 ---------------------------------- - 2022/02/24 11:11:28 server started - 2022/02/24 11:11:28 main interface at http://pc-windows - 2022/02/24 11:11:28 main interface at https://pc-windows - 2022/02/24 11:11:28 admin interface at https://pc-windows/admin + 2022/03/03 11:11:28 server started + 2022/03/03 11:11:28 main interface at http://pc-windows + 2022/03/03 11:11:28 main interface at https://pc-windows + 2022/03/03 11:11:28 admin interface at https://pc-windows/admin \pagebreak{} diff --git a/server/access.go b/server/access.go index 9511936..0743a03 100644 --- a/server/access.go +++ b/server/access.go @@ -225,6 +225,10 @@ func (accesses *Accesses) Read(db *Database) error { access.Limit = uint(limit.Float64) } + if order.Valid && order.Float64 > 0 { + access.Order = uint(order.Float64) + } + if err = json.Unmarshal([]byte(systems), &access.Systems); err != nil { access.Systems = []interface{}{} } diff --git a/server/admin.go b/server/admin.go index 5d2b276..370e810 100644 --- a/server/admin.go +++ b/server/admin.go @@ -142,8 +142,10 @@ func (admin *Admin) ConfigHandler(w http.ResponseWriter, r *http.Request) { } else { admin.Controller.IngestLock() admin.mutex.Lock() - defer admin.mutex.Unlock() - defer admin.Controller.IngestUnlock() + defer func() { + admin.mutex.Unlock() + admin.Controller.IngestUnlock() + }() logError := func(err error) { admin.Controller.Logs.LogEvent(admin.Controller.Database, LogLevelError, fmt.Sprintf("admin.confighandler.put: %s", err.Error())) diff --git a/server/certificates.go b/server/certificates.go deleted file mode 100644 index eb03f35..0000000 --- a/server/certificates.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright Saubeo Solutions All Rights Reserved. -// This source code is proprietary and confidential. - -package main - -import ( - "bytes" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "math/big" - "os" - "time" -) - -func CreateSelfSignedCert(config *Config) error { - config.SslCaCertFile = "ca.crt" - config.SslCaKeyFile = "ca.key" - - if config.SslCertFile == "" { - config.SslCertFile = "server.crt" - } - if config.SslKeyFile == "" { - config.SslKeyFile = "server.key" - } - - ca := &x509.Certificate{ - BasicConstraintsValid: true, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, - IsCA: true, - KeyUsage: x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign, - NotBefore: time.Now(), - NotAfter: time.Now().AddDate(10, 0, 0), - SerialNumber: big.NewInt(int64(time.Now().Year())), - Subject: pkix.Name{CommonName: "Rdio Scanner CA"}, - } - - caKey, err := rsa.GenerateKey(rand.Reader, 4096) - if err != nil { - return err - } - - caBytes, err := x509.CreateCertificate(rand.Reader, ca, ca, &caKey.PublicKey, caKey) - if err != nil { - return err - } - - caPEM := new(bytes.Buffer) - pem.Encode(caPEM, &pem.Block{Type: "CERTIFICATE", Bytes: caBytes}) - - file, err := os.Create(config.GetSslCaCertFilePath()) - if err != nil { - return err - } - file.Write(caPEM.Bytes()) - file.Close() - - caKeyPEM := new(bytes.Buffer) - pem.Encode(caKeyPEM, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(caKey)}) - - file, err = os.Create(config.GetSslCaKeyFilePath()) - if err != nil { - return err - } - file.Write(caKeyPEM.Bytes()) - file.Close() - - cert := &x509.Certificate{ - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth}, - KeyUsage: x509.KeyUsageDigitalSignature, - NotBefore: time.Now(), - NotAfter: time.Now().AddDate(10, 0, 0), - SerialNumber: big.NewInt(int64(time.Now().Year())), - Subject: pkix.Name{CommonName: "Rdio Scanner"}, - } - - certKey, err := rsa.GenerateKey(rand.Reader, 4096) - if err != nil { - return err - } - - certBytes, err := x509.CreateCertificate(rand.Reader, cert, ca, &certKey.PublicKey, caKey) - if err != nil { - return err - } - - certPEM := new(bytes.Buffer) - pem.Encode(certPEM, &pem.Block{ - Type: "CERTIFICATE", - Bytes: certBytes, - }) - - file, err = os.Create(config.GetSslCertFilePath()) - if err != nil { - return err - } - file.Write(certPEM.Bytes()) - file.Write(caPEM.Bytes()) - file.Close() - - certKeyPEM := new(bytes.Buffer) - pem.Encode(certKeyPEM, &pem.Block{ - Type: "RSA PRIVATE KEY", - Bytes: x509.MarshalPKCS1PrivateKey(certKey), - }) - - file, err = os.Create(config.GetSslKeyFilePath()) - if err != nil { - return err - } - file.Write(certKeyPEM.Bytes()) - file.Close() - - return nil -} diff --git a/server/config.go b/server/config.go index 9b81d47..aae77fc 100644 --- a/server/config.go +++ b/server/config.go @@ -69,7 +69,6 @@ func NewConfig() *Config { config = &Config{} configSave = flag.Bool("config_save", false, fmt.Sprintf("save configuration to %s", defaultConfigFile)) serviceAction = flag.String("service", "", "service command, one of start, stop, restart, install, uninstall") - sslCreate = flag.Bool("ssl_create", false, "create self-signed certificates") version = flag.Bool("version", false, "show application version") ) @@ -118,17 +117,6 @@ func NewConfig() *Config { os.Exit(-1) } - case *sslCreate: - fmt.Println("generating ssl certificate files") - - if err := CreateSelfSignedCert(config); err == nil { - fmt.Println("ssl files created") - os.Exit(0) - } else { - fmt.Printf("error: %s", err.Error()) - os.Exit(-1) - } - case *version: fmt.Println(Version) os.Exit(0) diff --git a/server/controller.go b/server/controller.go index fa8ba87..6666130 100644 --- a/server/controller.go +++ b/server/controller.go @@ -71,9 +71,9 @@ func NewController(config *Config) *Controller { Systems: NewSystems(), Tags: NewTags(), Clients: make(map[*Client]bool), - Register: make(chan *Client, 64), - Unregister: make(chan *Client, 64), - Ingest: make(chan *Call, 64), + Register: make(chan *Client, 128), + Unregister: make(chan *Client, 128), + Ingest: make(chan *Call, 128), ingestMutex: sync.Mutex{}, } @@ -179,8 +179,8 @@ func (controller *Controller) IngestCall(call *Call) { talkgroup *Talkgroup ) - controller.ingestMutex.Lock() - defer controller.ingestMutex.Unlock() + controller.IngestLock() + defer controller.IngestUnlock() logCall := func(call *Call, level string, message string) { controller.Logs.LogEvent( @@ -383,10 +383,10 @@ func (controller *Controller) IngestCall(call *Call) { } } - controller.EmitCall(call) - logCall(call, LogLevelInfo, "success") + controller.EmitCall(call) + } else { logError(err) } @@ -647,6 +647,13 @@ func (controller *Controller) Start() error { controller.Terminate() }() + go func() { + for { + call := <-controller.Ingest + controller.IngestCall(call) + } + }() + go func() { var timer *time.Timer @@ -659,9 +666,6 @@ func (controller *Controller) Start() error { for { select { - case call := <-controller.Ingest: - controller.IngestCall(call) - case client := <-controller.Register: controller.Clients[client] = true logClientsCount() @@ -669,7 +673,6 @@ func (controller *Controller) Start() error { case client := <-controller.Unregister: if _, ok := controller.Clients[client]; ok { delete(controller.Clients, client) - close(client.Send) logClientsCount() } } diff --git a/server/database.go b/server/database.go index 93ce4ca..bca2096 100644 --- a/server/database.go +++ b/server/database.go @@ -61,7 +61,7 @@ func NewDatabase(config *Config) *Database { log.Fatalf("unknown database type %s\n", config.DbType) } - database.Sql.SetConnMaxLifetime(5 * time.Minute) + database.Sql.SetConnMaxLifetime(0) database.Sql.SetMaxIdleConns(25) database.Sql.SetMaxOpenConns(25) diff --git a/server/downstream.go b/server/downstream.go index bc6f3e7..b03bebf 100644 --- a/server/downstream.go +++ b/server/downstream.go @@ -378,10 +378,11 @@ func (downstreams *Downstreams) FromMap(f []interface{}) { func (downstreams *Downstreams) Read(db *Database) error { var ( - err error - id sql.NullFloat64 - order sql.NullFloat64 - rows *sql.Rows + err error + id sql.NullFloat64 + order sql.NullFloat64 + rows *sql.Rows + systems string ) downstreams.mutex.Lock() @@ -400,7 +401,7 @@ func (downstreams *Downstreams) Read(db *Database) error { for rows.Next() { downstream := &Downstream{} - if err = rows.Scan(&id, &downstream.Apikey, &downstream.Disabled, &order, &downstream.Systems, &downstream.Url); err != nil { + if err = rows.Scan(&id, &downstream.Apikey, &downstream.Disabled, &order, &systems, &downstream.Url); err != nil { break } @@ -412,13 +413,12 @@ func (downstreams *Downstreams) Read(db *Database) error { downstream.Apikey = uuid.New().String() } - switch v := downstream.Systems.(type) { - case string: - if err = json.Unmarshal([]byte(v), &downstream.Systems); err != nil { - downstream.Systems = defaults.downstream.systems - } - default: - downstream.Systems = defaults.downstream.systems + if order.Valid && order.Float64 > 0 { + downstream.Order = uint(order.Float64) + } + + if err = json.Unmarshal([]byte(systems), &downstream.Systems); err != nil { + downstream.Systems = []interface{}{} } if len(downstream.Url) == 0 { diff --git a/server/go.mod b/server/go.mod index af0b031..8d067b2 100644 --- a/server/go.mod +++ b/server/go.mod @@ -12,7 +12,7 @@ require ( github.com/kardianos/service v1.2.1 golang.org/x/crypto v0.0.0-20220214200702-86341886e292 gopkg.in/ini.v1 v1.66.4 - modernc.org/sqlite v1.14.6 + modernc.org/sqlite v1.14.7 ) require ( @@ -21,7 +21,7 @@ require ( github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/stretchr/testify v1.7.0 // indirect golang.org/x/mod v0.5.1 // indirect - golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect + golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.9 // indirect diff --git a/server/go.sum b/server/go.sum index 2d97110..32990ff 100644 --- a/server/go.sum +++ b/server/go.sum @@ -14,8 +14,6 @@ github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/kardianos/service v1.2.1 h1:AYndMsehS+ywIS6RB9KOlcXzteWUzxgMgBymJD7+BYk= @@ -39,8 +37,6 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506 h1:EuGTJDfeg/PGZJp3gq1K+14eSLFTsrj1eg8KQuiUyKg= -golang.org/x/crypto v0.0.0-20220213190939-1e6e3497d506/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -50,10 +46,9 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -70,11 +65,11 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7 h1:BXxu8t6QN0G1uff4bzZzSkpsax8+ALqTGUtz08QrV00= golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -217,8 +212,8 @@ modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14= modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM= modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A= modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.14.6 h1:Jt5P3k80EtDBWaq1beAxnWW+5MdHXbZITujnRS7+zWg= -modernc.org/sqlite v1.14.6/go.mod h1:yiCvMv3HblGmzENNIaNtFhfaNIwcla4u2JQEwJPzfEc= +modernc.org/sqlite v1.14.7 h1:A+6rGjtRQbt9SORXfV+hUyXOP3mDf7J5uz+EES/CNPE= +modernc.org/sqlite v1.14.7/go.mod h1:yiCvMv3HblGmzENNIaNtFhfaNIwcla4u2JQEwJPzfEc= modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= modernc.org/tcl v1.11.0 h1:B/zzEYjINeaki38KcIqdQRQx7W3WE7TkrlTwGnbm2II= diff --git a/server/version.go b/server/version.go index f26bd5e..de5ca7a 100644 --- a/server/version.go +++ b/server/version.go @@ -15,4 +15,4 @@ package main -const Version = "6.1.14" +const Version = "6.1.15"