sliftutils 1.4.7 → 1.4.8
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/package.json +1 -1
- package/storage/FileFolderAPI.tsx +12 -2
package/package.json
CHANGED
|
@@ -95,6 +95,16 @@ function loadRemoteConfig(): RemoteConfig | undefined {
|
|
|
95
95
|
}
|
|
96
96
|
function saveRemoteConfig(c: RemoteConfig) { localStorage.setItem(remoteConfigKey(), JSON.stringify(c)); }
|
|
97
97
|
|
|
98
|
+
// The server is always HTTPS on the filehoster's default port, so the user only needs to type the host
|
|
99
|
+
// (e.g. "65.109.93.113"). We strip any scheme/path they include and default the port if omitted.
|
|
100
|
+
const DEFAULT_REMOTE_PORT = 8787; // matches remoteFileServer.js's default
|
|
101
|
+
function normalizeServerUrl(raw: string): string {
|
|
102
|
+
let s = raw.trim().replace(/^\w+:\/\//, "").replace(/\/.*$/, "");
|
|
103
|
+
if (!s) return "";
|
|
104
|
+
if (!/:\d+$/.test(s)) s += ":" + DEFAULT_REMOTE_PORT;
|
|
105
|
+
return "https://" + s;
|
|
106
|
+
}
|
|
107
|
+
|
|
98
108
|
// One shared factory (and therefore one shared range cache) per remote config.
|
|
99
109
|
let remoteFactory: { key: string; factory: ReturnType<typeof getRemoteFileStorage> } | undefined;
|
|
100
110
|
function getRemoteFactory(remote: RemoteConfig) {
|
|
@@ -129,7 +139,7 @@ class DirectoryPrompter extends preact.Component {
|
|
|
129
139
|
@observer
|
|
130
140
|
class ServerConnectForm extends preact.Component {
|
|
131
141
|
private obs = observable({ expanded: false, url: "", password: "", error: "", connecting: false, needsCert: false, showPassword: false });
|
|
132
|
-
private cleanUrl() { return this.obs.url
|
|
142
|
+
private cleanUrl() { return normalizeServerUrl(this.obs.url); }
|
|
133
143
|
private connect = async () => {
|
|
134
144
|
const s = this.obs;
|
|
135
145
|
s.error = "";
|
|
@@ -166,7 +176,7 @@ class ServerConnectForm extends preact.Component {
|
|
|
166
176
|
}
|
|
167
177
|
return (
|
|
168
178
|
<div className={css.vbox(16).center}>
|
|
169
|
-
<input className={inputCss} placeholder="
|
|
179
|
+
<input className={inputCss} placeholder="server address (e.g. 65.109.93.113, or host:port)" value={s.url}
|
|
170
180
|
onInput={e => s.url = (e.target as HTMLInputElement).value} />
|
|
171
181
|
<div className={css.hbox(10).center}>
|
|
172
182
|
<input className={inputCss} type={s.showPassword ? "text" : "password"} placeholder="password (six words)" value={s.password}
|