@bmfk/api 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1293 -2
  4. package/dist/apiServer/APIService.d.ts +125 -0
  5. package/dist/apiServer/APIService.js +769 -0
  6. package/dist/apiServer/BaseEndpoint.d.ts +90 -0
  7. package/dist/apiServer/BaseEndpoint.js +314 -0
  8. package/dist/apiServer/BaseService.d.ts +17 -0
  9. package/dist/apiServer/BaseService.js +39 -0
  10. package/dist/apiServer/DBService.d.ts +131 -0
  11. package/dist/apiServer/DBService.js +290 -0
  12. package/dist/apiServer/DocumentService.d.ts +9 -0
  13. package/dist/apiServer/DocumentService.js +65 -0
  14. package/dist/apiServer/LocalRequest.d.ts +3 -0
  15. package/dist/apiServer/LocalRequest.js +6 -0
  16. package/dist/apiServer/LogService.d.ts +78 -0
  17. package/dist/apiServer/LogService.js +349 -0
  18. package/dist/apiServer/MonitorService.d.ts +102 -0
  19. package/dist/apiServer/MonitorService.js +615 -0
  20. package/dist/apiServer/StatService.d.ts +4 -0
  21. package/dist/apiServer/StatService.js +10 -0
  22. package/dist/apiServer/TimeframeService.d.ts +28 -0
  23. package/dist/apiServer/TimeframeService.js +97 -0
  24. package/dist/apiServer/WebSocketServer.d.ts +39 -0
  25. package/dist/apiServer/WebSocketServer.js +173 -0
  26. package/dist/apiServer/db/IDBAdapter.d.ts +14 -0
  27. package/dist/apiServer/db/IDBAdapter.js +2 -0
  28. package/dist/apiServer/db/MysqlAdapter.d.ts +72 -0
  29. package/dist/apiServer/db/MysqlAdapter.js +869 -0
  30. package/dist/apiServer/db/PostgresAdapter.d.ts +41 -0
  31. package/dist/apiServer/db/PostgresAdapter.js +73 -0
  32. package/dist/apiServer/deployment/AccessConfigWizard.d.ts +5 -0
  33. package/dist/apiServer/deployment/AccessConfigWizard.js +254 -0
  34. package/dist/apiServer/deployment/Activate.d.ts +4 -0
  35. package/dist/apiServer/deployment/Activate.js +124 -0
  36. package/dist/apiServer/deployment/BackupManager.d.ts +33 -0
  37. package/dist/apiServer/deployment/BackupManager.js +174 -0
  38. package/dist/apiServer/deployment/Backups.d.ts +2 -0
  39. package/dist/apiServer/deployment/Backups.js +44 -0
  40. package/dist/apiServer/deployment/BlueGreenState.d.ts +31 -0
  41. package/dist/apiServer/deployment/BlueGreenState.js +150 -0
  42. package/dist/apiServer/deployment/Bundler.d.ts +12 -0
  43. package/dist/apiServer/deployment/Bundler.js +178 -0
  44. package/dist/apiServer/deployment/ConfigService.d.ts +203 -0
  45. package/dist/apiServer/deployment/ConfigService.js +195 -0
  46. package/dist/apiServer/deployment/Deploy.d.ts +4 -0
  47. package/dist/apiServer/deployment/Deploy.js +404 -0
  48. package/dist/apiServer/deployment/DeployKeyWizard.d.ts +2 -0
  49. package/dist/apiServer/deployment/DeployKeyWizard.js +84 -0
  50. package/dist/apiServer/deployment/Deployer.d.ts +13 -0
  51. package/dist/apiServer/deployment/Deployer.js +96 -0
  52. package/dist/apiServer/deployment/DeployerInit.d.ts +25 -0
  53. package/dist/apiServer/deployment/DeployerInit.js +214 -0
  54. package/dist/apiServer/deployment/DeployerService.d.ts +378 -0
  55. package/dist/apiServer/deployment/DeployerService.js +1553 -0
  56. package/dist/apiServer/deployment/HashPassword.d.ts +3 -0
  57. package/dist/apiServer/deployment/HashPassword.js +126 -0
  58. package/dist/apiServer/deployment/MigrateConfigsWizard.d.ts +1 -0
  59. package/dist/apiServer/deployment/MigrateConfigsWizard.js +202 -0
  60. package/dist/apiServer/deployment/MigrateProject.d.ts +31 -0
  61. package/dist/apiServer/deployment/MigrateProject.js +335 -0
  62. package/dist/apiServer/deployment/NginxHelper.d.ts +10 -0
  63. package/dist/apiServer/deployment/NginxHelper.js +111 -0
  64. package/dist/apiServer/deployment/Notifier.d.ts +30 -0
  65. package/dist/apiServer/deployment/Notifier.js +82 -0
  66. package/dist/apiServer/deployment/ProjectConfigWizard.d.ts +1 -0
  67. package/dist/apiServer/deployment/ProjectConfigWizard.js +148 -0
  68. package/dist/apiServer/deployment/Restore.d.ts +2 -0
  69. package/dist/apiServer/deployment/Restore.js +89 -0
  70. package/dist/apiServer/deployment/ReviewStore.d.ts +62 -0
  71. package/dist/apiServer/deployment/ReviewStore.js +186 -0
  72. package/dist/apiServer/deployment/SecretsInjector.d.ts +21 -0
  73. package/dist/apiServer/deployment/SecretsInjector.js +189 -0
  74. package/dist/apiServer/deployment/SetupConfigWizard.d.ts +1 -0
  75. package/dist/apiServer/deployment/SetupConfigWizard.js +238 -0
  76. package/dist/apiServer/deployment/Status.d.ts +2 -0
  77. package/dist/apiServer/deployment/Status.js +83 -0
  78. package/dist/apiServer/deployment/TelegramNotifier.d.ts +8 -0
  79. package/dist/apiServer/deployment/TelegramNotifier.js +23 -0
  80. package/dist/apiServer/deployment/Watchdog.d.ts +15 -0
  81. package/dist/apiServer/deployment/Watchdog.js +65 -0
  82. package/dist/apiServer/deployment/Wizards.d.ts +1 -0
  83. package/dist/apiServer/deployment/Wizards.js +83 -0
  84. package/dist/apiServer/deployment/cli.d.ts +2 -0
  85. package/dist/apiServer/deployment/cli.js +224 -0
  86. package/dist/apiServer/deployment/cliCommon.d.ts +27 -0
  87. package/dist/apiServer/deployment/cliCommon.js +110 -0
  88. package/dist/apiServer/deployment/cliPrompt.d.ts +5 -0
  89. package/dist/apiServer/deployment/cliPrompt.js +38 -0
  90. package/dist/apiServer/deployment/resolveConfig.d.ts +19 -0
  91. package/dist/apiServer/deployment/resolveConfig.js +139 -0
  92. package/dist/apiServer/documentation/Documentation.d.ts +18 -0
  93. package/dist/apiServer/documentation/Documentation.js +143 -0
  94. package/dist/apiServer/documentation/index.html +460 -0
  95. package/dist/apiServer/external/MicroserviceClient.d.ts +28 -0
  96. package/dist/apiServer/external/MicroserviceClient.js +144 -0
  97. package/dist/apiServer/external/MicroserviceHost.d.ts +52 -0
  98. package/dist/apiServer/external/MicroserviceHost.js +183 -0
  99. package/dist/apiServer/external/MicroserviceHostController.d.ts +6 -0
  100. package/dist/apiServer/external/MicroserviceHostController.js +65 -0
  101. package/dist/apiServer/helper/AppDataPath.d.ts +9 -0
  102. package/dist/apiServer/helper/AppDataPath.js +81 -0
  103. package/dist/apiServer/helper/ClientIp.d.ts +3 -0
  104. package/dist/apiServer/helper/ClientIp.js +33 -0
  105. package/dist/apiServer/helper/DataProvider.d.ts +18 -0
  106. package/dist/apiServer/helper/DataProvider.js +57 -0
  107. package/dist/apiServer/helper/IpAllowList.d.ts +8 -0
  108. package/dist/apiServer/helper/IpAllowList.js +40 -0
  109. package/dist/apiServer/helper/JSONStableStringify.d.ts +1 -0
  110. package/dist/apiServer/helper/JSONStableStringify.js +15 -0
  111. package/dist/apiServer/helper/PasswordHash.d.ts +5 -0
  112. package/dist/apiServer/helper/PasswordHash.js +52 -0
  113. package/dist/apiServer/helper/Sleep.d.ts +1 -0
  114. package/dist/apiServer/helper/Sleep.js +5 -0
  115. package/dist/apiServer/helper/Trace.d.ts +8 -0
  116. package/dist/apiServer/helper/Trace.js +30 -0
  117. package/dist/apiServer/helper/UID.d.ts +16 -0
  118. package/dist/apiServer/helper/UID.js +98 -0
  119. package/dist/apiServer/helper/Validator.d.ts +86 -0
  120. package/dist/apiServer/helper/Validator.js +560 -0
  121. package/dist/apiServer/helper/YYYYMMDDHH.d.ts +2 -0
  122. package/dist/apiServer/helper/YYYYMMDDHH.js +31 -0
  123. package/dist/apiServer/helper/ZipUtils.d.ts +6 -0
  124. package/dist/apiServer/helper/ZipUtils.js +28 -0
  125. package/dist/apiServer/http/Http.d.ts +183 -0
  126. package/dist/apiServer/http/Http.js +627 -0
  127. package/dist/apiServer/interceptors/InterceptorPayAuth.d.ts +19 -0
  128. package/dist/apiServer/interceptors/InterceptorPayAuth.js +124 -0
  129. package/dist/apiServer/interceptors/InterceptorSignedAuth.d.ts +40 -0
  130. package/dist/apiServer/interceptors/InterceptorSignedAuth.js +150 -0
  131. package/dist/apiServer/monitor/AccessStore.d.ts +27 -0
  132. package/dist/apiServer/monitor/AccessStore.js +163 -0
  133. package/dist/apiServer/monitor/LogFiles.d.ts +34 -0
  134. package/dist/apiServer/monitor/LogFiles.js +109 -0
  135. package/dist/apiServer/monitor/Monitor.d.ts +54 -0
  136. package/dist/apiServer/monitor/Monitor.js +447 -0
  137. package/dist/apiServer/monitor/MonitorAuth.d.ts +87 -0
  138. package/dist/apiServer/monitor/MonitorAuth.js +474 -0
  139. package/dist/apiServer/monitor/ProcessMonitor.d.ts +177 -0
  140. package/dist/apiServer/monitor/ProcessMonitor.js +468 -0
  141. package/dist/apiServer/monitor/SystemInfo.d.ts +70 -0
  142. package/dist/apiServer/monitor/SystemInfo.js +217 -0
  143. package/dist/apiServer/monitor/ThreatMonitor.d.ts +73 -0
  144. package/dist/apiServer/monitor/ThreatMonitor.js +239 -0
  145. package/dist/apiServer/monitor/index.html +591 -0
  146. package/dist/apiServer/review/Review.d.ts +23 -0
  147. package/dist/apiServer/review/Review.js +149 -0
  148. package/dist/apiServer/review/ReviewAuth.d.ts +56 -0
  149. package/dist/apiServer/review/ReviewAuth.js +147 -0
  150. package/dist/apiServer/review/ReviewDiff.d.ts +43 -0
  151. package/dist/apiServer/review/ReviewDiff.js +175 -0
  152. package/dist/apiServer/review/index.html +501 -0
  153. package/dist/apiServer/routes/Liveness.d.ts +7 -0
  154. package/dist/apiServer/routes/Liveness.js +27 -0
  155. package/dist/apiServer/routes/Readiness.d.ts +13 -0
  156. package/dist/apiServer/routes/Readiness.js +20 -0
  157. package/dist/apiServer/security/BlockedIps.d.ts +46 -0
  158. package/dist/apiServer/security/BlockedIps.js +185 -0
  159. package/dist/apiServer/structures/DefaultErrors.d.ts +36 -0
  160. package/dist/apiServer/structures/DefaultErrors.js +52 -0
  161. package/dist/apiServer/structures/HTTPStatus.d.ts +7 -0
  162. package/dist/apiServer/structures/HTTPStatus.js +11 -0
  163. package/dist/apiServer/structures/Interfaces.d.ts +55 -0
  164. package/dist/apiServer/structures/Interfaces.js +2 -0
  165. package/dist/index.d.ts +45 -0
  166. package/dist/index.js +110 -0
  167. package/dist/signal/Signal.d.ts +23 -0
  168. package/dist/signal/Signal.js +85 -0
  169. package/package.json +88 -4
@@ -0,0 +1,501 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="referrer" content="no-referrer">
7
+ <title>{{title}}</title>
8
+ <style>
9
+ :root {
10
+ --bg: #f5f6f8; --card: #ffffff; --text: #1b1f24; --muted: #5f6b7a; --line: #dfe3e8;
11
+ --accent: #2457d6; --ok: #1d7a46; --ok-bg: #e6f4ec; --bad: #b42318; --bad-bg: #fdecea;
12
+ --warn: #8a5a00; --warn-bg: #fff4dc; --code: #f0f2f5;
13
+ }
14
+ @media (prefers-color-scheme: dark) {
15
+ :root {
16
+ --bg: #111418; --card: #1a1f25; --text: #e6e9ed; --muted: #9aa5b1; --line: #2c333b;
17
+ --accent: #6d95ff; --ok: #5cc98b; --ok-bg: #16301f; --bad: #ff8a80; --bad-bg: #3a1d1b;
18
+ --warn: #ffcc66; --warn-bg: #3a2e12; --code: #232a32;
19
+ }
20
+ }
21
+ * { box-sizing: border-box; }
22
+ body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
23
+ main { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
24
+ h1 { font-size: 20px; margin: 0 0 4px; }
25
+ h2 { font-size: 15px; margin: 24px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
26
+ .sub { color: var(--muted); margin: 0 0 24px; }
27
+ .card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
28
+ .card + .card { margin-top: 16px; }
29
+ label { display: block; font-weight: 600; margin: 14px 0 6px; }
30
+ input { width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
31
+ input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
32
+ .hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
33
+ button { font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
34
+ button:disabled { opacity: .55; cursor: default; }
35
+ .primary { background: var(--accent); color: #fff; }
36
+ .accept { background: var(--ok); color: #fff; }
37
+ .decline { background: transparent; color: var(--bad); border-color: var(--bad); }
38
+ .row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
39
+ .msg { margin-top: 14px; padding: 10px 12px; border-radius: 8px; display: none; }
40
+ .msg.show { display: block; }
41
+ .msg.err { background: var(--bad-bg); color: var(--bad); }
42
+ .msg.ok { background: var(--ok-bg); color: var(--ok); }
43
+ .msg.warn { background: var(--warn-bg); color: var(--warn); }
44
+ dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
45
+ dt { color: var(--muted); }
46
+ dd { margin: 0; overflow-wrap: anywhere; }
47
+ code { background: var(--code); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
48
+ .qr { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; margin: 12px 0; }
49
+ .qr svg { width: 100%; height: 100%; display: block; }
50
+ .secret { font-family: ui-monospace, Menlo, monospace; letter-spacing: .06em; word-break: break-all; }
51
+ .badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; }
52
+ .b-wait { background: var(--code); color: var(--muted); }
53
+ .b-accept { background: var(--ok-bg); color: var(--ok); }
54
+ .b-decline { background: var(--bad-bg); color: var(--bad); }
55
+ ul.reviewers { list-style: none; padding: 0; margin: 0; }
56
+ ul.reviewers li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
57
+ ul.reviewers li:last-child { border-bottom: 0; }
58
+ .hidden { display: none !important; }
59
+ .summary { margin: 0 0 12px; }
60
+ .counts span { margin-right: 14px; font-weight: 600; }
61
+ .c-add { color: var(--ok); } .c-del { color: var(--bad); } .c-mod { color: var(--warn); }
62
+ table.deps { width: 100%; border-collapse: collapse; margin: 8px 0 4px; font-size: 14px; }
63
+ table.deps td, table.deps th { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
64
+ table.deps th { color: var(--muted); font-weight: 600; }
65
+ details.file { border-top: 1px solid var(--line); }
66
+ details.file summary { cursor: pointer; padding: 8px 0; display: flex; gap: 10px; align-items: baseline; list-style: none; }
67
+ details.file summary::-webkit-details-marker { display: none; }
68
+ details.file summary .p { font-family: ui-monospace, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; flex: 1; }
69
+ details.file summary .tag { font-size: 12px; font-weight: 700; min-width: 70px; }
70
+ details.file summary .note { color: var(--muted); font-size: 12px; white-space: nowrap; }
71
+ pre.diff { margin: 0 0 12px; padding: 8px 0; background: var(--code); border-radius: 6px; overflow-x: auto; font: 12px/1.45 ui-monospace, Menlo, monospace; }
72
+ pre.diff div { padding: 0 10px; white-space: pre; }
73
+ pre.diff .add { background: var(--ok-bg); color: var(--ok); }
74
+ pre.diff .del { background: var(--bad-bg); color: var(--bad); }
75
+ pre.diff .hunk { color: var(--accent); }
76
+ pre.diff .meta { color: var(--muted); }
77
+ @media (max-width: 520px) { dl { grid-template-columns: 1fr; } dt { margin-top: 6px; } }
78
+ </style>
79
+ </head>
80
+ <body>
81
+ <main>
82
+ <h1>Deploy review</h1>
83
+ <p class="sub" id="subtitle">Checking your link…</p>
84
+
85
+ <!-- link problem -->
86
+ <section class="card hidden" id="v-invalid">
87
+ <p id="invalid-text"></p>
88
+ </section>
89
+
90
+ <!-- sign in -->
91
+ <section class="card hidden" id="v-login">
92
+ <form id="f-login" autocomplete="on">
93
+ <label for="login">Reviewer login</label>
94
+ <input id="login" name="username" autocomplete="username" required>
95
+ <label for="password">Password</label>
96
+ <input id="password" name="password" type="password" autocomplete="current-password" required>
97
+ <label for="totp">2FA code</label>
98
+ <input id="totp" name="totp" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" placeholder="123456">
99
+ <div class="hint">Leave empty on your first sign-in — you'll set up 2FA next.</div>
100
+ <div class="row"><button class="primary" type="submit" id="b-login">Sign in</button></div>
101
+ <div class="msg err" id="login-msg"></div>
102
+ </form>
103
+ </section>
104
+
105
+ <!-- 2FA enrollment -->
106
+ <section class="card hidden" id="v-enroll">
107
+ <p>Set up two-factor authentication. Scan this code with Google Authenticator, 1Password, Authy or a similar app:</p>
108
+ <div class="qr" id="qr"></div>
109
+ <div class="hint">Can't scan? Enter this key manually:</div>
110
+ <p class="secret" id="secret"></p>
111
+ <form id="f-enroll">
112
+ <label for="enroll-code">Code from the app</label>
113
+ <input id="enroll-code" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required placeholder="123456">
114
+ <div class="row"><button class="primary" type="submit" id="b-enroll">Confirm</button></div>
115
+ <div class="msg err" id="enroll-msg"></div>
116
+ </form>
117
+ </section>
118
+
119
+ <!-- the review -->
120
+ <section class="hidden" id="v-review">
121
+ <div class="card">
122
+ <dl>
123
+ <dt>Project</dt><dd id="r-project"></dd>
124
+ <dt>Uploaded by</dt><dd id="r-uploader"></dd>
125
+ <dt>Uploaded</dt><dd id="r-uploaded"></dd>
126
+ <dt>Decide before</dt><dd id="r-expires"></dd>
127
+ <dt>Archive</dt><dd id="r-archive"></dd>
128
+ <dt>Approval</dt><dd id="r-mode"></dd>
129
+ </dl>
130
+ </div>
131
+
132
+ <h2>Reviewers</h2>
133
+ <div class="card"><ul class="reviewers" id="r-reviewers"></ul></div>
134
+
135
+ <h2>Changes</h2>
136
+ <div class="card" id="r-changes"><p class="hint">Comparing with the last deployed version…</p></div>
137
+
138
+ <div class="card" id="r-actions">
139
+ <p id="r-question">Deploy this version?</p>
140
+ <div class="row">
141
+ <button class="accept" id="b-accept">Accept and deploy</button>
142
+ <button class="decline" id="b-decline">Decline</button>
143
+ </div>
144
+ </div>
145
+ <div class="msg" id="r-msg"></div>
146
+ </section>
147
+ </main>
148
+
149
+ <script>
150
+ (function () {
151
+ "use strict";
152
+ var HOST = "{{host}}";
153
+
154
+ // ---- QR (byte mode, ECC M) ----
155
+ function qrMatrix(text, forcedMask) {
156
+ var ECC = [-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28];
157
+ var BLOCKS = [-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49];
158
+ var bytes = Array.from(new TextEncoder().encode(text));
159
+ function rawModules(v) { var r = (16 * v + 128) * v + 64; if (v >= 2) { var n = Math.floor(v / 7) + 2; r -= (25 * n - 10) * n - 55; if (v >= 7) r -= 36; } return r; }
160
+ function dataCodewords(v) { return Math.floor(rawModules(v) / 8) - ECC[v] * BLOCKS[v]; }
161
+ var ver = 1;
162
+ for (; ver <= 40; ver++) if (4 + (ver < 10 ? 8 : 16) + bytes.length * 8 <= dataCodewords(ver) * 8) break;
163
+ if (ver > 40) throw new Error("text too long for a QR code");
164
+ var size = ver * 4 + 17;
165
+
166
+ // data bits
167
+ var bits = [];
168
+ function put(val, len) { for (var i = len - 1; i >= 0; i--) bits.push((val >>> i) & 1); }
169
+ put(4, 4); put(bytes.length, ver < 10 ? 8 : 16); bytes.forEach(function (b) { put(b, 8); });
170
+ var cap = dataCodewords(ver) * 8;
171
+ put(0, Math.min(4, cap - bits.length));
172
+ put(0, (8 - bits.length % 8) % 8);
173
+ for (var pad = 0xEC; bits.length < cap; pad ^= 0xEC ^ 0x11) put(pad, 8);
174
+ var data = [];
175
+ for (var i = 0; i < bits.length; i += 8) { var b = 0; for (var j = 0; j < 8; j++) b = (b << 1) | bits[i + j]; data.push(b); }
176
+
177
+ // Reed–Solomon over GF(256), polynomial 0x11D
178
+ function mul(x, y) { var z = 0; for (var i = 7; i >= 0; i--) { z = (z << 1) ^ ((z >>> 7) * 0x11D); z ^= ((y >>> i) & 1) * x; } return z & 0xFF; }
179
+ function divisor(deg) { var r = []; for (var i = 0; i < deg - 1; i++) r.push(0); r.push(1); var root = 1;
180
+ for (var i = 0; i < deg; i++) { for (var j = 0; j < r.length; j++) { r[j] = mul(r[j], root); if (j + 1 < r.length) r[j] ^= r[j + 1]; } root = mul(root, 2); } return r; }
181
+ function remainder(d, div) { var r = div.map(function () { return 0; });
182
+ d.forEach(function (b) { var f = b ^ r.shift(); r.push(0); div.forEach(function (c, i) { r[i] ^= mul(c, f); }); }); return r; }
183
+ var nb = BLOCKS[ver], el = ECC[ver], raw = Math.floor(rawModules(ver) / 8);
184
+ var nShort = nb - raw % nb, shortLen = Math.floor(raw / nb), div = divisor(el), blocks = [];
185
+ for (var i = 0, k = 0; i < nb; i++) {
186
+ var dat = data.slice(k, k + shortLen - el + (i < nShort ? 0 : 1)); k += dat.length;
187
+ var ecc = remainder(dat, div); if (i < nShort) dat.push(0); blocks.push(dat.concat(ecc));
188
+ }
189
+ var words = [];
190
+ for (var i = 0; i < blocks[0].length; i++) for (var j = 0; j < blocks.length; j++)
191
+ if (i !== shortLen - el || j >= nShort) words.push(blocks[j][i]);
192
+
193
+ // function patterns
194
+ var m = [], fn = [];
195
+ for (var y = 0; y < size; y++) { m.push(new Array(size).fill(false)); fn.push(new Array(size).fill(false)); }
196
+ function set(x, y, dark) { m[y][x] = dark; fn[y][x] = true; }
197
+ for (var i = 0; i < size; i++) { set(6, i, i % 2 === 0); set(i, 6, i % 2 === 0); }
198
+ function finder(cx, cy) { for (var dy = -4; dy <= 4; dy++) for (var dx = -4; dx <= 4; dx++) {
199
+ var d = Math.max(Math.abs(dx), Math.abs(dy)), x = cx + dx, y = cy + dy;
200
+ if (x >= 0 && x < size && y >= 0 && y < size) set(x, y, d !== 2 && d !== 4); } }
201
+ finder(3, 3); finder(size - 4, 3); finder(3, size - 4);
202
+ var align = [];
203
+ if (ver > 1) { var na = Math.floor(ver / 7) + 2, step = Math.floor((ver * 8 + na * 3 + 5) / (na * 4 - 4)) * 2;
204
+ align = [6]; for (var p = size - 7; align.length < na; p -= step) align.splice(1, 0, p); }
205
+ for (var i = 0; i < align.length; i++) for (var j = 0; j < align.length; j++) {
206
+ if ((i === 0 && j === 0) || (i === 0 && j === align.length - 1) || (i === align.length - 1 && j === 0)) continue;
207
+ for (var dy = -2; dy <= 2; dy++) for (var dx = -2; dx <= 2; dx++) set(align[i] + dx, align[j] + dy, Math.max(Math.abs(dx), Math.abs(dy)) !== 1);
208
+ }
209
+ function format(mask) {
210
+ var d = (0 << 3) | mask, r = d; // error correction M = 00
211
+ for (var i = 0; i < 10; i++) r = (r << 1) ^ ((r >>> 9) * 0x537);
212
+ var b = ((d << 10) | r) ^ 0x5412, bit = function (i) { return ((b >>> i) & 1) !== 0; };
213
+ for (var i = 0; i <= 5; i++) set(8, i, bit(i));
214
+ set(8, 7, bit(6)); set(8, 8, bit(7)); set(7, 8, bit(8));
215
+ for (var i = 9; i < 15; i++) set(14 - i, 8, bit(i));
216
+ for (var i = 0; i < 8; i++) set(size - 1 - i, 8, bit(i));
217
+ for (var i = 8; i < 15; i++) set(8, size - 15 + i, bit(i));
218
+ set(8, size - 8, true);
219
+ }
220
+ format(0);
221
+ if (ver >= 7) { var r = ver; for (var i = 0; i < 12; i++) r = (r << 1) ^ ((r >>> 11) * 0x1F25);
222
+ var vb = (ver << 12) | r;
223
+ for (var i = 0; i < 18; i++) { var bit = ((vb >>> i) & 1) !== 0, a = size - 11 + i % 3, c = Math.floor(i / 3); set(a, c, bit); set(c, a, bit); } }
224
+
225
+ // data placement (zigzag)
226
+ var bi = 0;
227
+ for (var right = size - 1; right >= 1; right -= 2) {
228
+ if (right === 6) right = 5;
229
+ for (var vert = 0; vert < size; vert++) for (var j = 0; j < 2; j++) {
230
+ var x = right - j, up = ((right + 1) & 2) === 0, y = up ? size - 1 - vert : vert;
231
+ if (!fn[y][x] && bi < words.length * 8) { m[y][x] = ((words[bi >>> 3] >>> (7 - (bi & 7))) & 1) !== 0; bi++; }
232
+ }
233
+ }
234
+
235
+ function applyMask(k) { for (var y = 0; y < size; y++) for (var x = 0; x < size; x++) {
236
+ var inv;
237
+ switch (k) { case 0: inv = (x + y) % 2 === 0; break; case 1: inv = y % 2 === 0; break; case 2: inv = x % 3 === 0; break;
238
+ case 3: inv = (x + y) % 3 === 0; break; case 4: inv = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 === 0; break;
239
+ case 5: inv = x * y % 2 + x * y % 3 === 0; break; case 6: inv = (x * y % 2 + x * y % 3) % 2 === 0; break;
240
+ default: inv = ((x + y) % 2 + x * y % 3) % 2 === 0; }
241
+ if (!fn[y][x] && inv) m[y][x] = !m[y][x]; } }
242
+ function penalty() {
243
+ var score = 0;
244
+ function addHist(len, h) { if (h[0] === 0) len += size; h.pop(); h.unshift(len); }
245
+ function count(h) { var n = h[1], core = n > 0 && h[2] === n && h[3] === n * 3 && h[4] === n && h[5] === n;
246
+ return (core && h[0] >= n * 4 && h[6] >= n ? 1 : 0) + (core && h[6] >= n * 4 && h[0] >= n ? 1 : 0); }
247
+ function terminate(color, len, h) { if (color) { addHist(len, h); len = 0; } len += size; addHist(len, h); return count(h); }
248
+ for (var pass = 0; pass < 2; pass++) for (var a = 0; a < size; a++) {
249
+ var color = false, run = 0, h = [0, 0, 0, 0, 0, 0, 0];
250
+ for (var b = 0; b < size; b++) {
251
+ var cell = pass === 0 ? m[a][b] : m[b][a];
252
+ if (cell === color) { run++; if (run === 5) score += 3; else if (run > 5) score++; }
253
+ else { addHist(run, h); if (!color) score += count(h) * 40; color = cell; run = 1; }
254
+ }
255
+ score += terminate(color, run, h) * 40;
256
+ }
257
+ for (var y = 0; y < size - 1; y++) for (var x = 0; x < size - 1; x++) {
258
+ var c = m[y][x]; if (c === m[y][x + 1] && c === m[y + 1][x] && c === m[y + 1][x + 1]) score += 3; }
259
+ var dark = 0; m.forEach(function (row) { row.forEach(function (c) { if (c) dark++; }); });
260
+ var total = size * size;
261
+ score += (Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1) * 10;
262
+ return score;
263
+ }
264
+ var best = forcedMask, min = Infinity;
265
+ if (best === undefined) for (var k = 0; k < 8; k++) { applyMask(k); format(k); var p = penalty(); if (p < min) { min = p; best = k; } applyMask(k); }
266
+ applyMask(best); format(best);
267
+ return { size: size, version: ver, mask: best, modules: m };
268
+ }
269
+
270
+ function qrSvg(text) {
271
+ var q = qrMatrix(text), b = 4, n = q.size + b * 2, d = "";
272
+ for (var y = 0; y < q.size; y++) for (var x = 0; x < q.size; x++) if (q.modules[y][x]) d += "M" + (x + b) + " " + (y + b) + "h1v1h-1z";
273
+ return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ' + n + " " + n + '" shape-rendering="crispEdges"><rect width="100%" height="100%" fill="#fff"/><path d="' + d + '" fill="#000"/></svg>';
274
+ }
275
+
276
+
277
+ // The link token travels in the URL fragment, which never reaches a server or a log.
278
+ // Keep it in memory and take it out of the address bar.
279
+ var linkToken = decodeURIComponent((location.hash || "").replace(/^#/, ""));
280
+ if (linkToken) history.replaceState(null, "", location.pathname + location.search);
281
+ var session = null, enrollmentToken = null, pollTimer = null, info = null;
282
+
283
+ function $(id) { return document.getElementById(id); }
284
+ function show(id) { ["v-invalid", "v-login", "v-enroll", "v-review"].forEach(function (v) { $(v).classList.toggle("hidden", v !== id); }); }
285
+ function text(id, value) { $(id).textContent = value == null ? "" : String(value); }
286
+ function msg(id, kind, value) { var el = $(id); el.className = "msg " + (value ? "show " + kind : ""); el.textContent = value || ""; }
287
+ function when(ms) { return ms ? new Date(ms).toLocaleString() : "—"; }
288
+ function size(n) { return n > 1048576 ? (n / 1048576).toFixed(1) + " MB" : Math.max(1, Math.round(n / 1024)) + " KB"; }
289
+
290
+ function api(endpoint, body) {
291
+ var headers = { "Content-Type": "application/json" };
292
+ if (session) headers.Authorization = "Bearer " + session;
293
+ return fetch(HOST + endpoint, { method: "POST", headers: headers, body: JSON.stringify(body || {}), credentials: "omit", cache: "no-store" })
294
+ .then(function (r) { return r.json().catch(function () { return { error: { details: "Unexpected response (HTTP " + r.status + ")" } }; }); })
295
+ .then(function (j) {
296
+ if (j && j.error) { var e = new Error(j.error.details || j.error.message || "Request failed"); e.status = j.error.httpStatus; throw e; }
297
+ return j ? j.data : null;
298
+ });
299
+ }
300
+
301
+ function invalid(message) {
302
+ text("subtitle", "");
303
+ text("invalid-text", message);
304
+ show("v-invalid");
305
+ }
306
+
307
+ var STATE_TEXT = {
308
+ deploying: "Approved — deploying now…",
309
+ deployed: "Deployed.",
310
+ failed: "The deploy failed.",
311
+ declined: "Declined — the uploaded archive was deleted.",
312
+ expired: "Nobody decided in time — the upload was removed."
313
+ };
314
+
315
+ function start() {
316
+ if (!linkToken) return invalid("Open the link from your email. For your safety the page forgets it after loading, so reloading needs the link again.");
317
+ api("info", { token: linkToken }).then(function (d) {
318
+ info = d;
319
+ text("subtitle", d.project + " — uploaded by " + d.uploadedBy);
320
+ if (d.state !== "pending") {
321
+ invalid((STATE_TEXT[d.state] || d.state) + (d.result && d.result.message ? " " + d.result.message : ""));
322
+ return;
323
+ }
324
+ $("login").value = d.reviewer || "";
325
+ show("v-login");
326
+ ($("login").value ? $("password") : $("login")).focus();
327
+ }).catch(function (e) { invalid(e.message); });
328
+ }
329
+
330
+ $("f-login").addEventListener("submit", function (ev) {
331
+ ev.preventDefault();
332
+ msg("login-msg");
333
+ $("b-login").disabled = true;
334
+ api("login", { token: linkToken, login: $("login").value.trim(), password: $("password").value, totp: $("totp").value.trim() || undefined })
335
+ .then(function (d) {
336
+ $("password").value = "";
337
+ if (d.enrollmentRequired) {
338
+ enrollmentToken = d.enrollmentToken;
339
+ $("qr").innerHTML = qrSvg(d.otpauthUri); // generated locally from data we trust; no user text
340
+ text("secret", d.secret.replace(/(.{4})/g, "$1 ").trim());
341
+ show("v-enroll");
342
+ $("enroll-code").focus();
343
+ return;
344
+ }
345
+ session = d.token;
346
+ loadReview();
347
+ })
348
+ .catch(function (e) { msg("login-msg", "err", e.message); })
349
+ .then(function () { $("b-login").disabled = false; });
350
+ });
351
+
352
+ $("f-enroll").addEventListener("submit", function (ev) {
353
+ ev.preventDefault();
354
+ msg("enroll-msg");
355
+ $("b-enroll").disabled = true;
356
+ api("enroll2fa", { enrollmentToken: enrollmentToken, totp: $("enroll-code").value.trim() })
357
+ .then(function (d) { session = d.token; enrollmentToken = null; $("qr").innerHTML = ""; text("secret", ""); loadReview(); })
358
+ .catch(function (e) { msg("enroll-msg", "err", e.message); })
359
+ .then(function () { $("b-enroll").disabled = false; });
360
+ });
361
+
362
+ function render(d) {
363
+ text("r-project", d.project);
364
+ text("r-uploader", d.uploadedBy);
365
+ text("r-uploaded", when(d.uploadedAt));
366
+ text("r-expires", when(d.expiresAt));
367
+ $("r-archive").innerHTML = "";
368
+ var c = document.createElement("code"); c.textContent = d.sha256.slice(0, 16) + "…";
369
+ c.title = "SHA-256 " + d.sha256;
370
+ $("r-archive").append(size(d.size) + ", ", c);
371
+ text("r-mode", d.mode === "all" ? "every reviewer must accept" : "one accept is enough");
372
+
373
+ var list = $("r-reviewers"); list.innerHTML = "";
374
+ d.reviewers.forEach(function (r) {
375
+ var li = document.createElement("li"), name = document.createElement("span"), badge = document.createElement("span");
376
+ name.textContent = r.login + (r.login === d.you ? " (you)" : "");
377
+ badge.className = "badge " + (r.decision === "accept" ? "b-accept" : r.decision === "decline" ? "b-decline" : "b-wait");
378
+ badge.textContent = r.decision ? r.decision + "ed " + when(r.at) : "waiting";
379
+ li.append(name, badge); list.append(li);
380
+ });
381
+
382
+ var mine = d.reviewers.filter(function (r) { return r.login === d.you; })[0];
383
+ var canDecide = d.state === "pending" && mine && !mine.decision;
384
+ $("r-actions").classList.toggle("hidden", !canDecide);
385
+
386
+ if (d.state === "pending" && mine && mine.decision === "accept")
387
+ msg("r-msg", "warn", "You accepted. Waiting for the other reviewers.");
388
+ else if (d.state === "deploying") msg("r-msg", "warn", STATE_TEXT.deploying);
389
+ else if (d.state === "deployed") msg("r-msg", "ok", (d.result && d.result.message) || STATE_TEXT.deployed);
390
+ else if (d.state === "failed") msg("r-msg", "err", STATE_TEXT.failed + (d.result ? " " + d.result.message : ""));
391
+ else if (d.state === "declined" || d.state === "expired") msg("r-msg", "err", STATE_TEXT[d.state] + (d.result ? " " + d.result.message : ""));
392
+ else msg("r-msg");
393
+
394
+ clearTimeout(pollTimer);
395
+ if (d.state === "deploying") pollTimer = setTimeout(loadReview, 3000);
396
+ }
397
+
398
+ var diffLoaded = false;
399
+ function loadReview() {
400
+ return api("details").then(function (d) {
401
+ show("v-review"); render(d);
402
+ if (!diffLoaded && d.state === "pending") {
403
+ diffLoaded = true;
404
+ api("diff").then(renderDiff).catch(function (e) { setChanges(note(e.message)); });
405
+ }
406
+ }).catch(sessionLost);
407
+ }
408
+
409
+ function el(tag, cls, value) { var e = document.createElement(tag); if (cls) e.className = cls; if (value != null) e.textContent = String(value); return e; }
410
+ function note(value) { return el("p", "hint", value); }
411
+ function setChanges() { var box = $("r-changes"); box.innerHTML = ""; for (var i = 0; i < arguments.length; i++) box.append(arguments[i]); }
412
+
413
+ var KIND_NOTE = { binary: "binary file", sensitive: "content hidden — sensitive file", large: "too large to show", symlink: "symlink" };
414
+ function renderDiff(d) {
415
+ if (d.unavailable) return setChanges(note(d.unavailable));
416
+ var parts = [];
417
+ var head = el("p", "summary");
418
+ if (d.baseline) head.textContent = "Compared with the last deployed version" + (d.baseline.version ? " " + d.baseline.version : "") + " (" + when(d.baseline.at) + ").";
419
+ else head.textContent = "This is the first reviewed deploy of the project — there is no earlier version to compare with, so every file is listed as added.";
420
+ parts.push(head);
421
+
422
+ var v = el("p");
423
+ v.append("Version: ", el("code", null, d.versionBefore || "—"), " → ", el("code", null, d.versionAfter || "—"));
424
+ parts.push(v);
425
+
426
+ var add = 0, del = 0, mod = 0;
427
+ d.files.forEach(function (f) { if (f.status === "added") add++; else if (f.status === "removed") del++; else mod++; });
428
+ var counts = el("p", "counts");
429
+ counts.append(el("span", "c-add", "+" + add + " added"), el("span", "c-del", "−" + del + " removed"), el("span", "c-mod", "~" + mod + " changed"), el("span", "hint", d.unchanged + " unchanged"));
430
+ parts.push(counts);
431
+ if (d.limited) parts.push(el("div", "msg show warn", d.limited));
432
+
433
+ if (d.dependencies.length) {
434
+ var t = el("table", "deps"), hr = el("tr");
435
+ ["Dependency", "Before", "After"].forEach(function (h) { hr.append(el("th", null, h)); });
436
+ t.append(hr);
437
+ d.dependencies.forEach(function (x) {
438
+ var tr = el("tr");
439
+ tr.append(el("td", null, x.name + (x.section !== "dependencies" ? " (" + x.section + ")" : "")),
440
+ el("td", x.before ? null : "c-add", x.before || "added"),
441
+ el("td", x.after ? null : "c-del", x.after || "removed"));
442
+ t.append(tr);
443
+ });
444
+ parts.push(el("h2", null, "Dependencies"), t);
445
+ }
446
+
447
+ if (d.files.length) parts.push(el("h2", null, "Files"));
448
+ d.files.forEach(function (f) {
449
+ var det = el("details", "file"), sum = el("summary");
450
+ var tagCls = f.status === "added" ? "c-add" : f.status === "removed" ? "c-del" : "c-mod";
451
+ sum.append(el("span", "tag " + tagCls, f.status), el("span", "p", f.path));
452
+ var sizes = f.sizeBefore != null && f.sizeAfter != null ? size(f.sizeBefore) + " → " + size(f.sizeAfter) : size(f.sizeAfter != null ? f.sizeAfter : f.sizeBefore || 0);
453
+ sum.append(el("span", "note", (KIND_NOTE[f.kind] ? KIND_NOTE[f.kind] + " · " : "") + sizes));
454
+ det.append(sum);
455
+ if (f.diff) {
456
+ var pre = el("pre", "diff");
457
+ f.diff.split("\n").forEach(function (line, i, all) {
458
+ if (i === all.length - 1 && line === "") return;
459
+ var cls = line.indexOf("@@") === 0 ? "hunk" : (line.indexOf("+++") === 0 || line.indexOf("---") === 0) ? "meta" : line[0] === "+" ? "add" : line[0] === "-" ? "del" : null;
460
+ pre.append(el("div", cls, line || " "));
461
+ });
462
+ det.append(pre);
463
+ if (f.truncated) det.append(note("The diff of this file is cut short."));
464
+ } else {
465
+ det.append(note(KIND_NOTE[f.kind] ? "No line-by-line view: " + KIND_NOTE[f.kind] + "." : "No content to show."));
466
+ }
467
+ parts.push(det);
468
+ });
469
+ if (!d.files.length) parts.push(note("No file differs from the last deployed version."));
470
+ setChanges.apply(null, parts);
471
+ }
472
+
473
+ function sessionLost(e) {
474
+ if (e.status === 401) {
475
+ session = null;
476
+ show("v-login");
477
+ msg("login-msg", "err", e.message);
478
+ } else {
479
+ msg("r-msg", "err", e.message);
480
+ }
481
+ }
482
+
483
+ function decide(decision) {
484
+ var question = decision === "accept"
485
+ ? "Accept and deploy " + (info ? info.project : "this version") + "?"
486
+ : "Decline? The uploaded archive will be deleted.";
487
+ if (!confirm(question)) return;
488
+ $("b-accept").disabled = $("b-decline").disabled = true;
489
+ api("decide", { decision: decision })
490
+ .then(function (d) { render(d); })
491
+ .catch(sessionLost)
492
+ .then(function () { $("b-accept").disabled = $("b-decline").disabled = false; });
493
+ }
494
+ $("b-accept").addEventListener("click", function () { decide("accept"); });
495
+ $("b-decline").addEventListener("click", function () { decide("decline"); });
496
+
497
+ start();
498
+ })();
499
+ </script>
500
+ </body>
501
+ </html>
@@ -0,0 +1,7 @@
1
+ import { BaseEndpoint } from "../BaseEndpoint";
2
+ import { IRequest, IResponse } from "../structures/Interfaces";
3
+ export declare class Liveness extends BaseEndpoint {
4
+ started: Date;
5
+ constructor(stated: Date);
6
+ checkLiveness(req: IRequest): Promise<IResponse<any>>;
7
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Liveness = void 0;
4
+ const APIService_1 = require("../APIService");
5
+ const BaseEndpoint_1 = require("../BaseEndpoint");
6
+ class Liveness extends BaseEndpoint_1.BaseEndpoint {
7
+ started;
8
+ constructor(stated) {
9
+ super("liveness");
10
+ this.ignoreInDocumentation = true;
11
+ this.ignoreHttpLogging = true;
12
+ this.started = stated;
13
+ this.registerEndpoints([{ endpoint: "", handler: this.checkLiveness, ignoreInterceptor: true }]);
14
+ }
15
+ async checkLiveness(req) {
16
+ const request = APIService_1.REQ_HTTP_REQUESTS_COUNT.request();
17
+ const data = { data: { liveness: true, wakeTime: (+new Date()) - (+this.started), request: request } };
18
+ let cb = null;
19
+ const p = new Promise((resolve, reject) => { cb = resolve; });
20
+ setTimeout(() => {
21
+ if (cb)
22
+ cb(data);
23
+ }, 1000 * 4);
24
+ return p;
25
+ }
26
+ }
27
+ exports.Liveness = Liveness;
@@ -0,0 +1,13 @@
1
+ import { BaseEndpoint } from "../BaseEndpoint";
2
+ import { IRequest } from "../structures/Interfaces";
3
+ export declare class Readiness extends BaseEndpoint {
4
+ started: Date;
5
+ constructor(stated: Date);
6
+ checkReadiness(req: IRequest): Promise<{
7
+ data: {
8
+ liveness: boolean;
9
+ wakeTime: number;
10
+ request: number;
11
+ };
12
+ }>;
13
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Readiness = void 0;
4
+ const APIService_1 = require("../APIService");
5
+ const BaseEndpoint_1 = require("../BaseEndpoint");
6
+ class Readiness extends BaseEndpoint_1.BaseEndpoint {
7
+ started;
8
+ constructor(stated) {
9
+ super("readiness");
10
+ this.started = stated;
11
+ this.ignoreInDocumentation = true;
12
+ this.ignoreHttpLogging = true;
13
+ this.registerEndpoints([{ endpoint: "", handler: this.checkReadiness, ignoreInterceptor: true }]);
14
+ }
15
+ async checkReadiness(req) {
16
+ const request = await APIService_1.REQ_HTTP_REQUESTS_COUNT.request();
17
+ return { data: { liveness: true, wakeTime: (+new Date()) - (+this.started), request: request } };
18
+ }
19
+ }
20
+ exports.Readiness = Readiness;
@@ -0,0 +1,46 @@
1
+ export declare const BLOCKED_IPS_FILE = "blocked-ips.json";
2
+ export interface IBlockedIp {
3
+ ip: string;
4
+ reason?: string;
5
+ until?: string | null;
6
+ by?: string;
7
+ at?: string;
8
+ }
9
+ export declare class BlockedIps {
10
+ private static file;
11
+ private static entries;
12
+ private static list;
13
+ private static nextExpiry;
14
+ private static hash;
15
+ private static refusedHash;
16
+ private static debounce;
17
+ private static watching;
18
+ private static hits;
19
+ static configure(file?: string | null): void;
20
+ static get path(): string | null;
21
+ static defaultPath(): string;
22
+ static validate(value: any): string | null;
23
+ private static load;
24
+ private static active;
25
+ private static apply;
26
+ static isBlocked(ip: string | undefined | null): boolean;
27
+ static noteHit(ip: string): void;
28
+ static snapshot(): {
29
+ file: string | null;
30
+ entries: {
31
+ ip: string;
32
+ reason?: string;
33
+ until?: string | null;
34
+ by?: string;
35
+ at?: string;
36
+ active: boolean;
37
+ }[];
38
+ hits: {
39
+ [k: string]: number;
40
+ };
41
+ };
42
+ private static update;
43
+ static add(entry: IBlockedIp): void;
44
+ static remove(ip: string): boolean;
45
+ private static watch;
46
+ }