@rogatio/cli 6.16.5 → 6.18.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/README.md +1 -1
- package/dist/editor/index.css +120 -27
- package/dist/editor/index.js +182 -86
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +345 -93
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ rogatio ai delete
|
|
|
109
109
|
|
|
110
110
|
Configuration is stored at `~/.config/rogatio/provider.json` (Linux), `~/Library/Application Support/rogatio/provider.json` (macOS), or `%LOCALAPPDATA%\rogatio\provider.json` (Windows) with `600` permissions.
|
|
111
111
|
|
|
112
|
-
When AI is configured, `rogatio edit` shows an **AI Assist** button
|
|
112
|
+
When AI is configured, `rogatio edit` shows an **AI Assist** button on the project title row. Click it to:
|
|
113
113
|
- Generate rules from natural language
|
|
114
114
|
- Fix validation errors by repairing the offending rules in place (keeping their rule ids; max 3 auto-fix iterations)
|
|
115
115
|
|
package/dist/editor/index.css
CHANGED
|
@@ -213,8 +213,8 @@
|
|
|
213
213
|
font-weight: 600;
|
|
214
214
|
}
|
|
215
215
|
.rogatio-editor [data-search-wrap] {
|
|
216
|
-
|
|
217
|
-
flex: 0
|
|
216
|
+
position: relative;
|
|
217
|
+
flex: 0 1 18rem;
|
|
218
218
|
width: min(18rem, 100%);
|
|
219
219
|
min-width: 0;
|
|
220
220
|
}
|
|
@@ -223,11 +223,20 @@
|
|
|
223
223
|
padding: 1rem clamp(1rem, 3vw, 3rem) 3rem;
|
|
224
224
|
}
|
|
225
225
|
.rogatio-editor [data-editor-header] {
|
|
226
|
-
display:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-wrap: wrap;
|
|
228
|
+
align-items: center;
|
|
229
|
+
justify-content: space-between;
|
|
230
|
+
gap: 0.75rem 1.5rem;
|
|
231
|
+
margin-bottom: 1.25rem;
|
|
232
|
+
}
|
|
233
|
+
.rogatio-editor [data-editor-header-actions] {
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-wrap: wrap;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: flex-end;
|
|
238
|
+
gap: 0.5rem 0.65rem;
|
|
239
|
+
margin-left: auto;
|
|
231
240
|
}
|
|
232
241
|
.rogatio-editor [data-editor-header] h1,
|
|
233
242
|
.rogatio-editor [data-editor-form] h2,
|
|
@@ -302,29 +311,12 @@
|
|
|
302
311
|
text-align: left;
|
|
303
312
|
text-decoration: underline;
|
|
304
313
|
}
|
|
305
|
-
.rogatio-editor [data-editor-command-bar] button[aria-current=page] {
|
|
306
|
-
border-color: rgba(59, 158, 255, 0.45);
|
|
307
|
-
background: var(--rogatio-primary-bg);
|
|
308
|
-
font-weight: 700;
|
|
309
|
-
}
|
|
310
314
|
.rogatio-editor [data-project-actions] {
|
|
311
315
|
display: flex;
|
|
312
316
|
flex-wrap: wrap;
|
|
313
317
|
gap: 0.5rem;
|
|
314
318
|
margin-top: 0.75rem;
|
|
315
319
|
}
|
|
316
|
-
.rogatio-editor [data-editor-command-bar] {
|
|
317
|
-
display: flex;
|
|
318
|
-
flex-wrap: wrap;
|
|
319
|
-
align-items: center;
|
|
320
|
-
justify-content: space-between;
|
|
321
|
-
gap: 0.75rem 1rem;
|
|
322
|
-
margin-block: 1rem;
|
|
323
|
-
padding: 0.65rem 0.75rem;
|
|
324
|
-
border: 1px solid var(--rogatio-border);
|
|
325
|
-
border-radius: var(--rogatio-radius);
|
|
326
|
-
background: var(--rogatio-surface-raised);
|
|
327
|
-
}
|
|
328
320
|
.rogatio-editor [data-action-cluster] {
|
|
329
321
|
display: flex;
|
|
330
322
|
flex-wrap: wrap;
|
|
@@ -708,6 +700,25 @@
|
|
|
708
700
|
.rogatio-editor [data-search-wrap] {
|
|
709
701
|
position: relative;
|
|
710
702
|
}
|
|
703
|
+
.rogatio-editor [data-rail-tools] {
|
|
704
|
+
display: flex;
|
|
705
|
+
flex: 0 1 auto;
|
|
706
|
+
align-items: flex-end;
|
|
707
|
+
justify-content: flex-end;
|
|
708
|
+
gap: 0.65rem;
|
|
709
|
+
margin-left: auto;
|
|
710
|
+
min-width: 0;
|
|
711
|
+
max-width: 100%;
|
|
712
|
+
}
|
|
713
|
+
.rogatio-editor [data-rail-tools] [data-route=test] {
|
|
714
|
+
flex: none;
|
|
715
|
+
margin-bottom: 0.05rem;
|
|
716
|
+
}
|
|
717
|
+
.rogatio-editor [data-rail-tools] [data-route=test][aria-expanded=true] {
|
|
718
|
+
border-color: rgba(46, 196, 182, 0.55);
|
|
719
|
+
background: rgba(46, 196, 182, 0.14);
|
|
720
|
+
color: var(--rogatio-text);
|
|
721
|
+
}
|
|
711
722
|
.rogatio-editor [data-search-label] {
|
|
712
723
|
display: flex;
|
|
713
724
|
flex-direction: column;
|
|
@@ -755,7 +766,10 @@
|
|
|
755
766
|
display: block;
|
|
756
767
|
}
|
|
757
768
|
.rogatio-editor [data-editor-header] {
|
|
758
|
-
|
|
769
|
+
align-items: flex-start;
|
|
770
|
+
}
|
|
771
|
+
.rogatio-editor [data-editor-header-actions] {
|
|
772
|
+
width: 100%;
|
|
759
773
|
}
|
|
760
774
|
.rogatio-editor [data-rule-heading],
|
|
761
775
|
.rogatio-editor [data-group-heading],
|
|
@@ -805,7 +819,8 @@
|
|
|
805
819
|
.rogatio-editor [data-group-row],
|
|
806
820
|
.rogatio-editor [data-editor-check-group],
|
|
807
821
|
.rogatio-editor [data-action-dock],
|
|
808
|
-
.rogatio-editor [data-action-cluster=danger]
|
|
822
|
+
.rogatio-editor [data-action-cluster=danger],
|
|
823
|
+
.rogatio-editor [data-test-dialog] {
|
|
809
824
|
border-color: ButtonText;
|
|
810
825
|
background: Canvas;
|
|
811
826
|
}
|
|
@@ -828,7 +843,85 @@
|
|
|
828
843
|
transition: none;
|
|
829
844
|
}
|
|
830
845
|
}
|
|
831
|
-
.rogatio-editor [data-
|
|
846
|
+
.rogatio-editor [data-editor-confirmation] {
|
|
847
|
+
z-index: 4;
|
|
848
|
+
}
|
|
849
|
+
.rogatio-editor [data-test-console] {
|
|
850
|
+
position: fixed;
|
|
851
|
+
inset: 0;
|
|
852
|
+
z-index: 3;
|
|
853
|
+
display: grid;
|
|
854
|
+
place-items: center;
|
|
855
|
+
padding: clamp(0.75rem, 3vw, 2rem);
|
|
856
|
+
background: rgb(6 8 12 / 72%);
|
|
857
|
+
backdrop-filter: blur(8px);
|
|
858
|
+
}
|
|
859
|
+
.rogatio-editor [data-test-dialog] {
|
|
860
|
+
display: grid;
|
|
861
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
862
|
+
width: min(68rem, 100%);
|
|
863
|
+
max-height: min(86vh, 52rem);
|
|
864
|
+
overflow: hidden;
|
|
865
|
+
border: 1px solid var(--rogatio-border);
|
|
866
|
+
border-top: 3px solid var(--rogatio-card-rule-edge);
|
|
867
|
+
border-radius: var(--rogatio-radius);
|
|
868
|
+
background:
|
|
869
|
+
linear-gradient(
|
|
870
|
+
180deg,
|
|
871
|
+
rgba(46, 196, 182, 0.08) 0%,
|
|
872
|
+
transparent 4.5rem),
|
|
873
|
+
var(--rogatio-surface-raised);
|
|
874
|
+
box-shadow: 0 28px 80px rgb(0 0 0 / 55%);
|
|
875
|
+
}
|
|
876
|
+
.rogatio-editor [data-test-dialog-head] {
|
|
877
|
+
display: flex;
|
|
878
|
+
align-items: flex-start;
|
|
879
|
+
justify-content: space-between;
|
|
880
|
+
gap: 1rem;
|
|
881
|
+
padding: 1.1rem 1.25rem 0.9rem;
|
|
882
|
+
border-bottom: 1px solid var(--rogatio-border);
|
|
883
|
+
}
|
|
884
|
+
.rogatio-editor [data-test-dialog-head] h2 {
|
|
885
|
+
margin: 0;
|
|
886
|
+
font-size: 1.65rem;
|
|
887
|
+
letter-spacing: -0.03em;
|
|
888
|
+
}
|
|
889
|
+
.rogatio-editor [data-test-kicker] {
|
|
890
|
+
margin: 0 0 0.2rem;
|
|
891
|
+
color: var(--rogatio-card-rule-edge);
|
|
892
|
+
font-family: var(--rogatio-font-mono);
|
|
893
|
+
font-size: 0.6875rem;
|
|
894
|
+
font-weight: 700;
|
|
895
|
+
letter-spacing: 0.12em;
|
|
896
|
+
text-transform: uppercase;
|
|
897
|
+
}
|
|
898
|
+
.rogatio-editor [data-test-dialog] [data-test-description] {
|
|
899
|
+
margin: 0.35rem 0 0;
|
|
900
|
+
max-width: 40rem;
|
|
901
|
+
color: var(--rogatio-muted);
|
|
902
|
+
}
|
|
903
|
+
.rogatio-editor [data-test-dialog-body] {
|
|
904
|
+
overflow: auto;
|
|
905
|
+
padding: 1.1rem 1.25rem 1.35rem;
|
|
906
|
+
}
|
|
907
|
+
.rogatio-editor [data-test-status] {
|
|
908
|
+
margin: 0;
|
|
909
|
+
color: var(--rogatio-muted);
|
|
910
|
+
}
|
|
911
|
+
@media (min-width: 52rem) {
|
|
912
|
+
.rogatio-editor [data-test-dialog] [data-test-panel] {
|
|
913
|
+
grid-template-columns: minmax(0, 1.45fr) minmax(16rem, 0.7fr);
|
|
914
|
+
align-items: start;
|
|
915
|
+
}
|
|
916
|
+
.rogatio-editor [data-test-dialog] [data-test-panel] > fieldset {
|
|
917
|
+
grid-row: 1 / span 3;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
@media (prefers-reduced-motion: reduce) {
|
|
921
|
+
.rogatio-editor [data-test-console] {
|
|
922
|
+
backdrop-filter: none;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
832
925
|
.rogatio-editor [data-test-checking] {
|
|
833
926
|
color: var(--rogatio-muted);
|
|
834
927
|
margin-block: 0 1rem;
|
package/dist/editor/index.js
CHANGED
|
@@ -2517,12 +2517,12 @@ var EditorControllerImpl = class {
|
|
|
2517
2517
|
extensions;
|
|
2518
2518
|
instanceId;
|
|
2519
2519
|
host;
|
|
2520
|
+
layout;
|
|
2520
2521
|
rail;
|
|
2521
2522
|
main;
|
|
2522
2523
|
header;
|
|
2523
2524
|
status;
|
|
2524
2525
|
summary;
|
|
2525
|
-
commandBar;
|
|
2526
2526
|
form;
|
|
2527
2527
|
searchResults;
|
|
2528
2528
|
draft;
|
|
@@ -2540,6 +2540,7 @@ var EditorControllerImpl = class {
|
|
|
2540
2540
|
extensionCleanups = [];
|
|
2541
2541
|
confirmation;
|
|
2542
2542
|
groupPickerOpen = false;
|
|
2543
|
+
testConsoleOpen = false;
|
|
2543
2544
|
projectActions;
|
|
2544
2545
|
focusRequest;
|
|
2545
2546
|
saving = false;
|
|
@@ -2553,6 +2554,7 @@ var EditorControllerImpl = class {
|
|
|
2553
2554
|
testResourceType = "main_frame";
|
|
2554
2555
|
testResult = void 0;
|
|
2555
2556
|
testRunning = false;
|
|
2557
|
+
testNotice = "";
|
|
2556
2558
|
testRequestId = 0;
|
|
2557
2559
|
aiAssistPanel = null;
|
|
2558
2560
|
aiAssistInFlight = false;
|
|
@@ -2597,8 +2599,8 @@ var EditorControllerImpl = class {
|
|
|
2597
2599
|
this.host = this.document.createElement("div");
|
|
2598
2600
|
this.host.className = "rogatio-editor";
|
|
2599
2601
|
this.host.dataset.rogatioEditor = "true";
|
|
2600
|
-
|
|
2601
|
-
layout.dataset.editorLayout = "true";
|
|
2602
|
+
this.layout = this.document.createElement("div");
|
|
2603
|
+
this.layout.dataset.editorLayout = "true";
|
|
2602
2604
|
this.rail = this.document.createElement("nav");
|
|
2603
2605
|
this.rail.dataset.desktopRouteRail = "true";
|
|
2604
2606
|
this.rail.setAttribute("aria-label", "Project sections");
|
|
@@ -2613,10 +2615,6 @@ var EditorControllerImpl = class {
|
|
|
2613
2615
|
this.summary = this.document.createElement("section");
|
|
2614
2616
|
this.summary.dataset.editorSummary = "true";
|
|
2615
2617
|
this.summary.setAttribute("role", "alert");
|
|
2616
|
-
this.commandBar = this.document.createElement("div");
|
|
2617
|
-
this.commandBar.dataset.editorCommandBar = "true";
|
|
2618
|
-
this.commandBar.setAttribute("role", "toolbar");
|
|
2619
|
-
this.commandBar.setAttribute("aria-label", "Project actions");
|
|
2620
2618
|
this.form = this.document.createElement("form");
|
|
2621
2619
|
this.form.dataset.editorForm = "true";
|
|
2622
2620
|
this.form.noValidate = true;
|
|
@@ -2631,15 +2629,9 @@ var EditorControllerImpl = class {
|
|
|
2631
2629
|
this.searchQuery = "";
|
|
2632
2630
|
this.render();
|
|
2633
2631
|
});
|
|
2634
|
-
this.main.append(
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
this.summary,
|
|
2638
|
-
this.commandBar,
|
|
2639
|
-
this.form
|
|
2640
|
-
);
|
|
2641
|
-
layout.append(this.rail, this.main);
|
|
2642
|
-
this.host.append(layout);
|
|
2632
|
+
this.main.append(this.header, this.status, this.summary, this.form);
|
|
2633
|
+
this.layout.append(this.rail, this.main);
|
|
2634
|
+
this.host.append(this.layout);
|
|
2643
2635
|
this.root.append(this.host);
|
|
2644
2636
|
this.host.addEventListener("click", this.handleClick);
|
|
2645
2637
|
this.host.addEventListener("input", this.handleInput);
|
|
@@ -2688,6 +2680,10 @@ var EditorControllerImpl = class {
|
|
|
2688
2680
|
if (this.destroyed) return;
|
|
2689
2681
|
const target = event.target;
|
|
2690
2682
|
if (!(target instanceof Element)) return;
|
|
2683
|
+
if (this.testConsoleOpen && target instanceof HTMLElement && target.dataset.testConsole !== void 0 && event.target === target) {
|
|
2684
|
+
this.closeTestConsole();
|
|
2685
|
+
return;
|
|
2686
|
+
}
|
|
2691
2687
|
if (this.groupPickerOpen && target instanceof HTMLElement && target.dataset.groupPicker !== void 0 && event.target === target) {
|
|
2692
2688
|
this.closeGroupPicker();
|
|
2693
2689
|
return;
|
|
@@ -2804,6 +2800,14 @@ var EditorControllerImpl = class {
|
|
|
2804
2800
|
this.closeGroupPicker();
|
|
2805
2801
|
return;
|
|
2806
2802
|
}
|
|
2803
|
+
if (event.key === "Escape" && this.testConsoleOpen) {
|
|
2804
|
+
event.preventDefault();
|
|
2805
|
+
this.closeTestConsole();
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
if (event.key === "Tab" && this.testConsoleOpen && !this.confirmation) {
|
|
2809
|
+
this.trapTestConsoleFocus(event);
|
|
2810
|
+
}
|
|
2807
2811
|
const target = event.target;
|
|
2808
2812
|
const inRenameInput = target instanceof HTMLElement && target.dataset.renameInput !== void 0;
|
|
2809
2813
|
if (!inRenameInput) return;
|
|
@@ -2951,6 +2955,7 @@ var EditorControllerImpl = class {
|
|
|
2951
2955
|
return;
|
|
2952
2956
|
}
|
|
2953
2957
|
if (command === "test:open-rule") {
|
|
2958
|
+
this.testConsoleOpen = false;
|
|
2954
2959
|
this.navigateToRule(element.dataset.groupId, element.dataset.ruleId);
|
|
2955
2960
|
return;
|
|
2956
2961
|
}
|
|
@@ -2968,6 +2973,10 @@ var EditorControllerImpl = class {
|
|
|
2968
2973
|
}
|
|
2969
2974
|
if (command === "close-group-picker") {
|
|
2970
2975
|
this.closeGroupPicker();
|
|
2976
|
+
return;
|
|
2977
|
+
}
|
|
2978
|
+
if (command === "close-test-console") {
|
|
2979
|
+
this.closeTestConsole();
|
|
2971
2980
|
}
|
|
2972
2981
|
}
|
|
2973
2982
|
collectDiagnostics(value) {
|
|
@@ -3697,11 +3706,13 @@ var EditorControllerImpl = class {
|
|
|
3697
3706
|
showDryRunDiagnostics(diagnostics) {
|
|
3698
3707
|
this.testResult = void 0;
|
|
3699
3708
|
this.testRunning = false;
|
|
3709
|
+
this.testNotice = "";
|
|
3700
3710
|
this.errors = [...diagnostics];
|
|
3701
3711
|
const count = diagnostics.length;
|
|
3702
3712
|
this.statusMessage = count === 0 ? "The project could not be tested." : `${count} validation error${count === 1 ? "" : "s"} found.`;
|
|
3703
3713
|
const first = diagnostics[0];
|
|
3704
3714
|
if (first) {
|
|
3715
|
+
this.testConsoleOpen = false;
|
|
3705
3716
|
this.navigateToPath(first.path);
|
|
3706
3717
|
return;
|
|
3707
3718
|
}
|
|
@@ -3709,27 +3720,27 @@ var EditorControllerImpl = class {
|
|
|
3709
3720
|
}
|
|
3710
3721
|
async runTest() {
|
|
3711
3722
|
if (!this.options.dryRun) {
|
|
3712
|
-
this.
|
|
3723
|
+
this.testNotice = "Dry-run is not configured for this editor instance.";
|
|
3713
3724
|
this.render();
|
|
3714
3725
|
return;
|
|
3715
3726
|
}
|
|
3716
3727
|
if (this.ruleCount() === 0) {
|
|
3717
3728
|
this.testResult = void 0;
|
|
3718
3729
|
this.testRunning = false;
|
|
3719
|
-
this.
|
|
3730
|
+
this.testNotice = "";
|
|
3720
3731
|
this.render();
|
|
3721
3732
|
return;
|
|
3722
3733
|
}
|
|
3723
3734
|
const lines = this.testLines();
|
|
3724
3735
|
if (lines.length === 0) {
|
|
3725
|
-
this.
|
|
3736
|
+
this.testNotice = "Please enter at least one URL to test.";
|
|
3726
3737
|
this.render();
|
|
3727
3738
|
return;
|
|
3728
3739
|
}
|
|
3729
3740
|
if (lines.length > TEST_CASE_LIMIT) {
|
|
3730
3741
|
this.testResult = void 0;
|
|
3731
3742
|
this.testRunning = false;
|
|
3732
|
-
this.
|
|
3743
|
+
this.testNotice = "Only 256 URLs can be checked at once.";
|
|
3733
3744
|
this.render();
|
|
3734
3745
|
return;
|
|
3735
3746
|
}
|
|
@@ -3743,7 +3754,7 @@ var EditorControllerImpl = class {
|
|
|
3743
3754
|
});
|
|
3744
3755
|
const requestId = ++this.testRequestId;
|
|
3745
3756
|
this.testRunning = true;
|
|
3746
|
-
this.
|
|
3757
|
+
this.testNotice = "";
|
|
3747
3758
|
this.render();
|
|
3748
3759
|
try {
|
|
3749
3760
|
const outcome = await this.options.dryRun(this.getDraft(), cases);
|
|
@@ -3752,7 +3763,7 @@ var EditorControllerImpl = class {
|
|
|
3752
3763
|
if (isDryRunResult(outcome)) {
|
|
3753
3764
|
this.testResult = outcome;
|
|
3754
3765
|
const checked = outcome.summary.urlCount;
|
|
3755
|
-
this.
|
|
3766
|
+
this.testNotice = outcome.errors.length > 0 ? `Checked ${checked} URL${checked === 1 ? "" : "s"}. Some lines are not http(s) URLs.` : `Checked ${checked} URL${checked === 1 ? "" : "s"}.`;
|
|
3756
3767
|
this.render();
|
|
3757
3768
|
return;
|
|
3758
3769
|
}
|
|
@@ -3765,12 +3776,12 @@ var EditorControllerImpl = class {
|
|
|
3765
3776
|
this.testResult = void 0;
|
|
3766
3777
|
this.testRunning = false;
|
|
3767
3778
|
const message = e instanceof Error ? e.message : "Test failed";
|
|
3768
|
-
this.
|
|
3779
|
+
this.testNotice = `Test error: ${message}`;
|
|
3769
3780
|
this.render();
|
|
3770
3781
|
}
|
|
3771
3782
|
}
|
|
3772
|
-
renderTestResults(result) {
|
|
3773
|
-
const resultsSection =
|
|
3783
|
+
renderTestResults(result, scope = this.host) {
|
|
3784
|
+
const resultsSection = scope.querySelector(
|
|
3774
3785
|
"[data-test-results]"
|
|
3775
3786
|
);
|
|
3776
3787
|
if (!resultsSection || !isDryRunResult(result)) return;
|
|
@@ -3946,16 +3957,19 @@ var EditorControllerImpl = class {
|
|
|
3946
3957
|
return enablement.isEnabled(id) !== true;
|
|
3947
3958
|
}
|
|
3948
3959
|
navigate(route, groupId) {
|
|
3960
|
+
if (route === "test") {
|
|
3961
|
+
this.openTestConsole();
|
|
3962
|
+
return;
|
|
3963
|
+
}
|
|
3949
3964
|
const returnFocusToGroups = this.groupPickerOpen;
|
|
3950
3965
|
if (route === "project") {
|
|
3951
3966
|
this.route = { kind: "project" };
|
|
3952
|
-
} else if (route === "test") {
|
|
3953
|
-
this.route = { kind: "test" };
|
|
3954
3967
|
} else if (route === "group" && groupId && this.groupById(groupId)) {
|
|
3955
3968
|
this.route = { kind: "group", groupId };
|
|
3956
3969
|
} else {
|
|
3957
3970
|
return;
|
|
3958
3971
|
}
|
|
3972
|
+
this.testConsoleOpen = false;
|
|
3959
3973
|
this.groupPickerOpen = false;
|
|
3960
3974
|
if (returnFocusToGroups) this.focusRequest = "route:groups";
|
|
3961
3975
|
this.closeRenameOnLeave();
|
|
@@ -3984,6 +3998,7 @@ var EditorControllerImpl = class {
|
|
|
3984
3998
|
}
|
|
3985
3999
|
navigateToGroup(groupId) {
|
|
3986
4000
|
this.groupPickerOpen = false;
|
|
4001
|
+
this.testConsoleOpen = false;
|
|
3987
4002
|
const groupIds = new Set(
|
|
3988
4003
|
this.draft.groups.map((group) => typeof group.id === "string" ? group.id : "").filter((id) => id.length > 0)
|
|
3989
4004
|
);
|
|
@@ -4057,6 +4072,7 @@ var EditorControllerImpl = class {
|
|
|
4057
4072
|
}
|
|
4058
4073
|
navigateToSearchResult(path) {
|
|
4059
4074
|
this.groupPickerOpen = false;
|
|
4075
|
+
this.testConsoleOpen = false;
|
|
4060
4076
|
const segments = decodePointer(path);
|
|
4061
4077
|
if (segments?.[0] !== "groups") {
|
|
4062
4078
|
this.route = { kind: "project" };
|
|
@@ -4081,6 +4097,7 @@ var EditorControllerImpl = class {
|
|
|
4081
4097
|
const segments = decodePointer(path);
|
|
4082
4098
|
if (segments?.[0] !== "groups") {
|
|
4083
4099
|
this.route = { kind: "project" };
|
|
4100
|
+
this.testConsoleOpen = false;
|
|
4084
4101
|
this.focusRequest = path;
|
|
4085
4102
|
this.render();
|
|
4086
4103
|
return;
|
|
@@ -4090,6 +4107,7 @@ var EditorControllerImpl = class {
|
|
|
4090
4107
|
const group = this.draft.groups[groupIndex];
|
|
4091
4108
|
if (!group || typeof group.id !== "string") return;
|
|
4092
4109
|
this.route = { kind: "group", groupId: group.id };
|
|
4110
|
+
this.testConsoleOpen = false;
|
|
4093
4111
|
const last = segments[segments.length - 1];
|
|
4094
4112
|
const ruleIndex = arrayIndex(segments[3] ?? "");
|
|
4095
4113
|
const entityPath = last === "name" ? path : segments.length === 2 ? pointer("groups", groupIndex, "name") : segments.length === 4 && ruleIndex !== void 0 ? pointer("groups", groupIndex, "rules", ruleIndex, "name") : path;
|
|
@@ -4134,12 +4152,9 @@ var EditorControllerImpl = class {
|
|
|
4134
4152
|
}
|
|
4135
4153
|
this.renderHeader();
|
|
4136
4154
|
this.renderRail();
|
|
4137
|
-
this.renderCommandBar();
|
|
4138
4155
|
this.form.replaceChildren();
|
|
4139
4156
|
if (this.route.kind === "project") {
|
|
4140
4157
|
this.renderProject();
|
|
4141
|
-
} else if (this.route.kind === "test") {
|
|
4142
|
-
this.renderTest();
|
|
4143
4158
|
} else {
|
|
4144
4159
|
this.renderGroup(this.route.groupId);
|
|
4145
4160
|
}
|
|
@@ -4151,6 +4166,7 @@ var EditorControllerImpl = class {
|
|
|
4151
4166
|
if (this.confirmation) this.groupPickerOpen = false;
|
|
4152
4167
|
this.renderConfirmation();
|
|
4153
4168
|
this.renderGroupPicker();
|
|
4169
|
+
this.renderTestConsole();
|
|
4154
4170
|
this.restoreFocus();
|
|
4155
4171
|
this.focusRequest = void 0;
|
|
4156
4172
|
}
|
|
@@ -4163,7 +4179,13 @@ var EditorControllerImpl = class {
|
|
|
4163
4179
|
dirty.dataset.dirtyState = "true";
|
|
4164
4180
|
dirty.textContent = this.isDirty() ? "Unsaved changes" : "All changes saved";
|
|
4165
4181
|
titleBlock.append(title, dirty);
|
|
4166
|
-
this.
|
|
4182
|
+
const actions = this.document.createElement("div");
|
|
4183
|
+
actions.dataset.editorHeaderActions = "true";
|
|
4184
|
+
actions.setAttribute("role", "toolbar");
|
|
4185
|
+
actions.setAttribute("aria-label", "Project actions");
|
|
4186
|
+
actions.setAttribute("aria-busy", this.saving ? "true" : "false");
|
|
4187
|
+
this.appendProjectActions(actions);
|
|
4188
|
+
this.header.append(titleBlock, actions);
|
|
4167
4189
|
this.status.textContent = this.statusMessage;
|
|
4168
4190
|
this.status.setAttribute("aria-busy", this.saving ? "true" : "false");
|
|
4169
4191
|
}
|
|
@@ -4219,12 +4241,24 @@ var EditorControllerImpl = class {
|
|
|
4219
4241
|
search.setAttribute("aria-controls", "rogatio-search-results");
|
|
4220
4242
|
searchLabel.append(search);
|
|
4221
4243
|
searchWrap.append(searchLabel, this.searchResults);
|
|
4222
|
-
this.
|
|
4244
|
+
const railTools = this.document.createElement("div");
|
|
4245
|
+
railTools.dataset.railTools = "true";
|
|
4246
|
+
const testBtn = this.createButton("Console", "route:test");
|
|
4247
|
+
testBtn.dataset.route = "test";
|
|
4248
|
+
testBtn.dataset.editorKey = "route:test";
|
|
4249
|
+
testBtn.dataset.btn = "secondary";
|
|
4250
|
+
testBtn.disabled = this.saving;
|
|
4251
|
+
testBtn.setAttribute("aria-label", "Test console");
|
|
4252
|
+
testBtn.setAttribute("aria-haspopup", "dialog");
|
|
4253
|
+
testBtn.setAttribute(
|
|
4254
|
+
"aria-expanded",
|
|
4255
|
+
this.testConsoleOpen ? "true" : "false"
|
|
4256
|
+
);
|
|
4257
|
+
testBtn.setAttribute("aria-controls", `${this.instanceId}-test-console`);
|
|
4258
|
+
railTools.append(testBtn, searchWrap);
|
|
4259
|
+
this.rail.append(railTools);
|
|
4223
4260
|
}
|
|
4224
|
-
|
|
4225
|
-
this.commandBar.replaceChildren();
|
|
4226
|
-
this.commandBar.setAttribute("aria-busy", this.saving ? "true" : "false");
|
|
4227
|
-
this.commandBar.setAttribute("aria-label", "Project actions");
|
|
4261
|
+
appendProjectActions(actions) {
|
|
4228
4262
|
const tools = this.document.createElement("div");
|
|
4229
4263
|
tools.dataset.actionCluster = "tools";
|
|
4230
4264
|
if (this.aiAssistPanel) {
|
|
@@ -4232,18 +4266,7 @@ var EditorControllerImpl = class {
|
|
|
4232
4266
|
this.createCommandButton("AI Assist", "ai-assist", this.saving)
|
|
4233
4267
|
);
|
|
4234
4268
|
}
|
|
4235
|
-
|
|
4236
|
-
testBtn.dataset.route = "test";
|
|
4237
|
-
testBtn.dataset.editorKey = "route:test";
|
|
4238
|
-
testBtn.dataset.btn = "secondary";
|
|
4239
|
-
testBtn.disabled = this.saving;
|
|
4240
|
-
if (this.route.kind === "test") {
|
|
4241
|
-
testBtn.setAttribute("aria-current", "page");
|
|
4242
|
-
}
|
|
4243
|
-
tools.append(
|
|
4244
|
-
testBtn,
|
|
4245
|
-
this.createCommandButton("Validate", "validate", this.saving)
|
|
4246
|
-
);
|
|
4269
|
+
tools.append(this.createCommandButton("Validate", "validate", this.saving));
|
|
4247
4270
|
const commit = this.document.createElement("div");
|
|
4248
4271
|
commit.dataset.actionCluster = "commit";
|
|
4249
4272
|
commit.append(
|
|
@@ -4256,7 +4279,7 @@ var EditorControllerImpl = class {
|
|
|
4256
4279
|
"primary"
|
|
4257
4280
|
)
|
|
4258
4281
|
);
|
|
4259
|
-
|
|
4282
|
+
actions.append(tools, commit);
|
|
4260
4283
|
}
|
|
4261
4284
|
createGroupEnableButton(savedGroupId, groupName) {
|
|
4262
4285
|
const enablement = this.options.groupEnablement;
|
|
@@ -4325,27 +4348,7 @@ var EditorControllerImpl = class {
|
|
|
4325
4348
|
}
|
|
4326
4349
|
createProjectActionRow() {
|
|
4327
4350
|
const actions = this.document.createElement("div");
|
|
4328
|
-
|
|
4329
|
-
tools.dataset.actionCluster = "tools";
|
|
4330
|
-
if (this.aiAssistPanel) {
|
|
4331
|
-
tools.append(
|
|
4332
|
-
this.createCommandButton("AI Assist", "ai-assist", this.saving)
|
|
4333
|
-
);
|
|
4334
|
-
}
|
|
4335
|
-
tools.append(this.createCommandButton("Validate", "validate", this.saving));
|
|
4336
|
-
const commit = this.document.createElement("div");
|
|
4337
|
-
commit.dataset.actionCluster = "commit";
|
|
4338
|
-
commit.append(
|
|
4339
|
-
this.createCommandButton("Cancel", "cancel", this.saving),
|
|
4340
|
-
this.createCommandButton(
|
|
4341
|
-
"Save",
|
|
4342
|
-
"save",
|
|
4343
|
-
this.saving || !this.isDirty(),
|
|
4344
|
-
{},
|
|
4345
|
-
"primary"
|
|
4346
|
-
)
|
|
4347
|
-
);
|
|
4348
|
-
actions.append(tools, commit);
|
|
4351
|
+
this.appendProjectActions(actions);
|
|
4349
4352
|
return actions;
|
|
4350
4353
|
}
|
|
4351
4354
|
appendDockRow(dock, label, actions) {
|
|
@@ -4359,9 +4362,9 @@ var EditorControllerImpl = class {
|
|
|
4359
4362
|
dock.append(row);
|
|
4360
4363
|
}
|
|
4361
4364
|
/**
|
|
4362
|
-
* Repeats the actions a long page would otherwise hide
|
|
4363
|
-
*
|
|
4364
|
-
*
|
|
4365
|
+
* Repeats the actions a long group page would otherwise hide, under the last
|
|
4366
|
+
* rule. The project page stays short, so Add group lives on the Groups
|
|
4367
|
+
* heading and that route has no ledger.
|
|
4365
4368
|
*/
|
|
4366
4369
|
renderActionDock() {
|
|
4367
4370
|
if (this.route.kind === "project") return;
|
|
@@ -4539,14 +4542,7 @@ var EditorControllerImpl = class {
|
|
|
4539
4542
|
rulesSection.append(list);
|
|
4540
4543
|
this.form.append(rulesSection);
|
|
4541
4544
|
}
|
|
4542
|
-
|
|
4543
|
-
const heading = this.document.createElement("h2");
|
|
4544
|
-
heading.textContent = "Test console";
|
|
4545
|
-
this.form.append(heading);
|
|
4546
|
-
const description = this.document.createElement("p");
|
|
4547
|
-
description.dataset.testDescription = "true";
|
|
4548
|
-
description.textContent = "Check whether these URLs match your rules. Nothing is contacted, and nothing is saved.";
|
|
4549
|
-
this.form.append(description);
|
|
4545
|
+
renderTestBody(parent) {
|
|
4550
4546
|
const panel = this.document.createElement("div");
|
|
4551
4547
|
panel.dataset.testPanel = "true";
|
|
4552
4548
|
const urlsFieldset = this.document.createElement("fieldset");
|
|
@@ -4626,26 +4622,33 @@ var EditorControllerImpl = class {
|
|
|
4626
4622
|
);
|
|
4627
4623
|
runBtn.dataset.testRun = "true";
|
|
4628
4624
|
panel.append(runBtn);
|
|
4629
|
-
|
|
4625
|
+
parent.append(panel);
|
|
4626
|
+
if (this.testNotice.length > 0 && !this.testRunning && this.testNotice !== "Only 256 URLs can be checked at once.") {
|
|
4627
|
+
const note = this.document.createElement("p");
|
|
4628
|
+
note.dataset.testStatus = "true";
|
|
4629
|
+
note.setAttribute("role", "status");
|
|
4630
|
+
note.textContent = this.testNotice;
|
|
4631
|
+
parent.append(note);
|
|
4632
|
+
}
|
|
4630
4633
|
const resultsSection = this.document.createElement("section");
|
|
4631
4634
|
resultsSection.dataset.testResults = "true";
|
|
4632
|
-
|
|
4635
|
+
parent.append(resultsSection);
|
|
4633
4636
|
if (this.ruleCount() === 0) {
|
|
4634
4637
|
const empty = this.document.createElement("p");
|
|
4635
4638
|
empty.dataset.testEmpty = "true";
|
|
4636
4639
|
empty.textContent = "This project has no rules to test.";
|
|
4637
4640
|
resultsSection.append(empty);
|
|
4638
4641
|
} else if (this.testResult) {
|
|
4639
|
-
this.renderTestResults(this.testResult);
|
|
4642
|
+
this.renderTestResults(this.testResult, parent);
|
|
4640
4643
|
} else if (this.testRunning) {
|
|
4641
4644
|
const pending = this.document.createElement("p");
|
|
4642
4645
|
pending.dataset.testPending = "true";
|
|
4643
4646
|
pending.textContent = "Checking URLs...";
|
|
4644
4647
|
resultsSection.append(pending);
|
|
4645
|
-
} else if (this.
|
|
4648
|
+
} else if (this.testNotice === "Only 256 URLs can be checked at once.") {
|
|
4646
4649
|
const limit = this.document.createElement("p");
|
|
4647
4650
|
limit.dataset.testLimit = "true";
|
|
4648
|
-
limit.textContent = this.
|
|
4651
|
+
limit.textContent = this.testNotice;
|
|
4649
4652
|
resultsSection.append(limit);
|
|
4650
4653
|
}
|
|
4651
4654
|
}
|
|
@@ -5602,7 +5605,100 @@ var EditorControllerImpl = class {
|
|
|
5602
5605
|
}
|
|
5603
5606
|
fields.append(group);
|
|
5604
5607
|
}
|
|
5608
|
+
openTestConsole() {
|
|
5609
|
+
this.groupPickerOpen = false;
|
|
5610
|
+
this.testConsoleOpen = true;
|
|
5611
|
+
this.focusRequest = "test-urls";
|
|
5612
|
+
this.render();
|
|
5613
|
+
}
|
|
5614
|
+
closeTestConsole() {
|
|
5615
|
+
if (this.testRunning) {
|
|
5616
|
+
this.testRequestId += 1;
|
|
5617
|
+
this.testRunning = false;
|
|
5618
|
+
this.testNotice = "";
|
|
5619
|
+
}
|
|
5620
|
+
this.testConsoleOpen = false;
|
|
5621
|
+
this.focusRequest = "route:test";
|
|
5622
|
+
this.render();
|
|
5623
|
+
}
|
|
5624
|
+
trapTestConsoleFocus(event) {
|
|
5625
|
+
const dialog = this.host.querySelector("[data-test-dialog]");
|
|
5626
|
+
if (!(dialog instanceof HTMLElement)) return;
|
|
5627
|
+
const focusable = Array.from(
|
|
5628
|
+
dialog.querySelectorAll(
|
|
5629
|
+
"button, input, select, textarea, summary, a[href]"
|
|
5630
|
+
)
|
|
5631
|
+
).filter((element) => {
|
|
5632
|
+
if (element.hidden) return false;
|
|
5633
|
+
const closedDetails = element.closest("details:not([open])");
|
|
5634
|
+
if (closedDetails && element !== closedDetails.querySelector("summary")) {
|
|
5635
|
+
return false;
|
|
5636
|
+
}
|
|
5637
|
+
if (element instanceof HTMLButtonElement || element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement) {
|
|
5638
|
+
return !element.disabled;
|
|
5639
|
+
}
|
|
5640
|
+
return true;
|
|
5641
|
+
});
|
|
5642
|
+
const first = focusable[0];
|
|
5643
|
+
const last = focusable[focusable.length - 1];
|
|
5644
|
+
if (!first || !last) return;
|
|
5645
|
+
const active = this.document.activeElement;
|
|
5646
|
+
const inside = active instanceof Node && dialog.contains(active);
|
|
5647
|
+
if (!inside) {
|
|
5648
|
+
event.preventDefault();
|
|
5649
|
+
(event.shiftKey ? last : first).focus();
|
|
5650
|
+
return;
|
|
5651
|
+
}
|
|
5652
|
+
if (event.shiftKey && active === first) {
|
|
5653
|
+
event.preventDefault();
|
|
5654
|
+
last.focus();
|
|
5655
|
+
return;
|
|
5656
|
+
}
|
|
5657
|
+
if (!event.shiftKey && active === last) {
|
|
5658
|
+
event.preventDefault();
|
|
5659
|
+
first.focus();
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
renderTestConsole() {
|
|
5663
|
+
this.host.querySelector("[data-test-console]")?.remove();
|
|
5664
|
+
if ("inert" in this.layout) this.layout.inert = this.testConsoleOpen;
|
|
5665
|
+
if (!this.testConsoleOpen) return;
|
|
5666
|
+
const overlay = this.document.createElement("div");
|
|
5667
|
+
overlay.dataset.testConsole = "true";
|
|
5668
|
+
overlay.setAttribute("role", "presentation");
|
|
5669
|
+
const dialog = this.document.createElement("section");
|
|
5670
|
+
dialog.dataset.testDialog = "true";
|
|
5671
|
+
dialog.id = `${this.instanceId}-test-console`;
|
|
5672
|
+
dialog.setAttribute("role", "dialog");
|
|
5673
|
+
dialog.setAttribute("aria-modal", "true");
|
|
5674
|
+
const head = this.document.createElement("div");
|
|
5675
|
+
head.dataset.testDialogHead = "true";
|
|
5676
|
+
const titles = this.document.createElement("div");
|
|
5677
|
+
const kicker = this.document.createElement("p");
|
|
5678
|
+
kicker.dataset.testKicker = "true";
|
|
5679
|
+
kicker.textContent = "Offline match";
|
|
5680
|
+
const heading = this.document.createElement("h2");
|
|
5681
|
+
heading.id = `${this.instanceId}-test-console-title`;
|
|
5682
|
+
heading.textContent = "Test console";
|
|
5683
|
+
dialog.setAttribute("aria-labelledby", heading.id);
|
|
5684
|
+
const description = this.document.createElement("p");
|
|
5685
|
+
description.dataset.testDescription = "true";
|
|
5686
|
+
description.textContent = "Check whether these URLs match your rules. Nothing is contacted, and nothing is saved.";
|
|
5687
|
+
titles.append(kicker, heading, description);
|
|
5688
|
+
const close = this.createButton("Close", "test-console-close");
|
|
5689
|
+
close.dataset.command = "close-test-console";
|
|
5690
|
+
close.dataset.editorKey = "test-console-close";
|
|
5691
|
+
close.dataset.btn = "secondary";
|
|
5692
|
+
head.append(titles, close);
|
|
5693
|
+
const body = this.document.createElement("div");
|
|
5694
|
+
body.dataset.testDialogBody = "true";
|
|
5695
|
+
this.renderTestBody(body);
|
|
5696
|
+
dialog.append(head, body);
|
|
5697
|
+
overlay.append(dialog);
|
|
5698
|
+
this.host.append(overlay);
|
|
5699
|
+
}
|
|
5605
5700
|
openGroupPicker() {
|
|
5701
|
+
this.testConsoleOpen = false;
|
|
5606
5702
|
this.groupPickerOpen = true;
|
|
5607
5703
|
this.focusRequest = this.draft.groups.length > 0 ? "group-picker-first" : "group-picker-close";
|
|
5608
5704
|
this.render();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cli(args?: string[]): Promise<number>;
|
package/dist/node/index.js
CHANGED
|
@@ -22598,6 +22598,15 @@ function defaultTrustInstallRoot(platform) {
|
|
|
22598
22598
|
}
|
|
22599
22599
|
return join2(process.env.HOME ?? "", ".local", "share", "rogatio");
|
|
22600
22600
|
}
|
|
22601
|
+
var MANIFEST_DIR_RECORD = "native-messaging-dirs.json";
|
|
22602
|
+
function isSafeManifestDir(dir) {
|
|
22603
|
+
if (!isAbsolute2(dir) || dir.includes("\0")) return false;
|
|
22604
|
+
const parts = dir.split(/[\\/]/).filter((part) => part.length > 0);
|
|
22605
|
+
if (parts.includes("..") || parts.length < 2) return false;
|
|
22606
|
+
const browser = parts[parts.length - 2];
|
|
22607
|
+
const leaf = parts[parts.length - 1];
|
|
22608
|
+
return leaf === "NativeMessagingHosts" && (browser === "google-chrome" || browser === "chromium");
|
|
22609
|
+
}
|
|
22601
22610
|
function isWellFormedManifest(value) {
|
|
22602
22611
|
if (typeof value !== "object" || value === null) return false;
|
|
22603
22612
|
const m = value;
|
|
@@ -22754,12 +22763,110 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22754
22763
|
installRoot,
|
|
22755
22764
|
options.caCertFileName ?? ".rogatio-ca.crt"
|
|
22756
22765
|
);
|
|
22766
|
+
const storePendingPath = join2(
|
|
22767
|
+
dirname2(caKeyFile),
|
|
22768
|
+
".rogatio-ca-store-pending"
|
|
22769
|
+
);
|
|
22757
22770
|
const caPreviousCertFile = join2(
|
|
22758
22771
|
dirname2(caCertFile),
|
|
22759
22772
|
".rogatio-ca.previous.crt"
|
|
22760
22773
|
);
|
|
22761
|
-
const
|
|
22774
|
+
const configuredManifestDirs = options.manifestDirs && options.manifestDirs.length > 0 ? [...options.manifestDirs] : [manifestDir];
|
|
22775
|
+
const recordsManifestDirs = options.manifestDirs !== void 0 && options.manifestDirs.length > 0;
|
|
22776
|
+
const manifestRecordPath = join2(installRoot, MANIFEST_DIR_RECORD);
|
|
22762
22777
|
let installerCalled = false;
|
|
22778
|
+
function parseRecordedDirs(raw) {
|
|
22779
|
+
let parsed;
|
|
22780
|
+
try {
|
|
22781
|
+
parsed = JSON.parse(raw);
|
|
22782
|
+
} catch {
|
|
22783
|
+
return void 0;
|
|
22784
|
+
}
|
|
22785
|
+
if (!Array.isArray(parsed) || parsed.length === 0 || parsed.length > 8) {
|
|
22786
|
+
return void 0;
|
|
22787
|
+
}
|
|
22788
|
+
const dirs = [];
|
|
22789
|
+
const seen = /* @__PURE__ */ new Set();
|
|
22790
|
+
for (const entry of parsed) {
|
|
22791
|
+
if (typeof entry !== "string" || seen.has(entry) || !isSafeManifestDir(entry)) {
|
|
22792
|
+
return void 0;
|
|
22793
|
+
}
|
|
22794
|
+
seen.add(entry);
|
|
22795
|
+
dirs.push(entry);
|
|
22796
|
+
}
|
|
22797
|
+
return dirs;
|
|
22798
|
+
}
|
|
22799
|
+
async function readRecordedDirs() {
|
|
22800
|
+
if (!recordsManifestDirs) return void 0;
|
|
22801
|
+
try {
|
|
22802
|
+
return parseRecordedDirs(await readFile2(manifestRecordPath, "utf8"));
|
|
22803
|
+
} catch {
|
|
22804
|
+
return void 0;
|
|
22805
|
+
}
|
|
22806
|
+
}
|
|
22807
|
+
async function activeManifestDirs() {
|
|
22808
|
+
const recorded = await readRecordedDirs();
|
|
22809
|
+
if (recorded) return recorded;
|
|
22810
|
+
if (!recordsManifestDirs) return configuredManifestDirs;
|
|
22811
|
+
const present = [];
|
|
22812
|
+
for (const dir of configuredManifestDirs) {
|
|
22813
|
+
if (await existsFile(join2(dir, `${hostName}.json`))) present.push(dir);
|
|
22814
|
+
}
|
|
22815
|
+
return present.length > 0 ? present : configuredManifestDirs;
|
|
22816
|
+
}
|
|
22817
|
+
async function snapshotFile(path2) {
|
|
22818
|
+
let previous;
|
|
22819
|
+
try {
|
|
22820
|
+
previous = await readFile2(path2, "utf8");
|
|
22821
|
+
} catch {
|
|
22822
|
+
previous = void 0;
|
|
22823
|
+
}
|
|
22824
|
+
return { path: path2, previous, written: false };
|
|
22825
|
+
}
|
|
22826
|
+
async function restoreSnapshot(snap) {
|
|
22827
|
+
if (!snap.written) return;
|
|
22828
|
+
if (snap.previous !== void 0) {
|
|
22829
|
+
await writeFileAtomic(snap.path, snap.previous);
|
|
22830
|
+
return;
|
|
22831
|
+
}
|
|
22832
|
+
await rm(snap.path, { force: true });
|
|
22833
|
+
}
|
|
22834
|
+
async function rollbackWritten(snaps) {
|
|
22835
|
+
for (const snap of snaps) {
|
|
22836
|
+
try {
|
|
22837
|
+
await restoreSnapshot(snap);
|
|
22838
|
+
} catch {
|
|
22839
|
+
}
|
|
22840
|
+
}
|
|
22841
|
+
}
|
|
22842
|
+
async function writeManifestFiles(data) {
|
|
22843
|
+
const snaps = [];
|
|
22844
|
+
try {
|
|
22845
|
+
for (const dir of configuredManifestDirs) {
|
|
22846
|
+
if (recordsManifestDirs && !isSafeManifestDir(dir)) {
|
|
22847
|
+
throw new Error("trust.write-failed");
|
|
22848
|
+
}
|
|
22849
|
+
const snap = await snapshotFile(join2(dir, `${hostName}.json`));
|
|
22850
|
+
snaps.push(snap);
|
|
22851
|
+
await writeFileAtomic(snap.path, data);
|
|
22852
|
+
snap.written = true;
|
|
22853
|
+
}
|
|
22854
|
+
if (recordsManifestDirs) {
|
|
22855
|
+
const recordSnap = await snapshotFile(manifestRecordPath);
|
|
22856
|
+
snaps.push(recordSnap);
|
|
22857
|
+
await writeFileAtomic(
|
|
22858
|
+
manifestRecordPath,
|
|
22859
|
+
`${JSON.stringify(configuredManifestDirs)}
|
|
22860
|
+
`
|
|
22861
|
+
);
|
|
22862
|
+
recordSnap.written = true;
|
|
22863
|
+
}
|
|
22864
|
+
return { ok: true, snaps };
|
|
22865
|
+
} catch (error) {
|
|
22866
|
+
await rollbackWritten(snaps);
|
|
22867
|
+
return { ok: false, reason: codeOf(error, "trust.write-failed") };
|
|
22868
|
+
}
|
|
22869
|
+
}
|
|
22763
22870
|
async function install(extensionId) {
|
|
22764
22871
|
if (!extensionId || !/^[a-p]{32}$/.test(extensionId)) {
|
|
22765
22872
|
return {
|
|
@@ -22794,21 +22901,17 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22794
22901
|
}
|
|
22795
22902
|
const caps = await detect();
|
|
22796
22903
|
if (!caps.manifest) return unsupportedResult(caps);
|
|
22797
|
-
|
|
22798
|
-
|
|
22799
|
-
} catch (error) {
|
|
22904
|
+
const written = await writeManifestFiles(data);
|
|
22905
|
+
if (!written.ok) {
|
|
22800
22906
|
return {
|
|
22801
22907
|
ok: false,
|
|
22802
22908
|
state: "unsupported",
|
|
22803
|
-
reasons: [
|
|
22909
|
+
reasons: [written.reason]
|
|
22804
22910
|
};
|
|
22805
22911
|
}
|
|
22806
22912
|
const caTrustCaps = await detect();
|
|
22807
22913
|
if (!caTrustCaps.caTrust) {
|
|
22808
|
-
|
|
22809
|
-
await rm(manifestPath(), { force: true });
|
|
22810
|
-
} catch {
|
|
22811
|
-
}
|
|
22914
|
+
await rollbackWritten(written.snaps);
|
|
22812
22915
|
return unsupportedResult(caTrustCaps);
|
|
22813
22916
|
}
|
|
22814
22917
|
const trustResult = await trust();
|
|
@@ -22817,13 +22920,11 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22817
22920
|
await rollbackReplacedCa();
|
|
22818
22921
|
} catch {
|
|
22819
22922
|
}
|
|
22820
|
-
|
|
22821
|
-
await rm(manifestPath(), { force: true });
|
|
22822
|
-
} catch {
|
|
22823
|
-
}
|
|
22923
|
+
await rollbackWritten(written.snaps);
|
|
22824
22924
|
installerCalled = false;
|
|
22825
22925
|
return trustResult;
|
|
22826
22926
|
}
|
|
22927
|
+
await rm(storePendingPath, { force: true });
|
|
22827
22928
|
return trustResult.reasons ? { ok: true, state: "installed", reasons: trustResult.reasons } : { ok: true, state: "installed" };
|
|
22828
22929
|
}
|
|
22829
22930
|
async function reusableCaMaterial() {
|
|
@@ -22953,8 +23054,8 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22953
23054
|
}
|
|
22954
23055
|
let installedNew = false;
|
|
22955
23056
|
if (caTrustInstaller && !installerCalled) {
|
|
22956
|
-
await caTrustInstaller(await readFile2(caCertFile, "utf8"));
|
|
22957
23057
|
installerCalled = true;
|
|
23058
|
+
await caTrustInstaller(await readFile2(caCertFile, "utf8"));
|
|
22958
23059
|
installedNew = true;
|
|
22959
23060
|
}
|
|
22960
23061
|
if (reusable && siblingAnchor && (installedNew || !caTrustInstaller)) {
|
|
@@ -22979,11 +23080,15 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22979
23080
|
const saved = await readPreviousRogatioCa(caPreviousCertFile);
|
|
22980
23081
|
const live = await readPreviousRogatioCa(caCertFile);
|
|
22981
23082
|
const caWasPresent = await existsFile(caKeyFile);
|
|
23083
|
+
if (caWasPresent && caTrustRemover) {
|
|
23084
|
+
await writeFileAtomic(storePendingPath, "1\n", 384);
|
|
23085
|
+
}
|
|
22982
23086
|
await rm(caKeyFile, { force: true });
|
|
22983
23087
|
await rm(caPubFile, { force: true });
|
|
22984
23088
|
await rm(caCertFile, { force: true });
|
|
22985
|
-
if (
|
|
23089
|
+
if (caTrustRemover && await existsFile(storePendingPath)) {
|
|
22986
23090
|
await caTrustRemover();
|
|
23091
|
+
await rm(storePendingPath, { force: true });
|
|
22987
23092
|
}
|
|
22988
23093
|
if (!saved) return;
|
|
22989
23094
|
if (!caWasPresent || saved.fingerprint !== live?.fingerprint) {
|
|
@@ -22998,14 +23103,19 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
22998
23103
|
}
|
|
22999
23104
|
async function uninstall() {
|
|
23000
23105
|
try {
|
|
23001
|
-
|
|
23106
|
+
const dirs = await activeManifestDirs();
|
|
23107
|
+
for (const dir of dirs) {
|
|
23108
|
+
await rm(join2(dir, `${hostName}.json`), { force: true });
|
|
23109
|
+
}
|
|
23110
|
+
if (recordsManifestDirs) await rm(manifestRecordPath, { force: true });
|
|
23002
23111
|
await removeCa();
|
|
23003
23112
|
installerCalled = false;
|
|
23004
23113
|
} catch (error) {
|
|
23114
|
+
const reason = error instanceof TrustError ? error.message : error instanceof Error ? error.message : String(error);
|
|
23005
23115
|
return {
|
|
23006
23116
|
ok: false,
|
|
23007
23117
|
state: "unsupported",
|
|
23008
|
-
reasons: [
|
|
23118
|
+
reasons: [reason]
|
|
23009
23119
|
};
|
|
23010
23120
|
}
|
|
23011
23121
|
return { ok: true, state: "uninstalled" };
|
|
@@ -23022,13 +23132,30 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
23022
23132
|
}
|
|
23023
23133
|
return anchorRemovalWarning ? { ok: true, state: "trusted", reasons: [anchorRemovalWarning] } : { ok: true, state: "trusted" };
|
|
23024
23134
|
}
|
|
23135
|
+
function manifestAcceptable(parsed) {
|
|
23136
|
+
if (!recordsManifestDirs) return true;
|
|
23137
|
+
return parsed.name === hostName && parsed.path === hostPath && parsed.type === "stdio";
|
|
23138
|
+
}
|
|
23139
|
+
function sameOrigins(left, right) {
|
|
23140
|
+
if (left.length !== right.length) return false;
|
|
23141
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
23142
|
+
if (left[index] !== right[index]) return false;
|
|
23143
|
+
}
|
|
23144
|
+
return true;
|
|
23145
|
+
}
|
|
23025
23146
|
async function status() {
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23147
|
+
const dirs = await activeManifestDirs();
|
|
23148
|
+
let installed = dirs.length > 0;
|
|
23149
|
+
for (const dir of dirs) {
|
|
23150
|
+
try {
|
|
23151
|
+
const raw = await readFile2(join2(dir, `${hostName}.json`), "utf8");
|
|
23152
|
+
const parsed = JSON.parse(raw);
|
|
23153
|
+
if (!isWellFormedManifest(parsed) || !manifestAcceptable(parsed)) {
|
|
23154
|
+
installed = false;
|
|
23155
|
+
}
|
|
23156
|
+
} catch {
|
|
23157
|
+
installed = false;
|
|
23158
|
+
}
|
|
23032
23159
|
}
|
|
23033
23160
|
const trusted = await existsFile(caKeyFile) && await existsFile(caCertFile);
|
|
23034
23161
|
const caps = await detect();
|
|
@@ -23041,34 +23168,50 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
23041
23168
|
}
|
|
23042
23169
|
async function verify2() {
|
|
23043
23170
|
const reasons = [];
|
|
23044
|
-
|
|
23045
|
-
|
|
23171
|
+
const pushReason = (reason) => {
|
|
23172
|
+
if (!reasons.includes(reason)) reasons.push(reason);
|
|
23173
|
+
};
|
|
23174
|
+
const dirs = await activeManifestDirs();
|
|
23175
|
+
let manifestExists = dirs.length > 0;
|
|
23176
|
+
let manifestValid = dirs.length > 0;
|
|
23046
23177
|
let binaryExists = false;
|
|
23047
23178
|
let binaryExecutable = false;
|
|
23048
23179
|
let allowedOrigins = [];
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
|
|
23053
|
-
|
|
23054
|
-
|
|
23055
|
-
|
|
23056
|
-
|
|
23057
|
-
|
|
23058
|
-
binaryExists = fileStat.isFile();
|
|
23059
|
-
binaryExecutable = platform === "win32" ? binaryExists : (fileStat.mode & 73) !== 0;
|
|
23060
|
-
if (!binaryExists) reasons.push("binary-not-found");
|
|
23061
|
-
if (!binaryExecutable) reasons.push("binary-not-executable");
|
|
23062
|
-
} catch {
|
|
23063
|
-
binaryExists = false;
|
|
23064
|
-
reasons.push("binary-not-found");
|
|
23180
|
+
let binaryPath;
|
|
23181
|
+
for (const dir of dirs) {
|
|
23182
|
+
try {
|
|
23183
|
+
const raw = await readFile2(join2(dir, `${hostName}.json`), "utf8");
|
|
23184
|
+
const parsed = JSON.parse(raw);
|
|
23185
|
+
if (!isWellFormedManifest(parsed) || !manifestAcceptable(parsed)) {
|
|
23186
|
+
manifestValid = false;
|
|
23187
|
+
pushReason("manifest-invalid");
|
|
23188
|
+
continue;
|
|
23065
23189
|
}
|
|
23066
|
-
if (
|
|
23067
|
-
|
|
23068
|
-
|
|
23190
|
+
if (binaryPath === void 0) {
|
|
23191
|
+
binaryPath = parsed.path;
|
|
23192
|
+
allowedOrigins = [...parsed.allowed_origins];
|
|
23193
|
+
} else if (parsed.path !== binaryPath || !sameOrigins(parsed.allowed_origins, allowedOrigins)) {
|
|
23194
|
+
manifestValid = false;
|
|
23195
|
+
pushReason("manifest-invalid");
|
|
23196
|
+
}
|
|
23197
|
+
} catch {
|
|
23198
|
+
manifestExists = false;
|
|
23199
|
+
manifestValid = false;
|
|
23200
|
+
pushReason("manifest-not-found");
|
|
23069
23201
|
}
|
|
23070
|
-
}
|
|
23071
|
-
|
|
23202
|
+
}
|
|
23203
|
+
if (binaryPath !== void 0) {
|
|
23204
|
+
try {
|
|
23205
|
+
const fileStat = await stat(binaryPath);
|
|
23206
|
+
binaryExists = fileStat.isFile();
|
|
23207
|
+
binaryExecutable = platform === "win32" ? binaryExists : (fileStat.mode & 73) !== 0;
|
|
23208
|
+
if (!binaryExists) pushReason("binary-not-found");
|
|
23209
|
+
if (!binaryExecutable) pushReason("binary-not-executable");
|
|
23210
|
+
} catch {
|
|
23211
|
+
binaryExists = false;
|
|
23212
|
+
pushReason("binary-not-found");
|
|
23213
|
+
}
|
|
23214
|
+
if (allowedOrigins.length === 0) pushReason("no-allowed-origins");
|
|
23072
23215
|
}
|
|
23073
23216
|
const caTrusted = await existsFile(caKeyFile) && await existsFile(caCertFile);
|
|
23074
23217
|
if (!caTrusted) reasons.push("ca-not-trusted");
|
|
@@ -23261,10 +23404,99 @@ var darwinAdapter = {
|
|
|
23261
23404
|
};
|
|
23262
23405
|
var darwin_default = darwinAdapter;
|
|
23263
23406
|
var CA_DIR = "/usr/local/share/ca-certificates";
|
|
23264
|
-
var
|
|
23265
|
-
|
|
23266
|
-
|
|
23267
|
-
|
|
23407
|
+
var CERT_NAME = "rogatio-ca.crt";
|
|
23408
|
+
var DEBIAN_CERT = posixJoin2(CA_DIR, CERT_NAME);
|
|
23409
|
+
var ARCH_TRUST_SOURCE = "/etc/ca-certificates/trust-source";
|
|
23410
|
+
var FEDORA_TRUST_SOURCE = "/etc/pki/ca-trust/source";
|
|
23411
|
+
var ARCH_ANCHORS = "/etc/ca-certificates/trust-source/anchors";
|
|
23412
|
+
var FEDORA_ANCHORS = "/etc/pki/ca-trust/source/anchors";
|
|
23413
|
+
var P11_CERTS = [
|
|
23414
|
+
posixJoin2(ARCH_ANCHORS, CERT_NAME),
|
|
23415
|
+
posixJoin2(FEDORA_ANCHORS, CERT_NAME)
|
|
23416
|
+
];
|
|
23417
|
+
var BROWSERS = ["google-chrome", "chromium"];
|
|
23418
|
+
function nodeCode(err) {
|
|
23419
|
+
const code = err?.code;
|
|
23420
|
+
return typeof code === "string" && code.length > 0 ? code : "EACCES";
|
|
23421
|
+
}
|
|
23422
|
+
function exists(path2) {
|
|
23423
|
+
try {
|
|
23424
|
+
accessSync2(path2);
|
|
23425
|
+
return true;
|
|
23426
|
+
} catch (err) {
|
|
23427
|
+
return nodeCode(err) !== "ENOENT";
|
|
23428
|
+
}
|
|
23429
|
+
}
|
|
23430
|
+
function writable(path2) {
|
|
23431
|
+
try {
|
|
23432
|
+
accessSync2(path2, constants3.W_OK);
|
|
23433
|
+
return true;
|
|
23434
|
+
} catch {
|
|
23435
|
+
return false;
|
|
23436
|
+
}
|
|
23437
|
+
}
|
|
23438
|
+
function toolOnPath(name) {
|
|
23439
|
+
const result = spawnSync2("which", [name], { timeout: 1e3 });
|
|
23440
|
+
if (result.status === 0) return true;
|
|
23441
|
+
const code = result.error?.code;
|
|
23442
|
+
if (code !== "ENOENT") return false;
|
|
23443
|
+
const pathEnv = process.env.PATH ?? "";
|
|
23444
|
+
for (const dir of pathEnv.split(":")) {
|
|
23445
|
+
if (dir.length === 0) continue;
|
|
23446
|
+
try {
|
|
23447
|
+
accessSync2(posixJoin2(dir, name));
|
|
23448
|
+
return true;
|
|
23449
|
+
} catch {
|
|
23450
|
+
}
|
|
23451
|
+
}
|
|
23452
|
+
return false;
|
|
23453
|
+
}
|
|
23454
|
+
function caBackend() {
|
|
23455
|
+
if (toolOnPath("update-ca-certificates")) return "debian";
|
|
23456
|
+
if (toolOnPath("update-ca-trust")) return "p11kit";
|
|
23457
|
+
return void 0;
|
|
23458
|
+
}
|
|
23459
|
+
function p11kitAnchorsDir() {
|
|
23460
|
+
const arch = exists(ARCH_TRUST_SOURCE);
|
|
23461
|
+
const fedora = exists(FEDORA_TRUST_SOURCE);
|
|
23462
|
+
if (arch && !fedora) return ARCH_ANCHORS;
|
|
23463
|
+
if (fedora && !arch) return FEDORA_ANCHORS;
|
|
23464
|
+
return void 0;
|
|
23465
|
+
}
|
|
23466
|
+
function needsElevation(dir) {
|
|
23467
|
+
if (writable(dir)) return false;
|
|
23468
|
+
try {
|
|
23469
|
+
accessSync2(dir, constants3.W_OK);
|
|
23470
|
+
} catch (err) {
|
|
23471
|
+
if (nodeCode(err) === "ENOENT" && writable(dirname4(dir))) return false;
|
|
23472
|
+
}
|
|
23473
|
+
return !toolOnPath("sudo");
|
|
23474
|
+
}
|
|
23475
|
+
function configHome() {
|
|
23476
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
23477
|
+
if (typeof xdg === "string" && xdg.startsWith("/")) return xdg;
|
|
23478
|
+
const home = process.env.HOME ?? "";
|
|
23479
|
+
return posixJoin2(home, ".config");
|
|
23480
|
+
}
|
|
23481
|
+
function manifestDirFor(browser) {
|
|
23482
|
+
return posixJoin2(configHome(), browser, "NativeMessagingHosts");
|
|
23483
|
+
}
|
|
23484
|
+
function canHostManifest(dir) {
|
|
23485
|
+
try {
|
|
23486
|
+
accessSync2(dir, constants3.W_OK);
|
|
23487
|
+
return true;
|
|
23488
|
+
} catch (err) {
|
|
23489
|
+
if (nodeCode(err) !== "ENOENT") return false;
|
|
23490
|
+
}
|
|
23491
|
+
try {
|
|
23492
|
+
accessSync2(dirname4(dir), constants3.W_OK);
|
|
23493
|
+
return true;
|
|
23494
|
+
} catch {
|
|
23495
|
+
return false;
|
|
23496
|
+
}
|
|
23497
|
+
}
|
|
23498
|
+
function installableManifestDirs() {
|
|
23499
|
+
return BROWSERS.map(manifestDirFor).filter(canHostManifest);
|
|
23268
23500
|
}
|
|
23269
23501
|
function installFailureReason(stderr) {
|
|
23270
23502
|
const text = stderr.toLowerCase();
|
|
@@ -23306,44 +23538,36 @@ function runSudo(args, stdin) {
|
|
|
23306
23538
|
input.end(stdin);
|
|
23307
23539
|
});
|
|
23308
23540
|
}
|
|
23541
|
+
async function sudoOrThrow(args, stdin) {
|
|
23542
|
+
const result = await runSudo(args, stdin);
|
|
23543
|
+
if (result.code === 0) return;
|
|
23544
|
+
const reason = installFailureReason(result.stderr);
|
|
23545
|
+
throw new TrustError("trust.internal", reason, [reason]);
|
|
23546
|
+
}
|
|
23309
23547
|
var linuxAdapter = {
|
|
23310
23548
|
platform: "linux",
|
|
23311
23549
|
defaultManifestDir: () => {
|
|
23312
23550
|
const home = process.env.HOME ?? "";
|
|
23313
23551
|
return posixJoin2(home, ".config/google-chrome/NativeMessagingHosts");
|
|
23314
23552
|
},
|
|
23553
|
+
manifestDirs: () => installableManifestDirs(),
|
|
23315
23554
|
defaultCaInstallPath: () => CA_DIR,
|
|
23316
23555
|
detect() {
|
|
23317
23556
|
const reasons = [];
|
|
23318
|
-
const
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
});
|
|
23322
|
-
if (updateCa.status !== 0) {
|
|
23323
|
-
reasons.push("tooling-missing");
|
|
23324
|
-
}
|
|
23325
|
-
try {
|
|
23326
|
-
accessSync2(manifestDir, constants3.W_OK);
|
|
23327
|
-
} catch {
|
|
23557
|
+
const backend = caBackend();
|
|
23558
|
+
if (!backend) reasons.push("tooling-missing");
|
|
23559
|
+
if (installableManifestDirs().length === 0) {
|
|
23328
23560
|
reasons.push("manifest-dir-unwritable");
|
|
23329
23561
|
}
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
}
|
|
23333
|
-
|
|
23334
|
-
|
|
23335
|
-
|
|
23336
|
-
} catch {
|
|
23337
|
-
if (!hasSudo()) {
|
|
23338
|
-
reasons.push("elevation-required");
|
|
23339
|
-
}
|
|
23340
|
-
}
|
|
23341
|
-
} else if (!hasSudo()) {
|
|
23342
|
-
reasons.push("elevation-required");
|
|
23343
|
-
}
|
|
23562
|
+
if (backend === "debian") {
|
|
23563
|
+
if (needsElevation(CA_DIR)) reasons.push("elevation-required");
|
|
23564
|
+
} else if (backend === "p11kit") {
|
|
23565
|
+
const anchors = p11kitAnchorsDir();
|
|
23566
|
+
if (!anchors) reasons.push("ca-store-unwritable");
|
|
23567
|
+
else if (needsElevation(anchors)) reasons.push("elevation-required");
|
|
23344
23568
|
}
|
|
23345
23569
|
const manifest = !reasons.includes("tooling-missing") && !reasons.includes("manifest-dir-unwritable");
|
|
23346
|
-
const caTrust = !reasons.includes("tooling-missing") && !reasons.includes("elevation-required");
|
|
23570
|
+
const caTrust = !reasons.includes("tooling-missing") && !reasons.includes("elevation-required") && !reasons.includes("ca-store-unwritable");
|
|
23347
23571
|
return {
|
|
23348
23572
|
manifest,
|
|
23349
23573
|
caTrust,
|
|
@@ -23356,29 +23580,55 @@ var linuxAdapter = {
|
|
|
23356
23580
|
"invalid-ca-certificate"
|
|
23357
23581
|
]);
|
|
23358
23582
|
}
|
|
23359
|
-
|
|
23360
|
-
|
|
23361
|
-
|
|
23583
|
+
if (caBackend() === "debian") {
|
|
23584
|
+
try {
|
|
23585
|
+
mkdirSync(CA_DIR, { recursive: true });
|
|
23586
|
+
} catch {
|
|
23587
|
+
throw new TrustError("trust.internal", "ca-store-unwritable", [
|
|
23588
|
+
"ca-store-unwritable"
|
|
23589
|
+
]);
|
|
23590
|
+
}
|
|
23591
|
+
await sudoOrThrow(["tee", DEBIAN_CERT], certPem);
|
|
23592
|
+
await sudoOrThrow(["update-ca-certificates"]);
|
|
23593
|
+
return;
|
|
23594
|
+
}
|
|
23595
|
+
if (caBackend() !== "p11kit") {
|
|
23596
|
+
throw new TrustError("trust.internal", "tooling-missing", [
|
|
23597
|
+
"tooling-missing"
|
|
23598
|
+
]);
|
|
23599
|
+
}
|
|
23600
|
+
const anchors = p11kitAnchorsDir();
|
|
23601
|
+
if (!anchors) {
|
|
23362
23602
|
throw new TrustError("trust.internal", "ca-store-unwritable", [
|
|
23363
23603
|
"ca-store-unwritable"
|
|
23364
23604
|
]);
|
|
23365
23605
|
}
|
|
23366
|
-
const
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23606
|
+
const certPath = posixJoin2(anchors, CERT_NAME);
|
|
23607
|
+
await sudoOrThrow(["mkdir", "-p", anchors]);
|
|
23608
|
+
await sudoOrThrow(["tee", certPath], certPem);
|
|
23609
|
+
const refresh = await runSudo(["update-ca-trust"]);
|
|
23610
|
+
if (refresh.code === 0) return;
|
|
23611
|
+
await sudoOrThrow(["rm", "-f", certPath]);
|
|
23612
|
+
const rebuilt = await runSudo(["update-ca-trust"]);
|
|
23613
|
+
if (rebuilt.code !== 0) {
|
|
23614
|
+
const reason2 = installFailureReason(rebuilt.stderr);
|
|
23615
|
+
throw new TrustError("trust.internal", reason2, [reason2]);
|
|
23616
|
+
}
|
|
23617
|
+
const reason = installFailureReason(refresh.stderr);
|
|
23618
|
+
throw new TrustError("trust.internal", reason, [reason]);
|
|
23376
23619
|
},
|
|
23377
23620
|
async caTrustRemover() {
|
|
23378
23621
|
try {
|
|
23379
|
-
unlinkSync2(
|
|
23622
|
+
unlinkSync2(DEBIAN_CERT);
|
|
23380
23623
|
} catch {
|
|
23381
23624
|
}
|
|
23625
|
+
if (!toolOnPath("update-ca-trust")) return;
|
|
23626
|
+
const present = P11_CERTS.filter((path2) => exists(path2));
|
|
23627
|
+
if (caBackend() !== "p11kit" && present.length === 0) return;
|
|
23628
|
+
for (const certPath of present) {
|
|
23629
|
+
await sudoOrThrow(["rm", "-f", certPath]);
|
|
23630
|
+
}
|
|
23631
|
+
await sudoOrThrow(["update-ca-trust"]);
|
|
23382
23632
|
},
|
|
23383
23633
|
async caTrustAnchorRemover(fingerprintSha1, certPem) {
|
|
23384
23634
|
void fingerprintSha1;
|
|
@@ -23545,13 +23795,15 @@ function createInstalledTrustController() {
|
|
|
23545
23795
|
const platform = process.platform;
|
|
23546
23796
|
const adapter = selectTrustPlatformAdapter(platform);
|
|
23547
23797
|
const installRoot = defaultTrustInstallRoot(platform);
|
|
23798
|
+
const manifestDirs = adapter.manifestDirs?.() ?? [];
|
|
23548
23799
|
return createRequestBodyTrustController({
|
|
23549
23800
|
platform,
|
|
23550
23801
|
installRoot,
|
|
23551
23802
|
hostPath: join5(installRoot, "runtime-host"),
|
|
23552
23803
|
hostName: "com.rogatio.runtime",
|
|
23553
23804
|
allowedOrigins: [],
|
|
23554
|
-
manifestDir: adapter.defaultManifestDir(),
|
|
23805
|
+
manifestDir: manifestDirs[0] ?? adapter.defaultManifestDir(),
|
|
23806
|
+
...manifestDirs.length > 0 ? { manifestDirs } : {},
|
|
23555
23807
|
detectCapabilities: () => adapter.detect(),
|
|
23556
23808
|
caTrustInstaller: (cert) => adapter.caTrustInstaller(cert),
|
|
23557
23809
|
caTrustRemover: () => adapter.caTrustRemover(),
|
|
@@ -33270,10 +33522,10 @@ function reportTrust(subcommand, result, okMessage) {
|
|
|
33270
33522
|
const reasons = result.reasons ?? ["unknown"];
|
|
33271
33523
|
console.error(`trust unsupported: ${reasons.join(", ")}`);
|
|
33272
33524
|
const hints = {
|
|
33273
|
-
"tooling-missing": "Hint: install required tooling (macOS: security; Linux: update-ca-certificates; Windows: certutil is built-in)",
|
|
33274
|
-
"manifest-dir-unwritable": "Hint: check permissions on
|
|
33525
|
+
"tooling-missing": "Hint: install required tooling (macOS: security; Linux: update-ca-certificates or update-ca-trust; Windows: certutil is built-in)",
|
|
33526
|
+
"manifest-dir-unwritable": "Hint: check permissions on the browser NativeMessagingHosts directory (Google Chrome or Chromium) or run with appropriate access",
|
|
33275
33527
|
"keychain-unwritable": "Hint: macOS login keychain not writable; try running with appropriate keychain access or use sudo for system keychain",
|
|
33276
|
-
"ca-store-unwritable": "Hint: /usr/local/share/ca-certificates
|
|
33528
|
+
"ca-store-unwritable": "Hint: the CA trust store is not writable, or this system has no supported anchors directory. Debian uses /usr/local/share/ca-certificates. Arch uses /etc/ca-certificates/trust-source/anchors. Fedora and RHEL use /etc/pki/ca-trust/source/anchors",
|
|
33277
33529
|
"elevation-required": "Hint: device-local CA trust requires root (Linux: sudo, macOS: keychain password, Windows: Administrator). Re-run with elevated privileges"
|
|
33278
33530
|
};
|
|
33279
33531
|
for (const reason of reasons) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rogatio/cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local-first browser request and response rules — editor host, file verification, test runner, and runtime dispatch.",
|
|
@@ -20,9 +20,11 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
|
+
"main": "./dist/node/index.js",
|
|
24
|
+
"types": "./dist/node/index.d.ts",
|
|
23
25
|
"exports": {
|
|
24
26
|
".": {
|
|
25
|
-
"types": "./
|
|
27
|
+
"types": "./dist/node/index.d.ts",
|
|
26
28
|
"import": "./dist/node/index.js"
|
|
27
29
|
}
|
|
28
30
|
},
|