gallyga commited on
Commit
8171da1
·
verified ·
1 Parent(s): b358a0b

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +17 -0
  2. README.md +5 -3
  3. start.mjs +19 -0
Dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用官方 Node.js 镜像
2
+ FROM node:18-alpine
3
+
4
+ # 设置工作目录
5
+ WORKDIR /app
6
+
7
+ # 安装 @filen/webdav 包
8
+ RUN npm install @filen/webdav@latest
9
+
10
+ # 复制当前目录下的代码到容器中
11
+ COPY . .
12
+
13
+ # 暴露端口
14
+ EXPOSE 8080
15
+
16
+ # 运行代码
17
+ CMD ["node", "start.mjs"]
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: File
3
  emoji: 😻
4
- colorFrom: green
5
- colorTo: pink
6
  sdk: docker
7
  pinned: false
 
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Filen Webdav
3
  emoji: 😻
4
+ colorFrom: blue
5
+ colorTo: red
6
  sdk: docker
7
  pinned: false
8
+ license: mit
9
+ app_port: 8080
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
start.mjs ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)