Skip to content

Commit 7230a9a

Browse files
committed
enhance windows ftp transition
1 parent 574dbf4 commit 7230a9a

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "mdfriday",
33
"name": "Friday",
4-
"version": "0.11.1",
4+
"version": "0.11.2",
55
"minAppVersion": "0.15.0",
66
"description": "Notes to Website. Friday helps you turn Markdown documents into websites in minutes.",
77
"author": "sunwei",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-friday-plugin",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"description": "Friday is an Obsidian plugin that empowers users to focus on content creation by writing Markdown files, while we handle the distribution. From creating websites to content deployment, Friday serves as a creative output assistant, helping users turn their work into publishable sites with ease.",
55
"main": "main.js",
66
"scripts": {

src/ftp.ts

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,29 @@ export class FTPUploader {
7272
secure: true, // Try FTPS first
7373
secureOptions: {
7474
rejectUnauthorized: !this.config.ignoreCert
75-
}
75+
},
76+
// Timeout settings for slow networks and large files
77+
timeout: 90000 // 90 seconds timeout
7678
};
7779

7880
// Enable verbose logging for debugging
7981
this.client.ftp.verbose = true;
82+
83+
// Force IPv4 to avoid EPSV issues on Windows
84+
this.client.ftp.ipFamily = 4;
8085

8186
try {
8287
// First attempt: FTPS (secure)
8388
await this.client.access(accessConfig);
89+
90+
// Disable EPSV, use traditional PASV (better Windows compatibility)
91+
try {
92+
await this.client.send("EPSV ALL");
93+
} catch (epsvErr) {
94+
// Some servers don't support "EPSV ALL", ignore the error
95+
console.log('EPSV ALL command not supported, continuing with default settings');
96+
}
97+
8498
return { usedSecure: true };
8599
} catch (err) {
86100
const errorMessage = String(err);
@@ -94,15 +108,27 @@ export class FTPUploader {
94108
this.client = new ftp.Client();
95109
this.client.ftp.verbose = true;
96110

111+
// Force IPv4 for new client as well
112+
this.client.ftp.ipFamily = 4;
113+
97114
// Second attempt: Plain FTP
98115
const plainConfig = {
99116
host: this.config.server,
100117
user: this.config.username,
101118
password: this.config.password,
102-
secure: false
119+
secure: false,
120+
timeout: 90000 // Same timeout for plain FTP
103121
};
104122

105123
await this.client.access(plainConfig);
124+
125+
// Disable EPSV for plain FTP too
126+
try {
127+
await this.client.send("EPSV ALL");
128+
} catch (epsvErr) {
129+
console.log('EPSV ALL command not supported, continuing with default settings');
130+
}
131+
106132
return { usedSecure: false };
107133
} else {
108134
// Re-throw non-TLS related errors

versions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"0.10.20": "0.15.0",
55
"0.10.21": "0.15.0",
66
"0.10.22": "0.15.0",
7-
"0.11.1": "0.15.0"
7+
"0.11.1": "0.15.0",
8+
"0.11.2": "0.15.0"
89
}

0 commit comments

Comments
 (0)