@anymux/connect 0.1.0 → 0.2.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/dist/GitBrowser-BFyS9qJb.js +3 -0
- package/dist/{GitBrowser-BLgTNQyd.js → GitBrowser-C0L48q3x.js} +5 -5
- package/dist/GitBrowser-C0L48q3x.js.map +1 -0
- package/dist/index.d.ts +52 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +161 -44
- package/dist/index.js.map +1 -1
- package/dist/registry.js +1 -1
- package/dist/{scope-labels-B4VAwoL6.js → scope-labels-C7KX6ju6.js} +266 -2
- package/dist/scope-labels-C7KX6ju6.js.map +1 -0
- package/dist/scope-labels-DvdJLcSL.d.ts.map +1 -1
- package/package.json +10 -8
- package/src/adapters/adapter-registry.ts +45 -9
- package/src/components/CapabilityPanel.tsx +6 -5
- package/src/components/ConnectButton.tsx +2 -2
- package/src/components/CredentialForm.tsx +60 -4
- package/src/components/GitBrowser.tsx +5 -5
- package/src/index.ts +7 -0
- package/src/models/ConnectionManagerModel.ts +6 -3
- package/src/models/CredentialFormModel.ts +28 -11
- package/src/registry/service-registry.ts +12 -0
- package/src/registry/services/backblaze-b2.ts +21 -0
- package/src/registry/services/cloudflare-r2.ts +21 -0
- package/src/registry/services/imgur.ts +21 -0
- package/src/registry/services/pexels.ts +21 -0
- package/src/registry/services/unsplash.ts +21 -0
- package/src/registry/services/wasabi.ts +21 -0
- package/src/types/optional-deps.d.ts +9 -9
- package/dist/GitBrowser-BLgTNQyd.js.map +0 -1
- package/dist/GitBrowser-CIyWiuX-.js +0 -3
- package/dist/scope-labels-B4VAwoL6.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bitbucketService, browserFsService, dropboxService, getScopeLabel, getScopeLabels, giteaService, githubService, gitlabService, googleService, indexeddbService, s3Service, serviceRegistry, webdavService } from "./scope-labels-
|
|
2
|
-
import { GitHostBrowser, GitHostBrowserModel, GitRepoBrowser, GitRepoBrowserModel, showActionToast, showErrorToast, showInfoToast } from "./GitBrowser-
|
|
1
|
+
import { backblazeB2Service, bitbucketService, browserFsService, cloudflareR2Service, dropboxService, getScopeLabel, getScopeLabels, giteaService, githubService, gitlabService, googleService, imgurService, indexeddbService, pexelsService, s3Service, serviceRegistry, unsplashService, wasabiService, webdavService } from "./scope-labels-C7KX6ju6.js";
|
|
2
|
+
import { GitHostBrowser, GitHostBrowserModel, GitRepoBrowser, GitRepoBrowserModel, showActionToast, showErrorToast, showInfoToast } from "./GitBrowser-C0L48q3x.js";
|
|
3
3
|
import { ObjectStorageBrowser, ObjectStorageBrowserModel } from "./ObjectStorageBrowser-B_25Emfu.js";
|
|
4
4
|
import { RepoPicker, RepoPickerModel } from "./RepoPicker-CoHMiJ-3.js";
|
|
5
5
|
import { createAuthClient } from "better-auth/client";
|
|
@@ -215,6 +215,21 @@ var TokenManager = class {
|
|
|
215
215
|
|
|
216
216
|
//#endregion
|
|
217
217
|
//#region src/models/ConnectionManagerModel.ts
|
|
218
|
+
/** Auth providers that use stored credentials instead of OAuth */
|
|
219
|
+
const CREDENTIAL_AUTH_PROVIDERS = new Set([
|
|
220
|
+
"s3",
|
|
221
|
+
"backblaze-b2",
|
|
222
|
+
"cloudflare-r2",
|
|
223
|
+
"wasabi",
|
|
224
|
+
"webdav",
|
|
225
|
+
"gitea",
|
|
226
|
+
"icloud",
|
|
227
|
+
"unsplash",
|
|
228
|
+
"pexels",
|
|
229
|
+
"imgur",
|
|
230
|
+
"browser-fs",
|
|
231
|
+
"indexeddb"
|
|
232
|
+
]);
|
|
218
233
|
const STORAGE_KEY = "anymux-connect-connections";
|
|
219
234
|
const USER_PROFILES_STORAGE_KEY = "anymux-connect-user-profiles";
|
|
220
235
|
var ConnectionManagerModel = class {
|
|
@@ -284,7 +299,7 @@ var ConnectionManagerModel = class {
|
|
|
284
299
|
}
|
|
285
300
|
for (const [provider, configured] of Object.entries(config.providers)) if (configured) this.configuredProviders.add(provider);
|
|
286
301
|
for (const service of serviceRegistry.getAll()) {
|
|
287
|
-
if (
|
|
302
|
+
if (CREDENTIAL_AUTH_PROVIDERS.has(service.authProvider)) continue;
|
|
288
303
|
if (!this.configuredProviders.has(service.authProvider) && !this.isConnected(service.id)) this.connections.set(service.id, {
|
|
289
304
|
serviceId: service.id,
|
|
290
305
|
status: "not_configured",
|
|
@@ -474,14 +489,7 @@ var ConnectionManagerModel = class {
|
|
|
474
489
|
console.warn(`[AnyMux] refreshToken(${serviceId}): no service or authClient`);
|
|
475
490
|
return null;
|
|
476
491
|
}
|
|
477
|
-
if (
|
|
478
|
-
"s3",
|
|
479
|
-
"webdav",
|
|
480
|
-
"gitea",
|
|
481
|
-
"icloud",
|
|
482
|
-
"browser-fs",
|
|
483
|
-
"indexeddb"
|
|
484
|
-
].includes(service.authProvider)) return this.tokenManager.getToken(serviceId);
|
|
492
|
+
if (CREDENTIAL_AUTH_PROVIDERS.has(service.authProvider)) return this.tokenManager.getToken(serviceId);
|
|
485
493
|
const oldToken = this.tokenManager.getToken(serviceId);
|
|
486
494
|
try {
|
|
487
495
|
const token = await this.authClient.getAccessToken(service.authProvider);
|
|
@@ -519,7 +527,7 @@ var ConnectionManagerModel = class {
|
|
|
519
527
|
hasCapabilityScopes(serviceId, capabilityId) {
|
|
520
528
|
const service = serviceRegistry.get(serviceId);
|
|
521
529
|
if (!service) return false;
|
|
522
|
-
if (
|
|
530
|
+
if (CREDENTIAL_AUTH_PROVIDERS.has(service.authProvider)) return true;
|
|
523
531
|
const requiredScopes = service.scopes[capabilityId];
|
|
524
532
|
if (!requiredScopes || requiredScopes.length === 0) return false;
|
|
525
533
|
if (!this.grantedScopes.has(service.authProvider)) return true;
|
|
@@ -693,6 +701,16 @@ var DashboardModel = class {
|
|
|
693
701
|
|
|
694
702
|
//#endregion
|
|
695
703
|
//#region src/models/CredentialFormModel.ts
|
|
704
|
+
/** S3-compatible service types that share the same credential fields */
|
|
705
|
+
const S3_COMPATIBLE_TYPES = [
|
|
706
|
+
"s3",
|
|
707
|
+
"backblaze-b2",
|
|
708
|
+
"cloudflare-r2",
|
|
709
|
+
"wasabi"
|
|
710
|
+
];
|
|
711
|
+
function isS3Compatible(type) {
|
|
712
|
+
return S3_COMPATIBLE_TYPES.includes(type);
|
|
713
|
+
}
|
|
696
714
|
var CredentialFormModel = class {
|
|
697
715
|
constructor() {
|
|
698
716
|
this.open = false;
|
|
@@ -710,6 +728,7 @@ var CredentialFormModel = class {
|
|
|
710
728
|
this.repo = "";
|
|
711
729
|
this.email = "";
|
|
712
730
|
this.appPassword = "";
|
|
731
|
+
this.apiKey = "";
|
|
713
732
|
makeAutoObservable(this);
|
|
714
733
|
}
|
|
715
734
|
openForm(serviceType, prefill) {
|
|
@@ -726,17 +745,17 @@ var CredentialFormModel = class {
|
|
|
726
745
|
}
|
|
727
746
|
/** Serialize current form state to JSON credential string */
|
|
728
747
|
serialize() {
|
|
748
|
+
if (isS3Compatible(this.serviceType)) {
|
|
749
|
+
const creds = {
|
|
750
|
+
accessKeyId: this.accessKeyId,
|
|
751
|
+
secretAccessKey: this.secretAccessKey,
|
|
752
|
+
region: this.region,
|
|
753
|
+
bucket: this.bucket
|
|
754
|
+
};
|
|
755
|
+
if (this.endpoint) creds.endpoint = this.endpoint;
|
|
756
|
+
return JSON.stringify(creds);
|
|
757
|
+
}
|
|
729
758
|
switch (this.serviceType) {
|
|
730
|
-
case "s3": {
|
|
731
|
-
const creds = {
|
|
732
|
-
accessKeyId: this.accessKeyId,
|
|
733
|
-
secretAccessKey: this.secretAccessKey,
|
|
734
|
-
region: this.region,
|
|
735
|
-
bucket: this.bucket
|
|
736
|
-
};
|
|
737
|
-
if (this.endpoint) creds.endpoint = this.endpoint;
|
|
738
|
-
return JSON.stringify(creds);
|
|
739
|
-
}
|
|
740
759
|
case "webdav": return JSON.stringify({
|
|
741
760
|
url: this.url,
|
|
742
761
|
username: this.username,
|
|
@@ -754,6 +773,9 @@ var CredentialFormModel = class {
|
|
|
754
773
|
email: this.email,
|
|
755
774
|
appPassword: this.appPassword
|
|
756
775
|
});
|
|
776
|
+
case "unsplash": return JSON.stringify({ accessKey: this.apiKey });
|
|
777
|
+
case "pexels": return JSON.stringify({ apiKey: this.apiKey });
|
|
778
|
+
case "imgur": return JSON.stringify({ clientId: this.apiKey });
|
|
757
779
|
}
|
|
758
780
|
}
|
|
759
781
|
resetFields() {
|
|
@@ -770,6 +792,7 @@ var CredentialFormModel = class {
|
|
|
770
792
|
this.repo = "";
|
|
771
793
|
this.email = "";
|
|
772
794
|
this.appPassword = "";
|
|
795
|
+
this.apiKey = "";
|
|
773
796
|
}
|
|
774
797
|
applyPrefill(values) {
|
|
775
798
|
for (const [k, v] of Object.entries(values)) if (typeof v === "string" && k in this) this[k] = v;
|
|
@@ -819,7 +842,25 @@ const CredentialForm = observer(({ model, onSubmit }) => {
|
|
|
819
842
|
};
|
|
820
843
|
const inputClass = "w-full rounded-md border border-border px-3 py-2 text-base sm:text-sm bg-card text-foreground focus:border-ring focus:outline-none focus:ring-1 focus:ring-ring";
|
|
821
844
|
const labelClass = "block text-sm font-medium text-foreground mb-1";
|
|
822
|
-
const
|
|
845
|
+
const titleMap = {
|
|
846
|
+
"s3": "Amazon S3 Credentials",
|
|
847
|
+
"backblaze-b2": "Backblaze B2 Credentials",
|
|
848
|
+
"cloudflare-r2": "Cloudflare R2 Credentials",
|
|
849
|
+
"wasabi": "Wasabi Credentials",
|
|
850
|
+
"webdav": "WebDAV Credentials",
|
|
851
|
+
"icloud": "iCloud Credentials",
|
|
852
|
+
"gitea": "Gitea Credentials",
|
|
853
|
+
"unsplash": "Unsplash API Key",
|
|
854
|
+
"pexels": "Pexels API Key",
|
|
855
|
+
"imgur": "Imgur Client ID"
|
|
856
|
+
};
|
|
857
|
+
const title = titleMap[model.serviceType] || "Credentials";
|
|
858
|
+
const endpointPlaceholder = {
|
|
859
|
+
"s3": "https://s3.amazonaws.com",
|
|
860
|
+
"backblaze-b2": "https://s3.us-west-004.backblazeb2.com",
|
|
861
|
+
"cloudflare-r2": "https://<account-id>.r2.cloudflarestorage.com",
|
|
862
|
+
"wasabi": "https://s3.wasabisys.com"
|
|
863
|
+
};
|
|
823
864
|
return /* @__PURE__ */ jsx("div", {
|
|
824
865
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50",
|
|
825
866
|
onClick: () => model.closeForm(),
|
|
@@ -834,7 +875,7 @@ const CredentialForm = observer(({ model, onSubmit }) => {
|
|
|
834
875
|
className: "flex flex-col flex-1 min-h-0",
|
|
835
876
|
children: [/* @__PURE__ */ jsx("div", {
|
|
836
877
|
className: "flex-1 overflow-y-auto px-4 sm:px-6 space-y-3",
|
|
837
|
-
children: model.serviceType
|
|
878
|
+
children: isS3Compatible(model.serviceType) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
838
879
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
839
880
|
className: labelClass,
|
|
840
881
|
children: "Access Key ID"
|
|
@@ -875,15 +916,16 @@ const CredentialForm = observer(({ model, onSubmit }) => {
|
|
|
875
916
|
value: model.bucket,
|
|
876
917
|
onChange: (e) => model.setField("bucket", e.target.value)
|
|
877
918
|
})] }),
|
|
878
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */
|
|
919
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("label", {
|
|
879
920
|
className: labelClass,
|
|
880
|
-
children: "Endpoint (optional)"
|
|
921
|
+
children: ["Endpoint", model.serviceType === "s3" ? " (optional)" : ""]
|
|
881
922
|
}), /* @__PURE__ */ jsx("input", {
|
|
882
923
|
type: "text",
|
|
924
|
+
required: model.serviceType !== "s3",
|
|
883
925
|
className: inputClass,
|
|
884
926
|
value: model.endpoint,
|
|
885
927
|
onChange: (e) => model.setField("endpoint", e.target.value),
|
|
886
|
-
placeholder:
|
|
928
|
+
placeholder: endpointPlaceholder[model.serviceType] || ""
|
|
887
929
|
})] })
|
|
888
930
|
] }) : model.serviceType === "webdav" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
889
931
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
@@ -956,7 +998,50 @@ const CredentialForm = observer(({ model, onSubmit }) => {
|
|
|
956
998
|
"under Sign-In and Security → App-Specific Passwords."
|
|
957
999
|
]
|
|
958
1000
|
})
|
|
959
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1001
|
+
] }) : model.serviceType === "unsplash" || model.serviceType === "pexels" || model.serviceType === "imgur" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
1002
|
+
className: labelClass,
|
|
1003
|
+
children: model.serviceType === "imgur" ? "Client ID" : "API Key"
|
|
1004
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
1005
|
+
type: "password",
|
|
1006
|
+
required: true,
|
|
1007
|
+
className: inputClass,
|
|
1008
|
+
value: model.apiKey,
|
|
1009
|
+
onChange: (e) => model.setField("apiKey", e.target.value),
|
|
1010
|
+
placeholder: model.serviceType === "unsplash" ? "Unsplash Access Key" : model.serviceType === "pexels" ? "Pexels API Key" : "Imgur Client ID"
|
|
1011
|
+
})] }), /* @__PURE__ */ jsx("p", {
|
|
1012
|
+
className: "text-xs text-muted-foreground",
|
|
1013
|
+
children: model.serviceType === "unsplash" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1014
|
+
"Get a free API key at",
|
|
1015
|
+
" ",
|
|
1016
|
+
/* @__PURE__ */ jsx("a", {
|
|
1017
|
+
href: "https://unsplash.com/developers",
|
|
1018
|
+
target: "_blank",
|
|
1019
|
+
rel: "noopener noreferrer",
|
|
1020
|
+
className: "underline text-primary hover:text-primary/80",
|
|
1021
|
+
children: "unsplash.com/developers"
|
|
1022
|
+
})
|
|
1023
|
+
] }) : model.serviceType === "pexels" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1024
|
+
"Get a free API key at",
|
|
1025
|
+
" ",
|
|
1026
|
+
/* @__PURE__ */ jsx("a", {
|
|
1027
|
+
href: "https://www.pexels.com/api/",
|
|
1028
|
+
target: "_blank",
|
|
1029
|
+
rel: "noopener noreferrer",
|
|
1030
|
+
className: "underline text-primary hover:text-primary/80",
|
|
1031
|
+
children: "pexels.com/api"
|
|
1032
|
+
})
|
|
1033
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1034
|
+
"Register an app at",
|
|
1035
|
+
" ",
|
|
1036
|
+
/* @__PURE__ */ jsx("a", {
|
|
1037
|
+
href: "https://api.imgur.com/oauth2/addclient",
|
|
1038
|
+
target: "_blank",
|
|
1039
|
+
rel: "noopener noreferrer",
|
|
1040
|
+
className: "underline text-primary hover:text-primary/80",
|
|
1041
|
+
children: "api.imgur.com"
|
|
1042
|
+
})
|
|
1043
|
+
] })
|
|
1044
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
960
1045
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
961
1046
|
className: labelClass,
|
|
962
1047
|
children: "URL"
|
|
@@ -1150,7 +1235,7 @@ function ConnectedMenu({ service, connectionManager, user, profile, isOAuth }) {
|
|
|
1150
1235
|
const ConnectButton = observer(({ service, connectionManager }) => {
|
|
1151
1236
|
const [formModel] = useState(() => new CredentialFormModel());
|
|
1152
1237
|
const state = getServiceConnectionState(connectionManager, service.id);
|
|
1153
|
-
const needsCredentialForm = service.authProvider === "
|
|
1238
|
+
const needsCredentialForm = isS3Compatible(service.authProvider) || service.authProvider === "webdav" || service.authProvider === "gitea" || service.authProvider === "icloud" || service.authProvider === "unsplash" || service.authProvider === "pexels" || service.authProvider === "imgur";
|
|
1154
1239
|
const isBrowserFs = service.authProvider === "browser-fs";
|
|
1155
1240
|
const isIndexedDb = service.authProvider === "indexeddb";
|
|
1156
1241
|
const pendingReconnect = connectionManager.pendingReconnect.has(service.id);
|
|
@@ -1439,6 +1524,12 @@ const adapterRegistry = {
|
|
|
1439
1524
|
return factories.has(serviceId);
|
|
1440
1525
|
}
|
|
1441
1526
|
};
|
|
1527
|
+
/** Safely invoke a capability factory, throwing a descriptive error for unsupported capabilities */
|
|
1528
|
+
function invokeCapability(adapters, capabilityId, serviceId) {
|
|
1529
|
+
const factory = adapters[capabilityId];
|
|
1530
|
+
if (!factory) throw new Error(`Unsupported capability "${capabilityId}" for service "${serviceId}". Supported: ${Object.keys(adapters).join(", ")}`);
|
|
1531
|
+
return factory();
|
|
1532
|
+
}
|
|
1442
1533
|
adapterRegistry.register("google", async (token, capabilityId) => {
|
|
1443
1534
|
const m = await import("@anymux/google-drive");
|
|
1444
1535
|
const adapters = {
|
|
@@ -1446,7 +1537,7 @@ adapterRegistry.register("google", async (token, capabilityId) => {
|
|
|
1446
1537
|
"contacts": () => new m.GoogleContactsProvider(token),
|
|
1447
1538
|
"calendar": () => new m.GoogleCalendarProvider(token)
|
|
1448
1539
|
};
|
|
1449
|
-
return adapters
|
|
1540
|
+
return invokeCapability(adapters, capabilityId, "google");
|
|
1450
1541
|
});
|
|
1451
1542
|
adapterRegistry.register("dropbox", async (token) => {
|
|
1452
1543
|
const { DropboxFileSystem } = await import("@anymux/dropbox");
|
|
@@ -1471,7 +1562,7 @@ adapterRegistry.register("github", async (token, capabilityId, ctx) => {
|
|
|
1471
1562
|
"git-repo": () => new m.GitHubGitRepo(config),
|
|
1472
1563
|
"git-host": () => new m.GitHubGitHost(config)
|
|
1473
1564
|
};
|
|
1474
|
-
return adapters
|
|
1565
|
+
return invokeCapability(adapters, capabilityId, "github");
|
|
1475
1566
|
});
|
|
1476
1567
|
adapterRegistry.register("gitlab", async (token, capabilityId, ctx) => {
|
|
1477
1568
|
const repo = ctx.selectedRepo;
|
|
@@ -1487,7 +1578,7 @@ adapterRegistry.register("gitlab", async (token, capabilityId, ctx) => {
|
|
|
1487
1578
|
"git-repo": () => new m.GitLabGitRepo(config),
|
|
1488
1579
|
"git-host": () => new m.GitLabGitHost(config)
|
|
1489
1580
|
};
|
|
1490
|
-
return adapters
|
|
1581
|
+
return invokeCapability(adapters, capabilityId, "gitlab");
|
|
1491
1582
|
});
|
|
1492
1583
|
adapterRegistry.register("bitbucket", async (token, capabilityId, ctx) => {
|
|
1493
1584
|
const repo = ctx.selectedRepo;
|
|
@@ -1504,7 +1595,7 @@ adapterRegistry.register("bitbucket", async (token, capabilityId, ctx) => {
|
|
|
1504
1595
|
"git-repo": () => new m.BitbucketGitRepo(config),
|
|
1505
1596
|
"git-host": () => new m.BitbucketGitHost(config)
|
|
1506
1597
|
};
|
|
1507
|
-
return adapters
|
|
1598
|
+
return invokeCapability(adapters, capabilityId, "bitbucket");
|
|
1508
1599
|
});
|
|
1509
1600
|
adapterRegistry.register("gitea", async (token, capabilityId, ctx) => {
|
|
1510
1601
|
const creds = JSON.parse(token);
|
|
@@ -1525,7 +1616,7 @@ adapterRegistry.register("gitea", async (token, capabilityId, ctx) => {
|
|
|
1525
1616
|
"git-repo": () => new m.GiteaGitRepo(config),
|
|
1526
1617
|
"git-host": () => new m.GiteaGitHost(config)
|
|
1527
1618
|
};
|
|
1528
|
-
return adapters
|
|
1619
|
+
return invokeCapability(adapters, capabilityId, "gitea");
|
|
1529
1620
|
});
|
|
1530
1621
|
adapterRegistry.register("webdav", async (token) => {
|
|
1531
1622
|
const creds = JSON.parse(token);
|
|
@@ -1538,7 +1629,7 @@ adapterRegistry.register("webdav", async (token) => {
|
|
|
1538
1629
|
proxyUrl
|
|
1539
1630
|
});
|
|
1540
1631
|
});
|
|
1541
|
-
|
|
1632
|
+
async function createS3Adapter(token) {
|
|
1542
1633
|
const creds = JSON.parse(token);
|
|
1543
1634
|
const proxyUrl = typeof window !== "undefined" ? window.location.origin : void 0;
|
|
1544
1635
|
if (proxyUrl) {
|
|
@@ -1570,6 +1661,25 @@ adapterRegistry.register("s3", async (token) => {
|
|
|
1570
1661
|
storage,
|
|
1571
1662
|
bucket: creds.bucket || "anymux-test"
|
|
1572
1663
|
};
|
|
1664
|
+
}
|
|
1665
|
+
adapterRegistry.register("s3", createS3Adapter);
|
|
1666
|
+
adapterRegistry.register("backblaze-b2", createS3Adapter);
|
|
1667
|
+
adapterRegistry.register("cloudflare-r2", createS3Adapter);
|
|
1668
|
+
adapterRegistry.register("wasabi", createS3Adapter);
|
|
1669
|
+
adapterRegistry.register("unsplash", async (token) => {
|
|
1670
|
+
const creds = JSON.parse(token);
|
|
1671
|
+
const { UnsplashMediaProvider } = await import("@anymux/unsplash");
|
|
1672
|
+
return new UnsplashMediaProvider({ accessKey: creds.accessKey });
|
|
1673
|
+
});
|
|
1674
|
+
adapterRegistry.register("pexels", async (token) => {
|
|
1675
|
+
const creds = JSON.parse(token);
|
|
1676
|
+
const { PexelsMediaProvider } = await import("@anymux/pexels");
|
|
1677
|
+
return new PexelsMediaProvider({ apiKey: creds.apiKey });
|
|
1678
|
+
});
|
|
1679
|
+
adapterRegistry.register("imgur", async (token) => {
|
|
1680
|
+
const creds = JSON.parse(token);
|
|
1681
|
+
const { ImgurMediaProvider } = await import("@anymux/imgur");
|
|
1682
|
+
return new ImgurMediaProvider({ clientId: creds.clientId });
|
|
1573
1683
|
});
|
|
1574
1684
|
adapterRegistry.register("browser-fs", async () => {
|
|
1575
1685
|
const { BrowserFileSystemFactory } = await import("@anymux/browser-fs");
|
|
@@ -1655,8 +1765,8 @@ function CapabilityError({ error, onRetry, onReconnect, onGoBack }) {
|
|
|
1655
1765
|
|
|
1656
1766
|
//#endregion
|
|
1657
1767
|
//#region src/components/CapabilityPanel.tsx
|
|
1658
|
-
const FileBrowser = React.lazy(() => import("@anymux/
|
|
1659
|
-
const LazyMediaBrowser = React.lazy(() => import("@anymux/
|
|
1768
|
+
const FileBrowser = React.lazy(() => import("@anymux/ui-kit/file-browser").then((m) => ({ default: m.FileBrowser })));
|
|
1769
|
+
const LazyMediaBrowser = React.lazy(() => import("@anymux/ui-kit/media").then((m) => ({ default: ({ provider }) => {
|
|
1660
1770
|
const model = new m.MediaBrowserModel(provider);
|
|
1661
1771
|
return React.createElement(m.MediaBrowser, {
|
|
1662
1772
|
model,
|
|
@@ -1664,14 +1774,14 @@ const LazyMediaBrowser = React.lazy(() => import("@anymux/object-ui").then((m) =
|
|
|
1664
1774
|
className: "h-full"
|
|
1665
1775
|
});
|
|
1666
1776
|
} })));
|
|
1667
|
-
const LazyContactBrowser = React.lazy(() => import("@anymux/
|
|
1777
|
+
const LazyContactBrowser = React.lazy(() => import("@anymux/ui-kit/contacts").then((m) => ({ default: ({ provider }) => {
|
|
1668
1778
|
const model = new m.ContactListModel(provider);
|
|
1669
1779
|
return React.createElement(m.ContactBrowser, {
|
|
1670
1780
|
model,
|
|
1671
1781
|
className: "h-full"
|
|
1672
1782
|
});
|
|
1673
1783
|
} })));
|
|
1674
|
-
const LazyCalendarBrowser = React.lazy(() => import("@anymux/
|
|
1784
|
+
const LazyCalendarBrowser = React.lazy(() => import("@anymux/ui-kit/calendar").then((m) => ({ default: ({ provider }) => {
|
|
1675
1785
|
const model = new m.CalendarModel(provider);
|
|
1676
1786
|
return React.createElement(m.CalendarBrowser, {
|
|
1677
1787
|
model,
|
|
@@ -1680,8 +1790,8 @@ const LazyCalendarBrowser = React.lazy(() => import("@anymux/object-ui").then((m
|
|
|
1680
1790
|
} })));
|
|
1681
1791
|
const RepoPicker$1 = React.lazy(() => import("./RepoPicker-BprFGOn7.js").then((m) => ({ default: m.RepoPicker })));
|
|
1682
1792
|
const ObjectStorageBrowserLazy = React.lazy(() => import("./ObjectStorageBrowser-B2YkUxMl.js").then((m) => ({ default: m.ObjectStorageBrowser })));
|
|
1683
|
-
const GitRepoBrowserLazy = React.lazy(() => import("./GitBrowser-
|
|
1684
|
-
const GitHostBrowserLazy = React.lazy(() => import("./GitBrowser-
|
|
1793
|
+
const GitRepoBrowserLazy = React.lazy(() => import("./GitBrowser-BFyS9qJb.js").then((m) => ({ default: m.GitRepoBrowser })));
|
|
1794
|
+
const GitHostBrowserLazy = React.lazy(() => import("./GitBrowser-BFyS9qJb.js").then((m) => ({ default: m.GitHostBrowser })));
|
|
1685
1795
|
const CAPABILITY_LABELS = {
|
|
1686
1796
|
"file-system": "File System",
|
|
1687
1797
|
"object-storage": "Object Storage",
|
|
@@ -1845,14 +1955,21 @@ const GenericCapabilityContent = observer(function GenericCapabilityContent$1({
|
|
|
1845
1955
|
const service = dashboardModel.selectedService;
|
|
1846
1956
|
await connectionManager.disconnect(serviceId);
|
|
1847
1957
|
dashboardModel.closePanel();
|
|
1848
|
-
const
|
|
1958
|
+
const CRED_PROVIDERS = new Set([
|
|
1849
1959
|
"s3",
|
|
1960
|
+
"backblaze-b2",
|
|
1961
|
+
"cloudflare-r2",
|
|
1962
|
+
"wasabi",
|
|
1850
1963
|
"webdav",
|
|
1851
1964
|
"gitea",
|
|
1852
1965
|
"icloud",
|
|
1966
|
+
"unsplash",
|
|
1967
|
+
"pexels",
|
|
1968
|
+
"imgur",
|
|
1853
1969
|
"browser-fs",
|
|
1854
1970
|
"indexeddb"
|
|
1855
|
-
]
|
|
1971
|
+
]);
|
|
1972
|
+
const isOAuth = service && !CRED_PROVIDERS.has(service.authProvider);
|
|
1856
1973
|
if (isOAuth) await connectionManager.connect(serviceId);
|
|
1857
1974
|
else connectionManager.requestReconnect(serviceId);
|
|
1858
1975
|
};
|
|
@@ -2535,5 +2652,5 @@ const ServiceDashboardDemo = observer(({ authBaseURL, initialService, initialCap
|
|
|
2535
2652
|
});
|
|
2536
2653
|
|
|
2537
2654
|
//#endregion
|
|
2538
|
-
export { ActionHistoryPanel, ActionNotificationModel, CapabilityCell, CapabilityPanel, CapabilityPill, ConnectButton, ConnectedMenu, ConnectionManagerModel, ConnectionStatusIndicator, CredentialForm, CredentialFormModel, DashboardModel, FullScreenBrowser, GitHostBrowser, GitHostBrowserModel, GitHubRepoPicker, GitRepoBrowser, GitRepoBrowserModel, ObjectStorageBrowser, ObjectStorageBrowserModel, RepoPicker, RepoPickerModel, ServiceCard, ServiceDashboard, ServiceDashboardDemo, ServiceIcon, ServiceRow, TokenManager, bitbucketService, browserFsService, createConnectAuthClient, dropboxService, getScopeLabel, getScopeLabels, giteaService, githubService, gitlabService, googleService, icloudService, indexeddbService, microsoftService, s3Service, serviceRegistry, showActionToast, showErrorToast, showInfoToast, webdavService };
|
|
2655
|
+
export { ActionHistoryPanel, ActionNotificationModel, CapabilityCell, CapabilityPanel, CapabilityPill, ConnectButton, ConnectedMenu, ConnectionManagerModel, ConnectionStatusIndicator, CredentialForm, CredentialFormModel, DashboardModel, FullScreenBrowser, GitHostBrowser, GitHostBrowserModel, GitHubRepoPicker, GitRepoBrowser, GitRepoBrowserModel, ObjectStorageBrowser, ObjectStorageBrowserModel, RepoPicker, RepoPickerModel, S3_COMPATIBLE_TYPES, ServiceCard, ServiceDashboard, ServiceDashboardDemo, ServiceIcon, ServiceRow, TokenManager, backblazeB2Service, bitbucketService, browserFsService, cloudflareR2Service, createConnectAuthClient, dropboxService, getScopeLabel, getScopeLabels, giteaService, githubService, gitlabService, googleService, icloudService, imgurService, indexeddbService, isS3Compatible, microsoftService, pexelsService, s3Service, serviceRegistry, showActionToast, showErrorToast, showInfoToast, unsplashService, wasabiService, webdavService };
|
|
2539
2656
|
//# sourceMappingURL=index.js.map
|