Browse Source

many frontend changes that need generic change

master
peter 2 years ago
parent
commit
3e804fd0e6
53 changed files with 251 additions and 12692 deletions
  1. 56
    250
      package-lock.json
  2. 5
    5
      package.json
  3. 7
    19
      src/backend/Admin.ts
  4. 4
    17
      src/backend/Installer.ts
  5. 5
    4
      src/backend/webpack.prod.js
  6. 0
    69
      src/frontend/src/app/apiclient/.drone.yml
  7. 0
    10
      src/frontend/src/app/apiclient/.gitignore
  8. 0
    2
      src/frontend/src/app/apiclient/.npmignore
  9. 0
    0
      src/frontend/src/app/apiclient/apiclient-consumptions.component.ts
  10. 3
    6
      src/frontend/src/app/apiclient/apiclient-settings-form.component.ts
  11. 0
    0
      src/frontend/src/app/apiclient/apiclient-subscriptions.component.ts
  12. 0
    17
      src/frontend/src/app/apiclient/conf/ApiClient.json
  13. 20
    16
      src/frontend/src/app/apiclient/module.ts
  14. 0
    4652
      src/frontend/src/app/apiclient/package-lock.json
  15. 0
    45
      src/frontend/src/app/apiclient/package.json
  16. 0
    104
      src/frontend/src/app/apiclient/src/backend/FrontblockApiClient.ts
  17. 0
    201
      src/frontend/src/app/apiclient/src/backend/Plugin.ts
  18. 0
    38
      src/frontend/src/app/apiclient/src/backend/webpack.prod.js
  19. 0
    41
      src/frontend/src/app/apiclient/src/frontend/webpack.prod.js
  20. 0
    10
      src/frontend/src/app/apiclient/tsconfig.frontend.json
  21. 0
    18
      src/frontend/src/app/apiclient/tsconfig.json
  22. 10
    2
      src/frontend/src/app/app-routing.module.ts
  23. 7
    4
      src/frontend/src/app/app.component.ts
  24. 7
    1
      src/frontend/src/app/app.module.ts
  25. 10
    3
      src/frontend/src/app/dynamic-loader/dynamic-loader.component.ts
  26. 5
    0
      src/frontend/src/app/header-bar/header-bar.component.html
  27. 0
    1
      src/frontend/src/app/knex-config/knex-config.component.html
  28. 8
    9
      src/frontend/src/app/knex-config/knex-config.component.ts
  29. 0
    23
      src/frontend/src/app/knex-config/knex-config.module.ts
  30. 1
    1
      src/frontend/src/app/pluginmanager/module.ts
  31. 4
    0
      src/frontend/src/app/settings/settings.component.html
  32. 0
    0
      src/frontend/src/app/settings/settings.component.scss
  33. 25
    0
      src/frontend/src/app/settings/settings.component.spec.ts
  34. 30
    0
      src/frontend/src/app/settings/settings.component.ts
  35. 23
    0
      src/frontend/src/app/sidebar/sidebar.component.html
  36. 15
    16
      src/frontend/src/app/sidebar/sidebar.component.ts
  37. 5
    1
      src/frontend/src/app/subnav/subnav.component.html
  38. 0
    59
      src/frontend/src/app/wallet/.drone.yml
  39. 0
    11
      src/frontend/src/app/wallet/.gitignore
  40. 0
    5477
      src/frontend/src/app/wallet/package-lock.json
  41. 0
    57
      src/frontend/src/app/wallet/package.json
  42. 0
    118
      src/frontend/src/app/wallet/src/backend/Plugin.ts
  43. 0
    37
      src/frontend/src/app/wallet/src/backend/webpack.prod.js
  44. 0
    174
      src/frontend/src/app/wallet/src/frontend/btc/address-viewer.component.ts
  45. 0
    702
      src/frontend/src/app/wallet/src/frontend/btc/btc.component.ts
  46. 0
    266
      src/frontend/src/app/wallet/src/frontend/btc/wallet-generator.component.ts
  47. 0
    50
      src/frontend/src/app/wallet/src/frontend/btc/wallet-picker.component.ts
  48. 0
    67
      src/frontend/src/app/wallet/src/frontend/module.ts
  49. 0
    17
      src/frontend/src/app/wallet/src/frontend/settings.component.ts
  50. 0
    41
      src/frontend/src/app/wallet/src/frontend/webpack.prod.js
  51. 0
    10
      src/frontend/src/app/wallet/tsconfig.frontend.json
  52. 0
    19
      src/frontend/src/app/wallet/tsconfig.json
  53. 1
    2
      src/frontend/tsconfig.prod.json

+ 56
- 250
package-lock.json View File

@@ -5,49 +5,49 @@
5 5
   "requires": true,
6 6
   "dependencies": {
7 7
     "@angular/common": {
8
-      "version": "8.2.3",
9
-      "resolved": "https://registry.npmjs.org/@angular/common/-/common-8.2.3.tgz",
10
-      "integrity": "sha512-Y8ttd66bAApnJgxjndVnBP0aMsID8AzttR2TKp1KpdDKy4n6td22+1DeHZJqPMOBwoTDEdjHZqFQ7XRNYe3IVw==",
8
+      "version": "8.2.6",
9
+      "resolved": "https://registry.npmjs.org/@angular/common/-/common-8.2.6.tgz",
10
+      "integrity": "sha512-OlU3LCPShHJEsOHS+qczY52P0kWtjJD8N7NDHaGMB6Xp8GMgItjQIeeO6yf8DJyaCIC4qk4G7jPdnQk6IE1SbQ==",
11 11
       "requires": {
12 12
         "tslib": "^1.9.0"
13 13
       }
14 14
     },
15 15
     "@angular/core": {
16
-      "version": "8.2.3",
17
-      "resolved": "https://registry.npmjs.org/@angular/core/-/core-8.2.3.tgz",
18
-      "integrity": "sha512-wNlq6r0RI8q0BCr3I16NHfteliJLVjZN3MsLfzYi4u08LcGTemGL9YwcVjCOPEH4xREo3xX0ebvmuLwObu75lQ==",
16
+      "version": "8.2.6",
17
+      "resolved": "https://registry.npmjs.org/@angular/core/-/core-8.2.6.tgz",
18
+      "integrity": "sha512-l+BrvPGwtPUh/rQyB9mjtonMsFEAoRHgDYWeQu/QukIZbItNdFqrhewn2zQ8Skx75BpwFLAVIVXp9ioDyvP2eQ==",
19 19
       "requires": {
20 20
         "tslib": "^1.9.0"
21 21
       }
22 22
     },
23 23
     "@angular/forms": {
24
-      "version": "8.2.3",
25
-      "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.2.3.tgz",
26
-      "integrity": "sha512-BDphHWx6FI3wfOd9XqhiUBKuIg4dnpr9Aw5+n1by4y9e2avBwWoefHJ15FtEZdop5qMwVWlCcHjdwZ2+q65f4g==",
24
+      "version": "8.2.6",
25
+      "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-8.2.6.tgz",
26
+      "integrity": "sha512-sYUspJYJGq0OaBuxgdUXPf0TwYyED9OVWNCl9jDJCW//2NAbrZG8BSujvV54Dtg2emY1Uc7EFyQ8Wc8yxS7KSg==",
27 27
       "requires": {
28 28
         "tslib": "^1.9.0"
29 29
       }
30 30
     },
31 31
     "@angular/platform-browser": {
32
-      "version": "8.2.3",
33
-      "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.2.3.tgz",
34
-      "integrity": "sha512-hKC5V2n0jfrFc9DXvHW+NtHDSfC417WZz8onmUhMR2Eo3fjBm5cuZi5CNgnbZt9zUoXXOfwCy6p3N7FbPDXxLQ==",
32
+      "version": "8.2.6",
33
+      "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-8.2.6.tgz",
34
+      "integrity": "sha512-wUgcdTXItforNA+6qykPL9SDmV1uSIUQcEZrm3YCoVt7CuwMav3dq9Lg1zZ7HKv0A8It0fAKpXBkamzpRxvZEw==",
35 35
       "requires": {
36 36
         "tslib": "^1.9.0"
37 37
       }
38 38
     },
39 39
     "@angular/router": {
40
-      "version": "8.2.3",
41
-      "resolved": "https://registry.npmjs.org/@angular/router/-/router-8.2.3.tgz",
42
-      "integrity": "sha512-PMZ5JA0GonaNpwV3VfGWUkL6eo2KbtYUZERu6AnTYpQTTzGBiS6pakQTczE7lb9KZ9u+LIhKBaxQ8hrGLWqgKw==",
40
+      "version": "8.2.6",
41
+      "resolved": "https://registry.npmjs.org/@angular/router/-/router-8.2.6.tgz",
42
+      "integrity": "sha512-XAqhrPbU+z/ztf2b0VxFytHPJRpWfhnhCJ2qf9Tie1Cov6zOlgIKInOSF+WtsFEUZAnwSbAfGk4KSXrwBWw8zA==",
43 43
       "requires": {
44 44
         "tslib": "^1.9.0"
45 45
       }
46 46
     },
47 47
     "@clr/angular": {
48
-      "version": "2.1.2",
49
-      "resolved": "https://registry.npmjs.org/@clr/angular/-/angular-2.1.2.tgz",
50
-      "integrity": "sha512-S8rgtvbniAKobVlCJcIwxD38pkOc0av5mM85Q3jrC2SJy+tNVq4so8QwciwtgUjEP7PeHm/4wWJDItoTzk7aEA==",
48
+      "version": "2.2.0",
49
+      "resolved": "https://registry.npmjs.org/@clr/angular/-/angular-2.2.0.tgz",
50
+      "integrity": "sha512-+E93SBFlOZVQgZTD3lDsmdaSrv9ylE1r2siTDZeTqRtFz5W/NI055wFqVKAj3U3+/5kUYApeUEmfvSgE0cs80A==",
51 51
       "requires": {
52 52
         "tslib": "^1.9.0"
53 53
       }
@@ -140,18 +140,10 @@
140 140
       "resolved": "https://registry.npmjs.org/@types/is-valid-path/-/is-valid-path-0.1.0.tgz",
141 141
       "integrity": "sha512-2ontWtpN8O2nf5S7EjDDJ0DwrRa2t7wmS3Wmo322yWYG6yFBYC1QCaLhz4Iz+mzJy8Kf4zP5yVyEd1ANPDmOFQ=="
142 142
     },
143
-    "@types/knex": {
144
-      "version": "0.16.1",
145
-      "resolved": "https://registry.npmjs.org/@types/knex/-/knex-0.16.1.tgz",
146
-      "integrity": "sha512-54gWD1HWwdVx5iLHaJ1qxH3I6KyBsj5fFqzRpXFn7REWiEB2jwspeVCombNsocSrqPd7IRPqKrsIME7/cD+TFQ==",
147
-      "requires": {
148
-        "knex": "*"
149
-      }
150
-    },
151 143
     "@types/lodash": {
152
-      "version": "4.14.137",
153
-      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.137.tgz",
154
-      "integrity": "sha512-g4rNK5SRKloO+sUGbuO7aPtwbwzMgjK+bm9BBhLD7jGUiGR7zhwYEhSln/ihgYQBeIJ5j7xjyaYzrWTcu3UotQ=="
144
+      "version": "4.14.138",
145
+      "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.138.tgz",
146
+      "integrity": "sha512-A4uJgHz4hakwNBdHNPdxOTkYmXNgmUAKLbXZ7PKGslgeV0Mb8P3BlbYfPovExek1qnod4pDfRbxuzcVs3dlFLg=="
155 147
     },
156 148
     "@types/lowdb": {
157 149
       "version": "1.0.9",
@@ -696,11 +688,6 @@
696 688
       "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
697 689
       "dev": true
698 690
     },
699
-    "bignumber.js": {
700
-      "version": "7.2.1",
701
-      "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-7.2.1.tgz",
702
-      "integrity": "sha512-S4XzBk5sMB+Rcb/LNcpzXr57VRTxgAvaAEDAl1AwRx27j00hT84O6OkteE7u8UB3NuaaygCRrEpqox4uDOrbdQ=="
703
-    },
704 691
     "binary-extensions": {
705 692
       "version": "1.13.1",
706 693
       "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
@@ -893,11 +880,6 @@
893 880
       "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
894 881
       "dev": true
895 882
     },
896
-    "buffer-writer": {
897
-      "version": "2.0.0",
898
-      "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
899
-      "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
900
-    },
901 883
     "buffer-xor": {
902 884
       "version": "1.0.3",
903 885
       "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
@@ -2070,9 +2052,9 @@
2070 2052
       }
2071 2053
     },
2072 2054
     "frontblock": {
2073
-      "version": "0.14.0",
2074
-      "resolved": "https://registry.npmjs.org/frontblock/-/frontblock-0.14.0.tgz",
2075
-      "integrity": "sha512-USXiIb3T+WiS8LtiTUE+UkisFJJfMplxFmG5nQ8dCeRfknYSDQGafXPoH7mWCNkhSDoJHUMWGfVHmYH6LLRB0A==",
2055
+      "version": "0.14.2",
2056
+      "resolved": "https://registry.npmjs.org/frontblock/-/frontblock-0.14.2.tgz",
2057
+      "integrity": "sha512-M4/Kadf1i/g4pkSrkITtPdrwP4/SCQL/qA+22n41F+c/oxQVsEIpdTZQXK9iLlhMzx6ijIxokGoYh6uPY9yrlw==",
2076 2058
       "requires": {
2077 2059
         "@angular/common": "^8.2.1",
2078 2060
         "@angular/core": "^8.2.1",
@@ -2080,52 +2062,21 @@
2080 2062
         "@angular/platform-browser": "^8.2.1",
2081 2063
         "@angular/router": "^8.2.1",
2082 2064
         "@clr/angular": "^2.1.1",
2083
-        "@types/knex": "^0.16.1",
2084 2065
         "@types/node": "^11.13.10",
2085
-        "frontblock-generic": "^0.26.1",
2066
+        "frontblock-generic": "^0.32.3",
2086 2067
         "fs": "0.0.1-security",
2068
+        "knex": "^0.19.2",
2087 2069
         "log4js": "^4.3.1",
2088
-        "mysql": "^2.17.1",
2089 2070
         "node-fetch": "^2.5.0",
2090 2071
         "path": "^0.12.7",
2091
-        "pg": "^7.12.1",
2092
-        "pg-query-stream": "^2.0.0",
2093 2072
         "rxjs": "^6.5.2",
2094
-        "rxjs-compat": "^6.5.2",
2095
-        "sqlite3": "^4.1.0"
2096
-      },
2097
-      "dependencies": {
2098
-        "frontblock-generic": {
2099
-          "version": "0.26.1",
2100
-          "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.26.1.tgz",
2101
-          "integrity": "sha512-o7TSiTUg/VJbL+btzWN+FWtg+t/97hhNwbtcJwW+QVNRpD9oLSP1jQyC7YPMVi4SVGRP8tq/PYlQRQHlhGUG+A==",
2102
-          "requires": {
2103
-            "@types/lowdb": "^1.0.9",
2104
-            "@types/node": "^12.7.1",
2105
-            "bsock": "^0.1.9",
2106
-            "fs": "0.0.1-security",
2107
-            "http": "0.0.0",
2108
-            "key-file-storage": "^2.2.4",
2109
-            "log4js": "^4.2.0",
2110
-            "lowdb": "^1.0.0",
2111
-            "minimist": "^1.2.0",
2112
-            "path": "^0.12.7",
2113
-            "uuid": "^3.3.2"
2114
-          },
2115
-          "dependencies": {
2116
-            "@types/node": {
2117
-              "version": "12.7.2",
2118
-              "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz",
2119
-              "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg=="
2120
-            }
2121
-          }
2122
-        }
2073
+        "rxjs-compat": "^6.5.2"
2123 2074
       }
2124 2075
     },
2125 2076
     "frontblock-generic": {
2126
-      "version": "0.30.6",
2127
-      "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.30.6.tgz",
2128
-      "integrity": "sha512-ecOwcLpzPuAOThKhIdbdXQm7M7HnF6dtNf1dOr7pxFfkBq5T5h/wxT2mdlC3rUd1HqdKxwrUjqG+1XqKjwVY4g==",
2077
+      "version": "0.32.3",
2078
+      "resolved": "https://registry.npmjs.org/frontblock-generic/-/frontblock-generic-0.32.3.tgz",
2079
+      "integrity": "sha512-VcSP3EvV8Te78XOlyEL7WywxXawHSfgIPD/7g6ivZPWDSG8JzpgX1rq9fn4jnfpS167CMyGuKoHLwAY8tWkAng==",
2129 2080
       "requires": {
2130 2081
         "@types/lowdb": "^1.0.9",
2131 2082
         "@types/node": "^12.7.1",
@@ -2143,9 +2094,9 @@
2143 2094
       },
2144 2095
       "dependencies": {
2145 2096
         "@types/node": {
2146
-          "version": "12.7.2",
2147
-          "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.2.tgz",
2148
-          "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg=="
2097
+          "version": "12.7.5",
2098
+          "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz",
2099
+          "integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w=="
2149 2100
         }
2150 2101
       }
2151 2102
     },
@@ -3093,9 +3044,9 @@
3093 3044
       "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug=="
3094 3045
     },
3095 3046
     "ignore-walk": {
3096
-      "version": "3.0.1",
3097
-      "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz",
3098
-      "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==",
3047
+      "version": "3.0.2",
3048
+      "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.2.tgz",
3049
+      "integrity": "sha512-EXyErtpHbn75ZTsOADsfx6J/FPo6/5cjev46PXrcTpd8z3BoRkXgYu9/JVqrI7tusjmwCZutGeRJeU0Wo1e4Cw==",
3099 3050
       "requires": {
3100 3051
         "minimatch": "^3.0.4"
3101 3052
       },
@@ -3434,9 +3385,9 @@
3434 3385
       }
3435 3386
     },
3436 3387
     "key-file-storage": {
3437
-      "version": "2.2.5",
3438
-      "resolved": "https://registry.npmjs.org/key-file-storage/-/key-file-storage-2.2.5.tgz",
3439
-      "integrity": "sha512-e4MNwPqkKXTJZthmUE3KwOuDDzzoXUo+m4GWjIBiI47StphAEMvm1J4lfrG0V7t0tHxf/ikE/wNThwNvvYqJww==",
3388
+      "version": "2.2.6",
3389
+      "resolved": "https://registry.npmjs.org/key-file-storage/-/key-file-storage-2.2.6.tgz",
3390
+      "integrity": "sha512-7RBAWF2Mdz/EbNF1AruxxRQ8btYLNNbOptRIkJQDFK1nGvLIk4WwUuk/F4fd5Ebms7F2fPE0qhKyLC349Os24Q==",
3440 3391
       "requires": {
3441 3392
         "@types/fs-extra": "^8.0.0",
3442 3393
         "@types/is-valid-path": "^0.1.0",
@@ -3545,21 +3496,6 @@
3545 3496
         "flatted": "^2.0.0",
3546 3497
         "rfdc": "^1.1.4",
3547 3498
         "streamroller": "^1.0.6"
3548
-      },
3549
-      "dependencies": {
3550
-        "debug": {
3551
-          "version": "4.1.1",
3552
-          "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
3553
-          "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
3554
-          "requires": {
3555
-            "ms": "^2.1.1"
3556
-          }
3557
-        },
3558
-        "ms": {
3559
-          "version": "2.1.2",
3560
-          "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
3561
-          "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
3562
-        }
3563 3499
       }
3564 3500
     },
3565 3501
     "lowdb": {
@@ -3762,9 +3698,9 @@
3762 3698
       "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
3763 3699
     },
3764 3700
     "minipass": {
3765
-      "version": "2.4.0",
3766
-      "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.4.0.tgz",
3767
-      "integrity": "sha512-6PmOuSP4NnZXzs2z6rbwzLJu/c5gdzYg1mRI/WIYdx45iiX7T+a4esOzavD6V/KmBzAaopFSTZPZcUx73bqKWA==",
3701
+      "version": "2.6.0",
3702
+      "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.6.0.tgz",
3703
+      "integrity": "sha512-OuNZ0OHrrI+jswzmgivYBZ+fAAGHZA4293d5q0z631/I9QSw3yumKB92njxHIHiB1eAdGRsE+3CcOPkoEyV5FQ==",
3768 3704
       "requires": {
3769 3705
         "safe-buffer": "^5.1.2",
3770 3706
         "yallist": "^3.0.0"
@@ -3778,9 +3714,9 @@
3778 3714
       }
3779 3715
     },
3780 3716
     "minizlib": {
3781
-      "version": "1.2.1",
3782
-      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
3783
-      "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
3717
+      "version": "1.2.2",
3718
+      "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.2.tgz",
3719
+      "integrity": "sha512-hR3At21uSrsjjDTWrbu0IMLTpnkpv8IIMFDFaoz43Tmu4LkmAXfH44vNNzpTnf+OAQQCHrb91y/wc2J4x5XgSQ==",
3784 3720
       "requires": {
3785 3721
         "minipass": "^2.2.1"
3786 3722
       }
@@ -3914,17 +3850,6 @@
3914 3850
       "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
3915 3851
       "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
3916 3852
     },
3917
-    "mysql": {
3918
-      "version": "2.17.1",
3919
-      "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.17.1.tgz",
3920
-      "integrity": "sha512-7vMqHQ673SAk5C8fOzTG2LpPcf3bNt0oL3sFpxPEEFp1mdlDcrLK0On7z8ZYKaaHrHwNcQ/MTUz7/oobZ2OyyA==",
3921
-      "requires": {
3922
-        "bignumber.js": "7.2.1",
3923
-        "readable-stream": "2.3.6",
3924
-        "safe-buffer": "5.1.2",
3925
-        "sqlstring": "2.3.1"
3926
-      }
3927
-    },
3928 3853
     "nan": {
3929 3854
       "version": "2.14.0",
3930 3855
       "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
@@ -4301,11 +4226,6 @@
4301 4226
       "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
4302 4227
       "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ=="
4303 4228
     },
4304
-    "packet-reader": {
4305
-      "version": "1.0.0",
4306
-      "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz",
4307
-      "integrity": "sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ=="
4308
-    },
4309 4229
     "pako": {
4310 4230
       "version": "1.0.10",
4311 4231
       "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz",
@@ -4453,80 +4373,11 @@
4453 4373
       "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
4454 4374
       "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
4455 4375
     },
4456
-    "pg": {
4457
-      "version": "7.12.1",
4458
-      "resolved": "https://registry.npmjs.org/pg/-/pg-7.12.1.tgz",
4459
-      "integrity": "sha512-l1UuyfEvoswYfcUe6k+JaxiN+5vkOgYcVSbSuw3FvdLqDbaoa2RJo1zfJKfPsSYPFVERd4GHvX3s2PjG1asSDA==",
4460
-      "requires": {
4461
-        "buffer-writer": "2.0.0",
4462
-        "packet-reader": "1.0.0",
4463
-        "pg-connection-string": "0.1.3",
4464
-        "pg-pool": "^2.0.4",
4465
-        "pg-types": "^2.1.0",
4466
-        "pgpass": "1.x",
4467
-        "semver": "4.3.2"
4468
-      },
4469
-      "dependencies": {
4470
-        "pg-connection-string": {
4471
-          "version": "0.1.3",
4472
-          "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz",
4473
-          "integrity": "sha1-2hhHsglA5C7hSSvq9l1J2RskXfc="
4474
-        },
4475
-        "semver": {
4476
-          "version": "4.3.2",
4477
-          "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.2.tgz",
4478
-          "integrity": "sha1-x6BxWKgL7dBSNVt3DYLWZA+AO+c="
4479
-        }
4480
-      }
4481
-    },
4482 4376
     "pg-connection-string": {
4483 4377
       "version": "2.0.0",
4484 4378
       "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.0.0.tgz",
4485 4379
       "integrity": "sha1-Pu/lmX4G2Ugh5NUC5CtqHHP434I="
4486 4380
     },
4487
-    "pg-cursor": {
4488
-      "version": "2.0.0",
4489
-      "resolved": "https://registry.npmjs.org/pg-cursor/-/pg-cursor-2.0.0.tgz",
4490
-      "integrity": "sha512-/gYHadqLurektHk6HXiL0hSrn+RZfowkLr+ftC0lLoLBlIm8JIdk9f9g71EEjK63XxqhFqcykHuxQLFzSeyzdQ=="
4491
-    },
4492
-    "pg-int8": {
4493
-      "version": "1.0.1",
4494
-      "resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
4495
-      "integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="
4496
-    },
4497
-    "pg-pool": {
4498
-      "version": "2.0.7",
4499
-      "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-2.0.7.tgz",
4500
-      "integrity": "sha512-UiJyO5B9zZpu32GSlP0tXy8J2NsJ9EFGFfz5v6PSbdz/1hBLX1rNiiy5+mAm5iJJYwfCv4A0EBcQLGWwjbpzZw=="
4501
-    },
4502
-    "pg-query-stream": {
4503
-      "version": "2.0.0",
4504
-      "resolved": "https://registry.npmjs.org/pg-query-stream/-/pg-query-stream-2.0.0.tgz",
4505
-      "integrity": "sha512-EInD7AOhnJVFIgN8BSEbKA6MKyn20dDGPsJEuhxiNaWpmveNgnmn3W1BmYm9pa6LakioR/WTi7ecWA44GBRKig==",
4506
-      "requires": {
4507
-        "pg-cursor": "2.0.0"
4508
-      }
4509
-    },
4510
-    "pg-types": {
4511
-      "version": "2.2.0",
4512
-      "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
4513
-      "integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
4514
-      "requires": {
4515
-        "pg-int8": "1.0.1",
4516
-        "postgres-array": "~2.0.0",
4517
-        "postgres-bytea": "~1.0.0",
4518
-        "postgres-date": "~1.0.4",
4519
-        "postgres-interval": "^1.1.0"
4520
-      }
4521
-    },
4522
-    "pgpass": {
4523
-      "version": "1.0.2",
4524
-      "resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.2.tgz",
4525
-      "integrity": "sha1-Knu0G2BltnkH6R2hsHwYR8h3swY=",
4526
-      "requires": {
4527
-        "split": "^1.0.0"
4528
-      }
4529
-    },
4530 4381
     "pify": {
4531 4382
       "version": "3.0.0",
4532 4383
       "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
@@ -4559,29 +4410,6 @@
4559 4410
       "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
4560 4411
       "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
4561 4412
     },
4562
-    "postgres-array": {
4563
-      "version": "2.0.0",
4564
-      "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
4565
-      "integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="
4566
-    },
4567
-    "postgres-bytea": {
4568
-      "version": "1.0.0",
4569
-      "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
4570
-      "integrity": "sha1-AntTPAqokOJtFy1Hz5zOzFIazTU="
4571
-    },
4572
-    "postgres-date": {
4573
-      "version": "1.0.4",
4574
-      "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.4.tgz",
4575
-      "integrity": "sha512-bESRvKVuTrjoBluEcpv2346+6kgB7UlnqWZsnbnCccTNq/pqfj1j6oBaN5+b/NrDXepYUT/HKadqv3iS9lJuVA=="
4576
-    },
4577
-    "postgres-interval": {
4578
-      "version": "1.2.0",
4579
-      "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
4580
-      "integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
4581
-      "requires": {
4582
-        "xtend": "^4.0.0"
4583
-      }
4584
-    },
4585 4413
     "process": {
4586 4414
       "version": "0.11.10",
4587 4415
       "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
@@ -4624,9 +4452,9 @@
4624 4452
       "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
4625 4453
     },
4626 4454
     "psl": {
4627
-      "version": "1.3.0",
4628
-      "resolved": "https://registry.npmjs.org/psl/-/psl-1.3.0.tgz",
4629
-      "integrity": "sha512-avHdspHO+9rQTLbv1RO+MPYeP/SzsCoxofjVnHanETfQhTJrmB0HlDoW+EiN/R+C0BZ+gERab9NY0lPN2TxNag=="
4455
+      "version": "1.4.0",
4456
+      "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
4457
+      "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw=="
4630 4458
     },
4631 4459
     "public-encrypt": {
4632 4460
       "version": "4.0.3",
@@ -4954,17 +4782,17 @@
4954 4782
       }
4955 4783
     },
4956 4784
     "rxjs": {
4957
-      "version": "6.5.2",
4958
-      "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz",
4959
-      "integrity": "sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==",
4785
+      "version": "6.5.3",
4786
+      "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz",
4787
+      "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==",
4960 4788
       "requires": {
4961 4789
         "tslib": "^1.9.0"
4962 4790
       }
4963 4791
     },
4964 4792
     "rxjs-compat": {
4965
-      "version": "6.5.2",
4966
-      "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.2.tgz",
4967
-      "integrity": "sha512-TRMkTp4FgSxE2HtGvxmgRukh3JqdFM7ejAj1Ti/VdodbPGfWvZR5+KdLKRV9jVDFyu2SknM8RD+PR54KGnoLjg=="
4793
+      "version": "6.5.3",
4794
+      "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.5.3.tgz",
4795
+      "integrity": "sha512-BIJX2yovz3TBpjJoAZyls2QYuU6ZiCaZ+U96SmxQpuSP/qDUfiXPKOVLbThBB2WZijNHkdTTJXKRwvv5Y48H7g=="
4968 4796
     },
4969 4797
     "safe-buffer": {
4970 4798
       "version": "5.1.2",
@@ -5318,14 +5146,6 @@
5318 5146
       "resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-2.0.0.tgz",
5319 5147
       "integrity": "sha512-AGXIhH/XZVinFewojYTsG8uapHX2e7MjtFbmibvK9qqG4qGd9b6jelU1sTkCA0RVGHvN9exJYTBVbF1Ls2f69g=="
5320 5148
     },
5321
-    "split": {
5322
-      "version": "1.0.1",
5323
-      "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
5324
-      "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
5325
-      "requires": {
5326
-        "through": "2"
5327
-      }
5328
-    },
5329 5149
     "split-string": {
5330 5150
       "version": "3.1.0",
5331 5151
       "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz",
@@ -5344,11 +5164,6 @@
5344 5164
         "request": "^2.87.0"
5345 5165
       }
5346 5166
     },
5347
-    "sqlstring": {
5348
-      "version": "2.3.1",
5349
-      "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
5350
-      "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
5351
-    },
5352 5167
     "sshpk": {
5353 5168
       "version": "1.16.1",
5354 5169
       "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
@@ -5474,11 +5289,6 @@
5474 5289
             "jsonfile": "^4.0.0",
5475 5290
             "universalify": "^0.1.0"
5476 5291
           }
5477
-        },
5478
-        "ms": {
5479
-          "version": "2.1.2",
5480
-          "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
5481
-          "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
5482 5292
         }
5483 5293
       }
5484 5294
     },
@@ -5589,11 +5399,6 @@
5589 5399
         "worker-farm": "^1.7.0"
5590 5400
       }
5591 5401
     },
5592
-    "through": {
5593
-      "version": "2.3.8",
5594
-      "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
5595
-      "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
5596
-    },
5597 5402
     "through2": {
5598 5403
       "version": "2.0.5",
5599 5404
       "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz",
@@ -6155,7 +5960,8 @@
6155 5960
     "xtend": {
6156 5961
       "version": "4.0.2",
6157 5962
       "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
6158
-      "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
5963
+      "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
5964
+      "dev": true
6159 5965
     },
6160 5966
     "y18n": {
6161 5967
       "version": "4.0.0",

+ 5
- 5
package.json View File

@@ -9,8 +9,8 @@
9 9
     "build-backend": "tsc; npm run webpack",
10 10
     "build-frontend": "npm run build-dashboard; cp ./dist/FrontblockLib.js ./dist/static",
11 11
     "build-dashboard": "git submodule init && git submodule update --merge; cd src/frontend; npm i && npm run build; mkdir ../../dist/static; cp -r dist/* ../../dist/static",
12
-    "clean": "rm -rf lib static plugins conf dist widget .rpt2_cache *.js *.ts src/frontend/dist",
13
-    "update-frontblock": "rm -rf node_modules/frontblock*; npm install",
12
+    "clean": "rm -rf lib static plugins conf dist widget .rpt2_cache *.js *.ts src/frontend/dist data",
13
+    "update-frontblock": " npm install frontblock-generic@latest frontblock@latest",
14 14
     "webpack": "webpack  --config src/backend/webpack.prod.js --progress --colors"
15 15
   },
16 16
   "repository": {
@@ -25,13 +25,13 @@
25 25
     "child-process-promise": "^2.2.1",
26 26
     "debug": "^4.1.1",
27 27
     "express": "^4.16.4",
28
-    "frontblock": "^0.14.0",
29
-    "frontblock-generic": "^0.30.6",
28
+    "frontblock": "^0.14.2",
29
+    "frontblock-generic": "^0.32.3",
30 30
     "git-cherrypicker": "0.0.3",
31 31
     "git-describe": "^4.0.4",
32 32
     "http": "0.0.0",
33 33
     "knex": "^0.19.2",
34
-    "log4js": "^4.4.0",
34
+    "log4js": "^4.5.1",
35 35
     "lowdb": "^1.0.0",
36 36
     "node-fetch": "^2.6.0",
37 37
     "path": "^0.12.7",

+ 7
- 19
src/backend/Admin.ts View File

@@ -1,26 +1,16 @@
1 1
 'use strict'
2
-
3 2
 import * as Logger from 'log4js'
4 3
 import * as Knex from 'knex'
4
+import * as Path from 'path'
5 5
 import { FrontblockApiClient, FrontblockApiConf } from 'frontblock';
6
+import { getLogger } from 'frontblock-generic/Types';
6 7
 import { AdminBase } from 'frontblock-generic/Admin';
7
-import { FrontblockApi } from 'frontblock-generic/Api';
8
+import { IFrontblockApiClient } from 'frontblock-generic/Api';
8 9
 import { Plugin } from 'frontblock-generic/Plugin';
9 10
 import { socketioRPC } from 'frontblock-generic/RPC';
10 11
 import { GitUpdater, RepoFolderStatus } from './GitUpdater';
11 12
 
12
-Logger.configure({
13
-    appenders: 
14
-    {
15
-    "admin": { type: 'stdout' },
16
-    //app: { type: 'file', filename: 'application.log' }
17
-    },
18
-    categories: 
19
-    {
20
-    default: { appenders: [ 'admin' ], level: 'debug' }
21
-    }
22
-})
23
-const logger = Logger.getLogger("admin") 
13
+const logger:Logger.Logger = getLogger("admin", 'debug') 
24 14
 
25 15
 
26 16
 export type AdminConf = { httpPort: number}
@@ -31,6 +21,7 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
31 21
     
32 22
     constructor(runningPlugins: Plugin[] = []){
33 23
         super(runningPlugins)
24
+        this.initialize().then(() => this.makeKnex(this.getConfigKey('dbConf'))).then(() => logger.debug("Admin initialization finished"))
34 25
     }
35 26
 
36 27
     getDefaultConfig(): { apiConf: FrontblockApiConf; } & AdminConf & { dbConf:Knex.Config; } {
@@ -45,19 +36,16 @@ export class FrontblockAdmin extends AdminBase<AdminConf>{
45 36
             dbConf: {
46 37
                 client: 'sqlite3',
47 38
                 connection: {
48
-                    filename: "./data/ApiClient.sqlite"
39
+                    filename: Path.join(__dirname, "data/Admin.sqlite")
49 40
                 },
50 41
                 useNullAsDefault: true
51 42
             }
52 43
         }    
53 44
     }
54 45
 
55
-    protected makeApiClient(conf: FrontblockApiConf): FrontblockApi {
56
-        // @ts-ignore
46
+    protected makeApiClient(conf: FrontblockApiConf): IFrontblockApiClient {
57 47
         if(this.apiClient) this.apiClient.disconnect()
58 48
         this.apiClient = new FrontblockApiClient(conf)
59
-        
60
-        // @ts-ignore
61 49
         this.apiClient.connect()
62 50
         return this.apiClient    
63 51
     }

+ 4
- 17
src/backend/Installer.ts View File

@@ -1,20 +1,8 @@
1
-import * as Logger from 'log4js'
2 1
 import { Plugin } from "frontblock-generic/Plugin"
3
-
2
+import { getLogger } from "frontblock-generic/Types"
4 3
 var exec = require('child-process-promise').exec;
5 4
 
6
-Logger.configure({
7
-    appenders: 
8
-    {
9
-    "installer": { type: 'stdout' },
10
-    //app: { type: 'file', filename: 'application.log' }
11
-    },
12
-    categories: 
13
-    {
14
-    default: { appenders: [ 'installer' ], level: 'debug' }
15
-    }
16
-})
17
-const logger = Logger.getLogger("installer") 
5
+const logger = getLogger("installer", 'info') 
18 6
 
19 7
 export type NPMPkgName = string
20 8
 export type NPMVersion = string
@@ -25,11 +13,10 @@ export const installAdmin = (plugins: Plugin[] = []) => {
25 13
     const deps = npmPkgs.map(tuple => tuple.join('@') ).join(" ")
26 14
     logger.info("Installing plaform dependencies: "+deps)
27 15
 
28
-    exec("npm i --prefix ./plugins " + deps).then(process => {
29
-    
16
+    exec("npm i " + deps).then(async process => {
30 17
         logger.debug(process.stdout)    
31 18
         const Admin = require("./Admin").FrontblockAdmin
32
-        new Admin(plugins)
19
+        const fbAdmin = new Admin(plugins)
33 20
     })
34 21
 
35 22
 }

+ 5
- 4
src/backend/webpack.prod.js View File

@@ -5,9 +5,13 @@ module.exports = [{
5 5
   target: "web",
6 6
   
7 7
   entry: path.resolve(__dirname, '../../lib/FrontblockLib.js'),
8
+  externals: ['log4js'],
8 9
   output: {
9 10
       path: path.resolve(__dirname, '../../dist'),
10 11
       filename: 'FrontblockLib.js',
12
+  },
13
+  optimization: {
14
+    minimize: false, // <---- disables uglify.
11 15
   }
12 16
 },{
13 17
   mode: 'production',
@@ -19,7 +23,6 @@ module.exports = [{
19 23
     __dirname: false,
20 24
     Buffer: true,
21 25
   },
22
-
23 26
   
24 27
   resolve: {
25 28
     // Add `.ts` and `.tsx` as a resolvable extension.
@@ -32,9 +35,7 @@ module.exports = [{
32 35
     ]
33 36
   },
34 37
 
35
-  externals:{
36
-    knex: "../plugins/node_modules/knex"
37
-  },
38
+  externals: ['knex'],
38 39
   optimization: {
39 40
     minimize: false
40 41
   },

+ 0
- 69
src/frontend/src/app/apiclient/.drone.yml View File

@@ -1,69 +0,0 @@
1
-kind: pipeline
2
-name: default
3
-
4
-steps:
5
-- name: restore cache
6
-  image: drillster/drone-volume-cache
7
-  settings:
8
-    restore: true
9
-    mount:
10
-      - ./node_modules
11
-  volumes:
12
-  - name: cache
13
-    path: /cache
14
-    
15
-- name: npm install
16
-  image: node:12
17
-  commands:
18
-  - npm install
19
-
20
-- name: npm run build
21
-  image: node:12
22
-  commands:
23
-  - npm run build
24
-
25
-- name: rebuild cache
26
-  image: drillster/drone-volume-cache
27
-  settings:
28
-    rebuild: true
29
-    mount:
30
-      - ./node_modules
31
-  volumes:
32
-  - name: cache
33
-    path: /cache
34
-
35
-- name: npm publish
36
-  image: plugins/npm
37
-  settings:
38
-    username: frontblock
39
-    password:
40
-      from_secret: npm_password
41
-    email: frontblock.me@gmail.com
42
-  event:
43
-    - tag
44
-
45
-- name: deploy plugin
46
-  image: node:12
47
-  commands:
48
-  - git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
49
-  - git config --global user.name "${DRONE_COMMIT_AUTHOR}"
50
-  - git clone https://gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git
51
-  - cp -r ./dist/* ./${DRONE_REPO_NAME}
52
-  - cd ./${DRONE_REPO_NAME}
53
-  - git add -A
54
-  - git commit --allow-empty -m "drone tagged as version ${DRONE_TAG}"
55
-  - git tag ${DRONE_TAG}
56
-  - git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git master ${DRONE_TAG}
57
-  environment:
58
-    GIT_USER:
59
-      from_secret: git_user
60
-    GIT_PASSWORD:
61
-      from_secret: git_password
62
-  when:
63
-    event:
64
-    - tag
65
-
66
-volumes:
67
-- name: cache 
68
-  host:
69
-    path: /tmp

+ 0
- 10
src/frontend/src/app/apiclient/.gitignore View File

@@ -1,10 +0,0 @@
1
-dist
2
-.rpt2_cache
3
-node_modules
4
-lib
5
-
6
-*.d.ts
7
-*.js
8
-*.ts
9
-
10
-!src/**/*

+ 0
- 2
src/frontend/src/app/apiclient/.npmignore View File

@@ -1,2 +0,0 @@
1
-**/*
2
-!FrontblockApiClient.*

src/frontend/src/app/apiclient/src/frontend/apiclient-consumptions.component.ts → src/frontend/src/app/apiclient/apiclient-consumptions.component.ts View File


src/frontend/src/app/apiclient/src/frontend/apiclient-settings-form.component.ts → src/frontend/src/app/apiclient/apiclient-settings-form.component.ts View File

@@ -1,16 +1,15 @@
1 1
 import { Component, OnInit } from '@angular/core';
2
-import { FrontblockApiConf } from '../backend/FrontblockApiClient';
3 2
 import { isDevMode } from '@angular/core';
4 3
 
5 4
 declare const fb
6 5
 
7 6
 @Component({
8
-    selector: 'settings',
7
+    selector: '[apiclientconfig]',
9 8
     template: `
10 9
     <div class="clr-row">
11 10
         <div class="card clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-auto clr-col-xl-auto">
12 11
             <div class="card-header">
13
-            Settings
12
+            Frontblock API Client
14 13
             </div>
15 14
             <div class="card-block">
16 15
                 <div class="card-text">
@@ -61,15 +60,13 @@ declare const fb
61 60
             </div>
62 61
         </div>
63 62
     </div>
64
-
65
-    <knex-config fbPlugin="ApiClient"></knex-config>
66 63
   `
67 64
 })
68 65
 export class ApiclientFormComponent implements OnInit {
69 66
     testnet: boolean = true
70 67
     saving: boolean = false
71 68
     advanced: boolean = false
72
-    data: FrontblockApiConf = {
69
+    data: any = {
73 70
         apiHost: "api.testnet.frontblock.me",
74 71
         apiPort: 10001,
75 72
         tls: false,

src/frontend/src/app/apiclient/src/frontend/apiclient-subscriptions.component.ts → src/frontend/src/app/apiclient/apiclient-subscriptions.component.ts View File


+ 0
- 17
src/frontend/src/app/apiclient/conf/ApiClient.json View File

@@ -1,17 +0,0 @@
1
-{
2
-  "apiConf": {
3
-    "apiHost": "api.testnet.frontblock.me",
4
-    "apiKey": "",
5
-    "apiPort": 10001,
6
-    "tls": false
7
-  },
8
-  "dbConf": {
9
-    "type": "sqlite",
10
-    "database": "./data/ApiClient.sqlite",
11
-    "synchronize": true,
12
-    "entities": [
13
-      null,
14
-      null
15
-    ]
16
-  }
17
-}

src/frontend/src/app/apiclient/src/frontend/module.ts → src/frontend/src/app/apiclient/module.ts View File

@@ -6,47 +6,51 @@ import { ApiclientFormComponent } from './apiclient-settings-form.component';
6 6
 import { ApiclientConsumptionComponent } from './apiclient-consumptions.component';
7 7
 import { ApiclientSubscriptionComponent } from './apiclient-subscriptions.component';
8 8
 
9
-import { FrontendPlugin, SidebarEntries } from 'frontblock-generic/Plugin';
10 9
 import { ClarityModule } from '@clr/angular';
11 10
 import { FormsModule } from '@angular/forms';
12
-// @ts-ignore
13
-import { KnexConfigModule } from "../../../knex-config/knex-config.module";
11
+
12
+import {FrontendPlugin, SidebarEntries, SidebarEntry} from 'frontblock-generic/Plugin'
14 13
 
15 14
 @NgModule({
16 15
   imports: [
17 16
     FormsModule,
18 17
     ClarityModule,
19
-    KnexConfigModule,
18
+
20 19
     CommonModule, 
21 20
     RouterModule.forChild([
22
-      {path: "settings", component: ApiclientFormComponent},
23 21
       {path: "subscriptions", component: ApiclientSubscriptionComponent},
24 22
       {path: "consumers", component: ApiclientConsumptionComponent},
25 23
     ]),
26 24
   ],
27
-  exports: [RouterModule],
25
+  exports: [RouterModule, ApiclientFormComponent],
28 26
   declarations: [
29
-    ApiclientFormComponent,
30 27
     ApiclientConsumptionComponent,
31
-    ApiclientSubscriptionComponent
28
+    ApiclientSubscriptionComponent,
29
+    ApiclientFormComponent,
30
+
31
+  ],
32
+  entryComponents: [
33
+    ApiclientFormComponent,
34
+
32 35
   ]
33 36
 })
34
-export class PluginModule implements FrontendPlugin{
35
-  getSidebarEntry(): SidebarEntries {
37
+export class ApiclientModule implements FrontendPlugin{
38
+  getSidebarEntry(): SidebarEntry | SidebarEntries {
36 39
     return {
37 40
       icon: "terminal",
38 41
       parentRoute: "apiclient",
39 42
       text: "Api client",
40 43
       links: [{
41
-        route: "settings",
42
-        text: "Settings"
43
-      },{
44
-        route: "consumers",
44
+        route: "apiclient/consumers",
45 45
         text: "Consumers"
46 46
       },{
47
-        route: "subscriptions",
47
+        route: "apiclient/subscriptions",
48 48
         text: "Subscriptions"
49
-      },]
49
+      }]
50 50
     }
51 51
   }
52
+
53
+  getSettingsComponentClassName(): any{
54
+    return ApiclientFormComponent
55
+  }
52 56
 }

+ 0
- 4652
src/frontend/src/app/apiclient/package-lock.json
File diff suppressed because it is too large
View File


+ 0
- 45
src/frontend/src/app/apiclient/package.json View File

@@ -1,45 +0,0 @@
1
-{
2
-  "name": "frontblock",
3
-  "version": "0.14.0",
4
-  "description": "frontblock shop-side library ",
5
-  "main": "FrontblockApiClient.js",
6
-  "scripts": {
7
-    "tsc": "tsc",
8
-    "build-backend": "webpack --config src/backend/webpack.prod.js --progress --colors",
9
-    "build-frontend": "webpack --config src/frontend/webpack.prod.js --progress --colors",
10
-    "build": "npm run clean; npm run tsc; npm run build-backend; npm run build-frontend",
11
-    "clean": "rm -rf *.js *.ts backend frontend .rpt2_cache dist lib",
12
-    "update-frontblock": "rm -rf node_modules/frontblock*; npm install"
13
-  },
14
-  "keywords": [
15
-    "api",
16
-    "client",
17
-    "frontblock"
18
-  ],
19
-  "author": "",
20
-  "license": "ISC",
21
-  "dependencies": {
22
-    "@angular/common": "^8.2.1",
23
-    "@angular/core": "^8.2.1",
24
-    "@angular/forms": "^8.2.1",
25
-    "@angular/platform-browser": "^8.2.1",
26
-    "@angular/router": "^8.2.1",
27
-    "@clr/angular": "^2.1.1",
28
-    "@types/node": "^11.13.10",
29
-    "frontblock-generic": "^0.28.4",
30
-    "fs": "0.0.1-security",
31
-    "knex": "^0.19.2",
32
-    "log4js": "^4.3.1",
33
-    "node-fetch": "^2.5.0",
34
-    "path": "^0.12.7",
35
-    "rxjs": "^6.5.2",
36
-    "rxjs-compat": "^6.5.2"
37
-  },
38
-  "devDependencies": {
39
-    "ts-loader": "^6.0.4",
40
-    "typescript": "^3.4.5",
41
-    "webpack": "^4.39.1",
42
-    "webpack-cli": "^3.3.6",
43
-    "webpack-node-externals": "^1.7.2"
44
-  }
45
-}

+ 0
- 104
src/frontend/src/app/apiclient/src/backend/FrontblockApiClient.ts View File

@@ -1,104 +0,0 @@
1
-import { Coin, AccountMap, TransactionMap, SubscriptionResponse, ErrorResponse, SuccessResponse, parseResponse, parseSubResponse } from "frontblock-generic/Types";
2
-import { FrontblockApi as FrontblockApi } from "frontblock-generic/Api";
3
-import * as Logger from 'log4js'
4
-
5
-Logger.configure({
6
-    appenders: {
7
-        "frontblock-api-client": { type: 'stdout' },
8
-        //app: { type: 'file', filename: 'application.log' }
9
-    },
10
-    categories: {
11
-        default: { appenders: ['frontblock-api-client'], level: 'debug' }
12
-    }
13
-})
14
-const logger = Logger.getLogger("frontblock-api-client")
15
-const bsock = require('bsock')
16
-
17
-export type FrontblockApiConf = {
18
-    apiHost: string
19
-    apiPort: number
20
-    tls?: boolean
21
-    apiKey?: string
22
-}
23
-
24
-
25
-/**
26
- * Frontblock api connection lib
27
- */
28
-export class FrontblockApiClient implements FrontblockApi {
29
-    protected started: boolean = false
30
-    protected apikey: string = ""
31
-    protected socket
32
-
33
-    constructor(private conf: FrontblockApiConf){
34
-        
35
-    }
36
-
37
-    async consume<C extends Coin>(apikey: string, uid: string, callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> {
38
-        const r = await this.socket.call("consume", apikey, uid)
39
-        const res = parseSubResponse(r)
40
-        if (res instanceof SubscriptionResponse) {
41
-            this.socket.hook(res.uid, (tx) => {
42
-                const deserialized = <TransactionMap[C]>JSON.parse(tx)
43
-                callback(deserialized)
44
-            })
45
-        }
46
-        return res
47
-    }
48
-
49
-    async quit(apikey: string, consumerUid: string): Promise<ErrorResponse | SuccessResponse> {
50
-
51
-        const r = await this.socket.call("quit", apikey, consumerUid)
52
-        const res = parseResponse(r)
53
-        return res
54
-    }
55
-
56
-    async subscribe<C extends Coin>(apikey: string, coin: C, account: AccountMap[C]): Promise<SubscriptionResponse | ErrorResponse> {
57
-        const r = await this.socket.call("subscribe", apikey, coin, account)
58
-        const res = parseSubResponse(r)
59
-        return res
60
-    }
61
-
62
-    async subsume<C extends Coin>(apikey: string, coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse> {
63
-        const r = await this.socket.call("subsume", apikey, coin, account)
64
-        const res = parseSubResponse(r)
65
-        if (res instanceof SubscriptionResponse) {
66
-            this.socket.hook(res.uid, (tx) => {
67
-                const deserialized = <TransactionMap[C]>JSON.parse(tx)
68
-                callback(deserialized)
69
-            })
70
-        }
71
-        return res
72
-    }
73
-
74
-    async unsubscribe(apikey: string, uid: string): Promise<ErrorResponse | SuccessResponse> {
75
-        const r = await this.socket.call('unsubscribe', apikey, uid)
76
-        const res = parseResponse(r)
77
-        if (res instanceof SuccessResponse)
78
-            this.socket.unhook(uid)
79
-        return res
80
-    }
81
-
82
-    async getPluginList(): Promise<string[]> {
83
-        return await this.socket.call('getPluginList')
84
-    }
85
-
86
-
87
-    connect(): void {
88
-        if (this.started) {
89
-            logger.warn("FrontblockApiClient has already been started. Ignoring")
90
-            return
91
-        }
92
-        logger.info("Starting apiClient with ", this.conf)
93
-        this.socket = bsock.connect(this.conf.apiPort, this.conf.apiHost, this.conf.tls != null ? this.conf.tls : false)
94
-        this.started = true
95
-    }
96
-
97
-    disconnect(): void {
98
-        if (!this.started) {
99
-            logger.warn("FrontblockApiClient has not been started. Ignoring")
100
-            return
101
-        }
102
-        this.socket.close()
103
-    }
104
-}

+ 0
- 201
src/frontend/src/app/apiclient/src/backend/Plugin.ts View File

@@ -1,201 +0,0 @@
1
-import { FrontblockApiClient, FrontblockApiConf } from "./FrontblockApiClient";
2
-import { socketioRPC } from "frontblock-generic/RPC"
3
-import { DatabasePlugin, TableDefiniton } from "frontblock-generic/DatabasePlugin"
4
-
5
-import { Coin, AccountMap, TransactionMap, SubscriptionResponse } from "frontblock-generic/Types";
6
-import * as knex from 'knex';
7
-import * as Logger from 'log4js'
8
-Logger.configure({
9
-    appenders: {
10
-        "frontblock-api-client": { type: 'stdout' },
11
-        //app: { type: 'file', filename: 'application.log' }
12
-      },
13
-      categories: {
14
-        default: { appenders: [ 'frontblock-api-client' ], level: 'debug' }
15
-      }
16
-})
17
-const logger = Logger.getLogger("frontblock-api-client") 
18
-
19
-/**
20
- * Frontblock admin Plugin for FrontblockApiClient
21
- */
22
-
23
-type ApiClientPluginConf = { 
24
-    apiConf: FrontblockApiConf,
25
-}
26
-
27
-export default class FrontblockApiClientPlugin extends DatabasePlugin<ApiClientPluginConf>{
28
-    
29
-    private apiClient : FrontblockApiClient
30
-    constructor(){
31
-        super("ApiClient")
32
-    }
33
-
34
-    getDefaultConfig(): ApiClientPluginConf & { dbConf: knex.Config; } {
35
-        return {
36
-            apiConf: {
37
-                apiHost: "api.testnet.frontblock.me",
38
-                apiKey: "",
39
-                apiPort: 10001,
40
-                tls: false
41
-            },
42
-            dbConf: {
43
-                client: 'sqlite3',
44
-                connection: {
45
-                    filename: "./data/ApiClient.sqlite"
46
-                },
47
-                useNullAsDefault: true
48
-            }
49
-        }
50
-    }
51
-
52
-    async getConsumers(): Promise<SubscriptionResponse[]> {
53
-        const records = await this.knex.select('*').from('consumers')
54
-        return records.map(r => JSON.parse(r.JSON))
55
-    }
56
-
57
-    async getSubscriptions(): Promise<SubscriptionResponse[]> {
58
-        const records = await this.knex.select('*').from('subscriptions')
59
-        return records.map(r => JSON.parse(r.JSON))
60
-    }
61
-
62
-    exportExtraRPCs(): socketioRPC[] {
63
-        const quit = async(uid:string) => {return await this.quit(this.getConfigKey('apiConf').apiKey, uid) }
64
-        return [
65
-            {
66
-                name: "subscribe",
67
-                func: async <C extends Coin>(coin: C, account: AccountMap[C]) => { return await this.subscribe(this.getConfigKey('apiConf').apiKey, coin, account)},
68
-                type: 'call',
69
-                visibility: 'private'
70
-            },{
71
-                name: "subsume",
72
-                func: async <C extends Coin>(coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void) => { return await this.subsume(this.getConfigKey('apiConf').apiKey, coin, account, callback)},
73
-                type: 'hook',
74
-                unhook: quit,
75
-                visibility: 'private'
76
-            },{
77
-                name: 'unsubscribe',
78
-                func: async(uid:string) => { return await this.unsubscribe(this.getConfigKey('apiConf').apiKey, uid) },
79
-                type: 'call',
80
-                visibility: 'private'
81
-            },{
82
-                name: 'consume',
83
-                func: async<C extends Coin>(uid: string, callback: (tx: TransactionMap[C]) => void) => {return await this.consume(this.getConfigKey('apiConf').apiKey, uid, callback)},
84
-                type: 'hook',
85
-                unhook: quit,
86
-                visibility: 'private'
87
-            },{
88
-                name: 'quit',
89
-                func: quit,
90
-                type: 'call',
91
-                visibility: 'private'
92
-            },{
93
-                name: "getSubscriptions",
94
-                func: async() => { return await this.getSubscriptions() },
95
-                type: "call",
96
-                visibility: "private"
97
-            },{
98
-                name: "getConsumers",
99
-                func: async() => { return await this.getConsumers() },
100
-                type: "call",
101
-                visibility: "private"
102
-            }
103
-        ]
104
-    }
105
-
106
-    private subscribe:FrontblockApiClient['subscribe'] = async (apiKey, coin, account) => {
107
-        const res = await this.apiClient.subscribe(apiKey, coin, account)
108
-        if(res instanceof SubscriptionResponse){
109
-            await this.knex('subscriptions').insert([{uuid: res.uid, JSON: JSON.stringify(res)}])
110
-        }
111
-        return res
112
-    }
113
-
114
-    private consume:FrontblockApiClient['consume'] = async (apikey, uuid, callback) => {
115
-        const res = await this.apiClient.consume(apikey, uuid, callback)
116
-        if(res instanceof SubscriptionResponse){
117
-            await this.knex('consumers').insert([{uuid: res.uid, JSON: JSON.stringify(res)}])
118
-        }
119
-        return res
120
-    }
121
-
122
-    private unsubscribe:FrontblockApiClient['unsubscribe'] = async (apikey, uuid) => {
123
-        const res = await this.apiClient.unsubscribe(apikey, uuid)
124
-        await this.knex('subscriptions')
125
-        .where('uuid', uuid)
126
-        .del()
127
-        return res
128
-    }
129
-
130
-    private quit:FrontblockApiClient['quit'] = async (apikey, uuid) => {
131
-        const res = await this.apiClient.quit(apikey, uuid)
132
-        await this.knex('consumers')
133
-        .where('uuid', uuid)
134
-        .del()
135
-        return res    
136
-    }
137
-
138
-    private subsume:FrontblockApiClient['subsume'] = async (apikey, coin, account, callback) => {
139
-        const res = await this.apiClient.subsume(apikey, coin, account, callback)
140
-        if(res instanceof SubscriptionResponse){
141
-            await Promise.all([
142
-                this.knex('consumers')
143
-                .insert([{uuid: res.uid, JSON: JSON.stringify(res)}]),
144
-                
145
-                this.knex('subscriptions')
146
-                .insert([{uuid: res.uid, JSON: JSON.stringify(new SubscriptionResponse(res.message))}])
147
-            ])
148
-        }
149
-        return res
150
-    }
151
-
152
-    private makeApiClient(conf: FrontblockApiConf):FrontblockApiClient{
153
-        if(this.apiClient)
154
-            this.apiClient.disconnect()
155
-        this.apiClient = new FrontblockApiClient(conf)
156
-        this.apiClient.connect()
157
-        return this.apiClient
158
-    }
159
-
160
-    setConfig(conf:ApiClientPluginConf & { dbConf: knex.Config }):ApiClientPluginConf & { dbConf: knex.Config }{
161
-        const currConf = this.getConfig()
162
-        if(JSON.stringify(currConf.apiConf) !== JSON.stringify(conf.apiConf)){
163
-            this.makeApiClient(conf.apiConf)
164
-        }
165
-        return super.setConfig(conf)
166
-    }
167
-
168
-    setConfigKey(key:keyof ApiClientPluginConf, value: any):ApiClientPluginConf & { dbConf: knex.Config; }{
169
-        if(key === 'apiConf'){
170
-            this.makeApiClient(value)
171
-        }
172
-        return super.setConfigKey(key, value)
173
-    }
174
-
175
-
176
-    async start(): Promise<void> {
177
-        this.makeApiClient(this.getConfig().apiConf)
178
-        super.start()
179
-    }
180
-
181
-    stop(): void {
182
-        this.apiClient.disconnect()
183
-        super.stop()
184
-    }
185
-
186
-    protected getTableDefinitions(): TableDefiniton[] {
187
-        return [{
188
-            name: 'subscriptions', 
189
-            tableBuilder: function (table) {
190
-                table.string('uuid').primary();
191
-                table.string('JSON');
192
-            }
193
-        },{
194
-            name: 'consumers', 
195
-            tableBuilder: function (table) {
196
-                table.string('uuid').primary();
197
-                table.string('JSON');
198
-            }
199
-        }]
200
-    }
201
-}

+ 0
- 38
src/frontend/src/app/apiclient/src/backend/webpack.prod.js View File

@@ -1,38 +0,0 @@
1
-const nodeExternals = require('webpack-node-externals');
2
-const TerserPlugin = require('terser-webpack-plugin');
3
-var webpack = require('webpack');
4
-const path = require('path');
5
-
6
-module.exports = {
7
-  mode: 'production',
8
-  target: "node",
9
-  entry: path.resolve(__dirname, 'Plugin.ts'),
10
-  output: {
11
-      path: path.resolve(__dirname, '../../dist'),
12
-      filename: 'Plugin.js',
13
-      libraryTarget: 'commonjs',
14
-  },
15
-  resolve: {
16
-    // Add `.ts` and `.tsx` as a resolvable extension.
17
-
18
-    extensions: [".ts", ".tsx", ".js"]
19
-  },
20
-  module: {
21
-    rules: [
22
-      { test: /\.ts?$/, loader: "ts-loader" }
23
-    ]
24
-  },
25
-  optimization: {
26
-    minimize: false
27
-  },
28
-  node: {
29
-    global: true,
30
-    process: true,
31
-    __filename: false,
32
-    __dirname: false,
33
-    Buffer: true,
34
-  },
35
-  externals:{
36
-    knex: "../node_modules/knex"
37
-  }
38
-}

+ 0
- 41
src/frontend/src/app/apiclient/src/frontend/webpack.prod.js View File

@@ -1,41 +0,0 @@
1
-const path = require('path');
2
-const TerserPlugin = require('terser-webpack-plugin');
3
-
4
-module.exports = {
5
-  mode: 'production',
6
-  target: "web",
7
-  entry: path.resolve(__dirname, 'module.ts'),
8
-  output: {
9
-      path: path.resolve(__dirname, '../../dist'),
10
-      filename: 'FrontendPlugin.js',
11
-      libraryTarget: 'commonjs',
12
-  },
13
-  resolve: {
14
-    // Add `.ts` and `.tsx` as a resolvable extension.
15
-    extensions: [".ts", ".tsx", ".js"]
16
-  },
17
-  module: {
18
-    rules: [
19
-      { test: /\.ts?$/, loader: "ts-loader" }
20
-    ]
21
-  },
22
-  optimization: {
23
-    minimizer: [
24
-      new TerserPlugin({
25
-        exclude: [
26
-          /\.\/(.*)\/.ts/,
27
-          /\.\/(.*).ts/,
28
-        ],
29
-      }),
30
-    ],
31
-  },
32
-  externals: {
33
-    '@angular/core': '@angular/core',
34
-    '@angular/common': '@angular/common',
35
-    '@angular/router': '@angular/router',
36
-    '@angular/animations': '@angular/animations',
37
-    '@angular/forms': '@angular/forms',
38
-    '@clr/angular': '@clr/angular',
39
-    '../../../knex-config/knex-config.module': 'knexconfig'
40
-  }
41
-}

+ 0
- 10
src/frontend/src/app/apiclient/tsconfig.frontend.json View File

@@ -1,10 +0,0 @@
1
-{
2
-    "extends": "./tsconfig.json",
3
-    "include": ["src/frontend"],
4
-    "exclude": [
5
-        "src/backend"
6
-    ],
7
-    "compilerOptions": {
8
-        "sourceMap": true
9
-    }
10
-}

+ 0
- 18
src/frontend/src/app/apiclient/tsconfig.json View File

@@ -1,18 +0,0 @@
1
-{
2
-  "compilerOptions": {
3
-    "allowSyntheticDefaultImports": true,
4
-    "alwaysStrict": false,
5
-    "noImplicitAny": false,
6
-    "target": "ES2015",
7
-    "module": "commonjs",
8
-    "declaration": true,
9
-    "strict": true,
10
-    "outDir": ".",
11
-    "experimentalDecorators": true,
12
-    "strictPropertyInitialization": false,
13
-    "importHelpers": true,
14
-    "strictNullChecks": false,
15
-  },
16
-  "include": ["src/backend"],
17
-  "exclude": []
18
-}

+ 10
- 2
src/frontend/src/app/app-routing.module.ts View File

@@ -2,13 +2,21 @@ import { NgModule } from '@angular/core';
2 2
 import { Routes, RouterModule } from '@angular/router';
3 3
 import { HomeComponent } from './home/home.component';
4 4
 import { ErrorDisplayComponent } from './error-display/error-display.component';
5
+import { SettingsComponent } from './settings/settings.component';
5 6
 
6 7
 const routes: Routes = [{
7 8
     path: "pluginmanager",
8
-    loadChildren: () => import('./pluginmanager/module').then(mod => mod.PluginModule)
9
+    loadChildren: () => import('./pluginmanager/module').then(mod => mod.PluginmanagerModule)
9 10
   },{
10
-    path: "",
11
+    path: "settings",
12
+    component: SettingsComponent
13
+  },{
14
+    path: "home",
11 15
     component: HomeComponent
16
+  },{
17
+    path: "",
18
+    pathMatch: "full",
19
+    redirectTo: "home",
12 20
   },{
13 21
     path: "**",
14 22
     component: ErrorDisplayComponent

+ 7
- 4
src/frontend/src/app/app.component.ts View File

@@ -20,13 +20,16 @@ export class AppComponent implements AfterContentInit {
20 20
   }
21 21
 
22 22
   ngAfterContentInit(){
23
-    const _this = this;
24
-    (function awaitSidebar(){
25
-      if(_this.sidebar != null){
26
-        _this.sidebarService.setSidebar(_this.sidebar)
23
+    let awaitSidebar: { (): void; (...args: any[]): void; }
24
+    (awaitSidebar = () => {
25
+      if(this.sidebar != null){
26
+        this.sidebarService.setSidebar(this.sidebar)
27 27
         return
28 28
       }
29 29
       setTimeout(awaitSidebar,25)
30 30
     })()
31
+
32
+    
33
+
31 34
   }
32 35
 }

+ 7
- 1
src/frontend/src/app/app.module.ts View File

@@ -17,8 +17,11 @@ import { HomeComponent } from './home/home.component';
17 17
 import { ErrorDisplayComponent } from './error-display/error-display.component';
18 18
 import { HeaderBarComponent } from './header-bar/header-bar.component';
19 19
 import { SubnavComponent } from './subnav/subnav.component';
20
+import { KnexConfigComponent } from './knex-config/knex-config.component';
21
+import { ApiclientFormComponent } from './apiclient/apiclient-settings-form.component';
22
+import { SettingsComponent } from './settings/settings.component';
23
+import { ApiclientModule } from './apiclient/module';
20 24
 
21
-import { environment } from 'src/environments/environment';
22 25
 
23 26
 export function createCompiler(fn: CompilerFactory): Compiler {
24 27
   return fn.createCompiler();
@@ -34,6 +37,8 @@ const declarations = [
34 37
   HeaderBarComponent,
35 38
   ErrorDisplayComponent,
36 39
   SubnavComponent,
40
+  KnexConfigComponent,
41
+  SettingsComponent
37 42
 ]
38 43
 
39 44
 @NgModule({
@@ -44,6 +49,7 @@ const declarations = [
44 49
     BrowserAnimationsModule,
45 50
     ClarityModule,
46 51
     AppRoutingModule,
52
+    ApiclientModule
47 53
   ],
48 54
   entryComponents: [],
49 55
   providers: [

+ 10
- 3
src/frontend/src/app/dynamic-loader/dynamic-loader.component.ts View File

@@ -22,7 +22,6 @@ import * as btcHdkey from "btc-hdkey"
22 22
 import * as bitcoinjslib from "bitcoinjs-lib"
23 23
 import * as fetch from "node-fetch"
24 24
 import * as coinselect from "coinselect/accumulative"
25
-import * as KnexModule from '../knex-config/knex-config.module'
26 25
 
27 26
 SystemJS.set('@clr/angular', SystemJS.newModule(clarityModule));
28 27
 SystemJS.set('@angular/router', SystemJS.newModule(angularRouter));
@@ -40,7 +39,6 @@ SystemJS.set('btc-hdkey', SystemJS.newModule(btcHdkey))
40 39
 SystemJS.set('bitcoinjs-lib', SystemJS.newModule(bitcoinjslib))
41 40
 SystemJS.set('node-fetch', SystemJS.newModule(fetch))
42 41
 SystemJS.set('coinselect/accumulative', SystemJS.newModule(coinselect))
43
-SystemJS.set('knexconfig', SystemJS.newModule(KnexModule))
44 42
 
45 43
 SystemJS.config({ meta: { '*': { authorization: true } } });
46 44
 /** --------- */
@@ -53,7 +51,7 @@ import { environment } from "../../environments/environment"
53 51
 
54 52
 const fb = environment.production ? window["fb"] : {
55 53
   Admin: {
56
-    getLoadedPluginNames: () => ["ApiClient", "Wallet"]
54
+    getLoadedPluginNames: () => []
57 55
   }
58 56
 }
59 57
 
@@ -100,6 +98,15 @@ export class DynamicLoaderComponent implements AfterViewInit {
100 98
     }
101 99
 
102 100
     const plugin:FrontendPlugin = new module['PluginModule']()
101
+    this.injectPlugin(plugin)
102
+    this.compileModule(plugin)
103
+  }
104
+
105
+  compileModule(module:any){
106
+    
107
+  }
108
+
109
+  injectPlugin(plugin:FrontendPlugin):void{
103 110
     const entry: SidebarEntries | SidebarEntry = plugin.getSidebarEntry()
104 111
     const rc = this.router.config
105 112
 

+ 5
- 0
src/frontend/src/app/header-bar/header-bar.component.html View File

@@ -9,4 +9,9 @@
9 9
             <span class="nav-text">ALPHA {{devmode}}</span>
10 10
         </a>
11 11
     </div>
12
+    <div class="header-actions">
13
+        <a [routerLink]="'settings'" class="nav-link nav-icon" aria-label="settings">
14
+            <clr-icon shape="cog"></clr-icon>
15
+        </a>
16
+    </div>
12 17
 </clr-header>

+ 0
- 1
src/frontend/src/app/knex-config/knex-config.component.html View File

@@ -1 +0,0 @@
1
-<p>knex-config works!</p>

+ 8
- 9
src/frontend/src/app/knex-config/knex-config.component.ts View File

@@ -1,6 +1,6 @@
1 1
 import { Component, OnInit, Input } from '@angular/core';
2 2
 
3
-declare const fb
3
+declare const fb : { Admin: { getConfig:()=>any , setConfigKey:(knex:"dbConf", conf:KnexConfig)=>any } }
4 4
 
5 5
 @Component({
6 6
     selector: 'knex-config',
@@ -78,7 +78,7 @@ declare const fb
78 78
                           <form clrForm clrLayout="horizontal">
79 79
                             <clr-input-container >
80 80
                               <label class="clr-col-12 clr-col-md-4">file</label>
81
-                              <input class="clr-col-12 clr-col-md-8" clrInput type="text" name="sqlite-file" [(ngModel)]="sqlite3['connection']['filename']" placeholder="./data/benis.sqlite" required />
81
+                              <input class="clr-col-12 clr-col-md-8" clrInput type="text" name="sqlite-file" [(ngModel)]="sqlite3['connection']['filename']" placeholder="./data/db.sqlite" required />
82 82
                             </clr-input-container>
83 83
                           </form>
84 84
                         </clr-tab-content>
@@ -98,8 +98,6 @@ declare const fb
98 98
 })
99 99
 export class KnexConfigComponent implements OnInit{
100 100
 
101
-  @Input("fbPlugin")
102
-  fbPlugin:string
103 101
   conf: KnexConfig
104 102
 
105 103
   pg:PgConfig = {
@@ -138,10 +136,7 @@ export class KnexConfigComponent implements OnInit{
138 136
   }
139 137
 
140 138
   async ngOnInit(){
141
-    if(!fb[this.fbPlugin]){
142
-      throw new Error("Knex config component doesn't have fb."+this.fbPlugin)
143
-    }
144
-    const c = await fb[this.fbPlugin].getConfig()
139
+    const c = await fb.Admin.getConfig()
145 140
     this.conf = c.dbConf
146 141
 
147 142
     Object.keys(this.mode).forEach(knexType => {
@@ -155,9 +150,13 @@ export class KnexConfigComponent implements OnInit{
155 150
     window['knex'] = this
156 151
   }
157 152
   
153
+  getSettingsComponentClassName(){
154
+    return KnexConfigComponent
155
+  }
156
+
158 157
   save(){
159 158
     const modeName = Object.entries(this.mode).find(([key, active]) => active)[0]
160
-    fb[this.fbPlugin].setConfigKey('dbConf', this[modeName]).then(console.log)
159
+    fb.Admin.setConfigKey('dbConf', this[modeName]).then(console.log)
161 160
   }
162 161
 }
163 162
 

+ 0
- 23
src/frontend/src/app/knex-config/knex-config.module.ts View File

@@ -1,23 +0,0 @@
1
-import { NgModule } from '@angular/core';
2
-import { CommonModule } from '@angular/common';
3
-import { RouterModule } from '@angular/router';
4
-import { KnexConfigComponent } from './knex-config.component';
5
-import { ClarityModule } from '@clr/angular';
6
-import { FormsModule } from '@angular/forms';
7
-
8
-@NgModule({
9
-  imports: [
10
-    CommonModule,    
11
-    FormsModule,
12
-    ClarityModule,
13
-  ],
14
-  exports: [
15
-    KnexConfigComponent
16
-  ],
17
-  declarations: [
18
-    KnexConfigComponent
19
-  ],
20
-  entryComponents: [],
21
-  providers: []
22
-})
23
-export class KnexConfigModule{}

+ 1
- 1
src/frontend/src/app/pluginmanager/module.ts View File

@@ -27,5 +27,5 @@ import { FormsModule } from '@angular/forms';
27 27
     PluginsComponent
28 28
   ]
29 29
 })
30
-export class PluginModule{
30
+export class PluginmanagerModule{
31 31
 }

+ 4
- 0
src/frontend/src/app/settings/settings.component.html View File

@@ -0,0 +1,4 @@
1
+<knex-config></knex-config>
2
+
3
+
4
+<ng-container #dynamicSettings></ng-container>

src/frontend/src/app/knex-config/knex-config.component.scss → src/frontend/src/app/settings/settings.component.scss View File


+ 25
- 0
src/frontend/src/app/settings/settings.component.spec.ts View File

@@ -0,0 +1,25 @@
1
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+import { SettingsComponent } from './settings.component';
4
+
5
+describe('SettingsComponent', () => {
6
+  let component: SettingsComponent;
7
+  let fixture: ComponentFixture<SettingsComponent>;
8
+
9
+  beforeEach(async(() => {
10
+    TestBed.configureTestingModule({
11
+      declarations: [ SettingsComponent ]
12
+    })
13
+    .compileComponents();
14
+  }));
15
+
16
+  beforeEach(() => {
17
+    fixture = TestBed.createComponent(SettingsComponent);
18
+    component = fixture.componentInstance;
19
+    fixture.detectChanges();
20
+  });
21
+
22
+  it('should create', () => {
23
+    expect(component).toBeTruthy();
24
+  });
25
+});

+ 30
- 0
src/frontend/src/app/settings/settings.component.ts View File

@@ -0,0 +1,30 @@
1
+import { Component, ViewChild, ViewContainerRef, ComponentFactoryResolver, Injector, AfterViewInit } from '@angular/core';
2
+import { ApiclientModule } from '../apiclient/module'
3
+
4
+@Component({
5
+  selector: 'app-settings',
6
+  templateUrl: './settings.component.html',
7
+  styleUrls: ['./settings.component.scss']
8
+})
9
+export class SettingsComponent implements AfterViewInit {
10
+  ngAfterViewInit(): void {
11
+    this.injectModule(new ApiclientModule())
12
+    this.injectModule(new ApiclientModule())
13
+  }
14
+
15
+  @ViewChild('dynamicSettings', {read: ViewContainerRef, static: false})
16
+  settingsContainer: ViewContainerRef
17
+
18
+  constructor(
19
+    private componentFactoryResolver: ComponentFactoryResolver,
20
+    private injector: Injector
21
+  ) {
22
+  }
23
+
24
+  injectModule(module:any) {
25
+    const factory = this.componentFactoryResolver.resolveComponentFactory(module.getSettingsComponentClassName())
26
+    const component = factory.create(this.injector)
27
+    setTimeout(() => this.settingsContainer.insert(component.hostView), 1)
28
+  }
29
+
30
+}

+ 23
- 0
src/frontend/src/app/sidebar/sidebar.component.html View File

@@ -1,3 +1,26 @@
1
+<!--
2
+
3
+<nav class="sidenav">
4
+    <section class="sidenav-content">
5
+        <a *ngFor="let entry of entries" routerLinkActive="active" [routerLink]="entry.route" class="nav-link">
6
+            <clr-icon [attr.shape]="entry.icon" class="is-solid" clrVerticalNavIcon></clr-icon>{{entry.text}}
7
+        </a>
8
+
9
+        
10
+        <section class="nav-group" *ngFor="let e of multientires" >
11
+            <label> 
12
+                <clr-icon [attr.shape]="e.icon" class="is-solid"></clr-icon>
13
+                {{e.text}}
14
+            </label>
15
+            <ul class="nav-list">
16
+                <li *ngFor="let l of e.links"><a class="nav-link" routerLinkActive="active" [routerLink]="l.route" >{{l.text}}</a></li>
17
+            </ul>
18
+        </section>
19
+    </section>
20
+</nav>
21
+
22
+-->
23
+
1 24
 <clr-vertical-nav [clr-nav-level]="1" class="nav-trigger--bottom" style="height:  100%;" [clrVerticalNavCollapsible]="true" [(clrVerticalNavCollapsed)]="collapsed" >
2 25
     <clr-vertical-nav-group *ngFor="let e of multientires" routerLinkActive="active">
3 26
         <clr-icon [attr.shape]="e.icon" class="is-solid" clrVerticalNavIcon></clr-icon>

+ 15
- 16
src/frontend/src/app/sidebar/sidebar.component.ts View File

@@ -10,24 +10,23 @@ export class SidebarComponent implements OnInit {
10 10
 
11 11
   collapsed = true
12 12
 
13
-  entries:SidebarEntry[] = [
14
-  ]
13
+  entries:SidebarEntry[] = []
15 14
 
16 15
   multientires:SidebarEntries[] = [{
17
-      icon: "bundle",
18
-      text: "Update Manager",
19
-      parentRoute: "pluginmanager",
20
-      links: [{
21
-        route: "pluginmanager/debug",
22
-        text: "DEBUG"    
23
-      },{
24
-        route: "pluginmanager/admin",
25
-        text: "Dashboard"    
26
-      },{
27
-        route: "pluginmanager/plugins",
28
-        text: "Plugins"    
29
-      }]
30
-  }]
16
+    icon: "bundle",
17
+    text: "Update Manager",
18
+    parentRoute: "pluginmanager",
19
+    links: [{
20
+      route: "pluginmanager/debug",
21
+      text: "DEBUG"    
22
+    },{
23
+      route: "pluginmanager/admin",
24
+      text: "Dashboard"    
25
+    },{
26
+      route: "pluginmanager/plugins",
27
+      text: "Plugins"    
28
+    }]
29
+  },]
31 30
 
32 31
   constructor() { }
33 32
 

+ 5
- 1
src/frontend/src/app/subnav/subnav.component.html View File

@@ -1,7 +1,11 @@
1 1
 <nav class="subnav">
2 2
     <ul class="nav">
3 3
         <li class="nav-item">
4
-            <a class="nav-link active" href="#">Dashboard</a>
4
+            <a class="nav-link" routerLinkActive="active" [routerLink]="'home'">Dashboard</a>
5
+            &nbsp;
6
+            <a class="nav-link" routerLinkActive="active" [routerLink]="'notifications'">Notifications</a>
7
+            &nbsp;
8
+            <a class="nav-link" routerLinkActive="active" [routerLink]="'settings'">Settings</a>
5 9
         </li>
6 10
     </ul>
7 11
 </nav>

+ 0
- 59
src/frontend/src/app/wallet/.drone.yml View File

@@ -1,59 +0,0 @@
1
-kind: pipeline
2
-name: default
3
-
4
-steps:
5
-- name: restore cache
6
-  image: drillster/drone-volume-cache
7
-  settings:
8
-    restore: true
9
-    mount:
10
-      - ./node_modules
11
-  volumes:
12
-  - name: cache
13
-    path: /cache
14
-    
15
-- name: npm install
16
-  image: node:12
17
-  commands:
18
-  - npm install
19
-
20
-- name: npm run build
21
-  image: node:12
22
-  commands:
23
-  - npm run build
24
-
25
-- name: rebuild cache
26
-  image: drillster/drone-volume-cache
27
-  settings:
28
-    rebuild: true
29
-    mount:
30
-      - ./node_modules
31
-  volumes:
32
-  - name: cache
33
-    path: /cache
34
-
35
-- name: deploy plugin
36
-  image: node:12
37
-  commands:
38
-  - git config --global user.email "${DRONE_COMMIT_AUTHOR_EMAIL}"
39
-  - git config --global user.name "${DRONE_COMMIT_AUTHOR}"
40
-  - git clone https://gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git
41
-  - cp -r ./dist/* ./${DRONE_REPO_NAME}
42
-  - cd ./${DRONE_REPO_NAME}
43
-  - git add -A
44
-  - git commit --allow-empty -m "drone tagged as version ${DRONE_TAG}"
45
-  - git tag ${DRONE_TAG}
46
-  - git push https://$GIT_USER:$GIT_PASSWORD@gitea.frontblock.me/fb-dist/${DRONE_REPO_NAME}.git master ${DRONE_TAG}
47
-  environment:
48
-    GIT_USER:
49
-      from_secret: git_user
50
-    GIT_PASSWORD:
51
-      from_secret: git_password
52
-  when:
53
-    event:
54
-    - tag
55
-
56
-volumes:
57
-- name: cache 
58
-  host:
59
-    path: /tmp

+ 0
- 11
src/frontend/src/app/wallet/.gitignore View File

@@ -1,11 +0,0 @@
1
-dist
2
-kfs
3
-.rpt2_cache
4
-node_modules
5
-lib
6
-
7
-*.d.ts
8
-*.js
9
-*.ts
10
-
11
-!src/**/*

+ 0
- 5477
src/frontend/src/app/wallet/package-lock.json
File diff suppressed because it is too large
View File


+ 0
- 57
src/frontend/src/app/wallet/package.json View File

@@ -1,57 +0,0 @@
1
-{
2
-  "name": "frontblock",
3
-  "version": "0.9.10",
4
-  "description": "frontblock shop-side library ",
5
-  "main": "FrontblockApiClient.js",
6
-  "scripts": {
7
-    "build-backend": "webpack --config src/backend/webpack.prod.js --progress --colors",
8
-    "build-frontend": "webpack --config src/frontend/webpack.prod.js --progress --colors",
9
-    "build": "npm run clean; npm run build-backend; npm run build-frontend",
10
-    "clean": "rm -rf *.js *.ts backend frontend .rpt2_cache lib dist",
11
-    "update-frontblock": "rm -rf node_modules/frontblock*; npm install"
12
-  },
13
-  "keywords": [
14
-    "api",
15
-    "client",
16
-    "frontblock"
17
-  ],
18
-  "author": "",
19
-  "license": "ISC",
20
-  "dependencies": {
21
-    "@angular/common": "^8.2.1",
22
-    "@angular/core": "^8.2.1",
23
-    "@angular/forms": "^8.2.1",
24
-    "@angular/platform-browser": "^8.2.1",
25
-    "@angular/router": "^8.2.1",
26
-    "@clr/angular": "^2.1.1",
27
-    "@types/node": "^11.13.10",
28
-    "adm-zip": "^0.4.13",
29
-    "angular": "^1.7.8",
30
-    "bip39": "^3.0.2",
31
-    "bitcoinjs-lib": "^5.0.4",
32
-    "bsock": "^0.1.9",
33
-    "btc-hdkey": "0.0.17",
34
-    "coinselect": "^3.1.11",
35
-    "easy-unzip": "^1.1.0",
36
-    "express": "^4.16.4",
37
-    "frontblock-generic": "^0.28.4",
38
-    "hdkey": "^1.1.1",
39
-    "key-file-storage": "^2.2.1",
40
-    "knex": "^0.19.2",
41
-    "log4js": "^4.3.1",
42
-    "minimist": "^1.2.0",
43
-    "node-fetch": "^2.5.0",
44
-    "original-fs": "^1.1.0",
45
-    "rxjs": "^6.5.2",
46
-    "rxjs-compat": "^6.5.2",
47
-    "unzip": "^0.1.11",
48
-    "uuid": "^3.3.2"
49
-  },
50
-  "devDependencies": {
51
-    "ts-loader": "^6.0.4",
52
-    "typescript": "^3.4.5",
53
-    "webpack": "^4.39.2",
54
-    "webpack-cli": "^3.3.6",
55
-    "webpack-node-externals": "^1.7.2"
56
-  }
57
-}

+ 0
- 118
src/frontend/src/app/wallet/src/backend/Plugin.ts View File

@@ -1,118 +0,0 @@
1
-import { socketioRPC } from "frontblock-generic/RPC";
2
-import { DatabasePlugin, TableDefiniton } from "frontblock-generic/DatabasePlugin"
3
-import { Coin } from "frontblock-generic/Types";
4
-import * as knex from 'knex';
5
-import * as Logger from 'log4js'
6
-Logger.configure({
7
-    appenders: {
8
-        "frontblock-wallet": { type: 'stdout' },
9
-        //app: { type: 'file', filename: 'application.log' }
10
-      },
11
-      categories: {
12
-        default: { appenders: [ 'frontblock-wallet' ], level: 'debug' }
13
-      }
14
-})
15
-const logger = Logger.getLogger("frontblock-wallet")
16
-
17
-export type PublicNode = {
18
-    coin: Coin
19
-    net: 'testnet' | 'mainnet'
20
-    url: URL
21
-}
22
-
23
-export type WalletPluginConf = {
24
-    btcConf: { 
25
-        publicNodes: PublicNode[]
26
-    }
27
-}
28
-
29
-export type Key = {
30
-    name: string
31
-    type: 'plain' | 'encrypted'
32
-    value: string
33
-    coin: Coin
34
-}
35
-
36
-export default class WalletPlugin extends DatabasePlugin<WalletPluginConf>{
37
-    constructor(){
38
-        super("Wallet")
39
-    }
40
-
41
-    getDefaultConfig(): WalletPluginConf & { dbConf: knex.Config; } {
42
-        return {
43
-            btcConf: {
44
-                publicNodes: [
45
-                    {coin: 'BTC', net: 'testnet', url: new URL('https://testnet-api.smartbit.com.au/v1/blockchain')},
46
-                    {coin: 'BTC', net: 'mainnet', url: new URL('https://api.smartbit.com.au/v1/blockchain')}
47
-                ]
48
-            },
49
-            dbConf: {
50
-                client: 'sqlite3',
51
-                connection: {
52
-                    filename: "./data/Wallet.sqlite"
53
-                },
54
-                useNullAsDefault: true
55
-            }
56
-        }
57
-    }    
58
-
59
-    protected exportExtraRPCs(): socketioRPC[] {
60
-        return [
61
-            {
62
-                name: "putKey",
63
-                func: async(
64
-                    name: string, 
65
-                    type: 'plain' | 'encrypted', 
66
-                    value: string, 
67
-                    coin: Coin
68
-                ) => { 
69
-                    return await this.putKey({
70
-                        name: name, 
71
-                        type:type, 
72
-                        value:value, 
73
-                        coin:coin
74
-                    }) 
75
-                },
76
-                type: 'call',
77
-                visibility: 'private'
78
-            },{
79
-                name: "delKey",
80
-                func: async(name: string) => { return await this.delKey(name) },
81
-                type: 'call',
82
-                visibility: 'private'
83
-            },{
84
-                name: "getKeys",
85
-                func: async() => { return await this.getKeys() },
86
-                type: 'call',
87
-                visibility: 'private'
88
-            }
89
-        ]
90
-    }
91
-
92
-    public async putKey(key: Key){
93
-        return await this.knex('keys').insert([key])
94
-    }
95
-
96
-    public async delKey(name: string){
97
-        return await this.knex('keys')
98
-        .where('name', name)
99
-        .del()
100
-    }
101
-
102
-    public async getKeys(): Promise<Key[]>{
103
-        return await this.knex.select('*').from('keys')
104
-    }
105
-
106
-    protected getTableDefinitions(): TableDefiniton[] {
107
-        return [{
108
-            name: 'keys', 
109
-            tableBuilder: function (table) {
110
-                table.string('name').primary();
111
-                table.string('type');
112
-                table.string('value');
113
-                table.string('coin');
114
-            }
115
-        }]
116
-    }
117
-
118
-}

+ 0
- 37
src/frontend/src/app/wallet/src/backend/webpack.prod.js View File

@@ -1,37 +0,0 @@
1
-const nodeExternals = require('webpack-node-externals');
2
-const TerserPlugin = require('terser-webpack-plugin');
3
-
4
-const path = require('path');
5
-
6
-module.exports = {
7
-  mode: 'production',
8
-  target: "node",
9
-  entry: path.resolve(__dirname, 'Plugin.ts'),
10
-  output: {
11
-      path: path.resolve(__dirname, '../../dist'),
12
-      filename: 'Plugin.js',
13
-      libraryTarget: 'commonjs',
14
-  },
15
-  resolve: {
16
-    // Add `.ts` and `.tsx` as a resolvable extension.
17
-    extensions: [".ts", ".tsx", ".js"]
18
-  },
19
-  module: {
20
-    rules: [
21
-      { test: /\.ts?$/, loader: "ts-loader" }
22
-    ]
23
-  },
24
-  optimization: {
25
-    minimize: false
26
-  },
27
-  node: {
28
-    global: true,
29
-    process: true,
30
-    __filename: false,
31
-    __dirname: false,
32
-    Buffer: true,
33
-  },
34
-  externals:{
35
-    knex: "../node_modules/knex"
36
-  }
37
-}

+ 0
- 174
src/frontend/src/app/wallet/src/frontend/btc/address-viewer.component.ts View File

@@ -1,174 +0,0 @@
1
-
2
-
3
-import { Component, OnInit, isDevMode } from '@angular/core';
4
-import { PluginsComponent } from './btc.component';
5
-import { ClrDatagridStringFilterInterface, ClrDatagridNumericFilterInterface, ClrDropdownModule } from '@clr/angular';
6
-declare const fb
7
-@Component({
8
-    selector: 'address-viewer', //!!!!
9
-    template: `
10
-    <div class="clr-row">
11
-        <div *ngIf="regularAddresses.length != 0" class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-6">
12
-        <div class="card">    
13
-            <div class="card-header">
14
-                Addresses
15
-            </div>
16
-            <clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
17
-                <clr-alert-item>
18
-                    <span class="alert-text">
19
-                        {{line.message}}
20
-                    </span>
21
-                </clr-alert-item>
22
-            </clr-alert>
23
-
24
-            <clr-datagrid class="datagrid-compact ">
25
-                <clr-dg-column>Address</clr-dg-column>
26
-                <clr-dg-column>
27
-                    Balance
28
-                </clr-dg-column>
29
-                <clr-dg-column>
30
-                    Pending
31
-                </clr-dg-column>
32
-                <clr-dg-column>
33
-                    Estimate total
34
-                    <clr-dg-numeric-filter [clrDgNumericFilter]="otherBalanceFilter" [clrFilterValue]="[0, null]"></clr-dg-numeric-filter>                
35
-                </clr-dg-column>
36
-
37
-                <clr-dg-row *clrDgItems="let line of regularAddresses">
38
-                    <clr-dg-cell class="monospace" style="word-break: break-all">{{line.address}}</clr-dg-cell>
39
-                    <clr-dg-cell class="monospace">{{line.confirmed.balance | number: '1.8-18'}}</clr-dg-cell>
40
-                    <clr-dg-cell class="monospace">
41
-                        <span *ngIf="line.unconfirmed.balance != 0">
42
-                            {{line.unconfirmed.balance | number: '1.8-18'}} 
43
-                        </span>
44
-                    </clr-dg-cell>
45
-                    <clr-dg-cell class="monospace">{{line.total.balance | number: '1.8-18'}}</clr-dg-cell>
46
-
47
-                    <clr-dg-row-detail *clrIfExpanded >
48
-                        <div class="clr-row">
49
-                            <div class="clr-col-3">
50
-                                <button class="btn btn-info-outline"  (click)="parent.addrExplorer(line.address)">Explorer</button>
51
-                            </div>
52
-
53
-                            <div *ngIf="parent.keys[line.address] != null" class="clr-col-9" style="word-break:break-all">
54
-                                <h6  style="margin-top: 0">Derivation </h6>
55
-                                {{parent.keys[line.address].derivation}}                                
56
-                                <h6> Public key </h6>
57
-                                {{parent.keys[line.address].publicExtendedKey}}
58
-                                <h6> Private key </h6>
59
-                                {{parent.keys[line.address].privateExtendedKey}}
60
-                            </div>
61
-                        </div>
62
-                    </clr-dg-row-detail>
63
-                </clr-dg-row>
64
-
65
-                <clr-dg-footer>
66
-                    <clr-dg-pagination #pagination2 [clrDgPageSize]="10">
67
-                        <clr-dg-page-size [clrPageSizeOptions]="[5,10,20,50,100]">per page</clr-dg-page-size>
68
-                        {{pagination2.firstItem + 1}} - {{pagination2.lastItem + 1}}
69
-                        of {{pagination2.totalItems}}
70
-                    </clr-dg-pagination>
71
-                </clr-dg-footer>
72
-            </clr-datagrid>
73
-        </div>
74
-        </div>
75
-
76
-        <div *ngIf="changeAddresses.length != 0" class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-12 clr-col-xl-6">
77
-        <div class="card">    
78
-            <div class="card-header">
79
-                Change Addresses
80
-            </div>
81
-            <clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
82
-                <clr-alert-item>
83
-                    <span class="alert-text">
84
-                        {{line.message}}
85
-                    </span>
86
-                </clr-alert-item>
87
-            </clr-alert>
88
-
89
-            <clr-datagrid class="datagrid-compact">
90
-                <clr-dg-column>Address</clr-dg-column>
91
-                <clr-dg-column>
92
-                    Balance
93
-                </clr-dg-column>
94
-                <clr-dg-column>
95
-                    Pending
96
-                </clr-dg-column>
97
-                <clr-dg-column>
98
-                    Estimate total
99
-                    <clr-dg-numeric-filter [clrDgNumericFilter]="balanceFilter" [clrFilterValue]="[0.00000001, null]"></clr-dg-numeric-filter>
100
-                </clr-dg-column>
101
-
102
-                <clr-dg-row *clrDgItems="let line of changeAddresses">
103
-                    <clr-dg-cell class="monospace" style="word-break: break-all">{{line.address}}</clr-dg-cell>
104
-                    <clr-dg-cell class="monospace">{{line.confirmed.balance | number: '1.8-18'}}</clr-dg-cell>
105
-                    <clr-dg-cell class="monospace">
106
-                        <span *ngIf="line.unconfirmed.balance != 0">
107
-                          {{line.unconfirmed.balance | number: '1.8-18'}} 
108
-                        </span>
109
-                    </clr-dg-cell>
110
-                    <clr-dg-cell class="monospace">{{line.total.balance | number: '1.8-18'}}</clr-dg-cell>
111
-
112
-                    <clr-dg-row-detail *clrIfExpanded >
113
-                        <div class="clr-row">
114
-                            <div class="clr-col-3">
115
-                                <button class="btn btn-info-outline" (click)="parent.addrExplorer(line.address)">Explorer</button>
116
-                                <p>
117
-                            </div>
118
-
119
-                            <div *ngIf="parent.keys[line.address] != null" class="clr-col-9" style="word-break:break-all">
120
-                                <h6  style="margin-top: 0">Derivation </h6>
121
-                                {{parent.keys[line.address].derivation}}
122
-                                <h6> Public key </h6>
123
-                                {{parent.keys[line.address].publicExtendedKey}}
124
-                                <h6> Private key </h6>
125
-                                {{parent.keys[line.address].privateExtendedKey}}
126
-                            </div>
127
-                        </div>
128
-                    </clr-dg-row-detail>
129
-                </clr-dg-row>
130
-
131
-                <clr-dg-footer>
132
-                    <clr-dg-pagination #pagination [clrDgPageSize]="10">
133
-                        <clr-dg-page-size [clrPageSizeOptions]="[5,10,20,50,100]">per page</clr-dg-page-size>
134
-                        {{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
135
-                        of {{pagination.totalItems}}
136
-                    </clr-dg-pagination>
137
-                </clr-dg-footer>
138
-            </clr-datagrid>
139
-        </div>
140
-        </div>
141
-    </div>
142
-  `
143
-})
144
-export class AddressViewerComponent implements OnInit{    
145
-    balanceFilter = new BalanceFilter()
146
-    otherBalanceFilter = new BalanceFilter()
147
-    regularAddresses = []
148
-    changeAddresses = []
149
-    keys = {}
150
-    parent:PluginsComponent
151
-    ngOnInit() { }
152
-
153
-    setParent(parent:PluginsComponent){
154
-        this.parent = parent
155
-    }
156
-
157
-    setRegularAddresses(addresses){
158
-        this.regularAddresses = addresses
159
-    }
160
-
161
-    setChangeAddresses(addresses){
162
-        this.changeAddresses = addresses
163
-    }    
164
-}
165
-
166
-class BalanceFilter implements ClrDatagridNumericFilterInterface<any>{
167
-    accepts(item: any, low: number, high: number): boolean {
168
-        high = parseFloat(""+high)
169
-        low = parseFloat(""+low)
170
-        const balance = (parseFloat(item.unconfirmed.balance) + parseFloat(item.confirmed.balance))
171
-        return (Number.isNaN(low)  || balance >= low) 
172
-            && (Number.isNaN(high) || balance <= high)
173
-    }
174
-}

+ 0
- 702
src/frontend/src/app/wallet/src/frontend/btc/btc.component.ts View File

@@ -1,702 +0,0 @@
1
-import { Component, OnInit, isDevMode, ViewChild, AfterViewInit, OnDestroy, HostListener } from '@angular/core';
2
-import { WalletGeneratorComponent } from './wallet-generator.component';
3
-import { WalletPickerComponent } from './wallet-picker.component';
4
-import { HDKey } from "btc-hdkey"
5
-import { AddressViewerComponent } from './address-viewer.component';
6
-const coinselect = require('coinselect/accumulative')
7
-const fetch = require("node-fetch")
8
-import { TransactionBuilder, Signer } from 'bitcoinjs-lib'
9
-import { networks } from 'bitcoinjs-lib'
10
-import { SubscriptionResponse, ErrorResponse } from 'frontblock-generic/Types';
11
-let feeRate = 5 // satoshis per byte
12
-
13
-const hdkey = new HDKey()
14
-declare const fb
15
-@Component({
16
-
17
-    selector: 'plugins', //!!!!
18
-    template: `
19
-
20
-<wallet-generator></wallet-generator>
21
-
22
-<!-- loading -->
23
-<clr-modal  [clrModalSize]="'md'" [(clrModalOpen)]="loading">
24
-        
25
-    <div class="modal-body ">
26
-        <span class="spinner spinner-inverse spinner-md">
27
-            Loading...
28
-        </span> 
29
-        <h3>Checking addresses</h3> <br>
30
-        Checking the first {{loadingN*115}} addresses. <br>
31
-        Found addresses containing balance: {{regaddresses.length + changeaddresses.length}}
32
-    </div>
33
-</clr-modal>
34
-<!-- / loading -->
35
-
36
-<!-- faucets -->
37
-<div *ngIf="mode.net == 'testnet'" class="clr-all-12">
38
-    <div class="card">
39
-                            
40
-        <div class="card-header">
41
-            Faucet
42
-        </div>
43
-        <div class="card-block" >
44
-            <button class="btn btn-icon btn-info-outline" onclick="window.open('https://testnet-faucet.mempool.co/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>            
45
-            <button class="btn btn-icon btn-info-outline" onclick="window.open('https://bitcoinfaucet.uo1.net/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>            
46
-            <button class="btn btn-icon btn-info-outline" onclick="window.open('https://coinfaucet.eu/en/btc-testnet/', '_blank')"><clr-icon shape="fuel"></clr-icon></button>            
47
-            <button class="btn btn-icon btn-success-outline" onclick="window.open('https://www.google.com/search?q=btc+testnet+faucet&oq=btc+testnet+faucet', '_blank')"><clr-icon shape="plus"></clr-icon> more</button>            
48
-        </div>
49
-        <div class="card-footer" >
50
-            Get free test-BTC
51
-        </div>
52
-        
53
-        
54
-    </div>
55
-</div>
56
-<!-- /faucets -->
57
-
58
-<!-- row 1 -->
59
-<div class="clr-all-12">
60
-
61
-    <!-- wallet picker + send box + balance box -->
62
-    <div class="clr-row">
63
-        
64
-        <!-- left column -->
65
-        <div class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-5 clr-col-xl-5">
66
-
67
-            <!-- Wallet picker -->
68
-            <div class="clr-row">
69
-                <walletpicker class="clr-all-12"></walletpicker>
70
-            </div>
71
-            <!-- /Wallet picker -->
72
-
73
-            <!-- Send box -->
74
-            <div *ngIf="mode.type=='private'" class="clr-row">
75
-
76
-                <div class="clr-all-12">
77
-                    <div class="card">
78
-                        
79
-                        <div class="card-header">
80
-                            Send
81
-                        </div>
82
-                        <clr-alert *ngFor="let error of errors"  [clrAlertType]="'danger'">
83
-                            <clr-alert-item>
84
-                                <span class="alert-text">
85
-                                    {{error}}
86
-                                </span>
87
-                            </clr-alert-item>
88
-                        </clr-alert>
89
-                        <clr-alert *ngFor="let success of successes"  [clrAlertType]="'success'">
90
-                            <clr-alert-item>
91
-                                <span class="alert-text">
92
-                                    {{success}}
93
-                                </span>
94
-                            </clr-alert-item>
95
-                        </clr-alert>
96
-                        <div class="card-block" >
97
-                            
98
-                            <div class="clr-row" style="padding-left:12px; padding-right:12px">
99
-                                <input [(ngModel)]="sendTo" type="text" placeholder="To address" class="clr-input clr-col-12" />
100
-                                <input [(ngModel)]="sendAmount" type="text" min="0" placeholder="Amount" class="clr-input clr-col-12" style="margin-top:12px; margin-borrom:12px" />
101
-                            </div>
102
-                        </div>
103
-                        <div class="card-footer" *ngIf="!sending" >
104
-                            <button class="btn btn-success-outline" (click)="createAndSendTx(sendTo, sendAmount)">send</button>
105
-                        </div>
106
-
107
-                    </div>
108
-                </div>
109
-
110
-            </div>
111
-            <!-- /Send Box -->
112
-
113
-        </div>
114
-        <!-- /left column -->
115
-        
116
-        <!-- right column -->
117
-        <div class="clr-col-12 clr-col-sm-12 clr-col-md-12 clr-col-lg-7 clr-col-xl-7" >
118
-            
119
-            <!-- Balance box -->
120
-            <div *ngIf="rootkey.publicExtendedKey != ''" class="card">
121
-                <div class="card-header" style="word-break: break-all">
122
-                    <span *ngIf="mode.net=='testnet'" class="label label-danger">Testnet</span>{{rootkey.publicExtendedKey}} 
123
-                </div>
124
-                <clr-alert *ngFor="let entry of alerts" [clrAlertType]="line.severity">
125
-                    <clr-alert-item>
126
-                        <span class="alert-text">
127
-                            {{line.message}}
128
-                        </span>
129
-                    </clr-alert-item>
130
-                </clr-alert>
131
-            
132
-                <div class="card-block">
133
-                    <h3 style="margin-top:12px">{{balanceDisplay.total | number: '1.8-18'}} BTC </h3>
134
-                    <p class="monospace">
135
-                        <span *ngIf="balanceDisplay.unconfirmed < 0">&nbsp;</span>{{balanceDisplay.confirmed | number: '1.18'}} BTC confirmed<br />
136
-                        {{balanceDisplay.unconfirmed | number: '1.18'}} BTC pending
137
-                    </p>
138
-                    <p *ngIf="mode.type=='private'">
139
-                        <clr-icon shape="key"></clr-icon> Private key available
140
-                    </p>
141
-                </div>
142
-                
143
-                <div class="card-footer clr-row" style="margin-left: 2px" >
144
-                        <button *ngIf="!autorefresh" class="btn btn-icon clr-col-4" (click)="reload()"> <clr-icon shape="refresh"></clr-icon> Reload </button>
145
-                        <clr-toggle-wrapper class="clr-col-auto clr-align-self-center">
146
-                            <input type="checkbox" clrToggle [(ngModel)]="autorefresh" />
147
-                            <label>Autorefresh</label>
148
-                        </clr-toggle-wrapper>
149
-                </div>
150
-                
151
-            </div>
152
-            <!-- Balance box-->
153
-        
154
-        </div>
155
-        <!-- right column -->
156
-
157
-    </div>
158
-    <!-- /row wallet picker + send box + balance box -->
159
-
160
-
161
-
162
-    <!-- live-tx -->
163
-    <div class="clr-row" *ngIf="apiClientPlugin && transactions.length != 0" >
164
-        <div class="clr-col-12">
165
-            <div class="clr-all-12" style="padding-left:0px; padding-right: 0px">
166
-                <div class="card">
167
-                                        
168
-                    <div class="card-header">
169
-                        Live Transactions
170
-                    </div>
171
-                    <div class="card-block" >
172
-                        <table class="table table-compact">
173
-                            <thead>
174
-                                <tr>
175
-                                    <th>Hash</th>
176
-                                    <th>Amount</th>
177
-                                    <th>Status</th>
178
-                                    <th>To</th>
179
-                                    <th>From</th>
180
-                                </tr>
181
-                            </thead>
182
-                            <tbody>
183
-                                <tr *ngFor="let line of transactions">
184
-                                    <td style="word-break:break-all">{{line.hash}}</td>
185
-                                    <td>{{line.amount}}</td>
186
-                                    <td>{{line.status}}</td>
187
-                                    <td style="word-break:break-all">{{line.to}}</td>
188
-                                    <td style="word-break:break-all">{{line.from.join(', ')}}</td>
189
-                               </tr>
190
-                            </tbody>
191
-                        </table>            
192
-                    </div>
193