querysub 0.332.0 → 0.334.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.332.0",
3
+ "version": "0.334.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -22,7 +22,7 @@
22
22
  "js-sha512": "^0.9.0",
23
23
  "node-forge": "https://github.com/sliftist/forge#e618181b469b07bdc70b968b0391beb8ef5fecd6",
24
24
  "pako": "^2.1.0",
25
- "socket-function": "^0.140.0",
25
+ "socket-function": "^0.141.0",
26
26
  "terser": "^5.31.0",
27
27
  "typesafecss": "^0.22.0",
28
28
  "yaml": "^2.5.0",
@@ -713,6 +713,8 @@ export class Querysub {
713
713
  justHTTP?: boolean;
714
714
  debugName?: string;
715
715
 
716
+ staticRoots?: string[];
717
+
716
718
  sourceCheck?: MachineSourceCheck<any>;
717
719
  }) {
718
720
  console.log(`Hosting server with config: ${JSON.stringify(config)}`);
@@ -769,6 +771,9 @@ export class Querysub {
769
771
  });
770
772
  return `<script>${edgeBootstrapFile}</script>`;
771
773
  });
774
+ for (let root of config.staticRoots || []) {
775
+ RequireController.addStaticRoot(root);
776
+ }
772
777
 
773
778
  if (!noSyncing() && !isBootstrapOnly()) {
774
779
  SocketFunction.expose(QuerysubController);
@@ -68,6 +68,7 @@ export class UpdateButtons extends qreact.Component<{
68
68
  let value = e.currentTarget.value;
69
69
  if (!value) return;
70
70
  if (e.key === "Enter" && e.shiftKey || e.key === "Tab" && e.shiftKey) {
71
+ e.preventDefault();
71
72
  await controller.commitPushAndPublishQuerysub.promise(value);
72
73
  closeAllModals();
73
74
  }
@@ -110,6 +111,7 @@ export class UpdateButtons extends qreact.Component<{
110
111
  let value = e.currentTarget.value;
111
112
  if (!value) return;
112
113
  if (e.key === "Enter" && e.shiftKey || e.key === "Tab" && e.shiftKey) {
114
+ e.preventDefault();
113
115
  await controller.commitPushService.promise(value);
114
116
  closeAllModals();
115
117
  }
@@ -12,6 +12,7 @@ import { formatDateJSX } from "../../../misc/formatJSX";
12
12
  import { LogDatum } from "../diskLogger";
13
13
  import { measureFnc } from "socket-function/src/profiling/measure";
14
14
  import { throttleRender } from "../../../functional/throttleRender";
15
+ import { matchFilter } from "../../../misc";
15
16
 
16
17
  export class ErrorSuppressionUI extends qreact.Component<{
17
18
  dataSeqNum: number;
@@ -22,7 +23,8 @@ export class ErrorSuppressionUI extends qreact.Component<{
22
23
  }> {
23
24
  state = t.state({
24
25
  matchedInput: t.string(""),
25
- renderLimit: t.number(10)
26
+ renderLimit: t.number(10),
27
+ filter: t.string(""),
26
28
  });
27
29
 
28
30
  @measureFnc
@@ -58,22 +60,25 @@ export class ErrorSuppressionUI extends qreact.Component<{
58
60
 
59
61
  this.props.dataSeqNum;
60
62
  const controller = SuppressionListController(SocketFunction.browserNodeId());
61
- const entries = (controller.getSuppressionList() || []);
63
+ let entries = (controller.getSuppressionList() || []);
62
64
  sort(entries, x => -x.lastUpdateTime);
63
65
  sort(entries, x => -(this.props.suppressionCounts.get(x.key) ? 1 : 0));
64
66
  sort(entries, x => -(this.props.expiredSuppressionCounts.get(x.key) ? 1 : 0));
65
67
 
68
+ let totalCount = entries.length;
69
+ entries = entries.filter(x => matchFilter({ value: this.state.filter }, x.match));
70
+
66
71
  const previewMatchCount = this.calculatePreviewMatchCount(this.state.matchedInput);
67
72
 
68
73
  return <div className={css.vbox(16).pad2(16).fillWidth.bord2(0, 0, 50, 5).hsl(0, 0, 80)}>
69
- <div className={css.fontSize(18)}>Error Suppression List ({formatNumber(entries.length)})</div>
74
+ <div className={css.fontSize(18)}>Error Suppression List ({formatNumber(entries.length)} / {formatNumber(totalCount)})</div>
70
75
 
71
76
  <div className={css.hbox(8).fillWidth}>
72
77
  <InputLabel
73
78
  label="Add Match"
74
79
  value={this.state.matchedInput}
75
80
  hot
76
- onChangeValue={(value: string) => this.state.matchedInput = value}
81
+ onChangeValue={(value) => this.state.matchedInput = value}
77
82
  onKeyDown={e => {
78
83
  if (e.key === "Enter") {
79
84
  let value = e.currentTarget.value;
@@ -97,7 +102,6 @@ export class ErrorSuppressionUI extends qreact.Component<{
97
102
  fillWidth
98
103
  placeholder="* is supported as a wildcard (enter to submit and refresh, shift+enter to submit and do not refresh)"
99
104
  />
100
-
101
105
  {this.state.matchedInput.trim() && <span className={css.opacity(0.6).fontSize(12).flexShrink0}>
102
106
  matches {formatNumber(previewMatchCount)} (in top 1000)
103
107
  </span>}
@@ -164,6 +168,16 @@ export class ErrorSuppressionUI extends qreact.Component<{
164
168
  </Button>
165
169
  </div>
166
170
 
171
+
172
+ <InputLabel
173
+ label="Filter"
174
+ value={this.state.filter}
175
+ hot
176
+ onChangeValue={value => this.state.filter = value}
177
+ fillWidth
178
+ />
179
+
180
+
167
181
  <div className={css.pad2(12).bord2(200, 40, 85).hsl(200, 40, 95).fillWidth}>
168
182
  <strong>Note:</strong> Suppression time updates don't automatically rerun the search. Click Run to rerun the search.
169
183
  </div>
@@ -84,9 +84,11 @@ function canSendNow(info: IMInfo) {
84
84
  let historyInHour = historyInDay.filter(x => x.time > hourThreshold);
85
85
 
86
86
  if (historyInDay.length >= MAX_IMS_PER_DAY) {
87
+ console.log(magenta(`Not sending IM, because we've sent ${historyInDay.length} > ${MAX_IMS_PER_DAY} IMs in the last day`));
87
88
  return false;
88
89
  }
89
90
  if (historyInHour.length >= MAX_IMS_PER_HOURS) {
91
+ console.log(magenta(`Not sending IM, because we've sent ${historyInHour.length} > ${MAX_IMS_PER_HOURS} IMs in the last hour`));
90
92
  return false;
91
93
  }
92
94
  return true;