ShareDoMagic

轻量级分享服务 - 文本/图片/文件一键分享

📂 开发工具#分享#API#文件传输#轻量级📅 2026-7-25

快速开始

📅 2026-7-25

安装

一键安装

# Linux / macOS
curl -fsSL https://magicdo.top/install/sharedomagic.sh | bash

# Windows
irm https://magicdo.top/install/sharedomagic.ps1 | iex

手动安装

从下载列表获取对应平台的二进制文件,放置到 PATH 目录即可。

运行

# 启动服务
./sharedomagic -http-port 7456

# 访问 Web UI
# 浏览器打开 http://localhost:7456
# 默认账号:share / domagic

配置

程序支持以下启动参数:

| 参数 | 说明 | 默认值 |

|------|------|--------|

| -workdir | 工作目录 | 当前目录 |

| -config | 配置文件路径 | workdir/config.json |

| -http-port | HTTP 端口 | 7456 |

| -https-port | HTTPS 端口 | 0(禁用)|

| -cert | TLS 证书路径 | |

| -key | TLS 私钥路径 | |

| -data | 数据目录 | workdir/data |

| -uploads | 上传目录 | workdir/uploads |

创建分享

通过 Web UI

  1. 打开 http://localhost:7456
  2. 在「创建分享」标签中选择类型(文本/图片/文件)
  3. 填写内容和可选的分享码、密钥
  4. 点击「创建分享」
  5. 通过 API

    # 计算认证 token
    AUTH=$(echo -n share$(echo -n domagic | md5sum | cut -d' ' -f1)$(date +%Y%m%d) | md5sum | cut -d' ' -f1)
    
    # 创建文本分享
    curl -X POST "http://localhost:7456/api/share?action=create&auth=$AUTH" \
      -H 'Content-Type: application/json' \
      -d '{"type":"text","content":"Hello World","code":"hello"}'
    
    # 查看分享
    curl http://localhost:7456/api/share/hello?action=read