@kubohiroya/turbowarp-extension-security-dialog 0.6.0 → 0.7.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.ja.md +26 -7
- package/README.md +28 -7
- package/dist/index.cjs +25 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +25 -11
- package/dist/react.cjs +39 -18
- package/dist/react.mjs +39 -18
- package/dist/review-types.d.ts +30 -14
- package/dist/turbowarp.cjs +14 -5
- package/dist/turbowarp.mjs +14 -5
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -47,8 +47,27 @@ import '@kubohiroya/turbowarp-extension-security-dialog/styles.css';
|
|
|
47
47
|
| 一覧に載るもの | カタログの拡張。依存先は自動で選ばれる | 作品が使う拡張すべて |
|
|
48
48
|
| 選ぶ | チェックで選ぶ | 無し。作品が既に名指ししている |
|
|
49
49
|
| 動かし方 | サンドボックスの中で、またはサンドボックスなしで | 動かさない、サンドボックスの中で、サンドボックスなしで |
|
|
50
|
-
| 読み込み元 |
|
|
51
|
-
| 一括指定 | 両方 |
|
|
50
|
+
| 読み込み元 | 4つの持ち方から選ぶ | `remote-cacheable` の行で控えを残すかだけ。ほかの行は読み込み元を述べる |
|
|
51
|
+
| 一括指定 | 両方 | 動かし方と、断れる控えが1つでもあるときはその控え |
|
|
52
|
+
|
|
53
|
+
### 4つの持ち方
|
|
54
|
+
|
|
55
|
+
拡張のバイト列の持ち方は4つです。ローダーの Manifest・SB3 の保存形式・この画面が同じ語で呼ぶので、
|
|
56
|
+
ホストは両端を変換表なしでつなげます。
|
|
57
|
+
|
|
58
|
+
| 名前 | このブラウザー | 作品のファイル | 標準 TurboWarp |
|
|
59
|
+
| --- | --- | --- | --- |
|
|
60
|
+
| `remote-non-cacheable` | 何も残さない | 参照だけ | 開けない |
|
|
61
|
+
| `remote-cacheable` | 検証した控えを残してよい | 参照だけ | 開けない |
|
|
62
|
+
| `embedded-file` | 残すものが無い | バイト列を ZIP の中のファイルとして持つ | 開けない |
|
|
63
|
+
| `embedded-data` | 残すものが無い | バイト列を `data:` の値として持つ | **開ける** |
|
|
64
|
+
|
|
65
|
+
**4つはすべて作者の決定**で、拡張を追加したときに決まります。だから `add` は4つすべてを出し、
|
|
66
|
+
`open` はほとんど何も出しません。開く人に残る問いは「`remote-cacheable` の行の控えを自分の
|
|
67
|
+
ブラウザーに実際に残すか」だけで、しかも**断ることしかできません**。`remote-non-cacheable` は
|
|
68
|
+
作者が控えを禁じたということで、それを上書きして許可を書く書き方は存在しません。そのため
|
|
69
|
+
`loadingChoices` は行の source から選択肢を読み取り、横に対応表を置く必要がありません。source が
|
|
70
|
+
持ち方を名指している行はもうそのように読み込まれているので、画面は尋ねるのではなく述べます。
|
|
52
71
|
|
|
53
72
|
### しないこと
|
|
54
73
|
|
|
@@ -61,8 +80,8 @@ import '@kubohiroya/turbowarp-extension-security-dialog/styles.css';
|
|
|
61
80
|
扱いで、サンドボックスなしで動き、実行の選択肢を出しません。信頼済みの行だけの作品は止める
|
|
62
81
|
価値が無いので、`requiresReview` が画面を出さなくてよいと答えます。
|
|
63
82
|
|
|
64
|
-
**記録された答えは、いまも選択肢である場合だけ尊重します。**
|
|
65
|
-
|
|
83
|
+
**記録された答えは、いまも選択肢である場合だけ尊重します。** 作品が `remote-cacheable` から
|
|
84
|
+
埋め込みに変わった、行が信頼済みになった、といった場合に、もう提示しない答えを持ち込みません。
|
|
66
85
|
|
|
67
86
|
## 取得を待つあいだ
|
|
68
87
|
|
|
@@ -113,10 +132,10 @@ const uninstall = installBatchExtensionLoader(vm, review, defaultURLs, createDec
|
|
|
113
132
|
|
|
114
133
|
| 内容 | 場所 | 決める人 |
|
|
115
134
|
| --- | --- | --- |
|
|
116
|
-
|
|
|
135
|
+
| 4つの持ち方のどれか | 作品 | 追加した人 |
|
|
117
136
|
| 動かし方(追加したとき) | 作品 | 追加した人 |
|
|
118
137
|
| 動かし方(開いたとき) | このブラウザー、作品ごと | 開く人 |
|
|
119
|
-
|
|
|
138
|
+
| `remote-cacheable` の控えを実際に残すか | このブラウザー、作品ごと | 開く人。断ることだけできる |
|
|
120
139
|
| プレビュー画像 | このブラウザー | 誰でもない。常に残す |
|
|
121
140
|
|
|
122
141
|
保存が使えないとき(プライベートウィンドウ、サイトデータを止めたブラウザー)も、読み取りは必ず
|
|
@@ -132,7 +151,7 @@ const uninstall = installBatchExtensionLoader(vm, review, defaultURLs, createDec
|
|
|
132
151
|
|
|
133
152
|
```sh
|
|
134
153
|
pnpm install
|
|
135
|
-
pnpm run check # ビルド、テスト
|
|
154
|
+
pnpm run check # ビルド、テスト46件、pack の dry run
|
|
136
155
|
```
|
|
137
156
|
|
|
138
157
|
React と React DOM は peerDependencies なので、ホストが用意します。実行時の依存はありません。
|
package/README.md
CHANGED
|
@@ -48,8 +48,29 @@ is put, so they are the same component.
|
|
|
48
48
|
| What is listed | Catalog entries; dependencies are selected for you | Every extension the project uses |
|
|
49
49
|
| Picking | Tick to choose | None: the project already names them |
|
|
50
50
|
| How it runs | In the sandbox, or without it | Do not run, in the sandbox, or without it |
|
|
51
|
-
| Where it loads from |
|
|
52
|
-
| All at once | Both choices |
|
|
51
|
+
| Where it loads from | Any of the four forms | Only whether a `remote-cacheable` row keeps its copy; every other row states how it loads |
|
|
52
|
+
| All at once | Both choices | How they all run, and the copy where at least one row has one to decline |
|
|
53
|
+
|
|
54
|
+
### The four loading forms
|
|
55
|
+
|
|
56
|
+
An extension's bytes are held in one of four ways, spelled the same by the Loader's manifest, by
|
|
57
|
+
the SB3 save format and by this screen, so a host wires the two ends together without a
|
|
58
|
+
translation table.
|
|
59
|
+
|
|
60
|
+
| Form | This browser | The project file | Standard TurboWarp |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `remote-non-cacheable` | Keeps nothing | A reference | Cannot open it |
|
|
63
|
+
| `remote-cacheable` | May keep a verified copy | A reference | Cannot open it |
|
|
64
|
+
| `embedded-file` | Nothing to keep | The bytes, as a file in the archive | Cannot open it |
|
|
65
|
+
| `embedded-data` | Nothing to keep | The bytes, as a `data:` value | **Can open it** |
|
|
66
|
+
|
|
67
|
+
**All four are the author's decision**, made when the extension was added, which is why `add`
|
|
68
|
+
offers all of them and `open` offers almost none. The one thing left to the person opening a
|
|
69
|
+
project is whether a `remote-cacheable` row actually leaves its copy in this browser, and that can
|
|
70
|
+
only be declined: `remote-non-cacheable` is the author forbidding the copy, and there is no way to
|
|
71
|
+
write permission back over it. So `loadingChoices` reads the choices off the row's own source and
|
|
72
|
+
needs no table beside it — a row whose source names a form is already loading that way, and the
|
|
73
|
+
screen states it instead of asking.
|
|
53
74
|
|
|
54
75
|
### What it will not do
|
|
55
76
|
|
|
@@ -63,8 +84,8 @@ host's own gallery: it runs without the sandbox and offers no execution choice.
|
|
|
63
84
|
nothing but trusted rows is not worth stopping, so `requiresReview` says to skip the screen.
|
|
64
85
|
|
|
65
86
|
**A remembered answer is honoured only where it is still one of the choices.** A project that
|
|
66
|
-
moved from
|
|
67
|
-
a stale answer into a screen that no longer offers it.
|
|
87
|
+
moved from `remote-cacheable` to embedded bytes, or a row that has since become trusted, does not
|
|
88
|
+
carry a stale answer into a screen that no longer offers it.
|
|
68
89
|
|
|
69
90
|
## While a fetch is waiting
|
|
70
91
|
|
|
@@ -117,10 +138,10 @@ Saying no resolves `onComplete` with `null`, and the load rejects with an error
|
|
|
117
138
|
|
|
118
139
|
| What | Where | Who decides |
|
|
119
140
|
| --- | --- | --- |
|
|
120
|
-
|
|
|
141
|
+
| Which of the four loading forms | The project | Whoever added the extension |
|
|
121
142
|
| How it runs, when added | The project | Whoever added it |
|
|
122
143
|
| How it runs, when opened | This browser, per project | Whoever opens it |
|
|
123
|
-
|
|
|
144
|
+
| Whether a `remote-cacheable` copy is kept | This browser, per project | Whoever opens it, and only to decline |
|
|
124
145
|
| Preview pictures | This browser | Nobody; always kept |
|
|
125
146
|
|
|
126
147
|
Every read answers with something usable even when storage is unavailable — a private window, a
|
|
@@ -137,7 +158,7 @@ code does so elsewhere, and a row says so when it failed.
|
|
|
137
158
|
|
|
138
159
|
```sh
|
|
139
160
|
pnpm install
|
|
140
|
-
pnpm run check # build,
|
|
161
|
+
pnpm run check # build, 46 tests, and a packing dry run
|
|
141
162
|
```
|
|
142
163
|
|
|
143
164
|
React and React DOM are peer dependencies, so the host supplies them. There are no runtime
|
package/dist/index.cjs
CHANGED
|
@@ -47,6 +47,7 @@ __export(index_exports, {
|
|
|
47
47
|
loadExtensionCatalog: () => loadExtensionCatalog,
|
|
48
48
|
loadExtensionInfo: () => loadExtensionInfo,
|
|
49
49
|
loadingChoices: () => loadingChoices,
|
|
50
|
+
loadingModes: () => loadingModes,
|
|
50
51
|
messages: () => messages,
|
|
51
52
|
parseExtensionCatalog: () => parseExtensionCatalog,
|
|
52
53
|
parseExtensionMetadata: () => parseExtensionMetadata,
|
|
@@ -356,7 +357,7 @@ var run = async (store, mode, work) => {
|
|
|
356
357
|
db.close();
|
|
357
358
|
}
|
|
358
359
|
};
|
|
359
|
-
function createDecisionStorage({ fallbackLoading = "
|
|
360
|
+
function createDecisionStorage({ fallbackLoading = "remote-cacheable" } = {}) {
|
|
360
361
|
return Object.freeze({
|
|
361
362
|
fallbackLoading,
|
|
362
363
|
/**
|
|
@@ -440,17 +441,26 @@ function createPreviewCache() {
|
|
|
440
441
|
|
|
441
442
|
// src/decisions.js
|
|
442
443
|
var isTrusted = (entry) => Boolean(entry && entry.state && entry.state.trusted);
|
|
443
|
-
var
|
|
444
|
+
var loadingModes = Object.freeze([
|
|
445
|
+
"remote-cacheable",
|
|
446
|
+
"remote-non-cacheable",
|
|
447
|
+
"embedded-file",
|
|
448
|
+
"embedded-data"
|
|
449
|
+
]);
|
|
450
|
+
var loadingChoices = (entry) => entry.source.kind === "catalog" ? [...loadingModes] : entry.source.kind === "remote-cacheable" ? ["remote-cacheable", "remote-non-cacheable"] : [];
|
|
444
451
|
var executionChoices = (entry, mode) => isTrusted(entry) ? [] : mode === "add" ? ["sandboxed", "unsandboxed"] : ["deny", "sandboxed", "unsandboxed"];
|
|
445
|
-
function defaultDecision(entry, mode, fallbackLoading = "
|
|
452
|
+
function defaultDecision(entry, mode, fallbackLoading = "remote-cacheable") {
|
|
446
453
|
const execution = isTrusted(entry) ? "unsandboxed" : "sandboxed";
|
|
447
454
|
const choices = loadingChoices(entry);
|
|
448
455
|
if (choices.length === 0) {
|
|
449
|
-
return entry.source.kind === "
|
|
456
|
+
return entry.source.kind === "legacy" ? { execution } : { execution, loading: entry.source.kind };
|
|
450
457
|
}
|
|
451
458
|
return { execution, loading: choices.includes(fallbackLoading) ? fallbackLoading : choices[0] };
|
|
452
459
|
}
|
|
453
|
-
function initialDecisions(entries, mode, {
|
|
460
|
+
function initialDecisions(entries, mode, {
|
|
461
|
+
recorded = /* @__PURE__ */ new Map(),
|
|
462
|
+
fallbackLoading = "remote-cacheable"
|
|
463
|
+
} = {}) {
|
|
454
464
|
return new Map(entries.map((entry) => {
|
|
455
465
|
const base = defaultDecision(entry, mode, fallbackLoading);
|
|
456
466
|
const previous = recorded.get(entry.key);
|
|
@@ -477,9 +487,12 @@ var messages = {
|
|
|
477
487
|
"execution-deny": "Do not run",
|
|
478
488
|
"execution-sandboxed": "In the sandbox",
|
|
479
489
|
"execution-unsandboxed": "Without the sandbox",
|
|
480
|
-
"loading-
|
|
481
|
-
"loading-remote": "Fetch each time",
|
|
482
|
-
|
|
490
|
+
"loading-remote-cacheable": "Keep a copy (default)",
|
|
491
|
+
"loading-remote-non-cacheable": "Fetch each time",
|
|
492
|
+
// The two embedded forms differ only in the carrier, which is what decides who else can
|
|
493
|
+
// open the project, so the wording names the carrier and nothing else.
|
|
494
|
+
"loading-embedded-file": "In the project",
|
|
495
|
+
"loading-embedded-data": "In the project, as a data address",
|
|
483
496
|
loadingNote: "A kept copy is verified and reused, so the project opens without the network. Fetching each time leaves nothing in this browser.",
|
|
484
497
|
unsandboxedWarning: "Without the sandbox, an extension can reach the project, the editor and this site\u2019s data. Choose it only for code you trust.",
|
|
485
498
|
"requirement-required": "Says it needs to run without the sandbox",
|
|
@@ -522,9 +535,10 @@ var messages = {
|
|
|
522
535
|
"execution-deny": "\u52D5\u304B\u3055\u306A\u3044",
|
|
523
536
|
"execution-sandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u4E2D\u3067",
|
|
524
537
|
"execution-unsandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u3067",
|
|
525
|
-
"loading-
|
|
526
|
-
"loading-remote": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
527
|
-
"loading-embedded": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
538
|
+
"loading-remote-cacheable": "\u63A7\u3048\u3092\u6B8B\u3059\uFF08\u65E2\u5B9A\uFF09",
|
|
539
|
+
"loading-remote-non-cacheable": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
540
|
+
"loading-embedded-file": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
541
|
+
"loading-embedded-data": "\u4F5C\u54C1\u306E\u4E2D\u306E data: \u30A2\u30C9\u30EC\u30B9\u304B\u3089",
|
|
528
542
|
loadingNote: "\u63A7\u3048\u306F\u691C\u8A3C\u3057\u305F\u3046\u3048\u3067\u4F7F\u3044\u56DE\u3059\u306E\u3067\u3001\u901A\u4FE1\u306A\u3057\u3067\u3082\u4F5C\u54C1\u304C\u958B\u304D\u307E\u3059\u3002\u6BCE\u56DE\u53D6\u5F97\u3059\u308B\u5834\u5408\u306F\u3001\u3053\u306E\u30D6\u30E9\u30A6\u30B6\u30FC\u306B\u4F55\u3082\u6B8B\u308A\u307E\u305B\u3093\u3002",
|
|
529
543
|
unsandboxedWarning: "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u306E\u62E1\u5F35\u306F\u3001\u4F5C\u54C1\u30FB\u30A8\u30C7\u30A3\u30BF\u30FC\u30FB\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30C7\u30FC\u30BF\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002\u4FE1\u983C\u3067\u304D\u308B\u30B3\u30FC\u30C9\u306B\u3060\u3051\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",
|
|
530
544
|
"requirement-required": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u304C\u5FC5\u8981\u3068\u7533\u544A\u3057\u3066\u3044\u307E\u3059",
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export function createPreviewCache(): PreviewCache;
|
|
|
46
46
|
|
|
47
47
|
export type ReviewMode = 'add' | 'open';
|
|
48
48
|
export function isTrusted(entry: ReviewEntry): boolean;
|
|
49
|
+
export const loadingModes: readonly LoadingMode[];
|
|
49
50
|
export function loadingChoices(entry: ReviewEntry): LoadingMode[];
|
|
50
51
|
export function executionChoices(entry: ReviewEntry, mode: ReviewMode): ExecutionDecision[];
|
|
51
52
|
export function defaultDecision(entry: ReviewEntry, mode: ReviewMode, fallbackLoading?: LoadingMode): ReviewDecision;
|
package/dist/index.mjs
CHANGED
|
@@ -314,7 +314,7 @@ var run = async (store, mode, work) => {
|
|
|
314
314
|
db.close();
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
|
-
function createDecisionStorage({ fallbackLoading = "
|
|
317
|
+
function createDecisionStorage({ fallbackLoading = "remote-cacheable" } = {}) {
|
|
318
318
|
return Object.freeze({
|
|
319
319
|
fallbackLoading,
|
|
320
320
|
/**
|
|
@@ -398,17 +398,26 @@ function createPreviewCache() {
|
|
|
398
398
|
|
|
399
399
|
// src/decisions.js
|
|
400
400
|
var isTrusted = (entry) => Boolean(entry && entry.state && entry.state.trusted);
|
|
401
|
-
var
|
|
401
|
+
var loadingModes = Object.freeze([
|
|
402
|
+
"remote-cacheable",
|
|
403
|
+
"remote-non-cacheable",
|
|
404
|
+
"embedded-file",
|
|
405
|
+
"embedded-data"
|
|
406
|
+
]);
|
|
407
|
+
var loadingChoices = (entry) => entry.source.kind === "catalog" ? [...loadingModes] : entry.source.kind === "remote-cacheable" ? ["remote-cacheable", "remote-non-cacheable"] : [];
|
|
402
408
|
var executionChoices = (entry, mode) => isTrusted(entry) ? [] : mode === "add" ? ["sandboxed", "unsandboxed"] : ["deny", "sandboxed", "unsandboxed"];
|
|
403
|
-
function defaultDecision(entry, mode, fallbackLoading = "
|
|
409
|
+
function defaultDecision(entry, mode, fallbackLoading = "remote-cacheable") {
|
|
404
410
|
const execution = isTrusted(entry) ? "unsandboxed" : "sandboxed";
|
|
405
411
|
const choices = loadingChoices(entry);
|
|
406
412
|
if (choices.length === 0) {
|
|
407
|
-
return entry.source.kind === "
|
|
413
|
+
return entry.source.kind === "legacy" ? { execution } : { execution, loading: entry.source.kind };
|
|
408
414
|
}
|
|
409
415
|
return { execution, loading: choices.includes(fallbackLoading) ? fallbackLoading : choices[0] };
|
|
410
416
|
}
|
|
411
|
-
function initialDecisions(entries, mode, {
|
|
417
|
+
function initialDecisions(entries, mode, {
|
|
418
|
+
recorded = /* @__PURE__ */ new Map(),
|
|
419
|
+
fallbackLoading = "remote-cacheable"
|
|
420
|
+
} = {}) {
|
|
412
421
|
return new Map(entries.map((entry) => {
|
|
413
422
|
const base = defaultDecision(entry, mode, fallbackLoading);
|
|
414
423
|
const previous = recorded.get(entry.key);
|
|
@@ -435,9 +444,12 @@ var messages = {
|
|
|
435
444
|
"execution-deny": "Do not run",
|
|
436
445
|
"execution-sandboxed": "In the sandbox",
|
|
437
446
|
"execution-unsandboxed": "Without the sandbox",
|
|
438
|
-
"loading-
|
|
439
|
-
"loading-remote": "Fetch each time",
|
|
440
|
-
|
|
447
|
+
"loading-remote-cacheable": "Keep a copy (default)",
|
|
448
|
+
"loading-remote-non-cacheable": "Fetch each time",
|
|
449
|
+
// The two embedded forms differ only in the carrier, which is what decides who else can
|
|
450
|
+
// open the project, so the wording names the carrier and nothing else.
|
|
451
|
+
"loading-embedded-file": "In the project",
|
|
452
|
+
"loading-embedded-data": "In the project, as a data address",
|
|
441
453
|
loadingNote: "A kept copy is verified and reused, so the project opens without the network. Fetching each time leaves nothing in this browser.",
|
|
442
454
|
unsandboxedWarning: "Without the sandbox, an extension can reach the project, the editor and this site\u2019s data. Choose it only for code you trust.",
|
|
443
455
|
"requirement-required": "Says it needs to run without the sandbox",
|
|
@@ -480,9 +492,10 @@ var messages = {
|
|
|
480
492
|
"execution-deny": "\u52D5\u304B\u3055\u306A\u3044",
|
|
481
493
|
"execution-sandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u4E2D\u3067",
|
|
482
494
|
"execution-unsandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u3067",
|
|
483
|
-
"loading-
|
|
484
|
-
"loading-remote": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
485
|
-
"loading-embedded": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
495
|
+
"loading-remote-cacheable": "\u63A7\u3048\u3092\u6B8B\u3059\uFF08\u65E2\u5B9A\uFF09",
|
|
496
|
+
"loading-remote-non-cacheable": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
497
|
+
"loading-embedded-file": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
498
|
+
"loading-embedded-data": "\u4F5C\u54C1\u306E\u4E2D\u306E data: \u30A2\u30C9\u30EC\u30B9\u304B\u3089",
|
|
486
499
|
loadingNote: "\u63A7\u3048\u306F\u691C\u8A3C\u3057\u305F\u3046\u3048\u3067\u4F7F\u3044\u56DE\u3059\u306E\u3067\u3001\u901A\u4FE1\u306A\u3057\u3067\u3082\u4F5C\u54C1\u304C\u958B\u304D\u307E\u3059\u3002\u6BCE\u56DE\u53D6\u5F97\u3059\u308B\u5834\u5408\u306F\u3001\u3053\u306E\u30D6\u30E9\u30A6\u30B6\u30FC\u306B\u4F55\u3082\u6B8B\u308A\u307E\u305B\u3093\u3002",
|
|
487
500
|
unsandboxedWarning: "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u306E\u62E1\u5F35\u306F\u3001\u4F5C\u54C1\u30FB\u30A8\u30C7\u30A3\u30BF\u30FC\u30FB\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30C7\u30FC\u30BF\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002\u4FE1\u983C\u3067\u304D\u308B\u30B3\u30FC\u30C9\u306B\u3060\u3051\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",
|
|
488
501
|
"requirement-required": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u304C\u5FC5\u8981\u3068\u7533\u544A\u3057\u3066\u3044\u307E\u3059",
|
|
@@ -623,6 +636,7 @@ export {
|
|
|
623
636
|
loadExtensionCatalog,
|
|
624
637
|
loadExtensionInfo,
|
|
625
638
|
loadingChoices,
|
|
639
|
+
loadingModes,
|
|
626
640
|
messages,
|
|
627
641
|
parseExtensionCatalog,
|
|
628
642
|
parseExtensionMetadata,
|
package/dist/react.cjs
CHANGED
|
@@ -68,9 +68,12 @@ var messages = {
|
|
|
68
68
|
"execution-deny": "Do not run",
|
|
69
69
|
"execution-sandboxed": "In the sandbox",
|
|
70
70
|
"execution-unsandboxed": "Without the sandbox",
|
|
71
|
-
"loading-
|
|
72
|
-
"loading-remote": "Fetch each time",
|
|
73
|
-
|
|
71
|
+
"loading-remote-cacheable": "Keep a copy (default)",
|
|
72
|
+
"loading-remote-non-cacheable": "Fetch each time",
|
|
73
|
+
// The two embedded forms differ only in the carrier, which is what decides who else can
|
|
74
|
+
// open the project, so the wording names the carrier and nothing else.
|
|
75
|
+
"loading-embedded-file": "In the project",
|
|
76
|
+
"loading-embedded-data": "In the project, as a data address",
|
|
74
77
|
loadingNote: "A kept copy is verified and reused, so the project opens without the network. Fetching each time leaves nothing in this browser.",
|
|
75
78
|
unsandboxedWarning: "Without the sandbox, an extension can reach the project, the editor and this site\u2019s data. Choose it only for code you trust.",
|
|
76
79
|
"requirement-required": "Says it needs to run without the sandbox",
|
|
@@ -113,9 +116,10 @@ var messages = {
|
|
|
113
116
|
"execution-deny": "\u52D5\u304B\u3055\u306A\u3044",
|
|
114
117
|
"execution-sandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u4E2D\u3067",
|
|
115
118
|
"execution-unsandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u3067",
|
|
116
|
-
"loading-
|
|
117
|
-
"loading-remote": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
118
|
-
"loading-embedded": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
119
|
+
"loading-remote-cacheable": "\u63A7\u3048\u3092\u6B8B\u3059\uFF08\u65E2\u5B9A\uFF09",
|
|
120
|
+
"loading-remote-non-cacheable": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
121
|
+
"loading-embedded-file": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
122
|
+
"loading-embedded-data": "\u4F5C\u54C1\u306E\u4E2D\u306E data: \u30A2\u30C9\u30EC\u30B9\u304B\u3089",
|
|
119
123
|
loadingNote: "\u63A7\u3048\u306F\u691C\u8A3C\u3057\u305F\u3046\u3048\u3067\u4F7F\u3044\u56DE\u3059\u306E\u3067\u3001\u901A\u4FE1\u306A\u3057\u3067\u3082\u4F5C\u54C1\u304C\u958B\u304D\u307E\u3059\u3002\u6BCE\u56DE\u53D6\u5F97\u3059\u308B\u5834\u5408\u306F\u3001\u3053\u306E\u30D6\u30E9\u30A6\u30B6\u30FC\u306B\u4F55\u3082\u6B8B\u308A\u307E\u305B\u3093\u3002",
|
|
120
124
|
unsandboxedWarning: "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u306E\u62E1\u5F35\u306F\u3001\u4F5C\u54C1\u30FB\u30A8\u30C7\u30A3\u30BF\u30FC\u30FB\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30C7\u30FC\u30BF\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002\u4FE1\u983C\u3067\u304D\u308B\u30B3\u30FC\u30C9\u306B\u3060\u3051\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",
|
|
121
125
|
"requirement-required": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u304C\u5FC5\u8981\u3068\u7533\u544A\u3057\u3066\u3044\u307E\u3059",
|
|
@@ -365,17 +369,26 @@ var ExtensionPreview = class extends import_react.default.PureComponent {
|
|
|
365
369
|
|
|
366
370
|
// src/decisions.js
|
|
367
371
|
var isTrusted = (entry) => Boolean(entry && entry.state && entry.state.trusted);
|
|
368
|
-
var
|
|
372
|
+
var loadingModes = Object.freeze([
|
|
373
|
+
"remote-cacheable",
|
|
374
|
+
"remote-non-cacheable",
|
|
375
|
+
"embedded-file",
|
|
376
|
+
"embedded-data"
|
|
377
|
+
]);
|
|
378
|
+
var loadingChoices = (entry) => entry.source.kind === "catalog" ? [...loadingModes] : entry.source.kind === "remote-cacheable" ? ["remote-cacheable", "remote-non-cacheable"] : [];
|
|
369
379
|
var executionChoices = (entry, mode) => isTrusted(entry) ? [] : mode === "add" ? ["sandboxed", "unsandboxed"] : ["deny", "sandboxed", "unsandboxed"];
|
|
370
|
-
function defaultDecision(entry, mode, fallbackLoading = "
|
|
380
|
+
function defaultDecision(entry, mode, fallbackLoading = "remote-cacheable") {
|
|
371
381
|
const execution = isTrusted(entry) ? "unsandboxed" : "sandboxed";
|
|
372
382
|
const choices = loadingChoices(entry);
|
|
373
383
|
if (choices.length === 0) {
|
|
374
|
-
return entry.source.kind === "
|
|
384
|
+
return entry.source.kind === "legacy" ? { execution } : { execution, loading: entry.source.kind };
|
|
375
385
|
}
|
|
376
386
|
return { execution, loading: choices.includes(fallbackLoading) ? fallbackLoading : choices[0] };
|
|
377
387
|
}
|
|
378
|
-
function initialDecisions(entries, mode, {
|
|
388
|
+
function initialDecisions(entries, mode, {
|
|
389
|
+
recorded = /* @__PURE__ */ new Map(),
|
|
390
|
+
fallbackLoading = "remote-cacheable"
|
|
391
|
+
} = {}) {
|
|
379
392
|
return new Map(entries.map((entry) => {
|
|
380
393
|
const base = defaultDecision(entry, mode, fallbackLoading);
|
|
381
394
|
const previous = recorded.get(entry.key);
|
|
@@ -392,9 +405,12 @@ var fallbackBanner = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53
|
|
|
392
405
|
var bind = (instance, names) => names.forEach((name) => {
|
|
393
406
|
instance[name] = instance[name].bind(instance);
|
|
394
407
|
});
|
|
408
|
+
var isEmbedded = (source) => source.kind === "embedded-file" || source.kind === "embedded-data";
|
|
395
409
|
var sourceLabel = (entry, t) => {
|
|
396
|
-
if (entry.source.kind === "embedded") return t("sourceEmbedded");
|
|
397
|
-
if (String(entry.source.url).startsWith("data:"))
|
|
410
|
+
if (entry.source.kind === "embedded-file") return t("sourceEmbedded");
|
|
411
|
+
if (entry.source.kind === "embedded-data" || String(entry.source.url).startsWith("data:")) {
|
|
412
|
+
return t("sourceInline");
|
|
413
|
+
}
|
|
398
414
|
if (entry.source.kind === "legacy") return `${t("sourceLegacy")}: ${entry.source.url}`;
|
|
399
415
|
return entry.source.url;
|
|
400
416
|
};
|
|
@@ -434,7 +450,7 @@ var ExtensionReview = class extends import_react2.default.PureComponent {
|
|
|
434
450
|
const { loadInfo, entries } = this.props;
|
|
435
451
|
if (!loadInfo) return;
|
|
436
452
|
for (const entry of entries) {
|
|
437
|
-
if (entry.metadata || entry.source
|
|
453
|
+
if (entry.metadata || isEmbedded(entry.source)) continue;
|
|
438
454
|
try {
|
|
439
455
|
const info = await loadInfo(entry.source.url, this.controller.signal);
|
|
440
456
|
if (this.controller.signal.aborted) return;
|
|
@@ -586,7 +602,7 @@ var ExtensionReview = class extends import_react2.default.PureComponent {
|
|
|
586
602
|
t
|
|
587
603
|
}
|
|
588
604
|
),
|
|
589
|
-
loadings.length === 0 && decision.loading
|
|
605
|
+
loadings.length === 0 && decision.loading !== void 0 && /* @__PURE__ */ import_react2.default.createElement("p", { className: "twextsec-loading-fixed" }, t(`loading-${decision.loading}`)),
|
|
590
606
|
contradictsDeclaration(entry, decision) && /* @__PURE__ */ import_react2.default.createElement(
|
|
591
607
|
"p",
|
|
592
608
|
{
|
|
@@ -602,6 +618,7 @@ var ExtensionReview = class extends import_react2.default.PureComponent {
|
|
|
602
618
|
const t = this.t.bind(this);
|
|
603
619
|
const selection = this.selection();
|
|
604
620
|
const anyUnsandboxed = [...this.included()].some((key) => this.state.decisions.get(key).execution === "unsandboxed");
|
|
621
|
+
const bulkLoadings = loadingModes.filter((mode2) => entries.some((entry) => loadingChoices(entry).includes(mode2)));
|
|
605
622
|
const body = /* @__PURE__ */ import_react2.default.createElement("div", { className: "twextsec-review" }, /* @__PURE__ */ import_react2.default.createElement("p", { className: "twextsec-intro" }, t(mode === "add" ? "addIntro" : "openIntro")), /* @__PURE__ */ import_react2.default.createElement("div", { className: "twextsec-bulk" }, /* @__PURE__ */ import_react2.default.createElement(
|
|
606
623
|
Choices,
|
|
607
624
|
{
|
|
@@ -612,17 +629,17 @@ var ExtensionReview = class extends import_react2.default.PureComponent {
|
|
|
612
629
|
onChange: this.handleBulkExecution,
|
|
613
630
|
t
|
|
614
631
|
}
|
|
615
|
-
), /* @__PURE__ */ import_react2.default.createElement(
|
|
632
|
+
), bulkLoadings.length > 0 && /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(
|
|
616
633
|
Choices,
|
|
617
634
|
{
|
|
618
635
|
name: "loading-all",
|
|
619
636
|
label: t("loadingBulk"),
|
|
620
637
|
value: null,
|
|
621
|
-
options:
|
|
638
|
+
options: bulkLoadings,
|
|
622
639
|
onChange: this.handleBulkLoading,
|
|
623
640
|
t
|
|
624
641
|
}
|
|
625
|
-
), /* @__PURE__ */ import_react2.default.createElement("p", { className: "twextsec-note" }, t("loadingNote"))), anyUnsandboxed && /* @__PURE__ */ import_react2.default.createElement(
|
|
642
|
+
), /* @__PURE__ */ import_react2.default.createElement("p", { className: "twextsec-note" }, t("loadingNote")))), anyUnsandboxed && /* @__PURE__ */ import_react2.default.createElement(
|
|
626
643
|
"p",
|
|
627
644
|
{
|
|
628
645
|
className: "twextsec-warning",
|
|
@@ -659,5 +676,9 @@ var ExtensionReview = class extends import_react2.default.PureComponent {
|
|
|
659
676
|
return body;
|
|
660
677
|
}
|
|
661
678
|
};
|
|
662
|
-
ExtensionReview.defaultProps = {
|
|
679
|
+
ExtensionReview.defaultProps = {
|
|
680
|
+
locale: "en",
|
|
681
|
+
fallbackLoading: "remote-cacheable",
|
|
682
|
+
previewCache: createPreviewCache()
|
|
683
|
+
};
|
|
663
684
|
var review_default = ExtensionReview;
|
package/dist/react.mjs
CHANGED
|
@@ -35,9 +35,12 @@ var messages = {
|
|
|
35
35
|
"execution-deny": "Do not run",
|
|
36
36
|
"execution-sandboxed": "In the sandbox",
|
|
37
37
|
"execution-unsandboxed": "Without the sandbox",
|
|
38
|
-
"loading-
|
|
39
|
-
"loading-remote": "Fetch each time",
|
|
40
|
-
|
|
38
|
+
"loading-remote-cacheable": "Keep a copy (default)",
|
|
39
|
+
"loading-remote-non-cacheable": "Fetch each time",
|
|
40
|
+
// The two embedded forms differ only in the carrier, which is what decides who else can
|
|
41
|
+
// open the project, so the wording names the carrier and nothing else.
|
|
42
|
+
"loading-embedded-file": "In the project",
|
|
43
|
+
"loading-embedded-data": "In the project, as a data address",
|
|
41
44
|
loadingNote: "A kept copy is verified and reused, so the project opens without the network. Fetching each time leaves nothing in this browser.",
|
|
42
45
|
unsandboxedWarning: "Without the sandbox, an extension can reach the project, the editor and this site\u2019s data. Choose it only for code you trust.",
|
|
43
46
|
"requirement-required": "Says it needs to run without the sandbox",
|
|
@@ -80,9 +83,10 @@ var messages = {
|
|
|
80
83
|
"execution-deny": "\u52D5\u304B\u3055\u306A\u3044",
|
|
81
84
|
"execution-sandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306E\u4E2D\u3067",
|
|
82
85
|
"execution-unsandboxed": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u3067",
|
|
83
|
-
"loading-
|
|
84
|
-
"loading-remote": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
85
|
-
"loading-embedded": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
86
|
+
"loading-remote-cacheable": "\u63A7\u3048\u3092\u6B8B\u3059\uFF08\u65E2\u5B9A\uFF09",
|
|
87
|
+
"loading-remote-non-cacheable": "\u6BCE\u56DE\u53D6\u5F97\u3059\u308B",
|
|
88
|
+
"loading-embedded-file": "\u4F5C\u54C1\u306E\u4E2D\u304B\u3089",
|
|
89
|
+
"loading-embedded-data": "\u4F5C\u54C1\u306E\u4E2D\u306E data: \u30A2\u30C9\u30EC\u30B9\u304B\u3089",
|
|
86
90
|
loadingNote: "\u63A7\u3048\u306F\u691C\u8A3C\u3057\u305F\u3046\u3048\u3067\u4F7F\u3044\u56DE\u3059\u306E\u3067\u3001\u901A\u4FE1\u306A\u3057\u3067\u3082\u4F5C\u54C1\u304C\u958B\u304D\u307E\u3059\u3002\u6BCE\u56DE\u53D6\u5F97\u3059\u308B\u5834\u5408\u306F\u3001\u3053\u306E\u30D6\u30E9\u30A6\u30B6\u30FC\u306B\u4F55\u3082\u6B8B\u308A\u307E\u305B\u3093\u3002",
|
|
87
91
|
unsandboxedWarning: "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u306E\u62E1\u5F35\u306F\u3001\u4F5C\u54C1\u30FB\u30A8\u30C7\u30A3\u30BF\u30FC\u30FB\u3053\u306E\u30B5\u30A4\u30C8\u306E\u30C7\u30FC\u30BF\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u3059\u3002\u4FE1\u983C\u3067\u304D\u308B\u30B3\u30FC\u30C9\u306B\u3060\u3051\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002",
|
|
88
92
|
"requirement-required": "\u30B5\u30F3\u30C9\u30DC\u30C3\u30AF\u30B9\u306A\u3057\u304C\u5FC5\u8981\u3068\u7533\u544A\u3057\u3066\u3044\u307E\u3059",
|
|
@@ -332,17 +336,26 @@ var ExtensionPreview = class extends React.PureComponent {
|
|
|
332
336
|
|
|
333
337
|
// src/decisions.js
|
|
334
338
|
var isTrusted = (entry) => Boolean(entry && entry.state && entry.state.trusted);
|
|
335
|
-
var
|
|
339
|
+
var loadingModes = Object.freeze([
|
|
340
|
+
"remote-cacheable",
|
|
341
|
+
"remote-non-cacheable",
|
|
342
|
+
"embedded-file",
|
|
343
|
+
"embedded-data"
|
|
344
|
+
]);
|
|
345
|
+
var loadingChoices = (entry) => entry.source.kind === "catalog" ? [...loadingModes] : entry.source.kind === "remote-cacheable" ? ["remote-cacheable", "remote-non-cacheable"] : [];
|
|
336
346
|
var executionChoices = (entry, mode) => isTrusted(entry) ? [] : mode === "add" ? ["sandboxed", "unsandboxed"] : ["deny", "sandboxed", "unsandboxed"];
|
|
337
|
-
function defaultDecision(entry, mode, fallbackLoading = "
|
|
347
|
+
function defaultDecision(entry, mode, fallbackLoading = "remote-cacheable") {
|
|
338
348
|
const execution = isTrusted(entry) ? "unsandboxed" : "sandboxed";
|
|
339
349
|
const choices = loadingChoices(entry);
|
|
340
350
|
if (choices.length === 0) {
|
|
341
|
-
return entry.source.kind === "
|
|
351
|
+
return entry.source.kind === "legacy" ? { execution } : { execution, loading: entry.source.kind };
|
|
342
352
|
}
|
|
343
353
|
return { execution, loading: choices.includes(fallbackLoading) ? fallbackLoading : choices[0] };
|
|
344
354
|
}
|
|
345
|
-
function initialDecisions(entries, mode, {
|
|
355
|
+
function initialDecisions(entries, mode, {
|
|
356
|
+
recorded = /* @__PURE__ */ new Map(),
|
|
357
|
+
fallbackLoading = "remote-cacheable"
|
|
358
|
+
} = {}) {
|
|
346
359
|
return new Map(entries.map((entry) => {
|
|
347
360
|
const base = defaultDecision(entry, mode, fallbackLoading);
|
|
348
361
|
const previous = recorded.get(entry.key);
|
|
@@ -359,9 +372,12 @@ var fallbackBanner = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53
|
|
|
359
372
|
var bind = (instance, names) => names.forEach((name) => {
|
|
360
373
|
instance[name] = instance[name].bind(instance);
|
|
361
374
|
});
|
|
375
|
+
var isEmbedded = (source) => source.kind === "embedded-file" || source.kind === "embedded-data";
|
|
362
376
|
var sourceLabel = (entry, t) => {
|
|
363
|
-
if (entry.source.kind === "embedded") return t("sourceEmbedded");
|
|
364
|
-
if (String(entry.source.url).startsWith("data:"))
|
|
377
|
+
if (entry.source.kind === "embedded-file") return t("sourceEmbedded");
|
|
378
|
+
if (entry.source.kind === "embedded-data" || String(entry.source.url).startsWith("data:")) {
|
|
379
|
+
return t("sourceInline");
|
|
380
|
+
}
|
|
365
381
|
if (entry.source.kind === "legacy") return `${t("sourceLegacy")}: ${entry.source.url}`;
|
|
366
382
|
return entry.source.url;
|
|
367
383
|
};
|
|
@@ -401,7 +417,7 @@ var ExtensionReview = class extends React2.PureComponent {
|
|
|
401
417
|
const { loadInfo, entries } = this.props;
|
|
402
418
|
if (!loadInfo) return;
|
|
403
419
|
for (const entry of entries) {
|
|
404
|
-
if (entry.metadata || entry.source
|
|
420
|
+
if (entry.metadata || isEmbedded(entry.source)) continue;
|
|
405
421
|
try {
|
|
406
422
|
const info = await loadInfo(entry.source.url, this.controller.signal);
|
|
407
423
|
if (this.controller.signal.aborted) return;
|
|
@@ -553,7 +569,7 @@ var ExtensionReview = class extends React2.PureComponent {
|
|
|
553
569
|
t
|
|
554
570
|
}
|
|
555
571
|
),
|
|
556
|
-
loadings.length === 0 && decision.loading
|
|
572
|
+
loadings.length === 0 && decision.loading !== void 0 && /* @__PURE__ */ React2.createElement("p", { className: "twextsec-loading-fixed" }, t(`loading-${decision.loading}`)),
|
|
557
573
|
contradictsDeclaration(entry, decision) && /* @__PURE__ */ React2.createElement(
|
|
558
574
|
"p",
|
|
559
575
|
{
|
|
@@ -569,6 +585,7 @@ var ExtensionReview = class extends React2.PureComponent {
|
|
|
569
585
|
const t = this.t.bind(this);
|
|
570
586
|
const selection = this.selection();
|
|
571
587
|
const anyUnsandboxed = [...this.included()].some((key) => this.state.decisions.get(key).execution === "unsandboxed");
|
|
588
|
+
const bulkLoadings = loadingModes.filter((mode2) => entries.some((entry) => loadingChoices(entry).includes(mode2)));
|
|
572
589
|
const body = /* @__PURE__ */ React2.createElement("div", { className: "twextsec-review" }, /* @__PURE__ */ React2.createElement("p", { className: "twextsec-intro" }, t(mode === "add" ? "addIntro" : "openIntro")), /* @__PURE__ */ React2.createElement("div", { className: "twextsec-bulk" }, /* @__PURE__ */ React2.createElement(
|
|
573
590
|
Choices,
|
|
574
591
|
{
|
|
@@ -579,17 +596,17 @@ var ExtensionReview = class extends React2.PureComponent {
|
|
|
579
596
|
onChange: this.handleBulkExecution,
|
|
580
597
|
t
|
|
581
598
|
}
|
|
582
|
-
), /* @__PURE__ */ React2.createElement(
|
|
599
|
+
), bulkLoadings.length > 0 && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
|
|
583
600
|
Choices,
|
|
584
601
|
{
|
|
585
602
|
name: "loading-all",
|
|
586
603
|
label: t("loadingBulk"),
|
|
587
604
|
value: null,
|
|
588
|
-
options:
|
|
605
|
+
options: bulkLoadings,
|
|
589
606
|
onChange: this.handleBulkLoading,
|
|
590
607
|
t
|
|
591
608
|
}
|
|
592
|
-
), /* @__PURE__ */ React2.createElement("p", { className: "twextsec-note" }, t("loadingNote"))), anyUnsandboxed && /* @__PURE__ */ React2.createElement(
|
|
609
|
+
), /* @__PURE__ */ React2.createElement("p", { className: "twextsec-note" }, t("loadingNote")))), anyUnsandboxed && /* @__PURE__ */ React2.createElement(
|
|
593
610
|
"p",
|
|
594
611
|
{
|
|
595
612
|
className: "twextsec-warning",
|
|
@@ -626,7 +643,11 @@ var ExtensionReview = class extends React2.PureComponent {
|
|
|
626
643
|
return body;
|
|
627
644
|
}
|
|
628
645
|
};
|
|
629
|
-
ExtensionReview.defaultProps = {
|
|
646
|
+
ExtensionReview.defaultProps = {
|
|
647
|
+
locale: "en",
|
|
648
|
+
fallbackLoading: "remote-cacheable",
|
|
649
|
+
previewCache: createPreviewCache()
|
|
650
|
+
};
|
|
630
651
|
var review_default = ExtensionReview;
|
|
631
652
|
export {
|
|
632
653
|
ExtensionReview,
|
package/dist/review-types.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The vocabulary the review screen and its hosts share.
|
|
3
3
|
*
|
|
4
|
-
* Nothing here
|
|
4
|
+
* Nothing here imports the Loader's own types. A host that reads a Plus manifest turns it into
|
|
5
5
|
* `ReviewEntry` rows before this package sees it, and turns `ReviewDecision` back into whatever
|
|
6
6
|
* the Loader wants. That keeps the dependency pointing one way: this package defines the port,
|
|
7
7
|
* the hosts implement it.
|
|
8
|
+
*
|
|
9
|
+
* The four loading forms are nevertheless spelled exactly as the manifest and the SB3 save format
|
|
10
|
+
* spell them. Sharing the words costs nothing and buys a lot: a host wires the two ends together
|
|
11
|
+
* without a translation table, and a translation table is where one layer quietly comes to
|
|
12
|
+
* disagree with the one above it.
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
15
|
/** What the person allows a row to do. `deny` means it does not run at all. */
|
|
@@ -13,18 +18,19 @@ export type ExecutionDecision = 'deny' | 'sandboxed' | 'unsandboxed';
|
|
|
13
18
|
/**
|
|
14
19
|
* Where a row's bytes come from when the project runs.
|
|
15
20
|
*
|
|
16
|
-
*
|
|
17
|
-
* time
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* value inside the project document.
|
|
21
|
+
* Four forms, two holding a reference and two holding the bytes. `remote-non-cacheable` fetches
|
|
22
|
+
* every time and keeps nothing anywhere. `remote-cacheable` fetches too, but a verified copy may
|
|
23
|
+
* be kept in this browser, so opening again costs no network while the project still holds only a
|
|
24
|
+
* reference. `embedded-file` is a file inside the archive. `embedded-data` is a `data:` value in
|
|
25
|
+
* the project document, which is also what lets a standard TurboWarp host open the project at all.
|
|
22
26
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
27
|
+
* All four are the author's decision, recorded when the extension was added, so the only question
|
|
28
|
+
* these leave the person opening a project is whether a `remote-cacheable` row may keep its copy
|
|
29
|
+
* here. That one can only ever be declined: `remote-non-cacheable` is the author forbidding the
|
|
30
|
+
* copy, and there is no way to write permission back over it.
|
|
26
31
|
*/
|
|
27
|
-
export type LoadingMode =
|
|
32
|
+
export type LoadingMode =
|
|
33
|
+
'remote-non-cacheable' | 'remote-cacheable' | 'embedded-file' | 'embedded-data';
|
|
28
34
|
|
|
29
35
|
export interface ExtensionMetadata {
|
|
30
36
|
name?: string; id?: string; description?: string; descriptions?: Record<string, string>;
|
|
@@ -33,11 +39,21 @@ export interface ExtensionMetadata {
|
|
|
33
39
|
unsandboxed?: string; updatedAt?: string;
|
|
34
40
|
}
|
|
35
41
|
|
|
36
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Where a row's code comes from, and what can be checked about it.
|
|
44
|
+
*
|
|
45
|
+
* A row some project already names carries the author's chosen form as its own `kind`, which is
|
|
46
|
+
* why `loadingChoices` can read the choices off the source and needs no table. The two kinds that
|
|
47
|
+
* are not forms are the two cases where there is no author's decision to read: `catalog` is a row
|
|
48
|
+
* that is in no project yet, so whoever is looking at it is the author and picks the form, and
|
|
49
|
+
* `legacy` is an ordinary custom extension, which has no form to pick.
|
|
50
|
+
*/
|
|
37
51
|
export type ReviewSource =
|
|
38
52
|
| {kind: 'catalog'; url: string; sha256?: string}
|
|
39
|
-
| {kind: '
|
|
40
|
-
| {kind: '
|
|
53
|
+
| {kind: 'remote-non-cacheable'; url: string; sha256: string}
|
|
54
|
+
| {kind: 'remote-cacheable'; url: string; sha256: string}
|
|
55
|
+
| {kind: 'embedded-file'; sha256: string}
|
|
56
|
+
| {kind: 'embedded-data'; sha256: string}
|
|
41
57
|
| {kind: 'legacy'; url: string};
|
|
42
58
|
|
|
43
59
|
export interface ReviewEntryState {
|
package/dist/turbowarp.cjs
CHANGED
|
@@ -26,17 +26,26 @@ module.exports = __toCommonJS(turbowarp_exports);
|
|
|
26
26
|
|
|
27
27
|
// src/decisions.js
|
|
28
28
|
var isTrusted = (entry) => Boolean(entry && entry.state && entry.state.trusted);
|
|
29
|
-
var
|
|
29
|
+
var loadingModes = Object.freeze([
|
|
30
|
+
"remote-cacheable",
|
|
31
|
+
"remote-non-cacheable",
|
|
32
|
+
"embedded-file",
|
|
33
|
+
"embedded-data"
|
|
34
|
+
]);
|
|
35
|
+
var loadingChoices = (entry) => entry.source.kind === "catalog" ? [...loadingModes] : entry.source.kind === "remote-cacheable" ? ["remote-cacheable", "remote-non-cacheable"] : [];
|
|
30
36
|
var executionChoices = (entry, mode) => isTrusted(entry) ? [] : mode === "add" ? ["sandboxed", "unsandboxed"] : ["deny", "sandboxed", "unsandboxed"];
|
|
31
|
-
function defaultDecision(entry, mode, fallbackLoading = "
|
|
37
|
+
function defaultDecision(entry, mode, fallbackLoading = "remote-cacheable") {
|
|
32
38
|
const execution = isTrusted(entry) ? "unsandboxed" : "sandboxed";
|
|
33
39
|
const choices = loadingChoices(entry);
|
|
34
40
|
if (choices.length === 0) {
|
|
35
|
-
return entry.source.kind === "
|
|
41
|
+
return entry.source.kind === "legacy" ? { execution } : { execution, loading: entry.source.kind };
|
|
36
42
|
}
|
|
37
43
|
return { execution, loading: choices.includes(fallbackLoading) ? fallbackLoading : choices[0] };
|
|
38
44
|
}
|
|
39
|
-
function initialDecisions(entries, mode, {
|
|
45
|
+
function initialDecisions(entries, mode, {
|
|
46
|
+
recorded = /* @__PURE__ */ new Map(),
|
|
47
|
+
fallbackLoading = "remote-cacheable"
|
|
48
|
+
} = {}) {
|
|
40
49
|
return new Map(entries.map((entry) => {
|
|
41
50
|
const base = defaultDecision(entry, mode, fallbackLoading);
|
|
42
51
|
const previous = recorded.get(entry.key);
|
|
@@ -109,7 +118,7 @@ function installBatchExtensionLoader(vm, review, defaultURLs = {}, storage = nul
|
|
|
109
118
|
const recorded = project && project.key && storage ? await storage.read(project.key) : /* @__PURE__ */ new Map();
|
|
110
119
|
const starting = initialDecisions(entries, "open", {
|
|
111
120
|
recorded,
|
|
112
|
-
fallbackLoading: storage ? storage.fallbackLoading : "
|
|
121
|
+
fallbackLoading: storage ? storage.fallbackLoading : "remote-cacheable"
|
|
113
122
|
});
|
|
114
123
|
if (!requiresReview(entries)) return starting;
|
|
115
124
|
const answer = await review(entries, starting);
|
package/dist/turbowarp.mjs
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
// src/decisions.js
|
|
2
2
|
var isTrusted = (entry) => Boolean(entry && entry.state && entry.state.trusted);
|
|
3
|
-
var
|
|
3
|
+
var loadingModes = Object.freeze([
|
|
4
|
+
"remote-cacheable",
|
|
5
|
+
"remote-non-cacheable",
|
|
6
|
+
"embedded-file",
|
|
7
|
+
"embedded-data"
|
|
8
|
+
]);
|
|
9
|
+
var loadingChoices = (entry) => entry.source.kind === "catalog" ? [...loadingModes] : entry.source.kind === "remote-cacheable" ? ["remote-cacheable", "remote-non-cacheable"] : [];
|
|
4
10
|
var executionChoices = (entry, mode) => isTrusted(entry) ? [] : mode === "add" ? ["sandboxed", "unsandboxed"] : ["deny", "sandboxed", "unsandboxed"];
|
|
5
|
-
function defaultDecision(entry, mode, fallbackLoading = "
|
|
11
|
+
function defaultDecision(entry, mode, fallbackLoading = "remote-cacheable") {
|
|
6
12
|
const execution = isTrusted(entry) ? "unsandboxed" : "sandboxed";
|
|
7
13
|
const choices = loadingChoices(entry);
|
|
8
14
|
if (choices.length === 0) {
|
|
9
|
-
return entry.source.kind === "
|
|
15
|
+
return entry.source.kind === "legacy" ? { execution } : { execution, loading: entry.source.kind };
|
|
10
16
|
}
|
|
11
17
|
return { execution, loading: choices.includes(fallbackLoading) ? fallbackLoading : choices[0] };
|
|
12
18
|
}
|
|
13
|
-
function initialDecisions(entries, mode, {
|
|
19
|
+
function initialDecisions(entries, mode, {
|
|
20
|
+
recorded = /* @__PURE__ */ new Map(),
|
|
21
|
+
fallbackLoading = "remote-cacheable"
|
|
22
|
+
} = {}) {
|
|
14
23
|
return new Map(entries.map((entry) => {
|
|
15
24
|
const base = defaultDecision(entry, mode, fallbackLoading);
|
|
16
25
|
const previous = recorded.get(entry.key);
|
|
@@ -83,7 +92,7 @@ function installBatchExtensionLoader(vm, review, defaultURLs = {}, storage = nul
|
|
|
83
92
|
const recorded = project && project.key && storage ? await storage.read(project.key) : /* @__PURE__ */ new Map();
|
|
84
93
|
const starting = initialDecisions(entries, "open", {
|
|
85
94
|
recorded,
|
|
86
|
-
fallbackLoading: storage ? storage.fallbackLoading : "
|
|
95
|
+
fallbackLoading: storage ? storage.fallbackLoading : "remote-cacheable"
|
|
87
96
|
});
|
|
88
97
|
if (!requiresReview(entries)) return starting;
|
|
89
98
|
const answer = await review(entries, starting);
|
package/package.json
CHANGED