minio_dw/gen_download_url_please_onl...

19 lines
623 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# === 用户配置区域 ===
bucket="plugai"
alias="autoalias"
endpoint="https://api.szaiai.com" # ✅ MinIO S3 API 外部可访问域名
access_key="admin" # ✅ MINIO_ROOT_USER
secret_key="Admin@123.." # ✅ MINIO_ROOT_PASSWORD
# === 自动设置 alias如果已存在则覆盖
mc alias rm $alias 2>/dev/null
mc alias set $alias $endpoint $access_key $secret_key > /dev/null
# === 遍历文件并生成 URL
mc ls --json --recursive "$alias/$bucket" | jq -r '.key' | while read file; do
mc share download "$alias/$bucket/$file" --json | jq -r '.url'
done