Sign inSign up

wtf111/clouddrive2-webhook

By wtf111

Updated about 1 year ago

Image
0

9.0K

wtf111/clouddrive2-webhook repository overview

用于转发clouddrive2的网盘挂载、卸载webhook消息到bark

直接在clouddrive2的webhook配置bark推送的话,无法处理json变量,所以制作了这个docker镜像来作为中间层处理
注意

虽然启用了文件修改、删除时触发推送,但并不起作用

docker部署命令
docker run -d \
  --name clouddrive2-webhook \
  -p 8081:8080 \
  -e BARK_BASE_URL="https://api.day.app" \
  -e BARK_KEY="你的bark密钥" \
  --restart always \
  wtf111/clouddrive2-webhook:latest
docker compose配置
services:
  clouddrive2-webhook:
    image: wtf111/clouddrive2-webhook:latest
    container_name: clouddrive2-webhook
    ports:
      - "8081:8080"
    environment:
      - BARK_BASE_URL=https://api.day.app
      - BARK_KEY=你的bark密钥
    restart: always
clouddrive2的webhook配置文件
# global variables
# {device_name} - The name of the device
# {user_name} - Current user name
# {version} - The version of the application

# global parameters
[global_params]
# The base URL of the server to send the data to, the server must be able to receive POST requests
# 【重要】这里填写你运行 Python 脚本的电脑的 IP 地址和端口号
base_url = "http://192.168.2.34:8112"
# 【重要】将此项设置为 true 来启用 Webhook 功能
enabled = true

# The default http headers
[global_params.default_headers]
content-type = "application/json"
user-agent = "clouddrive2/{version}"
# authorization = "basic usernamepassword" # 如果你的脚本需要认证,可以在这里配置

# File system watcher webhook configuration
[file_system_watcher]
# The URL of the server to send the data to, the server must be able to receive POST requests
url = "{base_url}/file_notify" # 路径与 Python 脚本中的 @app.route() 对应
# http method, can be "GET" or "POST", if not specified, the default value is POST
method = "POST"
# Whether the file system watcher is enabled
enabled = true
# The body to be sent to the server can be a JSON string
# The following is a sample template for the data to be sent
# the json string should contain at least an array of file changes, each file change item shoud contain the following fields
# {event_category} - The category of the event is "file"
# {event_name} - The name of the event is "notify"
# {action} - The action of file change (create, delete, rename)
# {is_dir} - Whether the file is a directory (false: file, true: directory)
# {source_file} - The source file's path of the action
# {destination_file} - The destination file's path of the action, only valid for action rename(move)
body = '''
{
  "device_name": "{device_name}",
  "user_name": "{user_name}",
  "version": "{version}",
  "event_category": "{event_category}",
  "event_name": "{event_name}",
  "event_time": "{event_time}",
  "send_time": "{send_time}",
  "data": [
      {
        "action": "{action}",
        "is_dir": "{is_dir}",
        "source_file": "{source_file}",
        "destination_file": "{destination_file}"
      }
  ]
}
'''
# specify additional http headers for the file system watcher request if required, headers with same name will override in the default headers
[file_system_watcher.headers]
# additional_header = "value"

# mount point watcher configuration
[mount_point_watcher]
# The URL of the server to send the data to, the server must be able to receive POST requests
url = "{base_url}/mount_notify" # 路径与 Python 脚本中的 @app.route() 对应
# http method
method = "POST"
# Whether the mount point watcher is enabled
enabled = true
# The body to be sent to the server can be a JSON string
# the mount_point_watcher should contain at least an array of mount point changes, each mount point change item shoud contain the following fields
# {event_category} - The category of the event is "mount_point"
# {event_name} - The name of the event is "mount" or "unmount"
# {action} - The action of mount point change (mount, unmount)
# {mount_point} - The mount point's path of the action
# {status} - The status of the action (true for success, false for failed)
# {reason} - The failed reason, empty string means success
body = '''
{
  "device_name": "{device_name}",
  "user_name": "{user_name}",
  "version": "{version}",
  "event_category": "{event_category}",
  "event_name": "{event_name}",
  "event_time": "{event_time}",
  "send_time": "{send_time}",
  "data": [
      {
        "action": "{action}",
        "mount_point": "{mount_point}",
        "status": "{status}",
        "reason": "{reason}"
      }
  ]
}
'''
# specify additional http headers for the file system watcher request if required, headers with same name will override in the default headers
[mount_point_watcher.headers]
# user-agent = "clouddrive2/{version}/mount"

Tag summary

Content type

Image

Digest

sha256:a313318f6

Size

49 MB

Last updated

about 1 year ago

docker pull wtf111/clouddrive2-webhook