@plutonhq/core-frontend 0.1.21 → 0.1.22
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-lib/components/Storage/AddStorage/AddStorage.module.scss.js +42 -26
- package/dist-lib/components/Storage/AddStorage/AddStorage.module.scss.js.map +1 -1
- package/dist-lib/components/Storage/StorageAuthSettings/StorageAuthSettings.d.ts.map +1 -1
- package/dist-lib/components/Storage/StorageAuthSettings/StorageAuthSettings.js +119 -53
- package/dist-lib/components/Storage/StorageAuthSettings/StorageAuthSettings.js.map +1 -1
- package/dist-lib/services/storage.d.ts +10 -0
- package/dist-lib/services/storage.d.ts.map +1 -1
- package/dist-lib/services/storage.js +55 -20
- package/dist-lib/services/storage.js.map +1 -1
- package/dist-lib/services.js +55 -52
- package/dist-lib/styles/core-frontend.css +1 -1
- package/package.json +1 -1
- package/src/components/Storage/AddStorage/AddStorage.module.scss +74 -0
- package/src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx +136 -3
- package/src/services/storage.ts +49 -0
|
@@ -1,34 +1,50 @@
|
|
|
1
|
-
const t = "
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const t = "_addStorage_OIwtX", o = "_loader_hFNvR", n = "_field_vxLnx", e = "_fieldErrorLabel_JQpkc", a = "_label_JAV7R", c = "_input_30oZl", r = "_inputHasError_mu8Ps", s = "_storageType_9j8NF", u = "_createButton_N2zgD", _ = "_advancedOptions_Vi5K5", d = "_advancedButton_O4koz", i = "_advancedButtonActive_cxq7u", h = "_authSettings_BE6ir", l = "_oauthDoc_8suty", B = "_codeBlock_tpOVA", p = "_oauthContainer_eLxGx", v = "_success_ZETFH", g = "_error_mS7QY", A = "_oauthButton_MhjWw", E = "_oauthAuthorizeBtn_mw4J6", f = "_oauthInnerBtn_5DQud", x = "_oauthProgress_9x8Q3", S = {
|
|
2
|
+
addStorage: t,
|
|
3
|
+
loader: o,
|
|
4
|
+
field: n,
|
|
4
5
|
fieldErrorLabel: e,
|
|
5
6
|
label: a,
|
|
6
|
-
input:
|
|
7
|
-
inputHasError:
|
|
8
|
-
storageType:
|
|
9
|
-
createButton:
|
|
10
|
-
advancedOptions:
|
|
11
|
-
advancedButton:
|
|
12
|
-
advancedButtonActive:
|
|
13
|
-
authSettings:
|
|
14
|
-
oauthDoc:
|
|
15
|
-
codeBlock:
|
|
7
|
+
input: c,
|
|
8
|
+
inputHasError: r,
|
|
9
|
+
storageType: s,
|
|
10
|
+
createButton: u,
|
|
11
|
+
advancedOptions: _,
|
|
12
|
+
advancedButton: d,
|
|
13
|
+
advancedButtonActive: i,
|
|
14
|
+
authSettings: h,
|
|
15
|
+
oauthDoc: l,
|
|
16
|
+
codeBlock: B,
|
|
17
|
+
oauthContainer: p,
|
|
18
|
+
success: v,
|
|
19
|
+
error: g,
|
|
20
|
+
oauthButton: A,
|
|
21
|
+
oauthAuthorizeBtn: E,
|
|
22
|
+
oauthInnerBtn: f,
|
|
23
|
+
oauthProgress: x
|
|
16
24
|
};
|
|
17
25
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
t as addStorage,
|
|
27
|
+
d as advancedButton,
|
|
28
|
+
i as advancedButtonActive,
|
|
29
|
+
_ as advancedOptions,
|
|
30
|
+
h as authSettings,
|
|
31
|
+
B as codeBlock,
|
|
32
|
+
u as createButton,
|
|
33
|
+
S as default,
|
|
34
|
+
g as error,
|
|
35
|
+
n as field,
|
|
26
36
|
e as fieldErrorLabel,
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
c as input,
|
|
38
|
+
r as inputHasError,
|
|
29
39
|
a as label,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
o as loader,
|
|
41
|
+
E as oauthAuthorizeBtn,
|
|
42
|
+
A as oauthButton,
|
|
43
|
+
p as oauthContainer,
|
|
44
|
+
l as oauthDoc,
|
|
45
|
+
f as oauthInnerBtn,
|
|
46
|
+
x as oauthProgress,
|
|
47
|
+
s as storageType,
|
|
48
|
+
v as success
|
|
33
49
|
};
|
|
34
50
|
//# sourceMappingURL=AddStorage.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddStorage.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddStorage.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageAuthSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"StorageAuthSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAO9D,UAAU,wBAAwB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACpD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,CAAC,WAAW,EAAE,wBAAwB,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACtE,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAID,QAAA,MAAM,mBAAmB,GAAI,oGAS1B,wBAAwB,4CAgO1B,CAAC;AACF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,92 +1,158 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as u, useEffect as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import { useState as u, useRef as F, useEffect as U, useCallback as y } from "react";
|
|
3
|
+
import R from "../../common/form/Tristate/Tristate.js";
|
|
4
|
+
import i from "../../common/Icon/Icon.js";
|
|
5
|
+
import o from "../AddStorage/AddStorage.module.scss.js";
|
|
6
|
+
import $ from "../StorageSettings/StorageSettings.js";
|
|
7
|
+
import { startStorageAuthorize as L, getStorageAuthorizeStatus as j, cancelStorageAuthorize as q } from "../../../services/storage.js";
|
|
8
|
+
const M = ({
|
|
9
|
+
storageType: m,
|
|
10
|
+
fields: S,
|
|
11
|
+
settings: g,
|
|
12
|
+
authTypes: a,
|
|
13
|
+
currentAuthType: l,
|
|
14
|
+
errors: O,
|
|
15
|
+
onUpdate: w,
|
|
16
|
+
onAuthTypeChange: b
|
|
16
17
|
}) => {
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
!
|
|
20
|
-
}, [
|
|
21
|
-
|
|
18
|
+
const [p, B] = u(!0), [k, _] = u(!1), [s, c] = u("idle"), [A, N] = u(null), [I, v] = u(null), [E, f] = u(null), d = F(null), C = window.plutonInstallType, z = C === "binary" || C === "dev";
|
|
19
|
+
console.log("availableAuthTypes :", S, a, l), U(() => {
|
|
20
|
+
!l && a.length > 0 && b(a[0]);
|
|
21
|
+
}, [a, l, b]), U(() => () => {
|
|
22
|
+
d.current && clearInterval(d.current);
|
|
23
|
+
}, []);
|
|
24
|
+
const h = y(() => {
|
|
25
|
+
d.current && (clearInterval(d.current), d.current = null);
|
|
26
|
+
}, []), P = y(async () => {
|
|
27
|
+
c("authorizing"), v(null), f(null);
|
|
28
|
+
try {
|
|
29
|
+
const { sessionId: n } = await L(m);
|
|
30
|
+
N(n), d.current = setInterval(async () => {
|
|
31
|
+
try {
|
|
32
|
+
const r = await j(n);
|
|
33
|
+
r.authUrl && v(r.authUrl), r.status === "success" && r.token ? (h(), c("success"), w({ ...g, token: r.token })) : r.status === "error" && (h(), c("error"), f(r.error || "Authorization failed"));
|
|
34
|
+
} catch (r) {
|
|
35
|
+
h(), c("error"), f((r == null ? void 0 : r.message) || "Failed to check authorization status");
|
|
36
|
+
}
|
|
37
|
+
}, 2e3);
|
|
38
|
+
} catch (n) {
|
|
39
|
+
c("error"), f((n == null ? void 0 : n.message) || "Failed to start authorization");
|
|
40
|
+
}
|
|
41
|
+
}, [m, g, w, h]), x = y(async () => {
|
|
42
|
+
if (h(), A)
|
|
43
|
+
try {
|
|
44
|
+
await q(A);
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
c("idle"), N(null), v(null), f(null);
|
|
48
|
+
}, [A, h]);
|
|
49
|
+
return /* @__PURE__ */ t("div", { className: o.authSettings, children: [
|
|
50
|
+
/* @__PURE__ */ t(
|
|
22
51
|
"div",
|
|
23
52
|
{
|
|
24
|
-
className: `${
|
|
25
|
-
onClick: () =>
|
|
53
|
+
className: `${o.advancedButton} ${p ? o.advancedButtonActive : ""}`,
|
|
54
|
+
onClick: () => B(!p),
|
|
26
55
|
children: [
|
|
27
|
-
/* @__PURE__ */ e(
|
|
28
|
-
/* @__PURE__ */ e("span", { children:
|
|
29
|
-
/* @__PURE__ */ e(
|
|
56
|
+
/* @__PURE__ */ e(i, { type: "authentication", size: 14 }),
|
|
57
|
+
/* @__PURE__ */ e("span", { children: m === "local" ? "Local Storage Setup" : "Account Authentication" }),
|
|
58
|
+
/* @__PURE__ */ e(i, { type: p ? "caret-up" : "caret-down" })
|
|
30
59
|
]
|
|
31
60
|
}
|
|
32
61
|
),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
p && /* @__PURE__ */ t("div", { className: o.advancedOptions, children: [
|
|
63
|
+
p && a.length > 1 && /* @__PURE__ */ e("div", { className: o.field, children: /* @__PURE__ */ e(
|
|
64
|
+
R,
|
|
36
65
|
{
|
|
37
66
|
label: "Authentication Type",
|
|
38
67
|
inline: !0,
|
|
39
|
-
fieldValue:
|
|
68
|
+
fieldValue: l,
|
|
40
69
|
options: [
|
|
41
|
-
{ label: "User (oAuth)", value: "oauth", disabled:
|
|
42
|
-
{ label: "User/Pass", value: "password", disabled:
|
|
43
|
-
{ label: "App/Client", value: "client", disabled:
|
|
70
|
+
{ label: "User (oAuth)", value: "oauth", disabled: a.includes("oauth") === !1 },
|
|
71
|
+
{ label: "User/Pass", value: "password", disabled: a.includes("password") === !1 },
|
|
72
|
+
{ label: "App/Client", value: "client", disabled: a.includes("client") === !1 }
|
|
44
73
|
],
|
|
45
74
|
hint: `User (oAuth): Use the generated Link to login to your account and authorize the App.
|
|
46
75
|
Username/Password: Your own Username/Password will be used to backup.
|
|
47
76
|
App/Client: Provide App/Client keys that can be found in your cloud storage account dashboard`,
|
|
48
|
-
onUpdate: (
|
|
77
|
+
onUpdate: (n) => b(n)
|
|
49
78
|
}
|
|
50
79
|
) }),
|
|
51
80
|
/* @__PURE__ */ e(
|
|
52
|
-
|
|
81
|
+
$,
|
|
53
82
|
{
|
|
54
|
-
fields:
|
|
55
|
-
settings:
|
|
56
|
-
onUpdate: (
|
|
57
|
-
errors:
|
|
83
|
+
fields: S.filter((n) => n.authFieldType === l),
|
|
84
|
+
settings: g,
|
|
85
|
+
onUpdate: (n) => w(n),
|
|
86
|
+
errors: O
|
|
58
87
|
}
|
|
59
88
|
),
|
|
60
|
-
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
|
|
89
|
+
l === "oauth" && z && s === "idle" && /* @__PURE__ */ e("div", { className: o.oauthButton, children: /* @__PURE__ */ t("button", { className: o.oauthAuthorizeBtn, onClick: P, children: [
|
|
90
|
+
/* @__PURE__ */ e(i, { type: "key", size: 14 }),
|
|
91
|
+
" Authorize & Get Access Token"
|
|
92
|
+
] }) }),
|
|
93
|
+
l === "oauth" && z && s !== "idle" && /* @__PURE__ */ t("div", { className: `${o.oauthContainer} ${o[s]}`, children: [
|
|
94
|
+
s === "authorizing" && /* @__PURE__ */ t("div", { className: o.oauthProgress, children: [
|
|
95
|
+
/* @__PURE__ */ t("p", { children: [
|
|
96
|
+
/* @__PURE__ */ e("strong", { children: "Waiting for authorization..." }),
|
|
97
|
+
/* @__PURE__ */ e("br", {}),
|
|
98
|
+
"A browser window should have opened. Please authorize the connection in your browser."
|
|
99
|
+
] }),
|
|
100
|
+
I && /* @__PURE__ */ t("p", { children: [
|
|
101
|
+
"If the browser didn't open automatically,",
|
|
102
|
+
" ",
|
|
103
|
+
/* @__PURE__ */ e("a", { href: I, target: "_blank", rel: "noopener noreferrer", children: "click here to authorize" }),
|
|
104
|
+
"."
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ e("button", { className: o.oauthInnerBtn, onClick: x, children: "Cancel" })
|
|
107
|
+
] }),
|
|
108
|
+
s === "success" && /* @__PURE__ */ e("div", { className: o.oauthProgress, children: /* @__PURE__ */ t("p", { children: [
|
|
109
|
+
/* @__PURE__ */ e(i, { type: "check", size: 14 }),
|
|
110
|
+
" ",
|
|
111
|
+
/* @__PURE__ */ e("strong", { children: "Authorization successful!" }),
|
|
112
|
+
" Token has been automatically filled in."
|
|
113
|
+
] }) }),
|
|
114
|
+
s === "error" && /* @__PURE__ */ t("div", { className: o.oauthProgress, children: [
|
|
115
|
+
/* @__PURE__ */ t("p", { children: [
|
|
116
|
+
/* @__PURE__ */ e("strong", { children: "Authorization failed:" }),
|
|
117
|
+
" ",
|
|
118
|
+
E
|
|
119
|
+
] }),
|
|
120
|
+
/* @__PURE__ */ t("button", { className: o.oauthInnerBtn, onClick: P, children: [
|
|
121
|
+
/* @__PURE__ */ e(i, { type: "key", size: 14 }),
|
|
122
|
+
" Try Again"
|
|
123
|
+
] })
|
|
124
|
+
] })
|
|
125
|
+
] }),
|
|
126
|
+
l === "oauth" && !z && /* @__PURE__ */ t("div", { className: o.oauthDoc, children: [
|
|
127
|
+
/* @__PURE__ */ t("h4", { onClick: () => _(!k), children: [
|
|
128
|
+
/* @__PURE__ */ e(i, { type: "key", size: 14 }),
|
|
63
129
|
" Acquiring the OAuth Access Token",
|
|
64
|
-
/* @__PURE__ */ e("button", { children: /* @__PURE__ */ e(
|
|
130
|
+
/* @__PURE__ */ e("button", { children: /* @__PURE__ */ e(i, { type: k ? "caret-up" : "caret-down" }) })
|
|
65
131
|
] }),
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
132
|
+
k && /* @__PURE__ */ t(D, { children: [
|
|
133
|
+
/* @__PURE__ */ t("p", { children: [
|
|
68
134
|
/* @__PURE__ */ e("strong", { children: "Step 1:" }),
|
|
69
135
|
" On a machine with a browser,",
|
|
70
136
|
" ",
|
|
71
137
|
/* @__PURE__ */ e("a", { href: "https://rclone.org/downloads/", target: "_blank", children: "install rclone" }),
|
|
72
138
|
" ",
|
|
73
139
|
"and execute this command in the CLI: ",
|
|
74
|
-
/* @__PURE__ */
|
|
140
|
+
/* @__PURE__ */ t("code", { className: o.codeBlock, children: [
|
|
75
141
|
"rclone authorize ",
|
|
76
|
-
|
|
142
|
+
m
|
|
77
143
|
] })
|
|
78
144
|
] }),
|
|
79
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ t("p", { children: [
|
|
80
146
|
/* @__PURE__ */ e("strong", { children: "Step 2:" }),
|
|
81
147
|
" A browser window will open where you will need to authorize Rclone to connect to your",
|
|
82
148
|
" ",
|
|
83
|
-
|
|
149
|
+
m,
|
|
84
150
|
" account. Authorize the connection."
|
|
85
151
|
] }),
|
|
86
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ t("p", { children: [
|
|
87
153
|
/* @__PURE__ */ e("strong", { children: "Step 3:" }),
|
|
88
154
|
" Once authorized, the cli where you ran the command, should display a message similar to this:",
|
|
89
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ t("code", { className: o.codeBlock, children: [
|
|
90
156
|
"Paste the following into your remote machine --->",
|
|
91
157
|
/* @__PURE__ */ e("strong", { children: '{"access_token":"....","token_type":"bearer...}' }),
|
|
92
158
|
"<---End paste"
|
|
@@ -99,13 +165,13 @@ const P = ({
|
|
|
99
165
|
" ",
|
|
100
166
|
/* @__PURE__ */ e("code", { children: '{"access_token":"....","token_type":"bearer...}' })
|
|
101
167
|
] }),
|
|
102
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ t("p", { children: [
|
|
103
169
|
/* @__PURE__ */ e("strong", { children: "Step 4:" }),
|
|
104
170
|
" Paste the copied content in the ",
|
|
105
171
|
/* @__PURE__ */ e("strong", { children: "OAuth Access Token" }),
|
|
106
172
|
" field above."
|
|
107
173
|
] }),
|
|
108
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ t("p", { children: [
|
|
109
175
|
/* @__PURE__ */ e("strong", { children: "Step 5:" }),
|
|
110
176
|
" If you no longer need Rclone, you can safely remove it from your system."
|
|
111
177
|
] })
|
|
@@ -115,6 +181,6 @@ const P = ({
|
|
|
115
181
|
] });
|
|
116
182
|
};
|
|
117
183
|
export {
|
|
118
|
-
|
|
184
|
+
M as default
|
|
119
185
|
};
|
|
120
186
|
//# sourceMappingURL=StorageAuthSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageAuthSettings.js","sources":["../../../../src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\r\nimport { storageOptionField } from '../../../@types/storages';\r\nimport Tristate from '../../common/form/Tristate/Tristate';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport classes from '../AddStorage/AddStorage.module.scss';\r\nimport StorageSettings from '../StorageSettings/StorageSettings';\r\n\r\ninterface StorageAuthSettingsProps {\r\n storageType: string;\r\n fields: storageOptionField[];\r\n settings: Record<string, string | number | boolean>;\r\n authTypes: string[];\r\n errors: Record<string, string>;\r\n currentAuthType: string;\r\n onUpdate: (newSettings: StorageAuthSettingsProps['settings']) => void;\r\n onAuthTypeChange: (authType: string) => void;\r\n}\r\n\r\nconst StorageAuthSettings = ({\r\n storageType,\r\n fields,\r\n settings,\r\n authTypes,\r\n currentAuthType,\r\n errors,\r\n onUpdate,\r\n onAuthTypeChange,\r\n}: StorageAuthSettingsProps) => {\r\n const [showAdvanced, setShowAdvanced] = useState(true);\r\n const [showOAuthDoc, setShowOAuthDoc] = useState(false);\r\n\r\n console.log('availableAuthTypes :', fields, authTypes, currentAuthType);\r\n\r\n useEffect(() => {\r\n if (!currentAuthType && authTypes.length > 0) {\r\n onAuthTypeChange(authTypes[0]);\r\n }\r\n }, [authTypes, currentAuthType, onAuthTypeChange]);\r\n\r\n return (\r\n <div className={classes.authSettings}>\r\n <div\r\n className={`${classes.advancedButton} ${showAdvanced ? classes.advancedButtonActive : ''}`}\r\n onClick={() => setShowAdvanced(!showAdvanced)}\r\n >\r\n <Icon type={'authentication'} size={14} />\r\n <span>{storageType === 'local' ? 'Local Storage Setup' : 'Account Authentication'}</span>\r\n <Icon type={showAdvanced ? 'caret-up' : 'caret-down'} />\r\n </div>\r\n {showAdvanced && (\r\n <div className={classes.advancedOptions}>\r\n {showAdvanced && authTypes.length > 1 && (\r\n <div className={classes.field}>\r\n <Tristate\r\n label={'Authentication Type'}\r\n inline={true}\r\n fieldValue={currentAuthType}\r\n options={[\r\n { label: 'User (oAuth)', value: 'oauth', disabled: authTypes.includes('oauth') === false },\r\n { label: 'User/Pass', value: 'password', disabled: authTypes.includes('password') === false },\r\n { label: 'App/Client', value: 'client', disabled: authTypes.includes('client') === false },\r\n ]}\r\n hint={\r\n 'User (oAuth): Use the generated Link to login to your account and authorize the App.\\n Username/Password: Your own Username/Password will be used to backup. \\n App/Client: Provide App/Client keys that can be found in your cloud storage account dashboard'\r\n }\r\n onUpdate={(newVal: string) => onAuthTypeChange(newVal)}\r\n />\r\n </div>\r\n )}\r\n\r\n <StorageSettings\r\n fields={fields.filter((f) => f.authFieldType === currentAuthType)}\r\n settings={settings}\r\n onUpdate={(newSettings) => onUpdate(newSettings)}\r\n errors={errors}\r\n />\r\n {currentAuthType === 'oauth' && (\r\n <div className={classes.oauthDoc}>\r\n <h4 onClick={() => setShowOAuthDoc(!showOAuthDoc)}>\r\n <Icon type={'key'} size={14} /> Acquiring the OAuth Access Token\r\n <button>\r\n <Icon type={showOAuthDoc ? 'caret-up' : 'caret-down'} />\r\n </button>\r\n </h4>\r\n {showOAuthDoc && (\r\n <>\r\n <p>\r\n <strong>Step 1:</strong> On a machine with a browser,{' '}\r\n <a href=\"https://rclone.org/downloads/\" target=\"_blank\">\r\n install rclone\r\n </a>{' '}\r\n and execute this command in the CLI: <code className={classes.codeBlock}>rclone authorize {storageType}</code>\r\n </p>\r\n <p>\r\n <strong>Step 2:</strong> A browser window will open where you will need to authorize Rclone to connect to your{' '}\r\n {storageType} account. Authorize the connection.\r\n </p>\r\n <p>\r\n <strong>Step 3:</strong> Once authorized, the cli where you ran the command, should display a message similar to this:\r\n <code className={classes.codeBlock}>\r\n {`Paste the following into your remote machine --->`}\r\n <strong>{`{\"access_token\":\"....\",\"token_type\":\"bearer...}`}</strong>\r\n {`<---End paste`}\r\n </code>\r\n Copy everything between <code>{`--->`}</code> and <code>{`<---`}</code>. Eg:{' '}\r\n <code>{`{\"access_token\":\"....\",\"token_type\":\"bearer...}`}</code>\r\n </p>\r\n <p>\r\n <strong>Step 4:</strong> Paste the copied content in the <strong>OAuth Access Token</strong> field above.\r\n </p>\r\n <p>\r\n <strong>Step 5:</strong> If you no longer need Rclone, you can safely remove it from your system.\r\n </p>\r\n </>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\nexport default StorageAuthSettings;\r\n"],"names":["StorageAuthSettings","storageType","fields","settings","authTypes","currentAuthType","errors","onUpdate","onAuthTypeChange","showAdvanced","setShowAdvanced","useState","showOAuthDoc","setShowOAuthDoc","useEffect","jsxs","classes","jsx","Icon","Tristate","newVal","StorageSettings","f","newSettings","Fragment"],"mappings":";;;;;;AAkBA,MAAMA,IAAsB,CAAC;AAAA,EAC1B,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AACH,MAAgC;AAC7B,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAS,EAAI,GAC/C,CAACC,GAAcC,CAAe,IAAIF,EAAS,EAAK;AAEtD,iBAAQ,IAAI,wBAAwBT,GAAQE,GAAWC,CAAe,GAEtES,EAAU,MAAM;AACb,IAAI,CAACT,KAAmBD,EAAU,SAAS,KACxCI,EAAiBJ,EAAU,CAAC,CAAC;AAAA,EAEnC,GAAG,CAACA,GAAWC,GAAiBG,CAAgB,CAAC,GAG9C,gBAAAO,EAAC,OAAA,EAAI,WAAWC,EAAQ,cACrB,UAAA;AAAA,IAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,WAAW,GAAGC,EAAQ,cAAc,KAAKP,IAAeO,EAAQ,uBAAuB,EAAE;AAAA,QACzF,SAAS,MAAMN,EAAgB,CAACD,CAAY;AAAA,QAE5C,UAAA;AAAA,UAAA,gBAAAQ,EAACC,GAAA,EAAK,MAAM,kBAAkB,MAAM,IAAI;AAAA,UACxC,gBAAAD,EAAC,QAAA,EAAM,UAAAhB,MAAgB,UAAU,wBAAwB,0BAAyB;AAAA,UAClF,gBAAAgB,EAACC,GAAA,EAAK,MAAMT,IAAe,aAAa,aAAA,CAAc;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAExDA,KACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAQ,iBAC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,CACH;AAAA,MAAA,EAAA,CAEN;AAAA,IAAA,EAAA,CAEN;AAAA,EAAA,GAEN;AAEN;"}
|
|
1
|
+
{"version":3,"file":"StorageAuthSettings.js","sources":["../../../../src/components/Storage/StorageAuthSettings/StorageAuthSettings.tsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\r\nimport { storageOptionField } from '../../../@types/storages';\r\nimport Tristate from '../../common/form/Tristate/Tristate';\r\nimport Icon from '../../common/Icon/Icon';\r\nimport classes from '../AddStorage/AddStorage.module.scss';\r\nimport StorageSettings from '../StorageSettings/StorageSettings';\r\nimport { startStorageAuthorize, getStorageAuthorizeStatus, cancelStorageAuthorize } from '../../../services/storage';\r\n\r\ninterface StorageAuthSettingsProps {\r\n storageType: string;\r\n fields: storageOptionField[];\r\n settings: Record<string, string | number | boolean>;\r\n authTypes: string[];\r\n errors: Record<string, string>;\r\n currentAuthType: string;\r\n onUpdate: (newSettings: StorageAuthSettingsProps['settings']) => void;\r\n onAuthTypeChange: (authType: string) => void;\r\n}\r\n\r\ntype OAuthStatus = 'idle' | 'authorizing' | 'success' | 'error';\r\n\r\nconst StorageAuthSettings = ({\r\n storageType,\r\n fields,\r\n settings,\r\n authTypes,\r\n currentAuthType,\r\n errors,\r\n onUpdate,\r\n onAuthTypeChange,\r\n}: StorageAuthSettingsProps) => {\r\n const [showAdvanced, setShowAdvanced] = useState(true);\r\n const [showOAuthDoc, setShowOAuthDoc] = useState(false);\r\n\r\n // OAuth auto-authorize state\r\n const [oauthStatus, setOauthStatus] = useState<OAuthStatus>('idle');\r\n const [authSessionId, setAuthSessionId] = useState<string | null>(null);\r\n const [authUrl, setAuthUrl] = useState<string | null>(null);\r\n const [authError, setAuthError] = useState<string | null>(null);\r\n const pollingRef = useRef<ReturnType<typeof setInterval> | null>(null);\r\n\r\n const installType = (window as any).plutonInstallType;\r\n const isDesktop = installType === 'binary' || installType === 'dev';\r\n\r\n console.log('availableAuthTypes :', fields, authTypes, currentAuthType);\r\n\r\n useEffect(() => {\r\n if (!currentAuthType && authTypes.length > 0) {\r\n onAuthTypeChange(authTypes[0]);\r\n }\r\n }, [authTypes, currentAuthType, onAuthTypeChange]);\r\n\r\n // Cleanup polling on unmount\r\n useEffect(() => {\r\n return () => {\r\n if (pollingRef.current) {\r\n clearInterval(pollingRef.current);\r\n }\r\n };\r\n }, []);\r\n\r\n const stopPolling = useCallback(() => {\r\n if (pollingRef.current) {\r\n clearInterval(pollingRef.current);\r\n pollingRef.current = null;\r\n }\r\n }, []);\r\n\r\n const startOAuthAuthorize = useCallback(async () => {\r\n setOauthStatus('authorizing');\r\n setAuthUrl(null);\r\n setAuthError(null);\r\n\r\n try {\r\n const { sessionId } = await startStorageAuthorize(storageType);\r\n setAuthSessionId(sessionId);\r\n\r\n // Start polling every 2 seconds\r\n pollingRef.current = setInterval(async () => {\r\n try {\r\n const result = await getStorageAuthorizeStatus(sessionId);\r\n\r\n if (result.authUrl) {\r\n setAuthUrl(result.authUrl);\r\n }\r\n\r\n if (result.status === 'success' && result.token) {\r\n stopPolling();\r\n setOauthStatus('success');\r\n onUpdate({ ...settings, token: result.token });\r\n } else if (result.status === 'error') {\r\n stopPolling();\r\n setOauthStatus('error');\r\n setAuthError(result.error || 'Authorization failed');\r\n }\r\n } catch (err: any) {\r\n stopPolling();\r\n setOauthStatus('error');\r\n setAuthError(err?.message || 'Failed to check authorization status');\r\n }\r\n }, 2000);\r\n } catch (err: any) {\r\n setOauthStatus('error');\r\n setAuthError(err?.message || 'Failed to start authorization');\r\n }\r\n }, [storageType, settings, onUpdate, stopPolling]);\r\n\r\n const handleCancelAuthorize = useCallback(async () => {\r\n stopPolling();\r\n if (authSessionId) {\r\n try {\r\n await cancelStorageAuthorize(authSessionId);\r\n } catch {\r\n // Ignore cancel errors\r\n }\r\n }\r\n setOauthStatus('idle');\r\n setAuthSessionId(null);\r\n setAuthUrl(null);\r\n setAuthError(null);\r\n }, [authSessionId, stopPolling]);\r\n\r\n return (\r\n <div className={classes.authSettings}>\r\n <div\r\n className={`${classes.advancedButton} ${showAdvanced ? classes.advancedButtonActive : ''}`}\r\n onClick={() => setShowAdvanced(!showAdvanced)}\r\n >\r\n <Icon type={'authentication'} size={14} />\r\n <span>{storageType === 'local' ? 'Local Storage Setup' : 'Account Authentication'}</span>\r\n <Icon type={showAdvanced ? 'caret-up' : 'caret-down'} />\r\n </div>\r\n {showAdvanced && (\r\n <div className={classes.advancedOptions}>\r\n {showAdvanced && authTypes.length > 1 && (\r\n <div className={classes.field}>\r\n <Tristate\r\n label={'Authentication Type'}\r\n inline={true}\r\n fieldValue={currentAuthType}\r\n options={[\r\n { label: 'User (oAuth)', value: 'oauth', disabled: authTypes.includes('oauth') === false },\r\n { label: 'User/Pass', value: 'password', disabled: authTypes.includes('password') === false },\r\n { label: 'App/Client', value: 'client', disabled: authTypes.includes('client') === false },\r\n ]}\r\n hint={\r\n 'User (oAuth): Use the generated Link to login to your account and authorize the App.\\n Username/Password: Your own Username/Password will be used to backup. \\n App/Client: Provide App/Client keys that can be found in your cloud storage account dashboard'\r\n }\r\n onUpdate={(newVal: string) => onAuthTypeChange(newVal)}\r\n />\r\n </div>\r\n )}\r\n <StorageSettings\r\n fields={fields.filter((f) => f.authFieldType === currentAuthType)}\r\n settings={settings}\r\n onUpdate={(newSettings) => onUpdate(newSettings)}\r\n errors={errors}\r\n />\r\n\r\n {currentAuthType === 'oauth' && isDesktop && oauthStatus === 'idle' && (\r\n <div className={classes.oauthButton}>\r\n <button className={classes.oauthAuthorizeBtn} onClick={startOAuthAuthorize}>\r\n <Icon type={'key'} size={14} /> Authorize & Get Access Token\r\n </button>\r\n </div>\r\n )}\r\n\r\n {currentAuthType === 'oauth' && isDesktop && oauthStatus !== 'idle' && (\r\n <div className={`${classes.oauthContainer} ${classes[oauthStatus]}`}>\r\n {oauthStatus === 'authorizing' && (\r\n <div className={classes.oauthProgress}>\r\n <p>\r\n <strong>Waiting for authorization...</strong>\r\n <br />A browser window should have opened. Please authorize the connection in your browser.\r\n </p>\r\n {authUrl && (\r\n <p>\r\n If the browser didn't open automatically,{' '}\r\n <a href={authUrl} target=\"_blank\" rel=\"noopener noreferrer\">\r\n click here to authorize\r\n </a>\r\n .\r\n </p>\r\n )}\r\n <button className={classes.oauthInnerBtn} onClick={handleCancelAuthorize}>\r\n Cancel\r\n </button>\r\n </div>\r\n )}\r\n {oauthStatus === 'success' && (\r\n <div className={classes.oauthProgress}>\r\n <p>\r\n <Icon type={'check'} size={14} /> <strong>Authorization successful!</strong> Token has been automatically filled in.\r\n </p>\r\n </div>\r\n )}\r\n {oauthStatus === 'error' && (\r\n <div className={classes.oauthProgress}>\r\n <p>\r\n <strong>Authorization failed:</strong> {authError}\r\n </p>\r\n <button className={classes.oauthInnerBtn} onClick={startOAuthAuthorize}>\r\n <Icon type={'key'} size={14} /> Try Again\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n\r\n {currentAuthType === 'oauth' && !isDesktop && (\r\n <div className={classes.oauthDoc}>\r\n <h4 onClick={() => setShowOAuthDoc(!showOAuthDoc)}>\r\n <Icon type={'key'} size={14} /> Acquiring the OAuth Access Token\r\n <button>\r\n <Icon type={showOAuthDoc ? 'caret-up' : 'caret-down'} />\r\n </button>\r\n </h4>\r\n {showOAuthDoc && (\r\n <>\r\n <p>\r\n <strong>Step 1:</strong> On a machine with a browser,{' '}\r\n <a href=\"https://rclone.org/downloads/\" target=\"_blank\">\r\n install rclone\r\n </a>{' '}\r\n and execute this command in the CLI: <code className={classes.codeBlock}>rclone authorize {storageType}</code>\r\n </p>\r\n <p>\r\n <strong>Step 2:</strong> A browser window will open where you will need to authorize Rclone to connect to your{' '}\r\n {storageType} account. Authorize the connection.\r\n </p>\r\n <p>\r\n <strong>Step 3:</strong> Once authorized, the cli where you ran the command, should display a message similar to this:\r\n <code className={classes.codeBlock}>\r\n {`Paste the following into your remote machine --->`}\r\n <strong>{`{\"access_token\":\"....\",\"token_type\":\"bearer...}`}</strong>\r\n {`<---End paste`}\r\n </code>\r\n Copy everything between <code>{`--->`}</code> and <code>{`<---`}</code>. Eg:{' '}\r\n <code>{`{\"access_token\":\"....\",\"token_type\":\"bearer...}`}</code>\r\n </p>\r\n <p>\r\n <strong>Step 4:</strong> Paste the copied content in the <strong>OAuth Access Token</strong> field above.\r\n </p>\r\n <p>\r\n <strong>Step 5:</strong> If you no longer need Rclone, you can safely remove it from your system.\r\n </p>\r\n </>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n )}\r\n </div>\r\n );\r\n};\r\nexport default StorageAuthSettings;\r\n"],"names":["StorageAuthSettings","storageType","fields","settings","authTypes","currentAuthType","errors","onUpdate","onAuthTypeChange","showAdvanced","setShowAdvanced","useState","showOAuthDoc","setShowOAuthDoc","oauthStatus","setOauthStatus","authSessionId","setAuthSessionId","authUrl","setAuthUrl","authError","setAuthError","pollingRef","useRef","installType","isDesktop","useEffect","stopPolling","useCallback","startOAuthAuthorize","sessionId","startStorageAuthorize","result","getStorageAuthorizeStatus","err","handleCancelAuthorize","cancelStorageAuthorize","jsxs","classes","jsx","Icon","Tristate","newVal","StorageSettings","f","newSettings","Fragment"],"mappings":";;;;;;;AAqBA,MAAMA,IAAsB,CAAC;AAAA,EAC1B,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AACH,MAAgC;AAC7B,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAS,EAAI,GAC/C,CAACC,GAAcC,CAAe,IAAIF,EAAS,EAAK,GAGhD,CAACG,GAAaC,CAAc,IAAIJ,EAAsB,MAAM,GAC5D,CAACK,GAAeC,CAAgB,IAAIN,EAAwB,IAAI,GAChE,CAACO,GAASC,CAAU,IAAIR,EAAwB,IAAI,GACpD,CAACS,GAAWC,CAAY,IAAIV,EAAwB,IAAI,GACxDW,IAAaC,EAA8C,IAAI,GAE/DC,IAAe,O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YAAO,UAAA,UAAA,CAAO;AAAA,YAAS;AAAA,UAAA,EAAA,CAC3B;AAAA,QAAA,EAAA,CACH;AAAA,MAAA,EAAA,CAEN;AAAA,IAAA,EAAA,CAEN;AAAA,EAAA,GAEN;AAEN;"}
|
|
@@ -29,5 +29,15 @@ export declare function deleteStorage(id: string): Promise<any>;
|
|
|
29
29
|
export declare function useDeleteStorage(): import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
30
30
|
export declare function verifyStorage(id: string): Promise<any>;
|
|
31
31
|
export declare function useVerifyStorage(): import("@tanstack/react-query").UseMutationResult<any, Error, string, unknown>;
|
|
32
|
+
export declare function startStorageAuthorize(type: string): Promise<{
|
|
33
|
+
sessionId: string;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function getStorageAuthorizeStatus(sessionId: string): Promise<{
|
|
36
|
+
status: 'pending' | 'success' | 'error';
|
|
37
|
+
token?: string;
|
|
38
|
+
error?: string;
|
|
39
|
+
authUrl?: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function cancelStorageAuthorize(sessionId: string): Promise<void>;
|
|
32
42
|
export {};
|
|
33
43
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/services/storage.ts"],"names":[],"mappings":"AAGA,UAAU,iBAAiB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACpD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AACD,UAAU,oBAAoB;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE;QA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,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY7E"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useQuery as a, useQueryClient as c, useMutation as
|
|
2
|
-
import { API_URL as
|
|
1
|
+
import { useQuery as a, useQueryClient as c, useMutation as o } from "@tanstack/react-query";
|
|
2
|
+
import { API_URL as s } from "../utils/constants.js";
|
|
3
3
|
async function i() {
|
|
4
|
-
const e = new URL(`${
|
|
4
|
+
const e = new URL(`${s}/storages/available`), n = await (await fetch(e.toString(), {
|
|
5
5
|
method: "GET",
|
|
6
6
|
credentials: "include"
|
|
7
7
|
})).json();
|
|
@@ -18,7 +18,7 @@ function p() {
|
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
async function u() {
|
|
21
|
-
const e = new URL(`${
|
|
21
|
+
const e = new URL(`${s}/storages`), n = await (await fetch(e.toString(), {
|
|
22
22
|
method: "GET",
|
|
23
23
|
credentials: "include"
|
|
24
24
|
})).json();
|
|
@@ -35,7 +35,7 @@ function S() {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
async function d(e) {
|
|
38
|
-
const r = new URL(`${
|
|
38
|
+
const r = new URL(`${s}/storages/${e}`), t = await (await fetch(r.toString(), {
|
|
39
39
|
method: "GET",
|
|
40
40
|
credentials: "include"
|
|
41
41
|
})).json();
|
|
@@ -52,7 +52,7 @@ function j(e) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
async function l(e) {
|
|
55
|
-
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${
|
|
55
|
+
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${s}/storages`, {
|
|
56
56
|
method: "POST",
|
|
57
57
|
credentials: "include",
|
|
58
58
|
headers: r,
|
|
@@ -64,7 +64,7 @@ async function l(e) {
|
|
|
64
64
|
}
|
|
65
65
|
function m() {
|
|
66
66
|
const e = c();
|
|
67
|
-
return
|
|
67
|
+
return o({
|
|
68
68
|
mutationFn: l,
|
|
69
69
|
onSuccess: (r) => {
|
|
70
70
|
console.log("# Storage Added! :", r), e.invalidateQueries({ queryKey: ["storages"] });
|
|
@@ -72,7 +72,7 @@ function m() {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
async function f(e) {
|
|
75
|
-
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${
|
|
75
|
+
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${s}/storages/${e.id}`, {
|
|
76
76
|
method: "PUT",
|
|
77
77
|
credentials: "include",
|
|
78
78
|
headers: r,
|
|
@@ -84,7 +84,7 @@ async function f(e) {
|
|
|
84
84
|
}
|
|
85
85
|
function E() {
|
|
86
86
|
const e = c();
|
|
87
|
-
return
|
|
87
|
+
return o({
|
|
88
88
|
mutationFn: f,
|
|
89
89
|
onSuccess: (r) => {
|
|
90
90
|
console.log("# Storage Updated! :", r), e.invalidateQueries({ queryKey: ["storages"] });
|
|
@@ -92,7 +92,7 @@ function E() {
|
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
94
|
async function g(e) {
|
|
95
|
-
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${
|
|
95
|
+
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${s}/storages/${e}`, {
|
|
96
96
|
method: "DELETE",
|
|
97
97
|
credentials: "include",
|
|
98
98
|
headers: r
|
|
@@ -101,17 +101,17 @@ async function g(e) {
|
|
|
101
101
|
throw new Error(t.error);
|
|
102
102
|
return t;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function T() {
|
|
105
105
|
const e = c();
|
|
106
|
-
return
|
|
106
|
+
return o({
|
|
107
107
|
mutationFn: g,
|
|
108
108
|
onSuccess: (r) => {
|
|
109
109
|
console.log("# Storage Updated! :", r), e.invalidateQueries({ queryKey: ["storages"] });
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
async function
|
|
114
|
-
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${
|
|
113
|
+
async function h(e) {
|
|
114
|
+
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${s}/storages/verify/${e}`, {
|
|
115
115
|
method: "POST",
|
|
116
116
|
credentials: "include",
|
|
117
117
|
headers: r
|
|
@@ -120,28 +120,63 @@ async function y(e) {
|
|
|
120
120
|
throw new Error(t.error);
|
|
121
121
|
return t;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return
|
|
125
|
-
mutationFn:
|
|
123
|
+
function A() {
|
|
124
|
+
return o({
|
|
125
|
+
mutationFn: h,
|
|
126
126
|
onSuccess: (e) => {
|
|
127
127
|
console.log("# Storage Verfied! :", e);
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
+
async function $(e) {
|
|
132
|
+
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${s}/storages/authorize`, {
|
|
133
|
+
method: "POST",
|
|
134
|
+
credentials: "include",
|
|
135
|
+
headers: r,
|
|
136
|
+
body: JSON.stringify({ type: e })
|
|
137
|
+
})).json();
|
|
138
|
+
if (!t.success)
|
|
139
|
+
throw new Error(t.error);
|
|
140
|
+
return t.result;
|
|
141
|
+
}
|
|
142
|
+
async function q(e) {
|
|
143
|
+
const r = new URL(`${s}/storages/authorize/status`);
|
|
144
|
+
r.searchParams.set("sessionId", e);
|
|
145
|
+
const t = await (await fetch(r.toString(), {
|
|
146
|
+
method: "GET",
|
|
147
|
+
credentials: "include"
|
|
148
|
+
})).json();
|
|
149
|
+
if (!t.success)
|
|
150
|
+
throw new Error(t.error);
|
|
151
|
+
return t.result;
|
|
152
|
+
}
|
|
153
|
+
async function O(e) {
|
|
154
|
+
const r = new Headers({ "Content-Type": "application/json", Accept: "application/json" }), t = await (await fetch(`${s}/storages/authorize/cancel`, {
|
|
155
|
+
method: "POST",
|
|
156
|
+
credentials: "include",
|
|
157
|
+
headers: r,
|
|
158
|
+
body: JSON.stringify({ sessionId: e })
|
|
159
|
+
})).json();
|
|
160
|
+
if (!t.success)
|
|
161
|
+
throw new Error(t.error);
|
|
162
|
+
}
|
|
131
163
|
export {
|
|
132
164
|
l as addStorage,
|
|
165
|
+
O as cancelStorageAuthorize,
|
|
133
166
|
g as deleteStorage,
|
|
134
167
|
u as getAllStorages,
|
|
135
168
|
i as getAvailableStorages,
|
|
136
169
|
d as getStorage,
|
|
170
|
+
q as getStorageAuthorizeStatus,
|
|
171
|
+
$ as startStorageAuthorize,
|
|
137
172
|
f as updateStorage,
|
|
138
173
|
m as useAddStorage,
|
|
139
|
-
|
|
174
|
+
T as useDeleteStorage,
|
|
140
175
|
p as useGetAvailableStorages,
|
|
141
176
|
j as useGetStorage,
|
|
142
177
|
S as useGetStorages,
|
|
143
178
|
E as useUpdateStorage,
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
A as useVerifyStorage,
|
|
180
|
+
h as verifyStorage
|
|
146
181
|
};
|
|
147
182
|
//# sourceMappingURL=storage.js.map
|