pluveto / upgit

Another upload hub that supports clipboard. It works well with Typora, Snipaste, VSCode.
MIT License
529 stars 44 forks source link

unknown uploader: smms #78

Closed Nyazira closed 1 month ago

Nyazira commented 1 month ago
# =============================================================================
# UPGIT Config
# =============================================================================

# default uploader id
default_uploader = "smms"

# The file name formatting template is applied when uploading
#   / is directory separator used to distinguish directories
#   {year} Year, for example: 2022
#   {month} Month, for example: 02
#   {day} Day, for example: 01
#   {unix_ts} Time stamp, for example: 1643617626. If you're uploading frequently, try {unix_tsms} to escape name repeating
#   {fname} Original file name, such as logo (without suffix)
#   {fname_hash} MD5 hash value of {fname}
#   {ext} File name suffix, for example: .png
#   The following example generates a file name like: 2022/01/upgit_20220131_1643617626.png
rename = "{year}/{month}/upgit_{year}{month}{day}_{unix_ts}{ext}"

# -----------------------------------------------------------------------------
# Custom extra output formats
# -----------------------------------------------------------------------------
#   {url} direct URL of the file
[output_formats]
"bbcode" = "[img]{url}[/img]"
"html" = '<img src="{url}" />'
"markdown-simple" = "![]({url})"

# -----------------------------------------------------------------------------
# URL replacing rules. Process: RawUrl -[replace]-> Url
# -----------------------------------------------------------------------------

# If your network access to Github is abnormal or sluggish, you can try the following CDN acceleration.
# [replacements]
# "raw.githubusercontent.com" = "cdn.jsdelivr.net/gh"
# "/master" = "@master"

# =============================================================================
# Configurations examples for some uploaders, leave them blank if not used
# =============================================================================

# SMMS Uploader
[uploaders.smms]
# Get token from https://sm.ms/home/apitoken
token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

image

default_uploader = "smms"不对吗?

pluveto commented 1 month ago

这个uploader并非自带,需要手动安装

This uploader is not buildtin. Install it manually.

参考:

Ref:

Manage extensions:
upgit ext ACTION

Actions:
  ls                     list all downloadable extensions
  my                     list all local extensions
  add smms.jsonc         install SMMS uploader
  remove smms.jsonc      remove SMMS uploader
Nyazira commented 1 month ago
{
    "meta": {
        "id": "smms",
        "name": "SMMS Uploader",
        "type": "simple-http-uploader",
        "version": "0.0.1",
        "repository": ""
    },
    "http": {
        "request": {
            "url": "https://sm.ms/api/v2/upload",
            "method": "POST",
            "headers": {
                "Authorization": "$(ext_config.token)",
                "Content-Type": "multipart/form-data",
                "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.80 Safari/537.36"
            },
            "body": {
                "format": {
                    "type": "string",
                    "value": "json"
                },
                "smfile": {
                    "type": "file",
                    "value": "$(task.local_path)"
                }
            }
        }
    },
    "upload": {
        "rawUrl": {
            "from": "json_response",
            "path": "data.url"
        }
    }
}

image

pluveto commented 1 month ago

推测是响应的 JSON 非预期,建议 curl 调一下看看

czz404 commented 1 month ago

大佬您好,我也遇到了 Failed: rawUrl path is not valid: for path data.url, key data not found 的问题 经过我几次测试,发现是 smms 图床通过图片 md5 之类的方法把 typora-icon.png typora-icon2.png 这两张测试图片禁止上传了(可能是因为被上传的太多?) 简单编辑图片(比如用画笔加个很小的点改变图片md5,上传就正常)

我直接在 smms 网页上上传照片证实了我的猜想 如图: pic_1719234971.png

pluveto commented 1 month ago

感谢反馈,看起来是 SMMS 的锅。大家可以参考下。