@dungsil/dsh-plugin-cli-proxy-api 0.2.3 → 0.3.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/client.js +28 -48
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -164,18 +164,14 @@ const copy = {
|
|
|
164
164
|
saved: "Saved · leave unchanged",
|
|
165
165
|
notSaved: "Not saved",
|
|
166
166
|
remove: "Remove saved key",
|
|
167
|
-
removed: "Will be removed on save",
|
|
168
167
|
serverHint: "Requires CLIProxyAPI v8. Use the server root without /v1. Remote servers require HTTPS.",
|
|
169
|
-
keyHint: "Blank fields keep saved keys.
|
|
170
|
-
save: "Save connection",
|
|
168
|
+
keyHint: "Changes save when you leave a field or press Enter. Blank fields keep saved keys. Changing the URL clears existing keys.",
|
|
171
169
|
refresh: "Refresh",
|
|
172
170
|
busy: "Working…",
|
|
173
171
|
connectionLocked: "Connection could not be confirmed. Refresh the connection to enable saving.",
|
|
174
172
|
error: "The request could not be confirmed. It will not be retried automatically. Refresh to check before trying again.",
|
|
175
173
|
success: "Request completed. Refresh the relevant list to confirm the latest state.",
|
|
176
|
-
savedConnection: "Connection saved and checked.",
|
|
177
174
|
managementHint: "Save a management key to enable management controls.",
|
|
178
|
-
draftHint: "Save the connection before using these controls.",
|
|
179
175
|
connectionSettingsHint: "Configure the server URL and keys in Settings → CLIProxyAPI. Connection information updates automatically.",
|
|
180
176
|
emptyAccounts: "No accounts available.",
|
|
181
177
|
disabled: "Disabled"
|
|
@@ -233,18 +229,14 @@ const copy = {
|
|
|
233
229
|
saved: "저장됨 · 변경하지 않음",
|
|
234
230
|
notSaved: "저장되지 않음",
|
|
235
231
|
remove: "저장된 키 삭제",
|
|
236
|
-
removed: "저장 시 삭제됩니다",
|
|
237
232
|
serverHint: "CLIProxyAPI v8이 필요합니다. /v1을 제외한 서버 주소를 입력하세요. 원격 서버는 HTTPS가 필요합니다.",
|
|
238
|
-
keyHint: "빈 입력란은 기존 키를
|
|
239
|
-
save: "연결 저장",
|
|
233
|
+
keyHint: "입력란을 벗어나거나 Enter를 누르면 자동 저장합니다. 빈 입력란은 기존 키를 유지하며, URL을 바꾸면 기존 키를 지웁니다.",
|
|
240
234
|
refresh: "새로고침",
|
|
241
235
|
busy: "처리 중…",
|
|
242
236
|
connectionLocked: "연결 정보를 확인하지 못했습니다. 연결을 새로고침하면 저장할 수 있습니다.",
|
|
243
237
|
error: "요청 결과를 확인하지 못했습니다. 자동으로 재시도하지 않습니다. 다시 시도하기 전에 새로고침하여 확인하세요.",
|
|
244
238
|
success: "요청을 완료했습니다. 해당 목록을 새로고침하여 최신 상태를 확인하세요.",
|
|
245
|
-
savedConnection: "연결을 저장하고 확인했습니다.",
|
|
246
239
|
managementHint: "관리 기능을 사용하려면 관리 키를 저장하세요.",
|
|
247
|
-
draftHint: "이 기능을 사용하기 전에 연결을 저장하세요.",
|
|
248
240
|
connectionSettingsHint: "설정 → CLIProxyAPI에서 서버 주소와 키를 설정하세요. 연결 정보는 자동으로 갱신됩니다.",
|
|
249
241
|
emptyAccounts: "사용 가능한 계정이 없습니다.",
|
|
250
242
|
disabled: "비활성"
|
|
@@ -302,18 +294,14 @@ const copy = {
|
|
|
302
294
|
saved: "已保存 · 保持不变",
|
|
303
295
|
notSaved: "未保存",
|
|
304
296
|
remove: "删除已保存的密钥",
|
|
305
|
-
removed: "保存时将删除",
|
|
306
297
|
serverHint: "需要 CLIProxyAPI v8。请输入不含 /v1 的服务器根地址。远程服务器必须使用 HTTPS。",
|
|
307
|
-
keyHint: "
|
|
308
|
-
save: "保存连接",
|
|
298
|
+
keyHint: "离开输入框或按 Enter 后自动保存。空输入框保留已保存的密钥,更改 URL 会清除原有密钥。",
|
|
309
299
|
refresh: "刷新",
|
|
310
300
|
busy: "处理中…",
|
|
311
301
|
connectionLocked: "无法确认连接信息。请刷新连接以启用保存。",
|
|
312
302
|
error: "无法确认请求结果。不会自动重试。请先刷新确认状态,再尝试操作。",
|
|
313
303
|
success: "请求已完成。请刷新相应列表以确认最新状态。",
|
|
314
|
-
savedConnection: "连接已保存并确认。",
|
|
315
304
|
managementHint: "请保存管理密钥以启用管理功能。",
|
|
316
|
-
draftHint: "使用这些功能前请保存连接。",
|
|
317
305
|
connectionSettingsHint: "请在设置 → CLIProxyAPI 中配置服务器地址和密钥。连接信息会自动更新。",
|
|
318
306
|
emptyAccounts: "没有可用账户。",
|
|
319
307
|
disabled: "已禁用"
|
|
@@ -828,8 +816,6 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
828
816
|
const [baseURL, setBaseURL] = (0, react.useState)(cachedView?.baseURL ?? "");
|
|
829
817
|
const [apiKey, setAPIKey] = (0, react.useState)("");
|
|
830
818
|
const [managementKey, setManagementKey] = (0, react.useState)("");
|
|
831
|
-
const [removeAPIKey, setRemoveAPIKey] = (0, react.useState)(false);
|
|
832
|
-
const [removeManagementKey, setRemoveManagementKey] = (0, react.useState)(false);
|
|
833
819
|
const [synchronized, setSynchronized] = (0, react.useState)(!!cached);
|
|
834
820
|
const [busy, setBusy] = (0, react.useState)(!cached);
|
|
835
821
|
const [notice, setNotice] = (0, react.useState)();
|
|
@@ -854,8 +840,6 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
854
840
|
setSynchronized(true);
|
|
855
841
|
setAPIKey("");
|
|
856
842
|
setManagementKey("");
|
|
857
|
-
setRemoveAPIKey(false);
|
|
858
|
-
setRemoveManagementKey(false);
|
|
859
843
|
setQuotaAccounts(void 0);
|
|
860
844
|
setQuotas({});
|
|
861
845
|
setFetchedAt(void 0);
|
|
@@ -989,14 +973,15 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
989
973
|
}
|
|
990
974
|
}
|
|
991
975
|
};
|
|
992
|
-
const save = () => {
|
|
993
|
-
if (!view || !synchronized || lock.current) return;
|
|
976
|
+
const save = (remove = {}) => {
|
|
977
|
+
if (!view || !synchronized || lock.current || !baseURL.trim()) return;
|
|
978
|
+
if (!draftChanged && !remove.removeAPIKey && !remove.removeManagementKey) return;
|
|
994
979
|
const changedURL = baseURL.trim() !== view.baseURL;
|
|
995
980
|
const payload = {
|
|
996
981
|
revision: view.revision,
|
|
997
982
|
baseURL: baseURL.trim(),
|
|
998
|
-
apiKey: apiKey || (
|
|
999
|
-
managementKey: managementKey || (
|
|
983
|
+
apiKey: remove.removeAPIKey ? "" : apiKey || (changedURL ? "" : void 0),
|
|
984
|
+
managementKey: remove.removeManagementKey ? "" : managementKey || (changedURL ? "" : void 0)
|
|
1000
985
|
};
|
|
1001
986
|
setAPIKey("");
|
|
1002
987
|
setManagementKey("");
|
|
@@ -1012,10 +997,10 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
1012
997
|
}
|
|
1013
998
|
await describe(controller);
|
|
1014
999
|
ctx.emit("cli-proxy-api/connection-changed");
|
|
1015
|
-
|
|
1000
|
+
if (!saved) setNotice("error");
|
|
1016
1001
|
});
|
|
1017
1002
|
};
|
|
1018
|
-
const draftChanged = !!view && (baseURL.trim() !== view.baseURL || !!apiKey || !!managementKey
|
|
1003
|
+
const draftChanged = !!view && (baseURL.trim() !== view.baseURL || !!apiKey || !!managementKey);
|
|
1019
1004
|
const canManage = !!view && synchronized && !draftChanged && !!view?.managementKeySaved;
|
|
1020
1005
|
const managementDisabled = busy || !canManage || uncertain;
|
|
1021
1006
|
const row = (label, children) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SettingsRow, {
|
|
@@ -1036,7 +1021,7 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
1036
1021
|
"aria-label": "CLIProxyAPI",
|
|
1037
1022
|
"aria-busy": busy,
|
|
1038
1023
|
children: [
|
|
1039
|
-
busy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1024
|
+
busy && !settings && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1040
1025
|
role: "status",
|
|
1041
1026
|
children: text.busy
|
|
1042
1027
|
}),
|
|
@@ -1061,7 +1046,11 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
1061
1046
|
spellCheck: false,
|
|
1062
1047
|
value: baseURL,
|
|
1063
1048
|
disabled: busy || !synchronized,
|
|
1064
|
-
onChange: (event) => setBaseURL(event.target.value)
|
|
1049
|
+
onChange: (event) => setBaseURL(event.target.value),
|
|
1050
|
+
onBlur: () => save(),
|
|
1051
|
+
onKeyDown: (event) => {
|
|
1052
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing) event.currentTarget.blur();
|
|
1053
|
+
}
|
|
1065
1054
|
})),
|
|
1066
1055
|
row(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1067
1056
|
htmlFor: `${id}-api`,
|
|
@@ -1072,15 +1061,13 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
1072
1061
|
autoComplete: "off",
|
|
1073
1062
|
value: apiKey,
|
|
1074
1063
|
disabled: busy || !synchronized,
|
|
1075
|
-
placeholder:
|
|
1076
|
-
onChange: (event) =>
|
|
1077
|
-
|
|
1078
|
-
|
|
1064
|
+
placeholder: view?.apiKeySaved ? text.saved : text.notSaved,
|
|
1065
|
+
onChange: (event) => setAPIKey(event.target.value),
|
|
1066
|
+
onBlur: () => save(),
|
|
1067
|
+
onKeyDown: (event) => {
|
|
1068
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing) event.currentTarget.blur();
|
|
1079
1069
|
}
|
|
1080
|
-
}), button(text.remove, () => {
|
|
1081
|
-
setAPIKey("");
|
|
1082
|
-
setRemoveAPIKey(true);
|
|
1083
|
-
}, busy || !synchronized || !view?.apiKeySaved || removeAPIKey)] })),
|
|
1070
|
+
}), button(text.remove, () => save({ removeAPIKey: true }), busy || !synchronized || !view?.apiKeySaved)] })),
|
|
1084
1071
|
row(/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
1085
1072
|
htmlFor: `${id}-management`,
|
|
1086
1073
|
children: text.managementKey
|
|
@@ -1090,15 +1077,13 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
1090
1077
|
autoComplete: "off",
|
|
1091
1078
|
value: managementKey,
|
|
1092
1079
|
disabled: busy || !synchronized,
|
|
1093
|
-
placeholder:
|
|
1094
|
-
onChange: (event) =>
|
|
1095
|
-
|
|
1096
|
-
|
|
1080
|
+
placeholder: view?.managementKeySaved ? text.saved : text.notSaved,
|
|
1081
|
+
onChange: (event) => setManagementKey(event.target.value),
|
|
1082
|
+
onBlur: () => save(),
|
|
1083
|
+
onKeyDown: (event) => {
|
|
1084
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing) event.currentTarget.blur();
|
|
1097
1085
|
}
|
|
1098
|
-
}), button(text.remove, () => {
|
|
1099
|
-
setManagementKey("");
|
|
1100
|
-
setRemoveManagementKey(true);
|
|
1101
|
-
}, busy || !synchronized || !view?.managementKeySaved || removeManagementKey)] })),
|
|
1086
|
+
}), button(text.remove, () => save({ removeManagementKey: true }), busy || !synchronized || !view?.managementKeySaved)] })),
|
|
1102
1087
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1103
1088
|
className: "hint",
|
|
1104
1089
|
children: text.keyHint
|
|
@@ -1106,11 +1091,6 @@ function ProxyPage({ ctx, cache, settings = false }) {
|
|
|
1106
1091
|
!synchronized && !busy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1107
1092
|
role: "alert",
|
|
1108
1093
|
children: text.connectionLocked
|
|
1109
|
-
}),
|
|
1110
|
-
row(text.connection, button(text.save, save, busy || !synchronized || !baseURL.trim())),
|
|
1111
|
-
draftChanged && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1112
|
-
className: "hint",
|
|
1113
|
-
children: text.draftHint
|
|
1114
1094
|
})
|
|
1115
1095
|
] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1116
1096
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|