Spaces:
Running
Running
Update start.mjs
Browse files
start.mjs
CHANGED
@@ -1,20 +1,19 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
const
|
6 |
-
|
7 |
-
const https = false
|
8 |
-
const server = new WebDAVServer({
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
authMode: "basic" // Only basic auth is supported in proxy mode
|
14 |
});
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
console.log(
|
19 |
-
|
20 |
-
)
|
|
|
1 |
+
import WebDAVServer from "@filen/webdav"
|
2 |
+
//WebDAV主机名,如果需要禁止外网访问,请改成127.0.0.1
|
3 |
+
const hostname = "0.0.0.0"
|
4 |
+
//WebDAV端口,可改成其他端口
|
5 |
+
const port = 8080
|
6 |
+
//是否使用https,暂时不知道怎么配置证书,所以这里禁用了https
|
7 |
+
const https = false
|
8 |
+
const server = new WebDAVServer.default({
|
9 |
+
hostname,
|
10 |
+
port,
|
11 |
+
https,
|
12 |
+
authMode: "basic"
|
|
|
13 |
});
|
14 |
+
server
|
15 |
+
.start()
|
16 |
+
.then(() =>
|
17 |
+
console.log(`WebDAV 服务端正运行在 ${https ? "https" : "http"}://${hostname === "0.0.0.0" ? "local.webdav.filen.io" : hostname}:${port}`)
|
18 |
+
)
|
19 |
+
.catch(console.error)
|