Tmpfiles Upload

将文件上传至临时托管平台,并通过飞书发送下载链接。

已扫描
适合谁
需要临时分享文件的办公人员、遇到文件上传失败的技术用户
不适合谁
需要长期或加密存储敏感文件的用户、对数据隐私要求极高的企业用户
国内可用性
需网络配置。可能需要网络配置或第三方服务可访问。
安装难度
新手友好(★☆☆)。基于终端操作、依赖、API Key 和本地环境要求的初步判断。

安装与下载

openclaw skills install @turbos7/tmpfiles-upload

Skill 说明

命令、参数、文件名以原文为准

tmpfiles.org 文件上传

将文件上传至 tmpfiles.org(临时文件托管服务),获取下载链接。

适用场景

  • 当飞书直接上传失败时发送截图
  • 临时分享文件(链接约 1 小时后过期)
  • 无需认证的快速文件分享

上传脚本

import requests

def upload_to_tmpfiles(file_path):
    """上传文件到 tmpfiles.org 并返回下载链接"""
    with open(file_path, 'rb') as f:
        r = requests.post('https://tmpfiles.org/api/v1/upload', files={'file': f})
        data = r.json()
        if data.get('status') == 'success':
            # 将 org/ 替换为 org/dl/ 以获得直接下载链接
            return data['data']['url'].replace('org/', 'org/dl/')
        raise Exception(f"上传失败: {data}")

在 OpenClaw 中使用

步骤 1:截屏(如需)

/usr/sbin/screencapture -x ~/Desktop/screenshot.png

步骤 2:上传至 tmpfiles.org

python3 -c "
import requests
with open('/path/to/file.png', 'rb') as f:
    r = requests.post('https://tmpfiles.org/api/v1/upload', files={'file': f})
    d = r.json()
    if d.get('status') == 'success':
        print(d['data']['url'].replace('org/', 'org/dl/'))
"

步骤 3:通过消息发送链接

{
  "action": "send",
  "channel": "feishu",
  "message": "文件链接:https://tmpfiles.org/dl/xxx",
  "target": "user_id"
}

注意事项

  • 链接有效期约为 1 小时
  • 最大文件大小:约 100MB
  • 文件在有效期内可公开访问
  • 不适用于敏感或需要长期保存的数据
T
@turbos7

已收录 1 个 Skill

相关推荐