sliftutils 1.7.9 → 1.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/bin/storageserver.js +4 -0
  2. package/{teststorage → examplestorage}/browser.tsx +18 -22
  3. package/{teststorage/server.ts → examplestorage/exampleserver.ts} +5 -5
  4. package/index.d.ts +528 -78
  5. package/misc/https/dns.d.ts +7 -3
  6. package/misc/https/dns.ts +4 -9
  7. package/misc/https/hostServer.d.ts +6 -3
  8. package/misc/https/hostServer.ts +6 -6
  9. package/package.json +2 -1
  10. package/spec.txt +77 -42
  11. package/storage/ArchivesDisk.d.ts +65 -0
  12. package/storage/ArchivesDisk.ts +365 -0
  13. package/storage/IArchives.d.ts +95 -1
  14. package/storage/IArchives.ts +146 -1
  15. package/storage/backblaze.d.ts +14 -2
  16. package/storage/backblaze.ts +18 -2
  17. package/storage/remoteStorage/ArchivesRemote.d.ts +29 -17
  18. package/storage/remoteStorage/ArchivesRemote.ts +63 -63
  19. package/storage/remoteStorage/ArchivesUrl.d.ts +46 -0
  20. package/storage/remoteStorage/ArchivesUrl.ts +74 -0
  21. package/storage/remoteStorage/accessPage.tsx +111 -28
  22. package/storage/remoteStorage/blobStore.d.ts +79 -25
  23. package/storage/remoteStorage/blobStore.ts +441 -287
  24. package/storage/remoteStorage/cliArgs.d.ts +1 -0
  25. package/storage/remoteStorage/cliArgs.ts +9 -0
  26. package/storage/remoteStorage/createArchives.d.ts +64 -0
  27. package/storage/remoteStorage/createArchives.ts +395 -0
  28. package/storage/remoteStorage/grantAccess.js +4 -0
  29. package/storage/remoteStorage/grantAccessCli.d.ts +1 -0
  30. package/storage/remoteStorage/grantAccessCli.ts +27 -0
  31. package/storage/remoteStorage/remoteConfig.d.ts +21 -0
  32. package/storage/remoteStorage/remoteConfig.ts +94 -0
  33. package/storage/remoteStorage/storageController.d.ts +19 -27
  34. package/storage/remoteStorage/storageController.ts +205 -136
  35. package/storage/remoteStorage/storageServer.d.ts +11 -0
  36. package/storage/remoteStorage/storageServer.ts +80 -93
  37. package/storage/remoteStorage/storageServerCli.d.ts +1 -0
  38. package/storage/remoteStorage/storageServerCli.ts +41 -0
  39. package/storage/remoteStorage/storageServerState.d.ts +37 -0
  40. package/storage/remoteStorage/storageServerState.ts +358 -0
  41. package/testsite/server.ts +1 -1
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ require("typenode");
4
+ require("../storage/remoteStorage/storageServerCli");
@@ -9,24 +9,18 @@ import { formatNumber, formatDateTime } from "socket-function/src/formatting/for
9
9
  import { css } from "typesafecss";
10
10
  import { InputLabel } from "../render-utils/InputLabel";
11
11
  import { redButton, greenButton, errorMessage } from "../render-utils/colors";
12
- import { ArchivesRemote } from "../storage/remoteStorage/ArchivesRemote";
12
+ import { createArchives } from "../storage/remoteStorage/createArchives";
13
13
  import { ArchiveFileInfo } from "../storage/IArchives";
14
14
 
15
- const STORAGE_ADDRESS = "storage.vidgridweb.com";
16
- const STORAGE_PORT = 4444;
17
- const ACCOUNT = "test";
18
- const BUCKET = "testfiles";
15
+ // The bucket's routing URL: server, account ("example"), and bucket ("examplefiles") in one.
16
+ // Nothing else is needed - the first call creates the bucket if it doesn't exist yet.
17
+ const STORAGE_URL = "https://storage.vidgridweb.com:4444/file/example/examplefiles/storage/storagerouting.json";
19
18
  const ACCESS_CHECK_INTERVAL = 1000 * 15;
20
19
 
21
- const archives = new ArchivesRemote({
22
- address: STORAGE_ADDRESS,
23
- port: STORAGE_PORT,
24
- account: ACCOUNT,
25
- bucketName: BUCKET,
26
- });
20
+ const archives = createArchives(STORAGE_URL);
27
21
 
28
22
  @observer
29
- class TestStoragePage extends preact.Component {
23
+ class ExampleStoragePage extends preact.Component {
30
24
  synced = observable({
31
25
  files: [] as ArchiveFileInfo[],
32
26
  loaded: false,
@@ -34,16 +28,16 @@ class TestStoragePage extends preact.Component {
34
28
  content: "",
35
29
  contentLoaded: false,
36
30
  newFileName: "",
37
- accessLink: "",
31
+ access: undefined as { link: string; machineId: string; ip: string } | undefined,
38
32
  error: "",
39
33
  });
40
34
 
41
35
  componentDidMount() {
42
36
  void (async () => {
43
37
  while (true) {
44
- let link = await archives.waitingForAccess();
45
- this.synced.accessLink = link || "";
46
- if (!link) break;
38
+ let access = await archives.waitingForAccess();
39
+ this.synced.access = access;
40
+ if (!access) break;
47
41
  await delay(ACCESS_CHECK_INTERVAL);
48
42
  }
49
43
  await this.refresh();
@@ -90,12 +84,14 @@ class TestStoragePage extends preact.Component {
90
84
  render() {
91
85
  let synced = this.synced;
92
86
  return <div className={css.vbox(12).pad2(16)}>
93
- <div>Storage test site. Account {ACCOUNT}, bucket {BUCKET} on {STORAGE_ADDRESS}:{STORAGE_PORT}</div>
87
+ <div>Storage example site. Bucket {STORAGE_URL}</div>
94
88
  {synced.error && <div className={errorMessage}>{synced.error}</div>}
95
- {!synced.loaded && !synced.accessLink && <div>Loading files...</div>}
96
- {!synced.loaded && synced.accessLink && <div className={css.vbox(8)}>
97
- <div>This machine does not have access to the account yet. Grant it here:</div>
98
- <a href={synced.accessLink} target="_blank">{synced.accessLink}</a>
89
+ {!synced.loaded && !synced.access && <div>Loading files...</div>}
90
+ {!synced.loaded && synced.access && <div className={css.vbox(8)}>
91
+ <div>This machine does not have access to the account yet.</div>
92
+ <div>Machine: {synced.access.machineId}</div>
93
+ <div>IP: {synced.access.ip}</div>
94
+ <a href={synced.access.link} target="_blank">{synced.access.link}</a>
99
95
  </div>}
100
96
  {synced.loaded && <div className={css.hbox(24).alignItems("flex-start")}>
101
97
  <div className={css.vbox(8)}>
@@ -142,7 +138,7 @@ class TestStoragePage extends preact.Component {
142
138
 
143
139
  async function main() {
144
140
  if (isNode()) return;
145
- preact.render(<TestStoragePage />, document.body);
141
+ preact.render(<ExampleStoragePage />, document.body);
146
142
  }
147
143
 
148
144
  main().catch(console.error);
@@ -7,10 +7,10 @@ import { hostServer } from "../misc/https/hostServer";
7
7
  // Import browser code, so it is allowed to be required by the client
8
8
  import "./browser";
9
9
 
10
- // Static test site for the remote storage system (storage/remoteStorage). The browser talks to
10
+ // Static example site for the remote storage system (storage/remoteStorage). The browser talks to
11
11
  // the storage server directly, so this server only serves the page.
12
12
 
13
- const DOMAIN = "stest.vidgridweb.com";
13
+ const DOMAIN = "storageexample.vidgridweb.com";
14
14
  const PORT = 4445;
15
15
 
16
16
  process.on("unhandledRejection", (error) => {
@@ -24,17 +24,17 @@ async function main() {
24
24
  RequireController.allowAllNodeModules();
25
25
  SocketFunction.expose(RequireController);
26
26
  SocketFunction.setDefaultHTTPCall(RequireController, "requireHTML", {
27
- requireCalls: ["./teststorage/browser.tsx"],
27
+ requireCalls: ["./examplestorage/browser.tsx"],
28
28
  });
29
29
  RequireController.addStaticRoot(path.resolve("."));
30
30
 
31
31
  await hostServer({
32
32
  domain: DOMAIN,
33
33
  port: PORT,
34
- cloudflareApiTokenPath: os.homedir() + "/vidgridweb.com.key",
34
+ cloudflareApiToken: { path: os.homedir() + "/vidgridweb.com.key" },
35
35
  setDNSRecord: true,
36
36
  });
37
- console.log(`Storage test site running at https://${DOMAIN}:${PORT}`);
37
+ console.log(`Storage example site running at https://${DOMAIN}:${PORT}`);
38
38
  }
39
39
 
40
40
  main().catch(e => {