diff --git a/CHANGELOG.md b/CHANGELOG.md index 874aafa..32dbf5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,11 @@ _v6.1.10_ - Backport dirwatch delay value from v5.1. +_v6.1.11_ + +- Fix connection errors when behind a reverse-proxy. +- Fix disappearing talkgroups (issue #127). + ## Version 6.0 - Backend server rewritten in Go for better performance and ease of installation. diff --git a/COMPILING.md b/COMPILING.md index 8b2d4a8..507679e 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -24,13 +24,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.10.zip - rdio-scanner-darwin-arm64-v6.1.10.zip - rdio-scanner-freebsd-amd64-v6.1.10.zip - rdio-scanner-linux-386-v6.1.10.zip - rdio-scanner-linux-amd64-v6.1.10.zip - rdio-scanner-linux-arm64-v6.1.10.zip - rdio-scanner-linux-arm-v6.1.10.zip - rdio-scanner-windows-amd64-v6.1.10.zip + rdio-scanner-darwin-amd64-v6.1.11.zip + rdio-scanner-darwin-arm64-v6.1.11.zip + rdio-scanner-freebsd-amd64-v6.1.11.zip + rdio-scanner-linux-386-v6.1.11.zip + rdio-scanner-linux-amd64-v6.1.11.zip + rdio-scanner-linux-arm64-v6.1.11.zip + rdio-scanner-linux-arm-v6.1.11.zip + rdio-scanner-windows-amd64-v6.1.11.zip **Happy Rdio scanning !** \ No newline at end of file diff --git a/Makefile b/Makefile index f62e8fa..c70eb8c 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ ################################################################################ app := rdio-scanner -date := 2022/02/02 -ver := 6.1.10 +date := 2022/02/13 +ver := 6.1.11 client := $(wildcard client/*.json client/*.ts) server := $(wildcard server/*.go) diff --git a/client/package.json b/client/package.json index 06ffcdf..268e85a 100644 --- a/client/package.json +++ b/client/package.json @@ -38,5 +38,5 @@ "build": "ng build --base-href ./ --configuration production", "start": "ng serve" }, - "version": "6.1.10" + "version": "6.1.11" } diff --git a/client/src/app/components/rdio-scanner/admin/admin.service.ts b/client/src/app/components/rdio-scanner/admin/admin.service.ts index b41f536..20098fe 100644 --- a/client/src/app/components/rdio-scanner/admin/admin.service.ts +++ b/client/src/app/components/rdio-scanner/admin/admin.service.ts @@ -413,7 +413,7 @@ export class RdioScannerAdminService implements OnDestroy { newDirWatchForm(dirWatch?: DirWatch): FormGroup { return this.ngFormBuilder.group({ _id: [dirWatch?._id], - delay: [typeof dirWatch?.delay === 'number' ? dirWatch?.delay : 2000], + delay: [typeof dirWatch?.delay === 'number' ? Math.max(2000, dirWatch?.delay) : 2000], deleteAfter: [dirWatch?.deleteAfter], directory: [dirWatch?.directory, [Validators.required, this.validateDirectory()]], disabled: [dirWatch?.disabled], @@ -721,12 +721,6 @@ export class RdioScannerAdminService implements OnDestroy { }; } - private validatePatches(): ValidatorFn { - return (control: AbstractControl): ValidationErrors | null => { - return typeof control.value === 'string' && control.value.length ? /^[0-9]+(,[0-9]+)*$/.test(control.value) ? null : { invalid: true } : null; - }; - } - private validateTag(): ValidatorFn { return (control: AbstractControl): ValidationErrors | null => { if (typeof control.value !== 'number') { 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 0ec383c..bb7cf82 100644 --- a/client/src/app/components/rdio-scanner/rdio-scanner.service.ts +++ b/client/src/app/components/rdio-scanner/rdio-scanner.service.ts @@ -815,7 +815,6 @@ export class RdioScannerService implements OnDestroy { this.queue(this.transformCall(call), { priority: true }); } else { - console.log(call.id, this.isPatched(call)); if (this.isPatched(call)) { call.patched = true; } diff --git a/docs/platforms/darwin.md b/docs/platforms/darwin.md index d69f6e5..58339d3 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.10.zip - Archive: /Users/rdio/Downloads/rdio-scanner-darwin-arm64-v6.1.10.zip + > ~/Downloads/rdio-scanner-darwin-arm64-v6.1.11.zip + Archive: /Users/rdio/Downloads/rdio-scanner-darwin-arm64-v6.1.11.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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 08:38:06 server started - 2022/02/02 08:38:06 main interface at http://macos.local:3000 - 2022/02/02 08:38:06 admin interface at http://macos.local:3000/admin + 2022/02/13 08:38:06 server started + 2022/02/13 08:38:06 main interface at http://macos.local:3000 + 2022/02/13 08:38:06 admin interface at http://macos.local:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -77,11 +77,11 @@ 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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 08:48:03 server started - 2022/02/02 08:48:03 main interface at http://macos.local - 2022/02/02 08:48:03 admin interface at http://macos.local/admin + 2022/02/13 08:48:03 server started + 2022/02/13 08:48:03 main interface at http://macos.local + 2022/02/13 08:48:03 admin interface at http://macos.local/admin ## Listening with SSL with self-signed certificates @@ -90,8 +90,8 @@ It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner 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/02 08:49:16 generating ssl certificate files - 2022/02/02 08:49:17 ssl files created + 2022/02/13 08:49:16 generating ssl certificate files + 2022/02/13 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. @@ -108,12 +108,12 @@ Now we use the self-signed server certificate to run our instance. > -ssl_key_file server.key \ > -ssl_listen :443 - Rdio Scanner v6.1.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 08:50:58 server started - 2022/02/02 08:50:58 main interface at http://macos.local - 2022/02/02 08:50:58 main interface at https://macos.local - 2022/02/02 08:50:58 admin interface at https://macos.local/admin + 2022/02/13 08:50:58 server started + 2022/02/13 08:50:58 main interface at http://macos.local + 2022/02/13 08:50:58 main interface at https://macos.local + 2022/02/13 08:50:58 admin interface at https://macos.local/admin ## Save your advanced configuration to a config file @@ -125,7 +125,7 @@ You don't want to have to type everytime a long list of arguments. No problem, y > -ssl_key_file server.key \ > -ssl_listen :443 \ > -config_save - 2022/02/02 08:52:24 rdio-scanner.ini file created + 2022/02/13 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. @@ -140,12 +140,12 @@ Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without an rdio@macos rdio-scanner % ./rdio-scanner - Rdio Scanner v6.1.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 08:54:08 server started - 2022/02/02 08:54:08 main interface at http://macos.local - 2022/02/02 08:54:08 main interface at https://macos.local - 2022/02/02 08:54:08 admin interface at https://macos.local/admin + 2022/02/13 08:54:08 server started + 2022/02/13 08:54:08 main interface at http://macos.local + 2022/02/13 08:54:08 main interface at https://macos.local + 2022/02/13 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 f19d3cd..d00b440 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.10.zip - Archive: ../rdio-scanner-freebsd-amd64-v6.1.10.zip + > ~/rdio-scanner-freebsd-amd64-v6.1.11.zip + Archive: ../rdio-scanner-freebsd-amd64-v6.1.11.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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 08:16:36 server started - 2022/02/02 08:16:36 main interface at http://pc-freebsd:3000 - 2022/02/02 08:16:36 admin interface at http://pc-freebsd:3000/admin + 2022/02/13 08:16:36 server started + 2022/02/13 08:16:36 main interface at http://pc-freebsd:3000 + 2022/02/13 08:16:36 admin interface at http://pc-freebsd:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -81,11 +81,11 @@ 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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 08:19:38 server started - 2022/02/02 08:19:38 main interface at http://pc-freebsd - 2022/02/02 08:19:38 admin interface at http://pc-freebsd/admin + 2022/02/13 08:19:38 server started + 2022/02/13 08:19:38 main interface at http://pc-freebsd + 2022/02/13 08:19:38 admin interface at http://pc-freebsd/admin ## Listening with SSL with self-signed certificates @@ -94,8 +94,8 @@ It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner 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/02 10:32:17 generating ssl certificate files - 2022/02/02 10:32:19 ssl files created + 2022/02/13 10:32:17 generating ssl certificate files + 2022/02/13 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. @@ -114,12 +114,12 @@ Now we use the self-signed server certificate to run our instance. > -ssl_key_file server.key \ > -ssl_listen :443 - Rdio Scanner v6.1.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 10:34:29 server started - 2022/02/02 10:34:29 main interface at http://pc-freebsd - 2022/02/02 10:34:29 main interface at https://pc-freebsd - 2022/02/02 10:34:29 admin interface at https://pc-freebsd/admin + 2022/02/13 10:34:29 server started + 2022/02/13 10:34:29 main interface at http://pc-freebsd + 2022/02/13 10:34:29 main interface at https://pc-freebsd + 2022/02/13 10:34:29 admin interface at https://pc-freebsd/admin ## Save your advanced configuration to a config file @@ -131,7 +131,7 @@ You don't want to have to type everytime a long list of arguments. No problem, y > -ssl_key_file server.key \ > -ssl_listen :443 \ > -config_save - 2022/02/02 10:37:00 rdio-scanner.ini file created + 2022/02/13 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. @@ -148,12 +148,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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 10:38:28 server started - 2022/02/02 10:38:29 main interface at http://pc-freebsd - 2022/02/02 10:38:29 main interface at https://pc-freebsd - 2022/02/02 10:38:29 admin interface at https://pc-freebsd/admin + 2022/02/13 10:38:28 server started + 2022/02/13 10:38:29 main interface at http://pc-freebsd + 2022/02/13 10:38:29 main interface at https://pc-freebsd + 2022/02/13 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 c60b512..231a144 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.10.zip - Archive: /home/rdio/Downloads/rdio-scanner-linux-amd64-v6.1.10.zip + > ~/Downloads/rdio-scanner-linux-amd64-v6.1.11.zip + Archive: /home/rdio/Downloads/rdio-scanner-linux-amd64-v6.1.11.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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 09:11:48 server started - 2022/02/02 09:11:48 main interface at http://pc-linux:3000 - 2022/02/02 09:11:48 admin interface at http://pc-linux:3000/admin + 2022/02/13 09:11:48 server started + 2022/02/13 09:11:48 main interface at http://pc-linux:3000 + 2022/02/13 09:11:48 admin interface at http://pc-linux:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -78,11 +78,11 @@ 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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 09:14:00 server started - 2022/02/02 09:14:00 main interface at http://pc-linux - 2022/02/02 09:14:00 admin interface at http://pc-linux/admin + 2022/02/13 09:14:00 server started + 2022/02/13 09:14:00 main interface at http://pc-linux + 2022/02/13 09:14:00 admin interface at http://pc-linux/admin ## Listening with SSL with self-signed certificates @@ -91,8 +91,8 @@ It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner 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/02 09:15:03 generating ssl certificate files - 2022/02/02 09:15:05 ssl files created + 2022/02/13 09:15:03 generating ssl certificate files + 2022/02/13 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. @@ -110,12 +110,12 @@ Now we use the self-signed server certificate to run our instance. > -ssl_listen :443 [sudo] password for rdio: - Rdio Scanner v6.1.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 09:16:47 server started - 2022/02/02 09:16:47 main interface at http://pc-linux - 2022/02/02 09:16:47 main interface at https://pc-linux - 2022/02/02 09:16:47 admin interface at https://pc-linux/admin + 2022/02/13 09:16:47 server started + 2022/02/13 09:16:47 main interface at http://pc-linux + 2022/02/13 09:16:47 main interface at https://pc-linux + 2022/02/13 09:16:47 admin interface at https://pc-linux/admin ## Save your advanced configuration to a config file @@ -127,7 +127,7 @@ You don't want to have to type everytime a long list of arguments. No problem, y > -ssl_key_file server.key \ > -ssl_listen :443 \ > -config_save - 2022/02/02 09:19:29 rdio-scanner.ini file created + 2022/02/13 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. @@ -143,12 +143,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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 09:20:40 server started - 2022/02/02 09:20:40 main interface at http://pc-linux - 2022/02/02 09:20:40 main interface at https://pc-linux - 2022/02/02 09:20:40 admin interface at https://pc-linux/admin + 2022/02/13 09:20:40 server started + 2022/02/13 09:20:40 main interface at http://pc-linux + 2022/02/13 09:20:40 main interface at https://pc-linux + 2022/02/13 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 ac3284f..49ddc5f 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.10.zip + ..\downloads\rdio-scanner-windows-amd64-v6.1.11.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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 13:48:48 server started - 2022/02/02 13:48:48 main interface at http://pc-windows:3000 - 2022/02/02 13:48:48 admin interface at http://pc-windows:3000/admin + 2022/02/13 13:48:48 server started + 2022/02/13 13:48:48 main interface at http://pc-windows:3000 + 2022/02/13 13:48:48 admin interface at http://pc-windows:3000/admin 4. Access the administrative dashboard to finalize the configuration. @@ -78,11 +78,11 @@ 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.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 10:53:31 server started - 2022/02/02 10:53:31 main interface at http://pc-windows - 2022/02/02 10:53:31 admin interface at http://pc-windows/admin + 2022/02/13 10:53:31 server started + 2022/02/13 10:53:31 main interface at http://pc-windows + 2022/02/13 10:53:31 admin interface at http://pc-windows/admin ## Listening with SSL with self-signed certificates @@ -91,8 +91,8 @@ It is advised to share your [Rdio Scanner](https://github.com/chuot/rdio-scanner 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/02 10:58:51 generating ssl certificate files - 2022/02/02 10:58:54 ssl files created + 2022/02/13 10:58:51 generating ssl certificate files + 2022/02/13 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. @@ -109,12 +109,12 @@ Now we use the self-signed server certificate to run our instance. -ssl_key_file server.key ^ -ssl_listen :443 - Rdio Scanner v6.1.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 11:05:43 server started - 2022/02/02 11:05:43 main interface at http://pc-windows - 2022/02/02 11:05:43 main interface at https://pc-windows - 2022/02/02 11:05:43 admin interface at https://pc-windows/admin + 2022/02/13 11:05:43 server started + 2022/02/13 11:05:43 main interface at http://pc-windows + 2022/02/13 11:05:43 main interface at https://pc-windows + 2022/02/13 11:05:43 admin interface at https://pc-windows/admin ## Save your advanced configuration to a config file @@ -126,7 +126,7 @@ You don't want to have to type everytime a long list of arguments. No problem, y -ssl_key_file server.key ^ -ssl_listen :443 ^ -config_save - 2022/02/02 11:08:28 rdio-scanner.ini file created + 2022/02/13 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. @@ -141,12 +141,12 @@ Then simply run [Rdio Scanner](https://github.com/chuot/rdio-scanner) without an C:\Users\rdio\rdio-scanner>rdio-scanner - Rdio Scanner v6.1.10 + Rdio Scanner v6.1.11 ---------------------------------- - 2022/02/02 11:11:28 server started - 2022/02/02 11:11:28 main interface at http://pc-windows - 2022/02/02 11:11:28 main interface at https://pc-windows - 2022/02/02 11:11:28 admin interface at https://pc-windows/admin + 2022/02/13 11:11:28 server started + 2022/02/13 11:11:28 main interface at http://pc-windows + 2022/02/13 11:11:28 main interface at https://pc-windows + 2022/02/13 11:11:28 admin interface at https://pc-windows/admin \pagebreak{} diff --git a/server/access.go b/server/access.go index 4b63571..9511936 100644 --- a/server/access.go +++ b/server/access.go @@ -289,7 +289,9 @@ func (accesses *Accesses) Write(db *Database) error { for rows.Next() { var id uint - rows.Scan(&id) + if err = rows.Scan(&id); err != nil { + break + } remove := true for _, access := range accesses.List { if access.Id == nil || access.Id == id { diff --git a/server/apikey.go b/server/apikey.go index 4e0f253..74a3586 100644 --- a/server/apikey.go +++ b/server/apikey.go @@ -257,7 +257,9 @@ func (apikeys *Apikeys) Write(db *Database) error { for rows.Next() { var id uint - rows.Scan(&id) + if err = rows.Scan(&id); err != nil { + break + } remove := true for _, apikey := range apikeys.List { if apikey.Id == nil || apikey.Id == id { diff --git a/server/call.go b/server/call.go index 5ba939f..f6132dc 100644 --- a/server/call.go +++ b/server/call.go @@ -163,24 +163,24 @@ func (calls *Calls) GetCall(id uint, db *Database) (*Call, error) { if t, err = db.ParseDateTime(dateTime); err == nil { call.DateTime = t } else { - return nil, fmt.Errorf("getcall.parsedatetime: %v", err) + call.DateTime = time.Time{} } if len(frequencies) > 0 { if err = json.Unmarshal([]byte(frequencies), &call.Frequencies); err != nil { - return nil, fmt.Errorf("getcall.unmarshal.frequencies: %v", err) + call.Frequencies = []interface{}{} } } if len(patches) > 0 { if err = json.Unmarshal([]byte(patches), &call.Patches); err != nil { - return nil, fmt.Errorf("getcall.unmarshal.patches: %v", err) + call.Patches = []interface{}{} } } if len(sources) > 0 { if err = json.Unmarshal([]byte(sources), &call.Sources); err != nil { - return nil, fmt.Errorf("getcall.unmarshal.sources: %v", err) + call.Sources = []interface{}{} } } diff --git a/server/client.go b/server/client.go index 4563b8a..1ed258c 100644 --- a/server/client.go +++ b/server/client.go @@ -80,7 +80,7 @@ func (client *Client) Init(controller *Controller, conn *websocket.Conn) error { }() go func() { - ticker := time.NewTicker(30 * time.Second) + ticker := time.NewTicker(5 * time.Second) defer func() { ticker.Stop() diff --git a/server/dirwatch.go b/server/dirwatch.go index 60c70ec..12d7023 100644 --- a/server/dirwatch.go +++ b/server/dirwatch.go @@ -801,7 +801,9 @@ func (dirwatches *Dirwatches) Write(db *Database) error { for rows.Next() { var rowId uint - rows.Scan(&rowId) + if err = rows.Scan(&rowId); err != nil { + break + } remove := true for _, dirwatch := range dirwatches.List { if dirwatch.Id == nil || dirwatch.Id == rowId { diff --git a/server/downstream.go b/server/downstream.go index 65b31f7..bc6f3e7 100644 --- a/server/downstream.go +++ b/server/downstream.go @@ -505,7 +505,9 @@ func (downstreams *Downstreams) Write(db *Database) error { for rows.Next() { var rowId uint - rows.Scan(&rowId) + if err = rows.Scan(&rowId); err != nil { + break + } remove := true for _, downstream := range downstreams.List { if downstream.Id == nil || downstream.Id == rowId { diff --git a/server/go.mod b/server/go.mod index 72e9e82..df7fd5f 100644 --- a/server/go.mod +++ b/server/go.mod @@ -6,13 +6,13 @@ require ( github.com/dhowden/tag v0.0.0-20201120070457-d52dcb253c63 github.com/fsnotify/fsnotify v1.5.1 github.com/go-sql-driver/mysql v1.6.0 - github.com/golang-jwt/jwt/v4 v4.2.0 + github.com/golang-jwt/jwt/v4 v4.3.0 github.com/google/uuid v1.3.0 github.com/gorilla/websocket v1.4.2 github.com/kardianos/service v1.2.1 - golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838 - gopkg.in/ini.v1 v1.66.3 - modernc.org/sqlite v1.14.5 + golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 + gopkg.in/ini.v1 v1.66.4 + modernc.org/sqlite v1.14.6 ) require ( @@ -22,7 +22,7 @@ require ( 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/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect + golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.9 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect diff --git a/server/go.sum b/server/go.sum index ce285a9..076dfee 100644 --- a/server/go.sum +++ b/server/go.sum @@ -8,8 +8,8 @@ github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWp github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= +github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= 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= @@ -37,8 +37,8 @@ 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-20220131195533-30dcbda58838 h1:71vQrMauZZhcTVK6KdYM+rklehEEwb3E+ZhaE5jrPrE= -golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 h1:XdAboW3BNMv9ocSCOk/u1MFioZGzCNkiJZ19v9Oe3Ig= +golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= @@ -66,8 +66,8 @@ golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBc 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-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/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/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= @@ -86,8 +86,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/ini.v1 v1.66.3 h1:jRskFVxYaMGAMUbN0UZ7niA9gzL9B49DOqE78vg0k3w= -gopkg.in/ini.v1 v1.66.3/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= @@ -148,7 +148,6 @@ modernc.org/ccgo/v3 v3.12.86/go.mod h1:dN7S26DLTgVSni1PVA3KxxHTcykyDurf3OgUzNqTS modernc.org/ccgo/v3 v3.12.90/go.mod h1:obhSc3CdivCRpYZmrvO88TXlW0NvoSVvdh/ccRjJYko= modernc.org/ccgo/v3 v3.12.92/go.mod h1:5yDdN7ti9KWPi5bRVWPl8UNhpEAtCjuEE7ayQnzzqHA= modernc.org/ccgo/v3 v3.13.1/go.mod h1:aBYVOUfIlcSnrsRVU8VRS35y2DIfpgkmVkYZ0tpIXi4= -modernc.org/ccgo/v3 v3.14.0/go.mod h1:hBrkiBlUwvr5vV/ZH9YzXIp982jKE8Ek8tR1ytoAL6Q= modernc.org/ccgo/v3 v3.15.1/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0= modernc.org/ccgo/v3 v3.15.9/go.mod h1:md59wBwDT2LznX/OTCPoVS6KIsdRgY8xqQwBV+hkTH0= modernc.org/ccgo/v3 v3.15.10/go.mod h1:wQKxoFn0ynxMuCLfFD09c8XPUCc8obfchoVR9Cn0fI8= @@ -198,8 +197,6 @@ modernc.org/libc v1.11.88/go.mod h1:h3oIVe8dxmTcchcFuCcJ4nAWaoiwzKCdv82MM0oiIdQ= modernc.org/libc v1.11.98/go.mod h1:ynK5sbjsU77AP+nn61+k+wxUGRx9rOFcIqWYYMaDZ4c= modernc.org/libc v1.11.101/go.mod h1:wLLYgEiY2D17NbBOEp+mIJJJBGSiy7fLL4ZrGGZ+8jI= modernc.org/libc v1.12.0/go.mod h1:2MH3DaF/gCU8i/UBiVE1VFRos4o523M7zipmwH8SIgQ= -modernc.org/libc v1.13.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk= -modernc.org/libc v1.13.2/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk= modernc.org/libc v1.14.1/go.mod h1:npFeGWjmZTjFeWALQLrvklVmAxv4m80jnG3+xI8FdJk= modernc.org/libc v1.14.2/go.mod h1:MX1GBLnRLNdvmK9azU9LCxZ5lMyhrbEMK8rG3X/Fe34= modernc.org/libc v1.14.3/go.mod h1:GPIvQVOVPizzlqyRX3l756/3ppsAgg1QgPxjr5Q4agQ= @@ -215,14 +212,13 @@ 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.5 h1:bYrrjwH9Y7QUGk1MbchZDhRfmpGuEAs/D45sVjNbfvs= -modernc.org/sqlite v1.14.5/go.mod h1:YyX5Rx0WbXokitdWl2GJIDy4BrPxBP0PwwhpXOHCDLE= +modernc.org/sqlite v1.14.6 h1:Jt5P3k80EtDBWaq1beAxnWW+5MdHXbZITujnRS7+zWg= +modernc.org/sqlite v1.14.6/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.10.0 h1:vux2MNFhSXYqD8Kq4Uc9RjWcgv2c7Atx3da3VpLPPEw= -modernc.org/tcl v1.10.0/go.mod h1:WzWapmP/7dHVhFoyPpEaNSVTL8xtewhouN/cqSJ5A2s= +modernc.org/tcl v1.11.0 h1:B/zzEYjINeaki38KcIqdQRQx7W3WE7TkrlTwGnbm2II= +modernc.org/tcl v1.11.0/go.mod h1:zsTUpbQ+NxQEjOjCUlImDLPv1sG8Ww0qp66ZvyOxCgw= modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.2.21/go.mod h1:uXrObx4pGqXWIMliC5MiKuwAyMrltzwpteOFUP1PWCc= modernc.org/z v1.3.0 h1:4RWULo1Nvaq5ZBhbLe74u8p6tV4Mmm0ZrPBXYPm/xjM= modernc.org/z v1.3.0/go.mod h1:+mvgLH814oDjtATDdT3rs84JnUIpkvAF5B8AVkNlE2g= diff --git a/server/group.go b/server/group.go index 6e69abb..35ae4fb 100644 --- a/server/group.go +++ b/server/group.go @@ -245,7 +245,9 @@ func (groups *Groups) Write(db *Database) error { for rows.Next() { var rowId uint - rows.Scan(&rowId) + if err = rows.Scan(&rowId); err != nil { + break + } remove := true for _, group := range groups.List { if group.Id == nil || group.Id == rowId { diff --git a/server/main.go b/server/main.go index c833b49..f8c263f 100644 --- a/server/main.go +++ b/server/main.go @@ -128,7 +128,11 @@ func main() { default: if strings.EqualFold(r.Header.Get("upgrade"), "websocket") { - upgrader := websocket.Upgrader{} + upgrader := websocket.Upgrader{ + CheckOrigin: func(r *http.Request) bool { + return true + }, + } conn, err := upgrader.Upgrade(w, r, nil) if err != nil { diff --git a/server/system.go b/server/system.go index e5dd947..4a6e056 100644 --- a/server/system.go +++ b/server/system.go @@ -160,21 +160,27 @@ func (systems *Systems) GetSystem(f interface{}) (system *System, ok bool) { func (systems *Systems) GetScopedSystems(client *Client, groups *Groups, tags *Tags, sortTalkgroups bool) *SystemsMap { var ( - rawSystems = []*System{} + rawSystems = []System{} systemsMap = SystemsMap{} ) if client.Access == nil { - rawSystems = append(rawSystems, systems.List...) + for _, system := range systems.List { + rawSystems = append(rawSystems, *system) + } } else { switch v := client.Access.Systems.(type) { case nil: - rawSystems = append(rawSystems, systems.List...) + for _, system := range systems.List { + rawSystems = append(rawSystems, *system) + } case string: if v == "*" { - rawSystems = append(rawSystems, systems.List...) + for _, system := range systems.List { + rawSystems = append(rawSystems, *system) + } } case []interface{}: @@ -202,12 +208,12 @@ func (systems *Systems) GetScopedSystems(client *Client, groups *Groups, tags *T switch v := mTalkgroups.(type) { case string: if mTalkgroups == "*" { - rawSystems = append(rawSystems, system) + rawSystems = append(rawSystems, *system) continue } case []interface{}: - rawSystem := system + rawSystem := *system rawSystem.Talkgroups = NewTalkgroups() for _, fTalkgroupId := range v { switch v := fTalkgroupId.(type) { @@ -441,7 +447,9 @@ func (systems *Systems) Write(db *Database) error { for rows.Next() { var rowId uint var systemId uint - rows.Scan(&rowId, &systemId) + if err = rows.Scan(&rowId, &systemId); err != nil { + break + } remove := true for _, system := range systems.List { if system.RowId == nil || system.RowId == rowId { diff --git a/server/tag.go b/server/tag.go index 2e12716..8247310 100644 --- a/server/tag.go +++ b/server/tag.go @@ -240,7 +240,9 @@ func (tags *Tags) Write(db *Database) error { for rows.Next() { var rowId uint - rows.Scan(&rowId) + if err = rows.Scan(&rowId); err != nil { + break + } remove := true for _, tag := range tags.List { if tag.Id == nil || tag.Id == rowId { diff --git a/server/talkgroup.go b/server/talkgroup.go index 5baee02..27585e6 100644 --- a/server/talkgroup.go +++ b/server/talkgroup.go @@ -233,7 +233,9 @@ func (talkgroups *Talkgroups) Write(db *Database, systemId uint) error { for rows.Next() { var id uint - rows.Scan(&id) + if err = rows.Scan(&id); err != nil { + break + } remove := true for _, talkgroup := range talkgroups.List { if talkgroup.Id == id { diff --git a/server/unit.go b/server/unit.go index c78b518..c4a7026 100644 --- a/server/unit.go +++ b/server/unit.go @@ -184,7 +184,9 @@ func (units *Units) Write(db *Database, systemId uint) error { for rows.Next() { var id uint - rows.Scan(&id) + if err = rows.Scan(&id); err != nil { + break + } remove := true for _, unit := range units.List { if unit.Id == id { diff --git a/server/version.go b/server/version.go index 09e301a..db4c8ef 100644 --- a/server/version.go +++ b/server/version.go @@ -15,4 +15,4 @@ package main -const Version = "6.1.10" +const Version = "6.1.11"